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

58 lines
1.8 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-09 00:58:53 -05:00
<%= gettext("Listing Tags") %>
2022-01-28 21:05:54 -05:00
</h1>
<p class="title text-md text-primary-500">
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>
<%= if @tags |> Enum.empty?() do %>
2022-02-01 00:11:37 -05:00
<h2 class="title text-xl text-primary-500">
2022-02-09 00:58:53 -05:00
<%= gettext("No tags") %> 😔
2022-02-01 00:11:37 -05:00
</h2>
2022-02-09 00:58:53 -05:00
<%= live_patch(dgettext("actions", "Make your first tag!"),
2022-02-01 00:11:37 -05:00
to: Routes.tag_index_path(@socket, :new),
2022-02-01 01:08:18 -05:00
class: "btn btn-primary"
) %>
2022-01-28 21:05:54 -05:00
<% else %>
2022-02-09 00:58:53 -05:00
<%= live_patch(dgettext("actions", "New Tag"),
2022-01-28 21:05:54 -05:00
to: Routes.tag_index_path(@socket, :new),
class: "btn btn-primary"
) %>
<% end %>
<div class="flex flex-row flex-wrap">
<%= for tag <- @tags do %>
<.tag_card tag={tag}>
<%= live_patch to: Routes.tag_index_path(Endpoint, :edit, tag),
class: "text-primary-500 link" do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
<%= link to: "#",
class: "text-primary-500 link",
phx_click: "delete",
phx_value_id: tag.id,
data: [
confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</.tag_card>
2022-01-28 21:05:54 -05:00
<% end %>
</div>
</div>
2022-02-05 01:59:40 -05:00
2022-01-28 21:05:54 -05:00
<%= if @live_action in [:new, :edit] do %>
2022-02-14 01:26:51 -05:00
<.modal return_to={Routes.tag_index_path(@socket, :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(@socket, :index)}
current_user={@current_user}
/>
</.modal>
2022-01-28 21:05:54 -05:00
<% end %>