update deps
Some checks are pending
continuous-integration/drone/push Build is running

This commit is contained in:
2025-04-05 03:42:43 +00:00
parent 4cca4ee3b7
commit 32094221c2
86 changed files with 841 additions and 20819 deletions

View File

@ -21,6 +21,7 @@ defmodule Memex.Accounts.User do
field :email, :string
field :password, :string, virtual: true
field :hashed_password, :string
field :current_password, :string, virtual: true, redact: true
field :confirmed_at, :utc_datetime_usec
field :role, Ecto.Enum, values: [:admin, :user], default: :user
field :locale, :string
@ -192,6 +193,8 @@ defmodule Memex.Accounts.User do
"""
@spec validate_current_password(changeset(), String.t()) :: changeset()
def validate_current_password(changeset, password) do
changeset = cast(changeset, %{current_password: password}, [:current_password])
if valid_password?(changeset.data, password),
do: changeset,
else: changeset |> add_error(:current_password, dgettext("errors", "is not valid"))

View File

@ -15,6 +15,7 @@ defmodule Memex.Application do
MemexWeb.Telemetry,
# Start the PubSub system
{Phoenix.PubSub, name: Memex.PubSub},
{DNSCluster, query: Application.get_env(:memex, :dns_cluster_query) || :ignore},
# Start the Endpoint (http/https)
MemexWeb.Endpoint,
# Add Oban

View File

@ -17,7 +17,7 @@ defmodule MemexWeb do
those modules here.
"""
def static_paths, do: ~w(css js fonts images favicon.ico robots.txt)
def static_paths, do: ~w(assets fonts images favicon.ico robots.txt webfonts)
def router do
quote do

View File

@ -91,7 +91,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
defp get_value_for_key(:slug, %{slug: slug} = assigns, _additional_data) do
slug_block = ~H"""
<.link navigate={~p"/context/#{@slug}"} class="link">
<%= @slug %>
{@slug}
</.link>
"""
@ -102,7 +102,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
~H"""
<div class="flex flex-wrap justify-center space-x-1">
<.link :for={tag <- @tags} patch={~p"/contexts/#{tag}"} class="link">
<%= tag %>
{tag}
</.link>
</div>
"""
@ -113,7 +113,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
~H"""
<div class="flex justify-center items-center space-x-4">
<%= render_slot(@actions, @context) %>
{render_slot(@actions, @context)}
</div>
"""
end

View File

@ -6,6 +6,6 @@
readonly
phx-no-format
><p class="inline"><%= display_links(@context) %></p></div>
<div :if={!@context.content} class="text-sm italic text-center text-gray-600">
<%= gettext("(This context is empty)") %>
<div :if={!@context.content} class="text-sm italic text-center text-zinc-600">
{gettext("(This context is empty)")}
</div>

View File

@ -1,3 +1,3 @@
<time :if={@date} id={@id} datetime={Date.to_iso8601(@date, :extended)} phx-hook="Date">
<%= Date.to_iso8601(@date, :extended) %>
{Date.to_iso8601(@date, :extended)}
</time>

View File

@ -1,3 +1,3 @@
<time :if={@datetime} id={@id} datetime={cast_datetime(@datetime)} phx-hook="DateTime">
<%= cast_datetime(@datetime) %>
{cast_datetime(@datetime)}
</time>

View File

@ -1,21 +1,21 @@
<div class="flex flex-col justify-center items-center px-8 py-4 space-y-4 rounded-lg border border-gray-400 shadow-lg transition-all duration-300 ease-in-out bg-primary-900 hover:shadow-md">
<div class="flex flex-col justify-center items-center px-8 py-4 space-y-4 rounded-lg border border-zinc-400 shadow-lg transition-all duration-300 ease-in-out bg-primary-900 hover:shadow-md">
<h1 class="text-xl title">
<%= @invite.name %>
{@invite.name}
</h1>
<%= if @invite.disabled_at do %>
<h2 class="title text-md">
<%= gettext("invite disabled") %>
{gettext("invite disabled")}
</h2>
<% else %>
<h2 class="title text-md">
<%= if @invite.uses_left do %>
<%= gettext(
{gettext(
"uses left: %{uses_left_count}",
uses_left_count: @invite.uses_left
) %>
)}
<% else %>
<%= gettext("uses left: unlimited") %>
{gettext("uses left: unlimited")}
<% end %>
</h2>
<% end %>
@ -26,7 +26,7 @@
/>
<h2 :if={@use_count && @use_count != 0} class="title text-md">
<%= gettext("uses: %{uses_count}", uses_count: @use_count) %>
{gettext("uses: %{uses_count}", uses_count: @use_count)}
</h2>
<div class="flex flex-row flex-wrap justify-center items-center">
@ -35,10 +35,10 @@
class="px-4 py-2 mx-2 my-1 text-xs text-center break-all rounded-lg text-primary-400 bg-primary-800"
phx-no-format
><%= url(MemexWeb.Endpoint, ~p"/users/register?invite=#{@invite.token}") %></code>
<%= if @code_actions, do: render_slot(@code_actions) %>
{if @code_actions, do: render_slot(@code_actions)}
</div>
<div :if={@inner_block} class="flex justify-center items-center space-x-4">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</div>
</div>

View File

@ -28,7 +28,7 @@
patch={@return_to}
id="close"
class="absolute top-8 right-10
text-gray-500 hover:text-gray-800
text-zinc-500 hover:text-zinc-800
transition-all duration-500 ease-in-out"
phx-remove={hide_modal()}
aria-label={gettext("close modal")}
@ -37,7 +37,7 @@
</.link>
<div class="overflow-x-hidden overflow-y-auto w-full p-8 flex flex-col space-y-4 justify-start items-stretch">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</div>
</div>
</div>

View File

@ -6,6 +6,6 @@
readonly
phx-no-format
><p class="inline"><%= display_links(@note) %></p></div>
<div :if={!@note.content} class="text-sm italic text-center text-gray-600">
<%= gettext("(This note is empty)") %>
<div :if={!@note.content} class="text-sm italic text-center text-zinc-600">
{gettext("(This note is empty)")}
</div>

View File

@ -2,14 +2,14 @@
<div class="flex flex-col sm:flex-row justify-between items-center">
<div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
<.link navigate={~p"/"} class="mx-2 my-1 leading-5 text-xl text-primary-400 hover:underline">
<%= gettext("memEx") %>
{gettext("memEx")}
</.link>
<%= if @title_content do %>
<span class="mx-2 my-1">
|
</span>
<%= @title_content %>
{@title_content}
<% end %>
</div>
@ -19,19 +19,19 @@
text-lg text-primary-400 text-ellipsis">
<li class="mx-2 my-1">
<.link navigate={~p"/notes"} class="text-primary-400 hover:underline truncate">
<%= gettext("notes") %>
{gettext("notes")}
</.link>
</li>
<li class="mx-2 my-1">
<.link navigate={~p"/contexts"} class="text-primary-400 hover:underline truncate">
<%= gettext("contexts") %>
{gettext("contexts")}
</.link>
</li>
<li class="mx-2 my-1">
<.link navigate={~p"/pipelines"} class="text-primary-400 hover:underline truncate">
<%= gettext("pipelines") %>
{gettext("pipelines")}
</.link>
</li>
@ -40,13 +40,13 @@
<%= if @current_user do %>
<li :if={@current_user |> Accounts.already_admin?()} class="mx-2 my-1">
<.link navigate={~p"/invites"} class="text-primary-400 hover:underline">
<%= gettext("invites") %>
{gettext("invites")}
</.link>
</li>
<li class="mx-2 my-1">
<.link navigate={~p"/users/settings"} class="text-primary-400 hover:underline truncate">
<%= @current_user.email %>
{@current_user.email}
</.link>
</li>
<li class="mx-2 my-1">
@ -76,13 +76,13 @@
<% else %>
<li :if={Accounts.allow_registration?()} class="mx-2 my-1">
<.link href={~p"/users/register"} class="text-primary-400 hover:underline truncate">
<%= dgettext("actions", "register") %>
{dgettext("actions", "register")}
</.link>
</li>
<li class="mx-2 my-1">
<.link href={~p"/users/log_in"} class="text-primary-400 hover:underline truncate">
<%= dgettext("actions", "log in") %>
{dgettext("actions", "log in")}
</.link>
</li>
<% end %>

