Files
dinge/lib/dinge_web/live/ding_live/index.html.heex

48 lines
1.4 KiB
Plaintext
Raw Normal View History

2024-02-26 14:37:03 +01:00
<.header>
Listing Dings
<:actions>
<.link patch={~p"/dings/new"}>
<.button>New Ding</.button>
</.link>
</:actions>
</.header>
<.table
id="dings"
rows={@streams.dings}
row_click={fn {_id, ding} -> JS.navigate(~p"/dings/#{ding}") end}
>
<:col :let={{_id, ding}} label="Title"><%= ding.title %></:col>
<:col :let={{_id, ding}} label="Count"><%= ding.count %></:col>
<:col :let={{_id, ding}} label="Target count"><%= ding.target_count %></:col>
<:col :let={{_id, ding}} label="Ding type"><%= ding.ding_type %></:col>
<:col :let={{_id, ding}} label="Target type"><%= ding.target_type %></:col>
<:col :let={{_id, ding}} label="Status"><%= ding.status %></:col>
<:action :let={{_id, ding}}>
<div class="sr-only">
<.link navigate={~p"/dings/#{ding}"}>Show</.link>
</div>
<.link patch={~p"/dings/#{ding}/edit"}>Edit</.link>
</:action>
<:action :let={{id, ding}}>
<.link
phx-click={JS.push("delete", value: %{id: ding.id}) |> hide("##{id}")}
data-confirm="Are you sure?"
>
Delete
</.link>
</:action>
</.table>
<.modal :if={@live_action in [:new, :edit]} id="ding-modal" show on_cancel={JS.patch(~p"/dings")}>
<.live_component
module={DingeWeb.DingLive.FormComponent}
id={@ding.id || :new}
title={@page_title}
action={@live_action}
ding={@ding}
user={@current_user}
patch={~p"/dings"}
/>
</.modal>