From f89d28fae5b976ec7070eca6cd28c4d1f108789a Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 15 Jul 2025 10:40:39 +0100 Subject: [PATCH] Standardize and simplify online store templates list markup --- .../index.html.heex | 158 +++++++++--------- priv/gettext/default.pot | 27 +-- priv/gettext/en/LC_MESSAGES/default.po | 27 +-- 3 files changed, 115 insertions(+), 97 deletions(-) diff --git a/lib/music_library_web/live/online_store_template_live/index.html.heex b/lib/music_library_web/live/online_store_template_live/index.html.heex index fbb4aa13..3963d5d3 100644 --- a/lib/music_library_web/live/online_store_template_live/index.html.heex +++ b/lib/music_library_web/live/online_store_template_live/index.html.heex @@ -1,87 +1,91 @@ -
-
-
-

+
+
+
+

{gettext("Online Store Templates")}

-

- {gettext("Manage templates for generating links to online record stores.")} -

-
- <.button as="link" patch={~p"/online-store-templates/new"}> - {gettext("Add Template")} - +
+
+
-
-
-
-
    -
  • -
    -
    -

    - {template.name} -

    - <.badge :if={template.enabled} color="green"> - {gettext("Enabled")} - - <.badge :if={!template.enabled} color="yellow"> - {gettext("Disabled")} - -
    -
    -

    {template.url_template}

    -
    -

    - {template.description} -

    -
    -
    - <.button - phx-click="toggle-enabled" - phx-value-id={template.id} - color={if template.enabled, do: "orange", else: "green"} - variant="ghost" - size="sm" - > - {if template.enabled, do: "Disable", else: "Enable"} - - <.button - as="link" - patch={~p"/online-store-templates/#{template}/edit"} - variant="ghost" - size="sm" - > - {gettext("Edit")} - - <.button - as="link" - phx-click={JS.push("delete", value: %{id: template.id})} - data-confirm="Are you sure?" - color="red" - variant="ghost" - size="sm" - > - {gettext("Delete")} - -
    -
  • -
+
+
    +
  • +
    +
    +

    + {template.name} +

    + <.badge :if={template.enabled} color="green"> + {gettext("Enabled")} + + <.badge :if={!template.enabled} color="yellow"> + {gettext("Disabled")} + +
    +
    +

    {template.url_template}

    +
    +

    + {template.description} +

    -
-
+
+ <.dropdown id={"actions-#{template.id}"} placement="bottom-end"> + <:toggle> +
+ {gettext("Actions")} + <.icon + name="hero-ellipsis-vertical" + class="-mt-1 h-5 w-5 text-zinc-500 dark:text-zinc-400 cursor-pointer" + aria-hidden="true" + data-slot="icon" + /> +
+ + <.dropdown_button phx-click="toggle-enabled" phx-value-id={template.id}> + {if template.enabled, + do: gettext("Disable template"), + else: gettext("Enable template")} + + <.dropdown_link + id={"actions-#{template.id}-edit"} + patch={~p"/online-store-templates/#{template}/edit"} + > + {gettext("Edit")} + + <.separator /> + <.dropdown_button + phx-click="delete" + phx-value-id={template.id} + data-confirm={gettext("Are you sure?")} + class={[ + "text-red-900! hover:bg-red-50! dark:text-red-500! dark:hover:bg-red-900/30! dark:hover:text-red-600!" + ]} + > + {gettext("Delete")} + + +
+ +
<.modal diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 97bfdc00..a5c935e0 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -13,6 +13,7 @@ msgstr "" #: lib/music_library_web/components/record_components.ex #: lib/music_library_web/live/collection_live/show.html.heex +#: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format @@ -921,6 +922,7 @@ msgstr "" #: lib/music_library_web/components/record_components.ex #: lib/music_library_web/live/artist_live/show.html.heex #: lib/music_library_web/live/collection_live/show.html.heex +#: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format @@ -1256,16 +1258,6 @@ msgstr "" msgid "e.g. https://www.amazon.co.uk/s?k={artist}+{title}+vinyl" msgstr "" -#: lib/music_library_web/live/online_store_template_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Add Template" -msgstr "" - -#: lib/music_library_web/live/online_store_template_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Manage templates for generating links to online record stores." -msgstr "" - #: lib/music_library_web/live/online_store_template_live/form_component.ex #, elixir-autogen, elixir-format msgid "Record format" @@ -1275,3 +1267,18 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Preview not available" msgstr "" + +#: lib/music_library_web/live/online_store_template_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Disable template" +msgstr "" + +#: lib/music_library_web/live/online_store_template_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Enable template" +msgstr "" + +#: lib/music_library_web/live/online_store_template_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "New Template" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index bde34ef5..66dec96e 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -13,6 +13,7 @@ msgstr "" #: lib/music_library_web/components/record_components.ex #: lib/music_library_web/live/collection_live/show.html.heex +#: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format @@ -921,6 +922,7 @@ msgstr "" #: lib/music_library_web/components/record_components.ex #: lib/music_library_web/live/artist_live/show.html.heex #: lib/music_library_web/live/collection_live/show.html.heex +#: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format @@ -1256,16 +1258,6 @@ msgstr "" msgid "e.g. https://www.amazon.co.uk/s?k={artist}+{title}+vinyl" msgstr "" -#: lib/music_library_web/live/online_store_template_live/index.html.heex -#, elixir-autogen, elixir-format, fuzzy -msgid "Add Template" -msgstr "" - -#: lib/music_library_web/live/online_store_template_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Manage templates for generating links to online record stores." -msgstr "" - #: lib/music_library_web/live/online_store_template_live/form_component.ex #, elixir-autogen, elixir-format msgid "Record format" @@ -1275,3 +1267,18 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Preview not available" msgstr "" + +#: lib/music_library_web/live/online_store_template_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Disable template" +msgstr "" + +#: lib/music_library_web/live/online_store_template_live/index.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Enable template" +msgstr "" + +#: lib/music_library_web/live/online_store_template_live/index.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "New Template" +msgstr ""