View File

@ -2,36 +2,36 @@
id={"user-#{@user.id}"}
class="px-8 py-4 flex flex-col justify-center items-center text-center
bg-primary-900
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
border border-zinc-400 rounded-lg shadow-lg hover:shadow-md
transition-all duration-300 ease-in-out"
>
<h1 class="px-4 py-2 rounded-lg title text-xl break-all">
<%= @user.email %>
{@user.email}
</h1>
<h3 class="px-4 py-2 rounded-lg title text-lg">
<p>
<%= if @user.confirmed_at do %>
<%= gettext(
{gettext(
"user confirmed on%{confirmed_datetime}",
confirmed_datetime: ""
) %>
)}
<.datetime id={"#{@user.id}-confirmed-at"} datetime={@user.confirmed_at} />
<% else %>
<%= gettext("email unconfirmed") %>
{gettext("email unconfirmed")}
<% end %>
</p>
<p>
<%= gettext(
{gettext(
"user registered on%{registered_datetime}",
registered_datetime: ""
) %>
)}
<.datetime id={"#{@user.id}-inserted-at"} datetime={@user.inserted_at} />
</p>
</h3>
<div :if={@inner_block} class="px-4 py-2 flex space-x-4 justify-center items-center">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</div>
</div>

View File

@ -10,7 +10,7 @@
phx-click="lv:clear-flash"
phx-value-key="info"
>
<%= Phoenix.Flash.get(@flash, :info) %>
{Phoenix.Flash.get(@flash, :info)}
</p>
<p
@ -20,13 +20,13 @@
phx-click="lv:clear-flash"
phx-value-key="error"
>
<%= Phoenix.Flash.get(@flash, :error) %>
{Phoenix.Flash.get(@flash, :error)}
</p>
</div>
</header>
<div class="mx-4 sm:mx-8 md:mx-16">
<%= @inner_content %>
{@inner_content}
</div>
</main>
@ -40,6 +40,6 @@
<i class="fas fa-fade text-md fa-satellite-dish"></i>
<h1 class="title text-md">
<%= gettext("Reconnecting...") %>
{gettext("Reconnecting...")}
</h1>
</div>

View File

@ -1,16 +1,16 @@
<html>
<head>
<title>
<%= @email.subject %>
{@email.subject}
</title>
</head>
<body style="padding: 2em; color: rgb(161, 161, 170); background-color: rgb(39, 39, 42); font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; text-align: center;">
<%= @inner_content %>
{@inner_content}
<hr style="margin: 2em auto; border-width: 1px; border-color: rgb(161, 161, 170); width: 100%; max-width: 42rem;" />
<a style="color: rgb(161, 161, 170);" href={~p"/"}>
<%= dgettext("emails", "this email was sent from memEx") %>
{dgettext("emails", "this email was sent from memEx")}
</a>
</body>
</html>

View File

@ -1 +1 @@
<%= @inner_content %>
{@inner_content}

View File

@ -1,19 +1,18 @@
<!DOCTYPE html>
<html lang="en" class="m-0 p-0 w-full h-full bg-primary-800">
<html lang="en" class="p-0 m-0 w-full h-full bg-primary-800 [scrollbar-gutter:stable]">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<%= csrf_meta_tag() %>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title suffix={" | #{gettext("memEx")}"}>
<%= assigns[:page_title] || gettext("memEx") %>
{assigns[:page_title] || gettext("memEx")}
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/css/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/js/app.js"}>
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
</script>
</head>
<body class="m-0 p-0 w-full h-full text-primary-400 subpixel-antialiased">
<%= @inner_content %>
<body class="p-0 m-0 w-full h-full subpixel-antialiased text-primary-400">
{@inner_content}
</body>
</html>

View File

@ -91,7 +91,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
defp get_value_for_key(:slug, %{slug: slug} = assigns, _additional_data) do
slug_block = ~H"""
<.link navigate={~p"/note/#{@slug}"} class="link">
<%= @slug %>
{@slug}
</.link>
"""
@ -102,7 +102,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
~H"""
<div class="flex flex-wrap justify-center space-x-1">
<.link :for={tag <- @tags} patch={~p"/notes/#{tag}"} class="link">
<%= tag %>
{tag}
</.link>
</div>
"""
@ -113,7 +113,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
~H"""
<div class="flex justify-center items-center space-x-4">
<%= render_slot(@actions, @note) %>
{render_slot(@actions, @note)}
</div>
"""
end

View File

@ -92,7 +92,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
defp get_value_for_key(:slug, %{slug: slug} = assigns, _additional_data) do
slug_block = ~H"""
<.link navigate={~p"/pipeline/#{@slug}"} class="link">
<%= @slug %>
{@slug}
</.link>
"""
@ -102,7 +102,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
defp get_value_for_key(:description, %{description: description} = assigns, _additional_data) do
description_block = ~H"""
<div class="max-w-sm truncate">
<%= @description %>
{@description}
</div>
"""
@ -113,7 +113,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
~H"""
<div class="flex flex-wrap justify-center space-x-1">
<.link :for={tag <- @tags} patch={~p"/pipelines/#{tag}"} class="link">
<%= tag %>
{tag}
</.link>
</div>
"""
@ -124,7 +124,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
~H"""
<div class="flex justify-center items-center space-x-4">
<%= render_slot(@actions, @pipeline) %>
{render_slot(@actions, @pipeline)}
</div>
"""
end

View File

@ -12,7 +12,7 @@
phx-target={@myself}
>
<i class="w-0 float-right fas fa-sm fa-chevron-up opacity-0"></i>
<span class={if @last_sort_key == key, do: "underline"}><%= label %></span>
<span class={if @last_sort_key == key, do: "underline"}>{label}</span>
<%= if @last_sort_key == key do %>
<%= case @sort_mode do %>
<% :asc -> %>
@ -27,7 +27,7 @@
</th>
<% else %>
<th class={["p-2 cursor-not-allowed", column[:class]]}>
<%= label %>
{label}
</th>
<% end %>
<% end %>
@ -41,9 +41,9 @@
<td :for={%{key: key} = value <- @columns} class={["p-2", value[:class]]}>
<%= case values |> Map.get(key) do %>
<% {_custom_sort_value, value} -> %>
<%= value %>
{value}
<% value -> %>
<%= value %>
{value}
<% end %>
</td>
</tr>

View File

@ -1,23 +1,23 @@
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<span style="margin-bottom: 0.75em; font-size: 1.5em;">
<%= dgettext("emails", "Hi %{email},", email: @user.email) %>
{dgettext("emails", "Hi %{email},", email: @user.email)}
</span>
<br />
<span style="margin-bottom: 1em; font-size: 1.25em;">
<%= dgettext("emails", "Welcome to memEx") %>
{dgettext("emails", "Welcome to memEx")}
</span>
<br />
<%= dgettext("emails", "You can confirm your account by visiting the URL below:") %>
{dgettext("emails", "You can confirm your account by visiting the URL below:")}
<br />
<a style="margin: 1em; color: rgb(161, 161, 170);" href={@url}><%= @url %></a>
<a style="margin: 1em; color: rgb(161, 161, 170);" href={@url}>{@url}</a>
<br />
<%= dgettext("emails", "If you didn't create an account at memEx, please ignore this.") %>
{dgettext("emails", "If you didn't create an account at memEx, please ignore this.")}
</div>

View File

