From eb7593758726aba3d52d2b45b762840b688813b7 Mon Sep 17 00:00:00 2001
From: shibao
Date: Sat, 4 Feb 2023 11:29:06 -0500
Subject: [PATCH] improve templates
---
changelog.md | 1 +
.../components/contexts_table_component.ex | 12 +-
lib/memex_web/components/invite_card.ex | 8 +-
.../components/notes_table_component.ex | 8 +-
.../components/pipelines_table_component.ex | 12 +-
.../components/table_component.html.heex | 25 +-
lib/memex_web/components/topbar.ex | 59 +++--
lib/memex_web/components/user_card.ex | 12 +-
.../live/context_live/index.html.heex | 72 +++---
.../live/context_live/show.html.heex | 75 +++---
lib/memex_web/live/home_live.html.heex | 12 +-
.../live/invite_live/form_component.html.heex | 11 +-
.../live/invite_live/index.html.heex | 216 +++++++++---------
lib/memex_web/live/live_helpers.ex | 14 +-
lib/memex_web/live/note_live/index.html.heex | 72 +++---
lib/memex_web/live/note_live/show.html.heex | 69 +++---
.../live/pipeline_live/index.html.heex | 75 +++---
.../live/pipeline_live/show.html.heex | 99 ++++----
lib/memex_web/templates/error/error.html.heex | 2 +-
lib/memex_web/templates/layout/app.html.heex | 16 +-
lib/memex_web/templates/layout/live.html.heex | 33 +--
.../templates/user_confirmation/new.html.heex | 12 +-
.../templates/user_registration/new.html.heex | 12 +-
.../user_reset_password/edit.html.heex | 24 +-
.../user_reset_password/new.html.heex | 12 +-
.../templates/user_session/new.html.heex | 24 +-
.../templates/user_settings/edit.html.heex | 45 ++--
lib/memex_web/views/error_helpers.ex | 12 +-
lib/memex_web/views/layout_view.ex | 9 +-
lib/memex_web/views/view_helpers.ex | 50 ++--
priv/gettext/actions.pot | 76 +++---
priv/gettext/de/LC_MESSAGES/actions.po | 76 +++---
priv/gettext/de/LC_MESSAGES/default.po | 79 +++----
priv/gettext/de/LC_MESSAGES/errors.po | 10 +-
priv/gettext/de/LC_MESSAGES/prompts.po | 38 +--
priv/gettext/default.pot | 79 +++----
priv/gettext/errors.pot | 10 +-
priv/gettext/prompts.pot | 38 +--
38 files changed, 745 insertions(+), 764 deletions(-)
diff --git a/changelog.md b/changelog.md
index 7593abc..64dd132 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,6 @@
# v0.1.8
- Fix bug with public registration
+- Improve templates
# v0.1.7
- Update dependencies
diff --git a/lib/memex_web/components/contexts_table_component.ex b/lib/memex_web/components/contexts_table_component.ex
index 4006db3..ccb176d 100644
--- a/lib/memex_web/components/contexts_table_component.ex
+++ b/lib/memex_web/components/contexts_table_component.ex
@@ -109,11 +109,13 @@ defmodule MemexWeb.Components.ContextsTableComponent do
~H"""
- <%= for tag <- @tags do %>
- <.link patch={Routes.context_index_path(Endpoint, :search, tag)} class="link">
- <%= tag %>
-
- <% end %>
+ <.link
+ :for={tag <- @tags}
+ patch={Routes.context_index_path(Endpoint, :search, tag)}
+ class="link"
+ >
+ <%= tag %>
+
"""
end
diff --git a/lib/memex_web/components/invite_card.ex b/lib/memex_web/components/invite_card.ex
index c4389bb..e71cbe1 100644
--- a/lib/memex_web/components/invite_card.ex
+++ b/lib/memex_web/components/invite_card.ex
@@ -47,11 +47,9 @@ defmodule MemexWeb.Components.InviteCard do
<%= render_slot(@code_actions) %>
- <%= if @inner_block do %>
-
- <%= render_slot(@inner_block) %>
-
- <% end %>
+
+ <%= render_slot(@inner_block) %>
+
"""
end
diff --git a/lib/memex_web/components/notes_table_component.ex b/lib/memex_web/components/notes_table_component.ex
index 527faf7..eef4b9e 100644
--- a/lib/memex_web/components/notes_table_component.ex
+++ b/lib/memex_web/components/notes_table_component.ex
@@ -109,11 +109,9 @@ defmodule MemexWeb.Components.NotesTableComponent do
~H"""
- <%= for tag <- @tags do %>
- <.link patch={Routes.note_index_path(Endpoint, :search, tag)} class="link">
- <%= tag %>
-
- <% end %>
+ <.link :for={tag <- @tags} patch={Routes.note_index_path(Endpoint, :search, tag)} class="link">
+ <%= tag %>
+
"""
end
diff --git a/lib/memex_web/components/pipelines_table_component.ex b/lib/memex_web/components/pipelines_table_component.ex
index a2c5be7..9bdc406 100644
--- a/lib/memex_web/components/pipelines_table_component.ex
+++ b/lib/memex_web/components/pipelines_table_component.ex
@@ -122,11 +122,13 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
~H"""
- <%= for tag <- @tags do %>
- <.link patch={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link">
- <%= tag %>
-
- <% end %>
+ <.link
+ :for={tag <- @tags}
+ patch={Routes.pipeline_index_path(Endpoint, :search, tag)}
+ class="link"
+ >
+ <%= tag %>
+
"""
end
diff --git a/lib/memex_web/components/table_component.html.heex b/lib/memex_web/components/table_component.html.heex
index cb417e6..7142e06 100644
--- a/lib/memex_web/components/table_component.html.heex
+++ b/lib/memex_web/components/table_component.html.heex
@@ -33,20 +33,19 @@
- <%= for {values, i} <- @rows |> Enum.with_index() do %>
- Integer.is_even(), do: @row_class, else: @alternate_row_class}>
- <%= for %{key: key} = value <- @columns do %>
-
- <%= case values |> Map.get(key) do %>
- <% {_custom_sort_value, value} -> %>
- <%= value %>
- <% value -> %>
- <%= value %>
- <% end %>
- |
+
Enum.with_index()}
+ class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}
+ >
+
+ <%= case values |> Map.get(key) do %>
+ <% {_custom_sort_value, value} -> %>
+ <%= value %>
+ <% value -> %>
+ <%= value %>
<% end %>
- |
- <% end %>
+
+
diff --git a/lib/memex_web/components/topbar.ex b/lib/memex_web/components/topbar.ex
index b22db1f..b016a0e 100644
--- a/lib/memex_web/components/topbar.ex
+++ b/lib/memex_web/components/topbar.ex
@@ -65,16 +65,14 @@ defmodule MemexWeb.Components.Topbar do
<%= if @current_user do %>
- <%= if @current_user |> Accounts.is_already_admin?() do %>
-
- <.link
- navigate={Routes.invite_index_path(Endpoint, :index)}
- class="text-primary-400 text-primary-400 hover:underline"
- >
- <%= gettext("invites") %>
-
-
- <% end %>
+ 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
@@ -95,27 +93,28 @@ defmodule MemexWeb.Components.Topbar do
- <%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
-
- <.link
- navigate={Routes.live_dashboard_path(Endpoint, :home)}
- class="text-primary-400 text-primary-400 hover:underline"
- >
-
-
-
- <% end %>
+
+ <.link
+ navigate={Routes.live_dashboard_path(Endpoint, :home)}
+ class="text-primary-400 text-primary-400 hover:underline"
+ >
+
+
+
<% else %>
- <%= if Accounts.allow_registration?() do %>
-
- <.link
- navigate={Routes.user_registration_path(Endpoint, :new)}
- class="text-primary-400 text-primary-400 hover:underline truncate"
- >
- <%= dgettext("actions", "register") %>
-
-
- <% end %>
+
+ <.link
+ navigate={Routes.user_registration_path(Endpoint, :new)}
+ class="text-primary-400 text-primary-400 hover:underline truncate"
+ >
+ <%= dgettext("actions", "register") %>
+
+
<.link
diff --git a/lib/memex_web/components/user_card.ex b/lib/memex_web/components/user_card.ex
index 37d7233..246de93 100644
--- a/lib/memex_web/components/user_card.ex
+++ b/lib/memex_web/components/user_card.ex
@@ -10,8 +10,8 @@ defmodule MemexWeb.Components.UserCard do
<%= @user.email %>
@@ -39,11 +39,9 @@ defmodule MemexWeb.Components.UserCard do
- <%= if @inner_block do %>
-
- <%= render_slot(@inner_block) %>
-
- <% end %>
+
+ <%= render_slot(@inner_block) %>
+
"""
end
diff --git a/lib/memex_web/live/context_live/index.html.heex b/lib/memex_web/live/context_live/index.html.heex
index dd0bc8b..2a94b79 100644
--- a/lib/memex_web/live/context_live/index.html.heex
+++ b/lib/memex_web/live/context_live/index.html.heex
@@ -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") %>
-
- <% 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") %>
-
- <% 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
+ :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") %>
+
<% end %>
- <%= if @current_user do %>
- <.link patch={Routes.context_index_path(@socket, :new)} class="self-end btn btn-primary">
- <%= dgettext("actions", "new context") %>
-
- <% end %>
+ <.link
+ :if={@current_user}
+ patch={Routes.context_index_path(@socket, :new)}
+ class="self-end btn btn-primary"
+ >
+ <%= dgettext("actions", "new context") %>
+
-<%= 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)}
- />
-
-<% 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)}
+ />
+
diff --git a/lib/memex_web/live/context_live/show.html.heex b/lib/memex_web/live/context_live/show.html.heex
index 1d5be4d..b1ba656 100644
--- a/lib/memex_web/live/context_live/show.html.heex
+++ b/lib/memex_web/live/context_live/show.html.heex
@@ -4,11 +4,13 @@
- <%= for tag <- @context.tags do %>
- <.link navigate={Routes.context_index_path(Endpoint, :search, tag)} class="link">
- <%= tag %>
-
- <% end %>
+ <.link
+ :for={tag <- @context.tags}
+ navigate={Routes.context_index_path(Endpoint, :search, tag)}
+ class="link"
+ >
+ <%= tag %>
+
<.context_content context={@context} />
@@ -21,38 +23,37 @@
<.link class="btn btn-primary" navigate={Routes.context_index_path(@socket, :index)}>
<%= dgettext("actions", "back") %>
- <%= if is_owner?(@context, @current_user) do %>
- <.link
- class="btn btn-primary"
- patch={Routes.context_show_path(@socket, :edit, @context.slug)}
- >
- <%= dgettext("actions", "edit") %>
-
- <% end %>
- <%= if is_owner_or_admin?(@context, @current_user) do %>
-
- <% end %>
+ <.link
+ :if={is_owner?(@context, @current_user)}
+ class="btn btn-primary"
+ patch={Routes.context_show_path(@socket, :edit, @context.slug)}
+ >
+ <%= dgettext("actions", "edit") %>
+
+
-<%= 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)}
- />
-
-<% 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)}
+ />
+
diff --git a/lib/memex_web/live/home_live.html.heex b/lib/memex_web/live/home_live.html.heex
index 947e353..1afd985 100644
--- a/lib/memex_web/live/home_live.html.heex
+++ b/lib/memex_web/live/home_live.html.heex
@@ -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") %>
@@ -92,15 +92,13 @@
<%= 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") %>
<% else %>
<% end %>
diff --git a/lib/memex_web/live/invite_live/form_component.html.heex b/lib/memex_web/live/invite_live/form_component.html.heex
index e43224d..5975ac2 100644
--- a/lib/memex_web/live/invite_live/form_component.html.heex
+++ b/lib/memex_web/live/invite_live/form_component.html.heex
@@ -11,11 +11,12 @@
phx-change="validate"
phx-submit="save"
>
- <%= if @changeset.action && not @changeset.valid? do %>
-
- <%= changeset_errors(@changeset) %>
-
- <% end %>
+
+ <%= changeset_errors(@changeset) %>
+
<%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-400") %>
<%= text_input(f, :name, class: "input input-primary col-span-2") %>
diff --git a/lib/memex_web/live/invite_live/index.html.heex b/lib/memex_web/live/invite_live/index.html.heex
index d128e85..3e206d8 100644
--- a/lib/memex_web/live/invite_live/index.html.heex
+++ b/lib/memex_web/live/invite_live/index.html.heex
@@ -18,69 +18,65 @@
<% end %>
- <%= for invite <- @invites do %>
- <.invite_card invite={invite}>
- <:code_actions>
-
-
- <.link
- patch={Routes.invite_index_path(Endpoint, :edit, invite)}
- class="text-primary-400 link"
- data-qa={"edit-#{invite.id}"}
- >
-
-
-
- <.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}"}
- >
-
-
-
- <%= if invite.disabled_at |> is_nil() do %>
-
- <%= gettext("disable") %>
-
- <% else %>
-
- <%= gettext("enable") %>
-
- <% end %>
-
- <%= if invite.disabled_at |> is_nil() and not (invite.uses_left |> is_nil()) do %>
-
+ <:code_actions>
+
- <% end %>
-
- <% end %>
+ <%= dgettext("actions", "Copy to clipboard") %>
+
+
+
+ <.link
+ patch={Routes.invite_index_path(Endpoint, :edit, invite)}
+ class="text-primary-400 link"
+ data-qa={"edit-#{invite.id}"}
+ >
+
+
+
+ <.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}"}
+ >
+
+
+
+
+ <%= if invite.disabled_at, do: gettext("enable"), else: gettext("disable") %>
+
+
+
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") %>
+
+
<%= unless @admins |> Enum.empty?() do %>
@@ -91,25 +87,23 @@
- <%= 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
- )
- }
- >
-
-
-
- <% 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
+ )
+ }
+ >
+
+
+
<% end %>
@@ -121,39 +115,35 @@
- <%= 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
- )
- }
- >
-
-
-
- <% 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
+ )
+ }
+ >
+
+
+
<% end %>
-<%= 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}
- />
-
-<% 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}
+ />
+
diff --git a/lib/memex_web/live/live_helpers.ex b/lib/memex_web/live/live_helpers.ex
index c68fbf1..793788c 100644
--- a/lib/memex_web/live/live_helpers.ex
+++ b/lib/memex_web/live/live_helpers.ex
@@ -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
<.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()}
>
diff --git a/lib/memex_web/live/note_live/index.html.heex b/lib/memex_web/live/note_live/index.html.heex
index f2bf01d..4554787 100644
--- a/lib/memex_web/live/note_live/index.html.heex
+++ b/lib/memex_web/live/note_live/index.html.heex
@@ -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") %>
-
- <% 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") %>
-
- <% 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
+ :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") %>
+
<% end %>
- <%= if @current_user do %>
- <.link patch={Routes.note_index_path(@socket, :new)} class="self-end btn btn-primary">
- <%= dgettext("actions", "new note") %>
-
- <% end %>
+ <.link
+ :if={@current_user}
+ patch={Routes.note_index_path(@socket, :new)}
+ class="self-end btn btn-primary"
+ >
+ <%= dgettext("actions", "new note") %>
+
-<%= 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)}
- />
-
-<% 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)}
+ />
+
diff --git a/lib/memex_web/live/note_live/show.html.heex b/lib/memex_web/live/note_live/show.html.heex
index f02b6ea..ebce59e 100644
--- a/lib/memex_web/live/note_live/show.html.heex
+++ b/lib/memex_web/live/note_live/show.html.heex
@@ -4,11 +4,13 @@
- <%= for tag <- @note.tags do %>
- <.link navigate={Routes.note_index_path(Endpoint, :search, tag)} class="link">
- <%= tag %>
-
- <% end %>
+ <.link
+ :for={tag <- @note.tags}
+ navigate={Routes.note_index_path(Endpoint, :search, tag)}
+ class="link"
+ >
+ <%= tag %>
+
<.note_content note={@note} />
@@ -21,35 +23,34 @@
<.link class="btn btn-primary" navigate={Routes.note_index_path(@socket, :index)}>
<%= dgettext("actions", "back") %>
- <%= if is_owner?(@note, @current_user) do %>
- <.link class="btn btn-primary" patch={Routes.note_show_path(@socket, :edit, @note.slug)}>
- <%= dgettext("actions", "edit") %>
-
- <% end %>
- <%= if is_owner_or_admin?(@note, @current_user) do %>
-
- <% end %>
+ <.link
+ :if={is_owner?(@note, @current_user)}
+ class="btn btn-primary"
+ patch={Routes.note_show_path(@socket, :edit, @note.slug)}
+ >
+ <%= dgettext("actions", "edit") %>
+
+
-<%= 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)}
- />
-
-<% 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)}
+ />
+
diff --git a/lib/memex_web/live/pipeline_live/index.html.heex b/lib/memex_web/live/pipeline_live/index.html.heex
index 6ef21f3..5d91906 100644
--- a/lib/memex_web/live/pipeline_live/index.html.heex
+++ b/lib/memex_web/live/pipeline_live/index.html.heex
@@ -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") %>
-
- <% 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") %>
-
- <% 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
+ :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") %>
+
<% end %>
- <%= if @current_user do %>
- <.link patch={Routes.pipeline_index_path(@socket, :new)} class="self-end btn btn-primary">
- <%= dgettext("actions", "new pipeline") %>
-
- <% end %>
+ <.link
+ :if={@current_user}
+ patch={Routes.pipeline_index_path(@socket, :new)}
+ class="self-end btn btn-primary"
+ >
+ <%= dgettext("actions", "new pipeline") %>
+
-<%= 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)}
- />
-
-<% 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)}
+ />
+
diff --git a/lib/memex_web/live/pipeline_live/show.html.heex b/lib/memex_web/live/pipeline_live/show.html.heex
index 45b5aa4..f6847df 100644
--- a/lib/memex_web/live/pipeline_live/show.html.heex
+++ b/lib/memex_web/live/pipeline_live/show.html.heex
@@ -4,23 +4,24 @@
- <%= for tag <- @pipeline.tags do %>
- <.link navigate={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link">
- <%= tag %>
-
- <% end %>
+ <.link
+ :for={tag <- @pipeline.tags}
+ navigate={Routes.pipeline_index_path(Endpoint, :search, tag)}
+ class="link"
+ >
+ <%= tag %>
+
- <%= if @pipeline.description do %>
-
- <% 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") %>
- <%= if is_owner?(@pipeline, @current_user) do %>
- <.link
- class="btn btn-primary"
- patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
- >
- <%= dgettext("actions", "edit") %>
-
- <% end %>
- <%= if is_owner_or_admin?(@pipeline, @current_user) do %>
-
- <% end %>
+ <.link
+ :if={is_owner?(@pipeline, @current_user)}
+ class="btn btn-primary"
+ patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
+ >
+ <%= dgettext("actions", "edit") %>
+
+
@@ -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") %>
-
- <% 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") %>
+
<%= case @live_action do %>
@@ -150,20 +148,7 @@
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
/>
- <% :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)}
- />
-
- <% :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}
diff --git a/lib/memex_web/templates/error/error.html.heex b/lib/memex_web/templates/error/error.html.heex
index c78a695..a7eb289 100644
--- a/lib/memex_web/templates/error/error.html.heex
+++ b/lib/memex_web/templates/error/error.html.heex
@@ -5,7 +5,7 @@
- <%= dgettext("errors", "Error") %> | memEx
+ <%= dgettext("errors", "Error") %> | <%= gettext("memEx") %>