.header>
Listing Gists
<:actions>
<.link patch={~p"/gists/new"}>
<.button>New Gist
<.table
id="gists"
rows={@streams.gists}
row_click={fn {_id, gist} -> JS.navigate(~p"/gists/#{gist}") end}
>
<:col :let={{_id, gist}} label="Code"><%= gist.code %>
<:col :let={{_id, gist}} label="Lang"><%= gist.lang %>
<:action :let={{_id, gist}}>
<.link navigate={~p"/gists/#{gist}"}>Show
<.link patch={~p"/gists/#{gist}/edit"}>Edit
<:action :let={{id, gist}}>
<.link
phx-click={JS.push("delete", value: %{id: gist.id}) |> hide("##{id}")}
data-confirm="Are you sure?"
>
Delete
<.modal :if={@live_action in [:new, :edit]} id="gist-modal" show on_cancel={JS.patch(~p"/gists")}>
<.live_component
module={ZoeyscomputerWeb.GistLive.FormComponent}
id={@gist.id || :new}
title={@page_title}
action={@live_action}
gist={@gist}
patch={~p"/gists"}
/>