@ -1,17 +1,17 @@
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<span style="margin-bottom: 0.5em; font-size: 1.5em;">
<%= dgettext("emails", "Hi %{email},", email: @user.email) %>
{dgettext("emails", "Hi %{email},", email: @user.email)}
</span>
<br />
<%= dgettext("emails", "You can reset your password by visiting the URL below:") %>
{dgettext("emails", "You can reset your password by visiting the URL below:")}
<br />
<a style="margin: 1em; color: rgb(161, 161, 170);" href={@url}><%= @url %></a>
<a style="margin: 1em; color: rgb(161, 161, 170);" href={@url}>{@url}</a>
<br />
<%= dgettext("emails", "If you didn't request this change from memEx, please ignore this.") %>
{dgettext("emails", "If you didn't request this change from memEx, please ignore this.")}
</div>

View File

@ -1,20 +1,20 @@
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<span style="margin-bottom: 0.5em; font-size: 1.5em;">
<%= dgettext("emails", "Hi %{email},", email: @user.email) %>
{dgettext("emails", "Hi %{email},", email: @user.email)}
</span>
<br />
<%= dgettext("emails", "You can change your email by visiting the URL below:") %>
{dgettext("emails", "You can change your email by visiting the URL below:")}
<br />
<a style="margin: 1em; color: rgb(161, 161, 170);" href={@url}><%= @url %></a>
<a style="margin: 1em; color: rgb(161, 161, 170);" href={@url}>{@url}</a>
<br />
<%= dgettext(
{dgettext(
"emails",
"If you didn't request this change from memEx, please ignore this."
) %>
)}
</div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%= dgettext("errors", "Error") %> | <%= gettext("memEx") %>
{dgettext("errors", "Error")} | {gettext("memEx")}
</title>
<link rel="stylesheet" href="/css/app.css" />
<script defer type="text/javascript" src="/js/app.js">
@ -19,13 +19,13 @@
<div class="pb-8 w-full flex flex-col justify-center items-center text-center">
<div class="p-8 sm:p-16 w-full flex flex-col justify-center items-center space-y-4 max-w-3xl">
<h1 class="title text-primary-400 text-3xl">
<%= @error_string %>
{@error_string}
</h1>
<hr class="w-full hr" />
<.link href={~p"/"} class="link title text-primary-400 text-lg">
<%= dgettext("errors", "go back home") %>
{dgettext("errors", "go back home")}
</.link>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
<h1 class="title text-primary-400 text-xl">
<%= dgettext("actions", "Resend confirmation instructions") %>
{dgettext("actions", "Resend confirmation instructions")}
</h1>
<.form
@ -10,22 +10,22 @@
action={~p"/users/confirm"}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<%= label(f, :email, gettext("Email"), class: "title text-lg text-primary-400") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
{label(f, :email, gettext("Email"), class: "title text-lg text-primary-400")}
{email_input(f, :email, required: true, class: "input input-primary col-span-2")}
<%= submit(dgettext("actions", "Resend confirmation instructions"),
{submit(dgettext("actions", "Resend confirmation instructions"),
class: "mx-auto btn btn-primary col-span-3"
) %>
)}
</.form>
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<.link :if={Accounts.allow_registration?()} href={~p"/users/register"} class="btn btn-primary">
<%= dgettext("actions", "register") %>
{dgettext("actions", "register")}
</.link>
<.link href={~p"/users/log_in"} class="btn btn-primary">
<%= dgettext("actions", "log in") %>
{dgettext("actions", "log in")}
</.link>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
<h1 class="title text-primary-400 text-xl">
<%= dgettext("actions", "register") %>
{dgettext("actions", "register")}
</h1>
<.form
@ -10,41 +10,41 @@
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<p :if={@changeset.action && not @changeset.valid?} class="alert alert-danger col-span-3">
<%= dgettext("errors", "oops, something went wrong! please check the errors below.") %>
{dgettext("errors", "oops, something went wrong! please check the errors below.")}
</p>
<%= if @invite_token do %>
<%= hidden_input(f, :invite_token, value: @invite_token) %>
{hidden_input(f, :invite_token, value: @invite_token)}
<% end %>
<%= label(f, :email, gettext("email"), class: "title text-lg text-primary-400") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
<%= error_tag(f, :email, "col-span-3") %>
{label(f, :email, gettext("email"), class: "title text-lg text-primary-400")}
{email_input(f, :email, required: true, class: "input input-primary col-span-2")}
{error_tag(f, :email, "col-span-3")}
<%= label(f, :password, gettext("password"), class: "title text-lg text-primary-400") %>
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
<%= error_tag(f, :password, "col-span-3") %>
{label(f, :password, gettext("password"), class: "title text-lg text-primary-400")}
{password_input(f, :password, required: true, class: "input input-primary col-span-2")}
{error_tag(f, :password, "col-span-3")}
<%= label(f, :locale, gettext("language"), class: "title text-lg text-primary-400") %>
<%= select(
{label(f, :locale, gettext("language"), class: "title text-lg text-primary-400")}
{select(
f,
:locale,
[{gettext("english"), "en_US"}],
class: "input input-primary col-span-2"
) %>
<%= error_tag(f, :locale) %>
)}
{error_tag(f, :locale)}
<%= submit(dgettext("actions", "register"), class: "mx-auto btn btn-primary col-span-3") %>
{submit(dgettext("actions", "register"), class: "mx-auto btn btn-primary col-span-3")}
</.form>
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<.link href={~p"/users/log_in"} class="btn btn-primary">
<%= dgettext("actions", "log in") %>
{dgettext("actions", "log in")}
</.link>
<.link href={~p"/users/reset_password"} class="btn btn-primary">
<%= dgettext("actions", "forgot your password?") %>
{dgettext("actions", "forgot your password?")}
</.link>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
<h1 class="title text-primary-400 text-xl">
<%= dgettext("actions", "reset password") %>
{dgettext("actions", "reset password")}
</h1>
<.form
@ -10,35 +10,35 @@
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<p :if={@changeset.action && not @changeset.valid?} class="alert alert-danger col-span-3">
<%= dgettext("errors", "oops, something went wrong! please check the errors below.") %>
{dgettext("errors", "oops, something went wrong! please check the errors below.")}
</p>
<%= label(f, :password, gettext("new password"), class: "title text-lg text-primary-400") %>
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
<%= error_tag(f, :password, "col-span-3") %>
{label(f, :password, gettext("new password"), class: "title text-lg text-primary-400")}
{password_input(f, :password, required: true, class: "input input-primary col-span-2")}
{error_tag(f, :password, "col-span-3")}
<%= label(f, :password_confirmation, gettext("confirm new password"),
{label(f, :password_confirmation, gettext("confirm new password"),
class: "title text-lg text-primary-400"
) %>
<%= password_input(f, :password_confirmation,
)}
{password_input(f, :password_confirmation,
required: true,
class: "input input-primary col-span-2"
) %>
<%= error_tag(f, :password_confirmation, "col-span-3") %>
)}
{error_tag(f, :password_confirmation, "col-span-3")}
<%= submit(dgettext("actions", "reset password"),
{submit(dgettext("actions", "reset password"),
class: "mx-auto btn btn-primary col-span-3"
) %>
)}
</.form>
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<.link :if={Accounts.allow_registration?()} href={~p"/users/register"} class="btn btn-primary">
<%= dgettext("actions", "register") %>
{dgettext("actions", "register")}
</.link>
<.link href={~p"/users/log_in"} class="btn btn-primary">
<%= dgettext("actions", "log in") %>
{dgettext("actions", "log in")}
</.link>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
<h1 class="title text-primary-400 text-xl">
<%= dgettext("actions", "forgot your password?") %>
{dgettext("actions", "forgot your password?")}
</h1>
<.form
@ -10,22 +10,22 @@
action={~p"/users/reset_password"}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<%= label(f, :email, gettext("email"), class: "title text-lg text-primary-400") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
{label(f, :email, gettext("email"), class: "title text-lg text-primary-400")}
{email_input(f, :email, required: true, class: "input input-primary col-span-2")}
<%= submit(dgettext("actions", "send instructions to reset password"),
{submit(dgettext("actions", "send instructions to reset password"),
class: "mx-auto btn btn-primary col-span-3"
) %>
)}
</.form>
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<.link :if={Accounts.allow_registration?()} href={~p"/users/register"} class="btn btn-primary">
<%= dgettext("actions", "register") %>
{dgettext("actions", "register")}
</.link>
<.link href={~p"/users/log_in"} class="btn btn-primary">
<%= dgettext("actions", "log in") %>
{dgettext("actions", "log in")}
</.link>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
<h1 class="title text-primary-400 text-xl">
<%= dgettext("actions", "log in") %>
{dgettext("actions", "log in")}
</h1>
<.form
@ -11,31 +11,31 @@
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<p :if={@error_message} class="alert alert-danger col-span-3">
<%= @error_message %>
{@error_message}
</p>
<%= label(f, :email, gettext("email"), class: "title text-lg text-primary-400") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
{label(f, :email, gettext("email"), class: "title text-lg text-primary-400")}
{email_input(f, :email, required: true, class: "input input-primary col-span-2")}
<%= label(f, :password, gettext("password"), class: "title text-lg text-primary-400") %>
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
{label(f, :password, gettext("password"), class: "title text-lg text-primary-400")}
{password_input(f, :password, required: true, class: "input input-primary col-span-2")}
<%= label(f, :remember_me, gettext("keep me logged in for 60 days"),
{label(f, :remember_me, gettext("keep me logged in for 60 days"),
class: "title text-lg text-primary-400"
) %>
<%= checkbox(f, :remember_me, class: "checkbox col-span-2") %>
)}
{checkbox(f, :remember_me, class: "checkbox col-span-2")}
<%= submit(dgettext("actions", "log in"), class: "mx-auto btn btn-primary col-span-3") %>
{submit(dgettext("actions", "log in"), class: "mx-auto btn btn-primary col-span-3")}
</.form>
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<.link :if={Accounts.allow_registration?()} href={~p"/users/register"} class="btn btn-primary">
<%= dgettext("actions", "register") %>
{dgettext("actions", "register")}
</.link>
<.link href={~p"/users/reset_password"} class="btn btn-primary">
<%= dgettext("actions", "forgot your password?") %>
{dgettext("actions", "forgot your password?")}
</.link>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto pb-8 max-w-3xl flex flex-col justify-center items-stretch text-right space-y-4">
<h1 class="title text-primary-400 text-xl text-left">
<%= gettext("settings") %>
{gettext("settings")}
</h1>
<hr class="hr" />
@ -12,37 +12,37 @@
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<h3 class="title text-primary-400 text-lg text-center col-span-3">
<%= dgettext("actions", "change email") %>
{dgettext("actions", "change email")}
</h3>
<div
:if={@email_changeset.action && not @email_changeset.valid?}
class="alert alert-danger col-span-3"
>
<%= dgettext("errors", "oops, something went wrong! please check the errors below") %>
{dgettext("errors", "oops, something went wrong! please check the errors below")}
</div>
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
{hidden_input(f, :action, name: "action", value: "update_email")}
<%= label(f, :email, gettext("email"), class: "title text-lg text-primary-400") %>
<%= email_input(f, :email, required: true, class: "mx-2 my-1 input input-primary col-span-2") %>
<%= error_tag(f, :email, "col-span-3") %>
{label(f, :email, gettext("email"), class: "title text-lg text-primary-400")}
{email_input(f, :email, required: true, class: "mx-2 my-1 input input-primary col-span-2")}
{error_tag(f, :email, "col-span-3")}
<%= label(f, :current_password, gettext("current password"),
{label(f, :current_password, gettext("current password"),
for: "current_password_for_email",
class: "mx-2 my-1 title text-lg text-primary-400"
) %>
<%= password_input(f, :current_password,
)}
{password_input(f, :current_password,
required: true,
name: "current_password",
id: "current_password_for_email",
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :current_password, "col-span-3") %>
)}
{error_tag(f, :current_password, "col-span-3")}
<%= submit(dgettext("actions", "change email"),
{submit(dgettext("actions", "change email"),
class: "mx-auto btn btn-primary col-span-3"
) %>
)}
</.form>
<hr class="hr" />
@ -54,49 +54,49 @@
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<h3 class="title text-primary-400 text-lg text-center col-span-3">
<%= dgettext("actions", "change password") %>
{dgettext("actions", "change password")}
</h3>
<p
:if={@password_changeset.action && not @password_changeset.valid?}
class="alert alert-danger col-span-3"
>
<%= dgettext("errors", "oops, something went wrong! please check the errors below.") %>
{dgettext("errors", "oops, something went wrong! please check the errors below.")}
</p>
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
{hidden_input(f, :action, name: "action", value: "update_password")}
<%= label(f, :password, gettext("new password"), class: "title text-lg text-primary-400") %>
<%= password_input(f, :password,
{label(f, :password, gettext("new password"), class: "title text-lg text-primary-400")}
{password_input(f, :password,
required: true,
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :password, "col-span-3") %>
)}
{error_tag(f, :password, "col-span-3")}
<%= label(f, :password_confirmation, gettext("confirm new password"),
{label(f, :password_confirmation, gettext("confirm new password"),
class: "title text-lg text-primary-400"
) %>
<%= password_input(f, :password_confirmation,
)}
{password_input(f, :password_confirmation,
required: true,
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :password_confirmation, "col-span-3") %>
)}
{error_tag(f, :password_confirmation, "col-span-3")}
<%= label(f, :current_password, gettext("current password"),
{label(f, :current_password, gettext("current password"),
for: "current_password_for_password",
class: "title text-lg text-primary-400"
) %>
<%= password_input(f, :current_password,
)}
{password_input(f, :current_password,
required: true,
name: "current_password",
id: "current_password_for_password",
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :current_password, "col-span-3") %>
)}
{error_tag(f, :current_password, "col-span-3")}
<%= submit(dgettext("actions", "change password"),
{submit(dgettext("actions", "change password"),
class: "mx-auto btn btn-primary col-span-3"
) %>
)}
</.form>
<hr class="hr" />
@ -107,35 +107,35 @@
action={~p"/users/settings"}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
<%= label(f, :locale, dgettext("actions", "change language"),
{label(f, :locale, dgettext("actions", "change language"),
class: "title text-primary-400 text-lg text-center col-span-3"
) %>
)}
<div
:if={@locale_changeset.action && not @locale_changeset.valid?}
class="alert alert-danger col-span-3"
>
<%= dgettext("errors", "oops, something went wrong! please check the errors below") %>
{dgettext("errors", "oops, something went wrong! please check the errors below")}
</div>
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
{hidden_input(f, :action, name: "action", value: "update_locale")}
<%= select(f, :locale, [{gettext("english"), "en_US"}, {"spanish", "es"}],
{select(f, :locale, [{gettext("english"), "en_US"}, {"spanish", "es"}],
class: "mx-2 my-1 min-w-md input input-primary col-start-2"
) %>
<%= error_tag(f, :locale, "col-span-3") %>
)}
{error_tag(f, :locale, "col-span-3")}
<%= submit(dgettext("actions", "change language"),
{submit(dgettext("actions", "change language"),
class: "whitespace-nowrap mx-auto btn btn-primary col-span-3",
data: [qa: dgettext("prompts", "are you sure you want to change your language?")]
) %>
)}
</.form>
<hr class="hr" />
<div class="flex justify-end items-center">
<.link href={~p"/export/json"} class="mx-4 my-2 btn btn-primary" target="_blank">
<%= dgettext("actions", "export data as json") %>
{dgettext("actions", "export data as json")}
</.link>
<.link
@ -144,7 +144,7 @@
class="mx-4 my-2 btn btn-alert"
data-confirm={dgettext("prompts", "are you sure you want to delete your account?")}
>
<%= dgettext("actions", "delete user") %>
{dgettext("actions", "delete user")}
</.link>
</div>
</div>

