improve templates
This commit is contained in:
@ -109,11 +109,13 @@ defmodule MemexWeb.Components.ContextsTableComponent do
|
||||
|
||||
~H"""
|
||||
<div class="flex flex-wrap justify-center space-x-1">
|
||||
<%= for tag <- @tags do %>
|
||||
<.link patch={Routes.context_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:for={tag <- @tags}
|
||||
patch={Routes.context_index_path(Endpoint, :search, tag)}
|
||||
class="link"
|
||||
>
|
||||
<%= tag %>
|
||||
</.link>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
@ -47,11 +47,9 @@ defmodule MemexWeb.Components.InviteCard do
|
||||
<%= render_slot(@code_actions) %>
|
||||
</div>
|
||||
|
||||
<%= if @inner_block do %>
|
||||
<div class="flex space-x-4 justify-center items-center">
|
||||
<%= render_slot(@inner_block) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div :if={@inner_block} class="flex space-x-4 justify-center items-center">
|
||||
<%= render_slot(@inner_block) %>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
@ -109,11 +109,9 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
||||
|
||||
~H"""
|
||||
<div class="flex flex-wrap justify-center space-x-1">
|
||||
<%= for tag <- @tags do %>
|
||||
<.link patch={Routes.note_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link :for={tag <- @tags} patch={Routes.note_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
@ -122,11 +122,13 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
||||
|
||||
~H"""
|
||||
<div class="flex flex-wrap justify-center space-x-1">
|
||||
<%= for tag <- @tags do %>
|
||||
<.link patch={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:for={tag <- @tags}
|
||||
patch={Routes.pipeline_index_path(Endpoint, :search, tag)}
|
||||
class="link"
|
||||
>
|
||||
<%= tag %>
|
||||
</.link>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
@ -33,20 +33,19 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= for {values, i} <- @rows |> Enum.with_index() do %>
|
||||
<tr class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}>
|
||||
<%= for %{key: key} = value <- @columns do %>
|
||||
<td class={["p-2", value[:class]]}>
|
||||
<%= case values |> Map.get(key) do %>
|
||||
<% {_custom_sort_value, value} -> %>
|
||||
<%= value %>
|
||||
<% value -> %>
|
||||
<%= value %>
|
||||
<% end %>
|
||||
</td>
|
||||
<tr
|
||||
:for={{values, i} <- @rows |> Enum.with_index()}
|
||||
class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}
|
||||
>
|
||||
<td :for={%{key: key} = value <- @columns} class={["p-2", value[:class]]}>
|
||||
<%= case values |> Map.get(key) do %>
|
||||
<% {_custom_sort_value, value} -> %>
|
||||
<%= value %>
|
||||
<% value -> %>
|
||||
<%= value %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -65,16 +65,14 @@ defmodule MemexWeb.Components.Topbar do
|
||||
<li class="mx-2 my-1 border-left border border-primary-700"></li>
|
||||
|
||||
<%= if @current_user do %>
|
||||
<%= if @current_user |> Accounts.is_already_admin?() do %>
|
||||
<li class="mx-2 my-1">
|
||||
<.link
|
||||
navigate={Routes.invite_index_path(Endpoint, :index)}
|
||||
class="text-primary-400 text-primary-400 hover:underline"
|
||||
>
|
||||
<%= gettext("invites") %>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
<li :if={@current_user |> Accounts.is_already_admin?()} class="mx-2 my-1">
|
||||
<.link
|
||||
navigate={Routes.invite_index_path(Endpoint, :index)}
|
||||
class="text-primary-400 text-primary-400 hover:underline"
|
||||
>
|
||||
<%= gettext("invites") %>
|
||||
</.link>
|
||||
</li>
|
||||
|
||||
<li class="mx-2 my-1">
|
||||
<.link
|
||||
@ -95,27 +93,28 @@ defmodule MemexWeb.Components.Topbar do
|
||||
</.link>
|
||||
</li>
|
||||
|
||||
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||
<li class="mx-2 my-1">
|
||||
<.link
|
||||
navigate={Routes.live_dashboard_path(Endpoint, :home)}
|
||||
class="text-primary-400 text-primary-400 hover:underline"
|
||||
>
|
||||
<i class="fas fa-gauge"></i>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
<li
|
||||
:if={
|
||||
@current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2)
|
||||
}
|
||||
class="mx-2 my-1"
|
||||
>
|
||||
<.link
|
||||
navigate={Routes.live_dashboard_path(Endpoint, :home)}
|
||||
class="text-primary-400 text-primary-400 hover:underline"
|
||||
>
|
||||
<i class="fas fa-gauge"></i>
|
||||
</.link>
|
||||
</li>
|
||||
<% else %>
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<li class="mx-2 my-1">
|
||||
<.link
|
||||
navigate={Routes.user_registration_path(Endpoint, :new)}
|
||||
class="text-primary-400 text-primary-400 hover:underline truncate"
|
||||
>
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
<li :if={Accounts.allow_registration?()} class="mx-2 my-1">
|
||||
<.link
|
||||
navigate={Routes.user_registration_path(Endpoint, :new)}
|
||||
class="text-primary-400 text-primary-400 hover:underline truncate"
|
||||
>
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
</li>
|
||||
|
||||
<li class="mx-2 my-1">
|
||||
<.link
|
||||
|
@ -10,8 +10,8 @@ defmodule MemexWeb.Components.UserCard do
|
||||
<div
|
||||
id={"user-#{@user.id}"}
|
||||
class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center text-center
|
||||
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
|
||||
transition-all duration-300 ease-in-out"
|
||||
border border-gray-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 %>
|
||||
@ -39,11 +39,9 @@ defmodule MemexWeb.Components.UserCard do
|
||||
</p>
|
||||
</h3>
|
||||
|
||||
<%= if @inner_block do %>
|
||||
<div class="px-4 py-2 flex space-x-4 justify-center items-center">
|
||||
<%= render_slot(@inner_block) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div :if={@inner_block} class="px-4 py-2 flex space-x-4 justify-center items-center">
|
||||
<%= render_slot(@inner_block) %>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
@ -30,46 +30,44 @@
|
||||
contexts={@contexts}
|
||||
>
|
||||
<:actions :let={context}>
|
||||
<%= if is_owner?(context, @current_user) do %>
|
||||
<.link
|
||||
patch={Routes.context_index_path(@socket, :edit, context.slug)}
|
||||
data-qa={"context-edit-#{context.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<%= if is_owner_or_admin?(context, @current_user) do %>
|
||||
<.link
|
||||
href="#"
|
||||
phx-click="delete"
|
||||
phx-value-id={context.id}
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-context-#{context.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(context, @current_user)}
|
||||
patch={Routes.context_index_path(@socket, :edit, context.slug)}
|
||||
data-qa={"context-edit-#{context.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<.link
|
||||
:if={is_owner_or_admin?(context, @current_user)}
|
||||
href="#"
|
||||
phx-click="delete"
|
||||
phx-value-id={context.id}
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-context-#{context.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.live_component>
|
||||
<% end %>
|
||||
|
||||
<%= if @current_user do %>
|
||||
<.link patch={Routes.context_index_path(@socket, :new)} class="self-end btn btn-primary">
|
||||
<%= dgettext("actions", "new context") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={@current_user}
|
||||
patch={Routes.context_index_path(@socket, :new)}
|
||||
class="self-end btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "new context") %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:new, :edit] do %>
|
||||
<.modal return_to={Routes.context_index_path(@socket, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.ContextLive.FormComponent}
|
||||
id={@context.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
context={@context}
|
||||
return_to={Routes.context_index_path(@socket, :index)}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.context_index_path(@socket, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.ContextLive.FormComponent}
|
||||
id={@context.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
context={@context}
|
||||
return_to={Routes.context_index_path(@socket, :index)}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -4,11 +4,13 @@
|
||||
</h1>
|
||||
|
||||
<div class="flex flex-wrap space-x-1">
|
||||
<%= for tag <- @context.tags do %>
|
||||
<.link navigate={Routes.context_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:for={tag <- @context.tags}
|
||||
navigate={Routes.context_index_path(Endpoint, :search, tag)}
|
||||
class="link"
|
||||
>
|
||||
<%= tag %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<.context_content context={@context} />
|
||||
@ -21,38 +23,37 @@
|
||||
<.link class="btn btn-primary" navigate={Routes.context_index_path(@socket, :index)}>
|
||||
<%= dgettext("actions", "back") %>
|
||||
</.link>
|
||||
<%= if is_owner?(@context, @current_user) do %>
|
||||
<.link
|
||||
class="btn btn-primary"
|
||||
patch={Routes.context_show_path(@socket, :edit, @context.slug)}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<%= if is_owner_or_admin?(@context, @current_user) do %>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-context-#{@context.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</button>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(@context, @current_user)}
|
||||
class="btn btn-primary"
|
||||
patch={Routes.context_show_path(@socket, :edit, @context.slug)}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<button
|
||||
:if={is_owner_or_admin?(@context, @current_user)}
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-context-#{@context.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:edit] do %>
|
||||
<.modal return_to={Routes.context_show_path(@socket, :show, @context.slug)}>
|
||||
<.live_component
|
||||
module={MemexWeb.ContextLive.FormComponent}
|
||||
id={@context.id}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
context={@context}
|
||||
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
<.modal
|
||||
if={@live_action == :edit}
|
||||
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
||||
>
|
||||
<.live_component
|
||||
module={MemexWeb.ContextLive.FormComponent}
|
||||
id={@context.id}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
context={@context}
|
||||
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -38,7 +38,7 @@
|
||||
navigate={Routes.live_path(Endpoint, FaqLive)}
|
||||
class="link title text-primary-400 text-lg"
|
||||
>
|
||||
<%= gettext("read more on how to use %{name}", name: "memEx") %>
|
||||
<%= gettext("read more on how to use memEx") %>
|
||||
</.link>
|
||||
</li>
|
||||
</ul>
|
||||
@ -92,15 +92,13 @@
|
||||
<p>
|
||||
<%= if @admins |> Enum.empty?() do %>
|
||||
<.link href={Routes.user_registration_path(Endpoint, :new)} class="link">
|
||||
<%= dgettext("prompts", "register to setup %{name}", name: "memEx") %>
|
||||
<%= dgettext("prompts", "register to setup memEx") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<div class="flex flex-wrap justify-center space-x-2">
|
||||
<%= for admin <- @admins do %>
|
||||
<a class="link" href={"mailto:#{admin.email}"}>
|
||||
<%= admin.email %>
|
||||
</a>
|
||||
<% end %>
|
||||
<a :for={%{email: email} <- @admins} class="link" href={"mailto:#{email}"}>
|
||||
<%= email %>
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</p>
|
||||
|
@ -11,11 +11,12 @@
|
||||
phx-change="validate"
|
||||
phx-submit="save"
|
||||
>
|
||||
<%= if @changeset.action && not @changeset.valid? do %>
|
||||
<div class="invalid-feedback col-span-3 text-center">
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div
|
||||
:if={@changeset.action && not @changeset.valid?()}
|
||||
class="invalid-feedback col-span-3 text-center"
|
||||
>
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
|
||||
<%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-400") %>
|
||||
<%= text_input(f, :name, class: "input input-primary col-span-2") %>
|
||||
|
@ -18,69 +18,65 @@
|
||||
<% end %>
|
||||
|
||||
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
||||
<%= for invite <- @invites do %>
|
||||
<.invite_card invite={invite}>
|
||||
<:code_actions>
|
||||
<form phx-submit="copy_to_clipboard">
|
||||
<button
|
||||
type="submit"
|
||||
class="mx-2 my-1 btn btn-primary"
|
||||
phx-click={JS.dispatch("memex:clipcopy", to: "#code-#{invite.id}")}
|
||||
>
|
||||
<%= dgettext("actions", "Copy to clipboard") %>
|
||||
</button>
|
||||
</form>
|
||||
</:code_actions>
|
||||
<.link
|
||||
patch={Routes.invite_index_path(Endpoint, :edit, invite)}
|
||||
class="text-primary-400 link"
|
||||
data-qa={"edit-#{invite.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
</.link>
|
||||
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-400 link"
|
||||
phx-click="delete_invite"
|
||||
phx-value-id={invite.id}
|
||||
data-confirm={
|
||||
dgettext("prompts", "are you sure you want to delete the invite for %{invite_name}?",
|
||||
invite_name: invite.name
|
||||
)
|
||||
}
|
||||
data-qa={"delete-#{invite.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
</.link>
|
||||
|
||||
<%= if invite.disabled_at |> is_nil() do %>
|
||||
<a href="#" class="btn btn-primary" phx-click="disable_invite" phx-value-id={invite.id}>
|
||||
<%= gettext("disable") %>
|
||||
</a>
|
||||
<% else %>
|
||||
<a href="#" class="btn btn-primary" phx-click="enable_invite" phx-value-id={invite.id}>
|
||||
<%= gettext("enable") %>
|
||||
</a>
|
||||
<% end %>
|
||||
|
||||
<%= if invite.disabled_at |> is_nil() and not (invite.uses_left |> is_nil()) do %>
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-primary"
|
||||
phx-click="set_unlimited"
|
||||
phx-value-id={invite.id}
|
||||
data-confirm={
|
||||
dgettext("prompts", "are you sure you want to make %{invite_name} unlimited?",
|
||||
invite_name: invite.name
|
||||
)
|
||||
}
|
||||
<.invite_card :for={invite <- @invites} invite={invite}>
|
||||
<:code_actions>
|
||||
<form phx-submit="copy_to_clipboard">
|
||||
<button
|
||||
type="submit"
|
||||
class="mx-2 my-1 btn btn-primary"
|
||||
phx-click={JS.dispatch("memex:clipcopy", to: "#code-#{invite.id}")}
|
||||
>
|
||||
<%= gettext("set unlimited") %>
|
||||
</a>
|
||||
<% end %>
|
||||
</.invite_card>
|
||||
<% end %>
|
||||
<%= dgettext("actions", "Copy to clipboard") %>
|
||||
</button>
|
||||
</form>
|
||||
</:code_actions>
|
||||
<.link
|
||||
patch={Routes.invite_index_path(Endpoint, :edit, invite)}
|
||||
class="text-primary-400 link"
|
||||
data-qa={"edit-#{invite.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
</.link>
|
||||
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-400 link"
|
||||
phx-click="delete_invite"
|
||||
phx-value-id={invite.id}
|
||||
data-confirm={
|
||||
dgettext("prompts", "are you sure you want to delete the invite for %{invite_name}?",
|
||||
invite_name: invite.name
|
||||
)
|
||||
}
|
||||
data-qa={"delete-#{invite.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
</.link>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-primary"
|
||||
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") %>
|
||||
</a>
|
||||
|
||||
<a
|
||||
:if={invite.disabled_at |> is_nil() and not (invite.uses_left |> is_nil())}
|
||||
href="#"
|
||||
class="btn btn-primary"
|
||||
phx-click="set_unlimited"
|
||||
phx-value-id={invite.id}
|
||||
data-confirm={
|
||||
dgettext("prompts", "are you sure you want to make %{invite_name} unlimited?",
|
||||
invite_name: invite.name
|
||||
)
|
||||
}
|
||||
>
|
||||
<%= gettext("set unlimited") %>
|
||||
</a>
|
||||
</.invite_card>
|
||||
</div>
|
||||
|
||||
<%= unless @admins |> Enum.empty?() do %>
|
||||
@ -91,25 +87,23 @@
|
||||
</h1>
|
||||
|
||||
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
||||
<%= for admin <- @admins do %>
|
||||
<.user_card user={admin}>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-400 link"
|
||||
phx-click="delete_user"
|
||||
phx-value-id={admin.id}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"are you sure you want to delete %{email}? This action is permanent!",
|
||||
email: admin.email
|
||||
)
|
||||
}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
</.link>
|
||||
</.user_card>
|
||||
<% end %>
|
||||
<.user_card :for={admin <- @admins} user={admin}>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-400 link"
|
||||
phx-click="delete_user"
|
||||
phx-value-id={admin.id}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"are you sure you want to delete %{email}? This action is permanent!",
|
||||
email: admin.email
|
||||
)
|
||||
}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
</.link>
|
||||
</.user_card>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@ -121,39 +115,35 @@
|
||||
</h1>
|
||||
|
||||
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
||||
<%= for user <- @users do %>
|
||||
<.user_card user={user}>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-400 link"
|
||||
phx-click="delete_user"
|
||||
phx-value-id={user.id}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"are you sure you want to delete %{email}? This action is permanent!",
|
||||
email: user.email
|
||||
)
|
||||
}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
</.link>
|
||||
</.user_card>
|
||||
<% end %>
|
||||
<.user_card :for={user <- @users} user={user}>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-400 link"
|
||||
phx-click="delete_user"
|
||||
phx-value-id={user.id}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"are you sure you want to delete %{email}? This action is permanent!",
|
||||
email: user.email
|
||||
)
|
||||
}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
</.link>
|
||||
</.user_card>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:new, :edit] do %>
|
||||
<.modal return_to={Routes.invite_index_path(Endpoint, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.InviteLive.FormComponent}
|
||||
id={@invite.id || :new}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
invite={@invite}
|
||||
return_to={Routes.invite_index_path(Endpoint, :index)}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.invite_index_path(Endpoint, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.InviteLive.FormComponent}
|
||||
id={@invite.id || :new}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
invite={@invite}
|
||||
return_to={Routes.invite_index_path(Endpoint, :index)}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -31,8 +31,8 @@ defmodule MemexWeb.LiveHelpers do
|
||||
patch={@return_to}
|
||||
id="modal-bg"
|
||||
class="fade-in fixed z-10 left-0 top-0
|
||||
w-screen h-screen overflow-hidden
|
||||
p-8 flex flex-col justify-center items-center cursor-auto"
|
||||
w-screen h-screen overflow-hidden
|
||||
p-8 flex flex-col justify-center items-center cursor-auto"
|
||||
style="background-color: rgba(0,0,0,0.4);"
|
||||
phx-remove={hide_modal()}
|
||||
>
|
||||
@ -48,16 +48,16 @@ defmodule MemexWeb.LiveHelpers do
|
||||
<div
|
||||
id="modal-content"
|
||||
class="fade-in-scale max-w-3xl max-h-3xl relative w-full
|
||||
pointer-events-auto overflow-hidden
|
||||
px-8 py-4 sm:py-8 flex flex-col justify-start items-stretch
|
||||
bg-primary-800 text-primary-400 border-primary-900 border-2 rounded-lg"
|
||||
pointer-events-auto overflow-hidden
|
||||
px-8 py-4 sm:py-8 flex flex-col justify-start items-stretch
|
||||
bg-primary-800 text-primary-400 border-primary-900 border-2 rounded-lg"
|
||||
>
|
||||
<.link
|
||||
patch={@return_to}
|
||||
id="close"
|
||||
class="absolute top-8 right-10
|
||||
text-gray-500 hover:text-gray-800
|
||||
transition-all duration-500 ease-in-out"
|
||||
text-gray-500 hover:text-gray-800
|
||||
transition-all duration-500 ease-in-out"
|
||||
phx-remove={hide_modal()}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-times"></i>
|
||||
|
@ -30,46 +30,44 @@
|
||||
notes={@notes}
|
||||
>
|
||||
<:actions :let={note}>
|
||||
<%= if is_owner?(note, @current_user) do %>
|
||||
<.link
|
||||
patch={Routes.note_index_path(@socket, :edit, note.slug)}
|
||||
data-qa={"note-edit-#{note.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<%= if is_owner_or_admin?(note, @current_user) do %>
|
||||
<.link
|
||||
href="#"
|
||||
phx-click="delete"
|
||||
phx-value-id={note.id}
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-note-#{note.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(note, @current_user)}
|
||||
patch={Routes.note_index_path(@socket, :edit, note.slug)}
|
||||
data-qa={"note-edit-#{note.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<.link
|
||||
:if={is_owner_or_admin?(note, @current_user)}
|
||||
href="#"
|
||||
phx-click="delete"
|
||||
phx-value-id={note.id}
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-note-#{note.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.live_component>
|
||||
<% end %>
|
||||
|
||||
<%= if @current_user do %>
|
||||
<.link patch={Routes.note_index_path(@socket, :new)} class="self-end btn btn-primary">
|
||||
<%= dgettext("actions", "new note") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={@current_user}
|
||||
patch={Routes.note_index_path(@socket, :new)}
|
||||
class="self-end btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "new note") %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:new, :edit] do %>
|
||||
<.modal return_to={Routes.note_index_path(@socket, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.NoteLive.FormComponent}
|
||||
id={@note.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
note={@note}
|
||||
return_to={Routes.note_index_path(@socket, :index)}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.note_index_path(@socket, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.NoteLive.FormComponent}
|
||||
id={@note.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
note={@note}
|
||||
return_to={Routes.note_index_path(@socket, :index)}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -4,11 +4,13 @@
|
||||
</h1>
|
||||
|
||||
<div class="flex flex-wrap space-x-1">
|
||||
<%= for tag <- @note.tags do %>
|
||||
<.link navigate={Routes.note_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:for={tag <- @note.tags}
|
||||
navigate={Routes.note_index_path(Endpoint, :search, tag)}
|
||||
class="link"
|
||||
>
|
||||
<%= tag %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<.note_content note={@note} />
|
||||
@ -21,35 +23,34 @@
|
||||
<.link class="btn btn-primary" navigate={Routes.note_index_path(@socket, :index)}>
|
||||
<%= dgettext("actions", "back") %>
|
||||
</.link>
|
||||
<%= if is_owner?(@note, @current_user) do %>
|
||||
<.link class="btn btn-primary" patch={Routes.note_show_path(@socket, :edit, @note.slug)}>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<%= if is_owner_or_admin?(@note, @current_user) do %>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-note-#{@note.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</button>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(@note, @current_user)}
|
||||
class="btn btn-primary"
|
||||
patch={Routes.note_show_path(@socket, :edit, @note.slug)}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<button
|
||||
:if={is_owner_or_admin?(@note, @current_user)}
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-note-#{@note.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:edit] do %>
|
||||
<.modal return_to={Routes.note_show_path(@socket, :show, @note.slug)}>
|
||||
<.live_component
|
||||
module={MemexWeb.NoteLive.FormComponent}
|
||||
id={@note.id}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
note={@note}
|
||||
return_to={Routes.note_show_path(@socket, :show, @note.slug)}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
<.modal :if={@live_action == :edit} return_to={Routes.note_show_path(@socket, :show, @note.slug)}>
|
||||
<.live_component
|
||||
module={MemexWeb.NoteLive.FormComponent}
|
||||
id={@note.id}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
note={@note}
|
||||
return_to={Routes.note_show_path(@socket, :show, @note.slug)}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -30,46 +30,47 @@
|
||||
pipelines={@pipelines}
|
||||
>
|
||||
<:actions :let={pipeline}>
|
||||
<%= if is_owner?(pipeline, @current_user) do %>
|
||||
<.link
|
||||
patch={Routes.pipeline_index_path(@socket, :edit, pipeline.slug)}
|
||||
data-qa={"pipeline-edit-#{pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<%= if is_owner_or_admin?(pipeline, @current_user) do %>
|
||||
<.link
|
||||
href="#"
|
||||
phx-click="delete"
|
||||
phx-value-id={pipeline.id}
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-pipeline-#{pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(pipeline, @current_user)}
|
||||
patch={Routes.pipeline_index_path(@socket, :edit, pipeline.slug)}
|
||||
data-qa={"pipeline-edit-#{pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<.link
|
||||
:if={is_owner_or_admin?(pipeline, @current_user)}
|
||||
href="#"
|
||||
phx-click="delete"
|
||||
phx-value-id={pipeline.id}
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-pipeline-#{pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.live_component>
|
||||
<% end %>
|
||||
|
||||
<%= if @current_user do %>
|
||||
<.link patch={Routes.pipeline_index_path(@socket, :new)} class="self-end btn btn-primary">
|
||||
<%= dgettext("actions", "new pipeline") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={@current_user}
|
||||
patch={Routes.pipeline_index_path(@socket, :new)}
|
||||
class="self-end btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "new pipeline") %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:new, :edit] do %>
|
||||
<.modal return_to={Routes.pipeline_index_path(@socket, :index)}>
|
||||
<.live_component
|
||||
module={MemexWeb.PipelineLive.FormComponent}
|
||||
id={@pipeline.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
pipeline={@pipeline}
|
||||
return_to={Routes.pipeline_index_path(@socket, :index)}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
<.modal
|
||||
:if={@live_action in [:new, :edit]}
|
||||
return_to={Routes.pipeline_index_path(@socket, :index)}
|
||||
>
|
||||
<.live_component
|
||||
module={MemexWeb.PipelineLive.FormComponent}
|
||||
id={@pipeline.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
pipeline={@pipeline}
|
||||
return_to={Routes.pipeline_index_path(@socket, :index)}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -4,23 +4,24 @@
|
||||
</h1>
|
||||
|
||||
<div class="flex flex-wrap space-x-1">
|
||||
<%= for tag <- @pipeline.tags do %>
|
||||
<.link navigate={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link">
|
||||
<%= tag %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:for={tag <- @pipeline.tags}
|
||||
navigate={Routes.pipeline_index_path(Endpoint, :search, tag)}
|
||||
class="link"
|
||||
>
|
||||
<%= tag %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<%= if @pipeline.description do %>
|
||||
<textarea
|
||||
id="show-pipeline-description"
|
||||
class="input input-primary h-32 min-h-32"
|
||||
phx-hook="MaintainAttrs"
|
||||
phx-update="ignore"
|
||||
readonly
|
||||
phx-no-format
|
||||
><%= @pipeline.description %></textarea>
|
||||
<% end %>
|
||||
<textarea
|
||||
:if={@pipeline.description}
|
||||
id="show-pipeline-description"
|
||||
class="input input-primary h-32 min-h-32"
|
||||
phx-hook="MaintainAttrs"
|
||||
phx-update="ignore"
|
||||
readonly
|
||||
phx-no-format
|
||||
><%= @pipeline.description %></textarea>
|
||||
|
||||
<p class="self-end">
|
||||
<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>
|
||||
@ -30,25 +31,23 @@
|
||||
<.link class="btn btn-primary" navigate={Routes.pipeline_index_path(@socket, :index)}>
|
||||
<%= dgettext("actions", "back") %>
|
||||
</.link>
|
||||
<%= if is_owner?(@pipeline, @current_user) do %>
|
||||
<.link
|
||||
class="btn btn-primary"
|
||||
patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<%= if is_owner_or_admin?(@pipeline, @current_user) do %>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-pipeline-#{@pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</button>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(@pipeline, @current_user)}
|
||||
class="btn btn-primary"
|
||||
patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
|
||||
>
|
||||
<%= dgettext("actions", "edit") %>
|
||||
</.link>
|
||||
<button
|
||||
:if={is_owner_or_admin?(@pipeline, @current_user)}
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "are you sure?")}
|
||||
data-qa={"delete-pipeline-#{@pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "delete") %>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<hr class="hr" />
|
||||
@ -126,15 +125,14 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= if is_owner?(@pipeline, @current_user) do %>
|
||||
<.link
|
||||
class="self-end btn btn-primary"
|
||||
patch={Routes.pipeline_show_path(@socket, :add_step, @pipeline.slug)}
|
||||
data-qa={"add-step-#{@pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "add step") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={is_owner?(@pipeline, @current_user)}
|
||||
class="self-end btn btn-primary"
|
||||
patch={Routes.pipeline_show_path(@socket, :add_step, @pipeline.slug)}
|
||||
data-qa={"add-step-#{@pipeline.id}"}
|
||||
>
|
||||
<%= dgettext("actions", "add step") %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<%= case @live_action do %>
|
||||
@ -150,20 +148,7 @@
|
||||
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
|
||||
/>
|
||||
</.modal>
|
||||
<% :add_step -> %>
|
||||
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
|
||||
<.live_component
|
||||
module={MemexWeb.StepLive.FormComponent}
|
||||
id={@pipeline.id || :new}
|
||||
current_user={@current_user}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
pipeline={@pipeline}
|
||||
step={@step}
|
||||
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
|
||||
/>
|
||||
</.modal>
|
||||
<% :edit_step -> %>
|
||||
<% action when action in [:add_step, :edit_step] -> %>
|
||||
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
|
||||
<.live_component
|
||||
module={MemexWeb.StepLive.FormComponent}
|
||||
|
@ -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") %> | memEx
|
||||
<%= dgettext("errors", "Error") %> | <%= gettext("memEx") %>
|
||||
</title>
|
||||
<link rel="stylesheet" href="/css/app.css" />
|
||||
<script defer type="text/javascript" src="/js/app.js">
|
||||
|
@ -3,16 +3,12 @@
|
||||
<.topbar current_user={assigns[:current_user]}></.topbar>
|
||||
|
||||
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
||||
<%= if get_flash(@conn, :info) do %>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<%= get_flash(@conn, :info) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= if get_flash(@conn, :error) do %>
|
||||
<p class="alert alert-danger" role="alert">
|
||||
<%= get_flash(@conn, :error) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p :if={get_flash(@conn, :info)} class="alert alert-info" role="alert">
|
||||
<%= get_flash(@conn, :info) %>
|
||||
</p>
|
||||
<p :if={get_flash(@conn, :error)} class="alert alert-danger" role="alert">
|
||||
<%= get_flash(@conn, :error) %>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
@ -3,22 +3,25 @@
|
||||
<.topbar current_user={assigns[:current_user]}></.topbar>
|
||||
|
||||
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
||||
<%= if @flash && @flash |> Map.has_key?("info") do %>
|
||||
<p class="alert alert-info" role="alert" phx-click="lv:clear-flash" phx-value-key="info">
|
||||
<%= live_flash(@flash, "info") %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p
|
||||
:if={@flash && @flash |> Map.has_key?("info")}
|
||||
class="alert alert-info"
|
||||
role="alert"
|
||||
phx-click="lv:clear-flash"
|
||||
phx-value-key="info"
|
||||
>
|
||||
<%= live_flash(@flash, "info") %>
|
||||
</p>
|
||||
|
||||
<%= if @flash && @flash |> Map.has_key?("error") do %>
|
||||
<p
|
||||
class="alert alert-danger"
|
||||
role="alert"
|
||||
phx-click="lv:clear-flash"
|
||||
phx-value-key="error"
|
||||
>
|
||||
<%= live_flash(@flash, "error") %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p
|
||||
:if={@flash && @flash |> Map.has_key?("error")}
|
||||
class="alert alert-danger"
|
||||
role="alert"
|
||||
phx-click="lv:clear-flash"
|
||||
phx-value-key="error"
|
||||
>
|
||||
<%= live_flash(@flash, "error") %>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
@ -20,11 +20,13 @@
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="flex flex-row justify-center items-center space-x-4">
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={Accounts.allow_registration?()}
|
||||
href={Routes.user_registration_path(@conn, :new)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "log in") %>
|
||||
</.link>
|
||||
|
@ -9,13 +9,11 @@
|
||||
action={Routes.user_registration_path(@conn, :create)}
|
||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||
>
|
||||
<%= if @changeset.action && not @changeset.valid? do %>
|
||||
<div class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div :if={@changeset.action && not @changeset.valid?()} class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= if @invite do %>
|
||||
<%= hidden_input(f, :invite_token, value: @invite.token) %>
|
||||
|
@ -9,13 +9,11 @@
|
||||
action={Routes.user_reset_password_path(@conn, :update, @token)}
|
||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||
>
|
||||
<%= if @changeset.action && not @changeset.valid? do %>
|
||||
<div class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div :if={@changeset.action && not @changeset.valid?()} class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= label(f, :password, "new password", class: "title text-lg text-primary-400") %>
|
||||
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
|
||||
@ -38,11 +36,13 @@
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="flex flex-row justify-center items-center space-x-4">
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={Accounts.allow_registration?()}
|
||||
href={Routes.user_registration_path(@conn, :new)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "log in") %>
|
||||
</.link>
|
||||
|
@ -20,11 +20,13 @@
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="flex flex-row justify-center items-center space-x-4">
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={Accounts.allow_registration?()}
|
||||
href={Routes.user_registration_path(@conn, :new)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "log in") %>
|
||||
</.link>
|
||||
|
@ -10,13 +10,11 @@
|
||||
as="user"
|
||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||
>
|
||||
<%= if @error_message do %>
|
||||
<div class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= @error_message %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div :if={@error_message} class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= @error_message %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= label(f, :email, class: "title text-lg text-primary-400") %>
|
||||
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
|
||||
@ -35,11 +33,13 @@
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="flex flex-row justify-center items-center space-x-4">
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
<.link
|
||||
:if={Accounts.allow_registration?()}
|
||||
href={Routes.user_registration_path(@conn, :new)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "register") %>
|
||||
</.link>
|
||||
<.link href={Routes.user_reset_password_path(@conn, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "forgot your password?") %>
|
||||
</.link>
|
||||
|
@ -15,13 +15,14 @@
|
||||
<%= dgettext("actions", "change email") %>
|
||||
</h3>
|
||||
|
||||
<%= if @email_changeset.action && not @email_changeset.valid? do %>
|
||||
<div class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div
|
||||
:if={@email_changeset.action && not @email_changeset.valid?()}
|
||||
class="alert alert-danger col-span-3"
|
||||
>
|
||||
<p>
|
||||
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
|
||||
|
||||
@ -58,13 +59,14 @@
|
||||
<%= dgettext("actions", "change password") %>
|
||||
</h3>
|
||||
|
||||
<%= if @password_changeset.action && not @password_changeset.valid? do %>
|
||||
<div class="alert alert-danger col-span-3">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div
|
||||
:if={@password_changeset.action && not @password_changeset.valid?()}
|
||||
class="alert alert-danger col-span-3"
|
||||
>
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
|
||||
|
||||
@ -113,13 +115,14 @@
|
||||
<%= dgettext("actions", "change language") %>
|
||||
</h3>
|
||||
|
||||
<%= if @locale_changeset.action && not @locale_changeset.valid? do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>
|
||||
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div
|
||||
:if={@locale_changeset.action && not @locale_changeset.valid?()}
|
||||
class="alert alert-danger"
|
||||
>
|
||||
<p>
|
||||
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
|
||||
|
||||
|
@ -17,11 +17,13 @@ defmodule MemexWeb.ErrorHelpers do
|
||||
assigns = %{extra_class: extra_class, form: form, field: field}
|
||||
|
||||
~H"""
|
||||
<%= for error <- Keyword.get_values(@form.errors, @field) do %>
|
||||
<span class={["invalid-feedback", @extra_class]} phx-feedback-for={input_name(@form, @field)}>
|
||||
<%= translate_error(error) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<span
|
||||
:for={error <- Keyword.get_values(@form.errors, @field)}
|
||||
class={["invalid-feedback", @extra_class]}
|
||||
phx-feedback-for={input_name(@form, @field)}
|
||||
>
|
||||
<%= translate_error(error) %>
|
||||
</span>
|
||||
"""
|
||||
end
|
||||
|
||||
|
@ -7,6 +7,11 @@ defmodule MemexWeb.LayoutView do
|
||||
# so we instruct Elixir to not warn if the dashboard route is missing.
|
||||
@compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}}
|
||||
|
||||
def get_title(%{assigns: %{title: title}}), do: gettext("memEx | %{title}", title: title)
|
||||
def get_title(_conn), do: gettext("memEx")
|
||||
def get_title(%{assigns: %{title: title}}) do
|
||||
gettext("memEx | %{title}", title: title)
|
||||
end
|
||||
|
||||
def get_title(_conn) do
|
||||
gettext("memEx")
|
||||
end
|
||||
end
|
||||
|
@ -16,19 +16,18 @@ defmodule MemexWeb.ViewHelpers do
|
||||
|
||||
def datetime(assigns) do
|
||||
~H"""
|
||||
<%= if @datetime do %>
|
||||
<time
|
||||
datetime={cast_datetime(@datetime)}
|
||||
x-data={"{
|
||||
datetime:
|
||||
Intl.DateTimeFormat([], {dateStyle: 'short', timeStyle: 'long'})
|
||||
.format(new Date(\"#{cast_datetime(@datetime)}\"))
|
||||
}"}
|
||||
x-text="datetime"
|
||||
>
|
||||
<%= cast_datetime(@datetime) %>
|
||||
</time>
|
||||
<% end %>
|
||||
<time
|
||||
:if={@datetime}
|
||||
datetime={cast_datetime(@datetime)}
|
||||
x-data={"{
|
||||
datetime:
|
||||
Intl.DateTimeFormat([], {dateStyle: 'short', timeStyle: 'long'})
|
||||
.format(new Date(\"#{cast_datetime(@datetime)}\"))
|
||||
}"}
|
||||
x-text="datetime"
|
||||
>
|
||||
<%= cast_datetime(@datetime) %>
|
||||
</time>
|
||||
"""
|
||||
end
|
||||
|
||||
@ -48,19 +47,18 @@ defmodule MemexWeb.ViewHelpers do
|
||||
|
||||
def date(assigns) do
|
||||
~H"""
|
||||
<%= if @date do %>
|
||||
<time
|
||||
datetime={@date |> Date.to_iso8601(:extended)}
|
||||
x-data={"{
|
||||
date:
|
||||
Intl.DateTimeFormat([], {timeZone: 'Etc/UTC', dateStyle: 'short'})
|
||||
.format(new Date(\"#{@date |> Date.to_iso8601(:extended)}\"))
|
||||
}"}
|
||||
x-text="date"
|
||||
>
|
||||
<%= @date |> Date.to_iso8601(:extended) %>
|
||||
</time>
|
||||
<% end %>
|
||||
<time
|
||||
:if={@date}
|
||||
datetime={@date |> Date.to_iso8601(:extended)}
|
||||
x-data={"{
|
||||
date:
|
||||
Intl.DateTimeFormat([], {timeZone: 'Etc/UTC', dateStyle: 'short'})
|
||||
.format(new Date(\"#{@date |> Date.to_iso8601(:extended)}\"))
|
||||
}"}
|
||||
x-text="date"
|
||||
>
|
||||
<%= @date |> Date.to_iso8601(:extended) %>
|
||||
</time>
|
||||
"""
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user