89 lines
2.6 KiB
Plaintext
89 lines
2.6 KiB
Plaintext
<div class="flex flex-col space-y-8 justify-center items-center">
|
|
<h1 class="title text-2xl title-primary-500">
|
|
<%= gettext("Tags") %>
|
|
</h1>
|
|
<p class="title text-md text-primary-600">
|
|
<%= gettext("Tags can be added to your containers to help you organize") %>
|
|
</p>
|
|
<%= if @tags |> Enum.empty?() and @search |> is_nil() do %>
|
|
<h2 class="title text-xl text-primary-600">
|
|
<%= gettext("No tags") %>
|
|
<%= display_emoji("😔") %>
|
|
</h2>
|
|
|
|
<.link patch={Routes.tag_index_path(Endpoint, :new)} class="btn btn-primary">
|
|
<%= dgettext("actions", "Make your first tag!") %>
|
|
</.link>
|
|
<% else %>
|
|
<.link patch={Routes.tag_index_path(Endpoint, :new)} class="btn btn-primary">
|
|
<%= dgettext("actions", "New Tag") %>
|
|
</.link>
|
|
<% end %>
|
|
|
|
<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"
|
|
data-qa="tag_search"
|
|
>
|
|
<%= text_input(f, :search_term,
|
|
class: "input input-primary",
|
|
value: @search,
|
|
phx_debounce: 300,
|
|
placeholder: gettext("Search tags")
|
|
) %>
|
|
</.form>
|
|
</div>
|
|
|
|
<div class="flex flex-row flex-wrap justify-center items-center">
|
|
<%= if @tags |> Enum.empty?() do %>
|
|
<h2 class="title text-xl text-primary-600">
|
|
<%= gettext("No tags") %>
|
|
<%= display_emoji("😔") %>
|
|
</h2>
|
|
<% end %>
|
|
|
|
<%= for tag <- @tags do %>
|
|
<.tag_card tag={tag}>
|
|
<.link
|
|
patch={Routes.tag_index_path(Endpoint, :edit, tag)}
|
|
class="text-primary-600 link"
|
|
data-qa={"edit-#{tag.id}"}
|
|
>
|
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
|
</.link>
|
|
|
|
<.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)
|
|
}
|
|
data-qa={"delete-#{tag.id}"}
|
|
>
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
|
</.link>
|
|
</.tag_card>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= if @live_action in [:new, :edit] do %>
|
|
<.modal 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>
|
|
<% end %>
|