View File

@ -4,7 +4,7 @@ defmodule MemexWeb.ErrorHelpers do
"""
use PhoenixHTMLHelpers
import Phoenix.{Component, HTML.Form}
import Phoenix.Component
alias Ecto.Changeset
alias Phoenix.{HTML.Form, LiveView.Rendered}
@ -19,10 +19,10 @@ defmodule MemexWeb.ErrorHelpers do
~H"""
<span
:for={error <- Keyword.get_values(@form.errors, @field)}
:if={used_input?(@form[@field])}
class={["invalid-feedback", @extra_class]}
phx-feedback-for={input_name(@form, @field)}
>
<%= translate_error(error) %>
{translate_error(error)}
</span>
"""
end

View File

@ -9,17 +9,17 @@
phx-hook="CtrlEnter"
class="flex flex-col justify-start items-stretch space-y-4"
>
<%= text_input(f, :slug,
{text_input(f, :slug,
aria_label: gettext("slug"),
class: "input input-primary",
phx_debounce: 300,
phx_hook: "SanitizeTitles",
placeholder: gettext("slug"),
required: true
) %>
<%= error_tag(f, :slug) %>
)}
{error_tag(f, :slug)}
<%= textarea(f, :content,
{textarea(f, :content,
id: "context-form-content",
class: "input input-primary h-64 min-h-64",
phx_update: "ignore",
@ -28,32 +28,32 @@
aria_label:
gettext("use [[note-slug]] to link to a note or [context-slug] to link to a context"),
phx_debounce: 300
) %>
<%= error_tag(f, :content) %>
)}
{error_tag(f, :content)}
<%= text_input(f, :tags_string,
{text_input(f, :tags_string,
aria_label: gettext("tag1,tag2"),
class: "input input-primary",
id: "tags-input",
phx_debounce: 300,
phx_hook: "SanitizeTags",
placeholder: gettext("tag1,tag2")
) %>
<%= error_tag(f, :tags_string) %>
)}
{error_tag(f, :tags_string)}
<div class="flex justify-center items-stretch space-x-4">
<%= select(f, :visibility, Ecto.Enum.values(Memex.Contexts.Context, :visibility),
{select(f, :visibility, Ecto.Enum.values(Memex.Contexts.Context, :visibility),
class: "grow input input-primary",
prompt: gettext("select privacy"),
aria_label: gettext("select privacy"),
phx_debounce: 300
) %>
)}
<%= submit(dgettext("actions", "save"),
{submit(dgettext("actions", "save"),
phx_disable_with: gettext("saving..."),
class: "mx-auto btn btn-primary"
) %>
)}
</div>
<%= error_tag(f, :visibility) %>
{error_tag(f, :visibility)}
</.form>
</div>

View File

@ -1,6 +1,6 @@
<div class="flex flex-col justify-center items-start mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= gettext("contexts") %>
{gettext("contexts")}
</h1>
<.form
@ -11,18 +11,18 @@
phx-submit="search"
class="flex flex-col items-stretch self-stretch"
>
<%= text_input(f, :search_term,
{text_input(f, :search_term,
class: "input input-primary",
value: @search,
role: "search",
phx_debounce: 300,
placeholder: gettext("search")
) %>
)}
</.form>
<%= if @contexts |> Enum.empty?() do %>
<h1 class="self-center text-primary-500">
<%= gettext("no contexts found") %>
{gettext("no contexts found")}
</h1>
<% else %>
<.live_component
@ -37,7 +37,7 @@
patch={~p"/contexts/#{context}/edit"}
aria-label={dgettext("actions", "edit %{context_slug}", context_slug: context.slug)}
>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<.link
:if={@current_user}
@ -47,14 +47,14 @@
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{context_slug}", context_slug: context.slug)}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</.link>
</:actions>
</.live_component>
<% end %>
<.link :if={@current_user} patch={~p"/contexts/new"} class="self-end btn btn-primary">
<%= dgettext("actions", "new context") %>
{dgettext("actions", "new context")}
</.link>
</div>

View File

@ -1,11 +1,11 @@
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= @context.slug %>
{@context.slug}
</h1>
<div class="flex flex-wrap space-x-1">
<.link :for={tag <- @context.tags} navigate={~p"/contexts/#{tag}"} class="link">
<%= tag %>
{tag}
</.link>
</div>
@ -15,30 +15,30 @@
:if={@context_backlinks ++ @pipeline_backlinks != []}
class="flex flex-wrap justify-end items-center self-end"
>
<p><%= gettext("Backlinked by:") %></p>
<p>{gettext("Backlinked by:")}</p>
<.link
:for={backlink <- @context_backlinks}
class="m-1 hover:underline"
patch={~p"/context/#{backlink}"}
>
<%= gettext("[%{slug}]", slug: backlink.slug) %>
{gettext("[%{slug}]", slug: backlink.slug)}
</.link>
<.link
:for={backlink <- @pipeline_backlinks}
class="m-1 hover:underline"
patch={~p"/pipeline/#{backlink}"}
>
<%= gettext("[[%{slug}]]", slug: backlink.slug) %>
{gettext("[[%{slug}]]", slug: backlink.slug)}
</.link>
</div>
<p class="self-end">
<%= gettext("Visibility: %{visibility}", visibility: @context.visibility) %>
{gettext("Visibility: %{visibility}", visibility: @context.visibility)}
</p>
<div class="flex self-end space-x-4">
<.link :if={@current_user} class="btn btn-primary" patch={~p"/context/#{@context}/edit"}>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<button
:if={@current_user}
@ -48,7 +48,7 @@
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{context_slug}", context_slug: @context.slug)}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</button>
</div>
</div>

View File

@ -1,6 +1,6 @@
<div class="mx-auto flex flex-col justify-center items-stretch space-y-8 text-center max-w-3xl">
<h1 class="title text-primary-400 text-xl text-left">
<%= gettext("faq") %>
{gettext("faq")}
</h1>
<hr class="hr" />
@ -8,13 +8,13 @@
<ul class="flex flex-col justify-center items-stretch space-y-8">
<li class="flex flex-col justify-center items-stretch space-y-2">
<b class="whitespace-nowrap text-left">
<%= gettext("what is this?") %>
{gettext("what is this?")}
</b>
<p>
<%= gettext(
{gettext(
"this is a memex, used to document not just your notes, but also your perspectives and processes."
) %>
<%= gettext("some things that this memex is very loosely inspired by:") %>
)}
{gettext("some things that this memex is very loosely inspired by:")}
</p>
<ul class="list-disc flex flex-col justify-center items-center space-y-2">
@ -25,7 +25,7 @@
target="_blank"
rel="noopener noreferrer"
>
<%= gettext("memex") %>
{gettext("memex")}
</.link>
</li>
<li>
@ -35,7 +35,7 @@
target="_blank"
rel="noopener noreferrer"
>
<%= gettext("zettelkasten") %>
{gettext("zettelkasten")}
</.link>
</li>
<li>
@ -45,7 +45,7 @@
target="_blank"
rel="noopener noreferrer"
>
<%= gettext("org-mode") %>
{gettext("org-mode")}
</.link>
</li>
</ul>
@ -53,75 +53,75 @@
<li class="flex flex-col justify-center items-stretch space-y-2">
<b class="whitespace-nowrap text-left">
<%= gettext("why split up into notes, contexts and pipelines?") %>
{gettext("why split up into notes, contexts and pipelines?")}
</b>
<p>
<%= gettext(
{gettext(
"i really admired the idea of a zettelkasten, especially with org-mode backlinks, however I felt like my notes would immediately become too messy by just putting everything into a single hierarchy."
) %>
<%= gettext(
)}
{gettext(
"i wanted to separate between a personal dictionary of concepts and then my thought processes that are built off of my experiences and life lessons. these are notes, and contexts, respectively."
) %>
<%= gettext(
)}
{gettext(
"finally, i wanted to externalize the processes for common situations that use these thought processes at discrete steps. these are pipelines!"
) %>
)}
</p>
</li>
<li class="flex flex-col justify-center items-stretch space-y-2">
<b class="whitespace-nowrap text-left">
<%= gettext("what should my notes be like?") %>
{gettext("what should my notes be like?")}
</b>
<p>
<%= gettext(
{gettext(
"in my opinion, notes should be written by any of the discrete objects or concepts that are meaningful to you in your life."
) %>
<%= gettext(
)}
{gettext(
"spoons? probably not. a particular brand of spoons that you really like? why not :)"
) %>
)}
</p>
</li>
<li class="flex flex-col justify-center items-stretch space-y-2">
<b class="whitespace-nowrap text-left">
<%= gettext("what should my contexts be like?") %>
{gettext("what should my contexts be like?")}
</b>
<p>
<%= gettext("in my opinion, contexts should be like single-topic blog posts.") %>
<%= gettext(
{gettext("in my opinion, contexts should be like single-topic blog posts.")}
{gettext(
"for instance, a good context could be what makes some physical designs spark joy for you, and in that context you could link to the spoon note as an example of how it fits nicely into your hand."
) %>
)}
</p>
</li>
<li class="flex flex-col justify-center items-stretch space-y-2">
<b class="whitespace-nowrap text-left">
<%= gettext("what should my pipelines be like?") %>
{gettext("what should my pipelines be like?")}
</b>
<p>
<%= gettext(
{gettext(
"in my opinion, pipelines should be pretty lightweight, and just link to contexts to provide most of the heavy lifting."
) %>
<%= gettext(
)}
{gettext(
"for instance, a pipeline for buying an object could have a step where you consider how much it sparks joy, and it could link to the physical designs context, maybe with some notes about how it applies in this case."
) %>
)}
</p>
</li>
<li class="flex flex-col justify-center items-stretch space-y-2">
<b class="whitespace-nowrap text-left">
<%= gettext("how many people should i invite?") %>
{gettext("how many people should i invite?")}
</b>
<p>
<%= gettext(
{gettext(
"while memEx fully supports multiple users, each memEx instance should be treated as a single cohesive and collaborative document."
) %>
<%= gettext(
)}
{gettext(
"note, context and pipeline slugs must be unique, and you are free to link to notes not written by you."
) %>
<%= gettext(
)}
{gettext(
"so, i'd recommend inviting anyone you'd like to work on your collective memEx. however, when in doubt, hopefully setting up a new instance is easy enough. if it isn't, then feel free to let me know :)"
) %>
)}
</p>
</li>
</ul>

View File

@ -1,39 +1,39 @@
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-lg">
<h1 class="text-xl title text-primary-400">
<%= gettext("memEx") %>
{gettext("memEx")}
</h1>
<ul class="flex flex-col space-y-4">
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("notes:") %>
{gettext("notes:")}
</b>
<p>
<%= gettext("document notes about individual items or concepts") %>
{gettext("document notes about individual items or concepts")}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("contexts:") %>
{gettext("contexts:")}
</b>
<p>
<%= gettext("provide context around a single topic and hotlink to your notes") %>
{gettext("provide context around a single topic and hotlink to your notes")}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("pipelines:") %>
{gettext("pipelines:")}
</b>
<p>
<%= gettext("document your processes, attaching contexts to each step") %>
{gettext("document your processes, attaching contexts to each step")}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2 text-right">
<.link navigate={~p"/faq"} class="btn btn-primary">
<%= gettext("read more on how to use memEx") %>
{gettext("read more on how to use memEx")}
</.link>
</li>
</ul>
@ -42,42 +42,42 @@
<ul class="flex flex-col space-y-4">
<h2 class="text-lg title text-primary-400">
<%= gettext("features") %>
{gettext("features")}
</h2>
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("multi-user:") %>
{gettext("multi-user:")}
</b>
<p>
<%= gettext("built with sharing and collaboration in mind") %>
{gettext("built with sharing and collaboration in mind")}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("privacy:") %>
{gettext("privacy:")}
</b>
<p>
<%= gettext("privacy controls on a per-note, context or pipeline basis") %>
{gettext("privacy controls on a per-note, context or pipeline basis")}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("convenient:") %>
{gettext("convenient:")}
</b>
<p>
<%= gettext("accessible from any internet-capable device") %>
{gettext("accessible from any internet-capable device")}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b class="whitespace-nowrap">
<%= gettext("backlinks:") %>
{gettext("backlinks:")}
</b>
<p>
<%= gettext("view referencing items from the referenced item") %>
{gettext("view referencing items from the referenced item")}
</p>
</li>
</ul>
@ -86,45 +86,45 @@
<ul class="flex flex-col justify-center space-y-4">
<h2 class="text-lg title text-primary-400">
<%= gettext("instance information") %>
{gettext("instance information")}
</h2>
<li class="flex flex-col justify-center items-center space-y-2">
<b>
<%= gettext("admins:") %>
{gettext("admins:")}
</b>
<p class="flex flex-col justify-center items-center space-y-2">
<%= if @admins |> Enum.empty?() do %>
<.link href={~p"/users/register"} class="link">
<%= dgettext("prompts", "register to setup memEx") %>
{dgettext("prompts", "register to setup memEx")}
</.link>
<% else %>
<.link :for={%{email: email} <- @admins} class="link" href={"mailto:#{email}"}>
<%= email %>
{email}
</.link>
<% end %>
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b><%= gettext("registration:") %></b>
<b>{gettext("registration:")}</b>
<p>
<%= case Accounts.registration_mode() do
{case Accounts.registration_mode() do
:public -> gettext("public signups")
:invite_only -> gettext("invite only")
end %>
end}
</p>
</li>
<li class="flex flex-col justify-center items-center space-y-2">
<b><%= gettext("version:") %></b>
<b>{gettext("version:")}</b>
<.link
href="https://gitea.bubbletea.dev/shibao/memEx/src/branch/stable/changelog.md"
class="flex flex-row justify-center items-center space-x-2 link"
target="_blank"
rel="noopener noreferrer"
>
<p><%= @version %></p>
<p>{@version}</p>
<i class="fas fa-md fa-info-circle"></i>
</.link>
</li>
@ -134,7 +134,7 @@
<ul class="flex flex-col space-y-2">
<h2 class="text-lg title text-primary-400">
<%= gettext("get involved") %>
{gettext("get involved")}
</h2>
<li class="flex flex-col justify-center items-center space-y-2">
@ -144,7 +144,7 @@
target="_blank"
rel="noopener noreferrer"
>
<p><%= gettext("view the source code") %></p>
<p>{gettext("view the source code")}</p>
<i class="fas fa-md fa-code"></i>
</.link>
</li>
@ -155,7 +155,7 @@
target="_blank"
rel="noopener noreferrer"
>
<p><%= gettext("help translate") %></p>
<p>{gettext("help translate")}</p>
<i class="fas fa-md fa-language"></i>
</.link>
</li>
@ -166,7 +166,7 @@
target="_blank"
rel="noopener noreferrer"
>
<p><%= gettext("report bugs or request features") %></p>
<p>{gettext("report bugs or request features")}</p>
<i class="fas fa-md fa-spider"></i>
</.link>
</li>

View File

@ -1,6 +1,6 @@
<div>
<h2 class="mb-8 text-xl text-center title text-primary-400">
<%= @title %>
{@title}
</h2>
<.form
:let={f}
@ -16,38 +16,38 @@
:if={@changeset.action && not @changeset.valid?}
class="col-span-3 text-center invalid-feedback"
>
<%= changeset_errors(@changeset) %>
{changeset_errors(@changeset)}
</div>
<%= label(f, :name, gettext("name"),
{label(f, :name, gettext("name"),
class: "title text-lg text-primary-400",
phx_debounce: 300
) %>
<%= text_input(f, :name,
)}
{text_input(f, :name,
class: "input input-primary col-span-2",
phx_debounce: 300,
required: true
) %>
<%= error_tag(f, :name, "col-span-3") %>
)}
{error_tag(f, :name, "col-span-3")}
<%= label(f, :uses_left, gettext("uses left"),
{label(f, :uses_left, gettext("uses left"),
class: "title text-lg text-primary-400",
phx_debounce: 300
) %>
<%= number_input(f, :uses_left,
)}
{number_input(f, :uses_left,
min: 0,
class: "input input-primary col-span-2",
phx_debounce: 300
) %>
<%= error_tag(f, :uses_left, "col-span-3") %>
)}
{error_tag(f, :uses_left, "col-span-3")}
<span class="col-span-3 italic text-center text-primary-500">
<%= gettext(~s/leave "uses left" blank to make invite unlimited/) %>
{gettext(~s/leave "uses left" blank to make invite unlimited/)}
</span>
<%= submit(dgettext("actions", "save"),
{submit(dgettext("actions", "save"),
class: "mx-auto btn btn-primary col-span-3",
phx_disable_with: dgettext("prompts", "saving...")
) %>
)}
</.form>
</div>

View File

@ -1,15 +1,15 @@
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl title title-primary-500">
<%= gettext("invites") %>
{gettext("invites")}
</h1>
<%= if @invites |> Enum.empty?() do %>
<h1 class="text-xl text-center title text-primary-400">
<%= gettext("no invites 😔") %>
{gettext("no invites 😔")}
</h1>
<.link patch={~p"/invites/new"} class="ml-auto btn btn-primary">
<%= dgettext("actions", "new invite") %>
{dgettext("actions", "new invite")}
</.link>
<% end %>
@ -30,7 +30,7 @@
dgettext("actions", "copy invite link for %{invite_name}", invite_name: invite.name)
}
>
<%= dgettext("actions", "copy") %>
{dgettext("actions", "copy")}
</button>
</form>
</:code_actions>
@ -67,7 +67,7 @@
phx-click={if invite.disabled_at, do: "enable_invite", else: "disable_invite"}
phx-value-id={invite.id}
>
<%= if invite.disabled_at, do: gettext("enable"), else: gettext("disable") %>
{if invite.disabled_at, do: gettext("enable"), else: gettext("disable")}
</.link>
<.link
@ -82,12 +82,12 @@
)
}
>
<%= gettext("set unlimited") %>
{gettext("set unlimited")}
</.link>
</.invite_card>
<.link :if={@invites != []} patch={~p"/invites/new"} class="ml-auto btn btn-primary">
<%= dgettext("actions", "create invite") %>
{dgettext("actions", "create invite")}
</.link>
</div>
@ -95,7 +95,7 @@
<hr class="hr" />
<h1 class="text-xl title text-primary-400">
<%= gettext("admins") %>
{gettext("admins")}
</h1>
<div class="flex flex-col justify-center items-stretch space-y-4">
@ -123,7 +123,7 @@
<hr class="hr" />
<h1 class="text-xl title text-primary-400">
<%= gettext("users") %>
{gettext("users")}
</h1>
<div class="flex flex-col justify-center items-stretch space-y-4">

View File

@ -9,49 +9,49 @@
phx-hook="CtrlEnter"
class="flex flex-col justify-start items-stretch space-y-4"
>
<%= text_input(f, :slug,
{text_input(f, :slug,
aria_label: gettext("slug"),
class: "input input-primary",
phx_debounce: 300,
phx_hook: "SanitizeTitles",
placeholder: gettext("slug"),
required: true
) %>
<%= error_tag(f, :slug) %>
)}
{error_tag(f, :slug)}
<%= textarea(f, :content,
{textarea(f, :content,
id: "note-form-content",
class: "input input-primary h-64 min-h-64",
phx_update: "ignore",
placeholder: gettext("use [note-slug] to link to a note"),
aria_label: gettext("use [note-slug] to link to a note"),
phx_debounce: 300
) %>
<%= error_tag(f, :content) %>
)}
{error_tag(f, :content)}
<%= text_input(f, :tags_string,
{text_input(f, :tags_string,
aria_label: gettext("tag1,tag2"),
class: "input input-primary",
id: "tags-input",
phx_debounce: 300,
phx_hook: "SanitizeTags",
placeholder: gettext("tag1,tag2")
) %>
<%= error_tag(f, :tags_string) %>
)}
{error_tag(f, :tags_string)}
<div class="flex justify-center items-stretch space-x-4">
<%= select(f, :visibility, Ecto.Enum.values(Memex.Notes.Note, :visibility),
{select(f, :visibility, Ecto.Enum.values(Memex.Notes.Note, :visibility),
class: "grow input input-primary",
prompt: gettext("select privacy"),
aria_label: gettext("select privacy"),
phx_debounce: 300
) %>
)}
<%= submit(dgettext("actions", "save"),
{submit(dgettext("actions", "save"),
phx_disable_with: gettext("saving..."),
class: "mx-auto btn btn-primary"
) %>
)}
</div>
<%= error_tag(f, :visibility) %>
{error_tag(f, :visibility)}
</.form>
</div>

View File

@ -1,6 +1,6 @@
<div class="flex flex-col justify-center items-start mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= gettext("notes") %>
{gettext("notes")}
</h1>
<.form
@ -11,18 +11,18 @@
phx-submit="search"
class="flex flex-col items-stretch self-stretch"
>
<%= text_input(f, :search_term,
{text_input(f, :search_term,
class: "input input-primary",
value: @search,
role: "search",
phx_debounce: 300,
placeholder: gettext("search")
) %>
)}
</.form>
<%= if @notes |> Enum.empty?() do %>
<h1 class="self-center text-primary-500">
<%= gettext("no notes found") %>
{gettext("no notes found")}
</h1>
<% else %>
<.live_component
@ -37,7 +37,7 @@
patch={~p"/notes/#{note}/edit"}
aria-label={dgettext("actions", "edit %{note_slug}", note_slug: note.slug)}
>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<.link
:if={@current_user}
@ -47,14 +47,14 @@
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{note_slug}", note_slug: note.slug)}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</.link>
</:actions>
</.live_component>
<% end %>
<.link :if={@current_user} patch={~p"/notes/new"} class="self-end btn btn-primary">
<%= dgettext("actions", "new note") %>
{dgettext("actions", "new note")}
</.link>
</div>

View File

@ -1,11 +1,11 @@
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= @note.slug %>
{@note.slug}
</h1>
<div class="flex flex-wrap space-x-1">
<.link :for={tag <- @note.tags} navigate={~p"/notes/#{tag}"} class="link">
<%= tag %>
{tag}
</.link>
</div>
@ -15,37 +15,37 @@
:if={@note_backlinks ++ @context_backlinks ++ @pipeline_backlinks != []}
class="flex flex-wrap justify-end items-center self-end"
>
<p><%= gettext("Backlinked by:") %></p>
<p>{gettext("Backlinked by:")}</p>
<.link
:for={backlink <- @note_backlinks}
class="m-1 hover:underline"
patch={~p"/note/#{backlink}"}
>
<%= gettext("[%{slug}]", slug: backlink.slug) %>
{gettext("[%{slug}]", slug: backlink.slug)}
</.link>
<.link
:for={backlink <- @context_backlinks}
class="m-1 hover:underline"
patch={~p"/context/#{backlink}"}
>
<%= gettext("[[%{slug}]]", slug: backlink.slug) %>
{gettext("[[%{slug}]]", slug: backlink.slug)}
</.link>
<.link
:for={backlink <- @pipeline_backlinks}
class="m-1 hover:underline"
patch={~p"/pipeline/#{backlink}"}
>
<%= gettext("[[[%{slug}]]]", slug: backlink.slug) %>
{gettext("[[[%{slug}]]]", slug: backlink.slug)}
</.link>
</div>
<p class="self-end">
<%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %>
{gettext("Visibility: %{visibility}", visibility: @note.visibility)}
</p>
<div class="flex self-end space-x-4">
<.link :if={@current_user} class="btn btn-primary" patch={~p"/note/#{@note}/edit"}>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<button
:if={@current_user}
@ -55,7 +55,7 @@
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{note_slug}", note_slug: @note.slug)}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</button>
</div>
</div>

View File

@ -9,17 +9,17 @@
phx-hook="CtrlEnter"
class="flex flex-col justify-start items-stretch space-y-4"
>
<%= text_input(f, :slug,
{text_input(f, :slug,
aria_label: gettext("slug"),
class: "input input-primary",
phx_debounce: 300,
phx_hook: "SanitizeTitles",
placeholder: gettext("slug"),
required: true
) %>
<%= error_tag(f, :slug) %>
)}
{error_tag(f, :slug)}
<%= textarea(f, :description,
{textarea(f, :description,
id: "pipeline-form-description",
class: "input input-primary h-64 min-h-64",
phx_update: "ignore",
@ -32,32 +32,32 @@
"use [[[note-slug]]] to link to a note or use [[context-slug]] to link to a context or [pipeline-slug] to link to a pipeline"
),
phx_debounce: 300
) %>
<%= error_tag(f, :description) %>
)}
{error_tag(f, :description)}
<%= text_input(f, :tags_string,
{text_input(f, :tags_string,
aria_label: gettext("tag1,tag2"),
class: "input input-primary",
id: "tags-input",
phx_debounce: 300,
phx_hook: "SanitizeTags",
placeholder: gettext("tag1,tag2")
) %>
<%= error_tag(f, :tags_string) %>
)}
{error_tag(f, :tags_string)}
<div class="flex justify-center items-stretch space-x-4">
<%= select(f, :visibility, Ecto.Enum.values(Memex.Pipelines.Pipeline, :visibility),
{select(f, :visibility, Ecto.Enum.values(Memex.Pipelines.Pipeline, :visibility),
class: "grow input input-primary",
prompt: gettext("select privacy"),
aria_label: gettext("select privacy"),
phx_debounce: 300
) %>
)}
<%= submit(dgettext("actions", "save"),
{submit(dgettext("actions", "save"),
phx_disable_with: gettext("saving..."),
class: "mx-auto btn btn-primary"
) %>
)}
</div>
<%= error_tag(f, :visibility) %>
{error_tag(f, :visibility)}
</.form>
</div>

View File

@ -1,6 +1,6 @@
<div class="flex flex-col justify-center items-start mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= gettext("pipelines") %>
{gettext("pipelines")}
</h1>
<.form
@ -11,18 +11,18 @@
phx-submit="search"
class="flex flex-col items-stretch self-stretch"
>
<%= text_input(f, :search_term,
{text_input(f, :search_term,
class: "input input-primary",
value: @search,
role: "search",
phx_debounce: 300,
placeholder: gettext("search")
) %>
)}
</.form>
<%= if @pipelines |> Enum.empty?() do %>
<h1 class="self-center text-primary-500">
<%= gettext("no pipelines found") %>
{gettext("no pipelines found")}
</h1>
<% else %>
<.live_component
@ -37,7 +37,7 @@
patch={~p"/pipelines/#{pipeline}/edit"}
aria-label={dgettext("actions", "edit %{pipeline_slug}", pipeline_slug: pipeline.slug)}
>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<.link
:if={@current_user}
@ -49,14 +49,14 @@
dgettext("actions", "delete %{pipeline_slug}", pipeline_slug: pipeline.slug)
}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</.link>
</:actions>
</.live_component>
<% end %>
<.link :if={@current_user} patch={~p"/pipelines/new"} class="self-end btn btn-primary">
<%= dgettext("actions", "new pipeline") %>
{dgettext("actions", "new pipeline")}
</.link>
</div>

View File

@ -1,34 +1,34 @@
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= @pipeline.slug %>
{@pipeline.slug}
</h1>
<div class="flex flex-wrap space-x-1">
<.link :for={tag <- @pipeline.tags} navigate={~p"/pipelines/#{tag}"} class="link">
<%= tag %>
{tag}
</.link>
</div>
<.pipeline_content pipeline={@pipeline} />
<div :if={@pipeline_backlinks != []} class="flex flex-wrap justify-end items-center self-end">
<p><%= gettext("Backlinked by:") %></p>
<p>{gettext("Backlinked by:")}</p>
<.link
:for={backlink <- @pipeline_backlinks}
class="m-1 hover:underline"
patch={~p"/pipeline/#{backlink}"}
>
<%= gettext("[%{slug}]", slug: backlink.slug) %>
{gettext("[%{slug}]", slug: backlink.slug)}
</.link>
</div>
<p class="self-end">
<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>
{gettext("Visibility: %{visibility}", visibility: @pipeline.visibility)}
</p>
<div class="flex self-end pb-4 space-x-4">
<.link :if={@current_user} class="btn btn-primary" patch={~p"/pipeline/#{@pipeline}/edit"}>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<button
:if={@current_user}
@ -38,25 +38,25 @@
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{pipeline_slug}", pipeline_slug: @pipeline.slug)}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</button>
</div>
<hr class="hr" />
<h2 class="self-center pt-2 text-lg">
<%= gettext("steps:") %>
{gettext("steps:")}
</h2>
<%= if @steps |> Enum.empty?() do %>
<h3 class="self-center text-md text-primary-600">
<%= gettext("no steps") %>
{gettext("no steps")}
</h3>
<% else %>
<%= for %{id: step_id, position: position, title: title} = step <- @steps do %>
<div class="flex justify-between items-center space-x-4">
<h3 class="text-md">
<%= gettext("%{position}. %{title}", position: position + 1, title: title) %>
{gettext("%{position}. %{title}", position: position + 1, title: title)}
</h3>
<%= if @current_user do %>
@ -98,7 +98,7 @@
patch={~p"/pipeline/#{@pipeline}/#{step_id}"}
aria-label={dgettext("actions", "edit %{step_title}", step_title: step.title)}
>
<%= dgettext("actions", "edit") %>
{dgettext("actions", "edit")}
</.link>
<button
@ -109,7 +109,7 @@
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{step_title}", step_title: step.title)}
>
<%= dgettext("actions", "delete") %>
{dgettext("actions", "delete")}
</button>
</div>
<% end %>
@ -124,7 +124,7 @@
class="self-end btn btn-primary"
patch={~p"/pipeline/#{@pipeline}/add_step"}
>
<%= dgettext("actions", "add step") %>
{dgettext("actions", "add step")}
</.link>
</div>

View File

@ -9,17 +9,17 @@
phx-hook="CtrlEnter"
class="flex flex-col justify-start items-stretch space-y-4"
>
<%= text_input(f, :title,
{text_input(f, :title,
aria_label: gettext("title"),
class: "input input-primary",
phx_debounce: 300,
phx_hook: "SanitizeTitles",
placeholder: gettext("title"),
required: true
) %>
<%= error_tag(f, :title) %>
)}
{error_tag(f, :title)}
<%= textarea(f, :content,
{textarea(f, :content,
id: "step-form-content",
class: "input input-primary h-64 min-h-64",
phx_update: "ignore",
@ -32,14 +32,14 @@
"use [[[note-slug]]] to link to a note or use [[context-slug]] to link to a context or [pipeline-slug] to link to a pipeline"
),
phx_debounce: 300
) %>
<%= error_tag(f, :content) %>
)}
{error_tag(f, :content)}
<div class="flex justify-center items-stretch space-x-4">
<%= submit(dgettext("actions", "save"),
{submit(dgettext("actions", "save"),
phx_disable_with: gettext("saving..."),
class: "mx-auto btn btn-primary"
) %>
)}
</div>
</.form>
</div>