cannery/lib/cannery_web/live/tag_live/index.html.heex

84 lines
2.6 KiB
Plaintext
Raw Normal View History

2022-01-28 21:05:54 -05:00
<div class="flex flex-col space-y-8 justify-center items-center">
<h1 class="title text-2xl title-primary-500">
2022-02-15 17:33:07 -05:00
<%= gettext("Tags") %>
2022-01-28 21:05:54 -05:00
</h1>
2022-02-17 22:29:01 -05:00
<p class="title text-md text-primary-600">
2022-02-09 00:58:53 -05:00
<%= gettext("Tags can be added to your containers to help you organize") %>
2022-01-28 21:05:54 -05:00
</p>
2022-12-03 20:35:54 -05:00
<%= if @tags |> Enum.empty?() and @search |> is_nil() do %>
2022-02-17 22:29:01 -05:00
<h2 class="title text-xl text-primary-600">
2022-02-15 23:52:44 -05:00
<%= gettext("No tags") %>
<%= display_emoji("😔") %>
2022-02-01 00:11:37 -05:00
</h2>
<.link patch={Routes.tag_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "Make your first tag!") %>
</.link>
2022-01-28 21:05:54 -05:00
<% else %>
<.link patch={Routes.tag_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "New Tag") %>
</.link>
2022-01-28 21:05:54 -05:00
<% end %>
2022-12-03 20:35:54 -05:00
<div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
<.form
:let={f}
for={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search tags")
) %>
</.form>
</div>
2022-12-03 21:54:22 -05:00
<%= if @tags |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No tags") %>
<%= display_emoji("😔") %>
</h2>
<% else %>
2022-12-03 22:09:32 -05:00
<div class="flex flex-row flex-wrap justify-center items-stretch">
2023-02-04 10:28:13 -05:00
<.tag_card :for={tag <- @tags} tag={tag}>
<.link
patch={Routes.tag_index_path(Endpoint, :edit, tag)}
class="text-primary-600 link"
2023-03-15 00:45:08 -04:00
aria-label={gettext("Edit %{tag_name}", tag_name: tag.name)}
2023-02-04 10:28:13 -05:00
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
2023-02-04 10:28:13 -05:00
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={tag.id}
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
}
2023-03-15 00:45:08 -04:00
aria-label={gettext("Delete %{tag_name}", tag_name: tag.name)}
2023-02-04 10:28:13 -05:00
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</.tag_card>
2022-12-03 21:54:22 -05:00
</div>
<% end %>
2022-01-28 21:05:54 -05:00
</div>
2022-02-05 01:59:40 -05:00
2023-02-04 10:28:13 -05:00
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.tag_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.TagLive.FormComponent}
id={@tag.id || :new}
title={@page_title}
action={@live_action}
tag={@tag}
return_to={Routes.tag_index_path(Endpoint, :index)}
current_user={@current_user}
/>
</.modal>