cannery/lib/cannery_web/live/container_live/index.html.heex
shibao 6b565abf93
All checks were successful
continuous-integration/drone/push Build is passing
update to liveview 0.18 and use elixir 1.14
2022-11-07 22:36:38 -05:00

85 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("Containers") %>
</h1>
<%= if @containers |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No containers") %>
<%= display_emoji("😔") %>
</h2>
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "Add your first container!") %>
</.link>
<% else %>
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "New Container") %>
</.link>
<% end %>
<div class="max-w-full flex flex-row flex-wrap justify-center items-center">
<%= for container <- @containers do %>
<.container_card container={container}>
<:tag_actions>
<div class="mx-4 my-2">
<.link
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
class="text-primary-600 link"
>
<i class="fa-fw fa-lg fas fa-tags"></i>
</.link>
</div>
</:tag_actions>
<.link
patch={Routes.container_index_path(Endpoint, :edit, container)}
class="text-primary-600 link"
data-qa={"edit-#{container.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={container.id}
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
}
data-qa={"delete-#{container.id}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</.container_card>
<% end %>
</div>
</div>
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.ContainerLive.FormComponent}
id={@container.id || :new}
title={@page_title}
action={@live_action}
container={@container}
return_to={Routes.container_index_path(Endpoint, :index)}
current_user={@current_user}
/>
</.modal>
<% end %>
<%= if @live_action == :edit_tags do %>
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.ContainerLive.EditTagsComponent}
id={@container.id}
title={@page_title}
action={@live_action}
container={@container}
current_user={@current_user}
/>
</.modal>
<% end %>