chiya/lib/chiya_web/controllers/note_html/index.html.heex

36 lines
1.5 KiB
Text

<.header>
<.icon name="hero-document-text" /> Notes
<:subtitle>Notes are the content, the heart of your site.</:subtitle>
<:actions>
<.link href={~p"/admin/notes/new"}>
<.button>New Note</.button>
</.link>
<.link href={~p"/admin/notes/import"}>
<.button>Import Note</.button>
</.link>
</:actions>
</.header>
<section class="flex flex-row flex-wrap mt-4 gap-3">
<a href={~p"/admin/notes"} class="text-sm dark:text-gray-300 rounded-full bg-gray-300 hover:bg-gray-400 dark:bg-gray-700 dark:hover:bg-gray-600 px-2 py-1">All</a>
<%= for channel <- @channels do %>
<a href={~p"/admin/notes?channel=#{channel.slug}"} class="text-sm dark:text-gray-300 rounded-full bg-gray-300 hover:bg-gray-400 dark:bg-gray-700 dark:hover:bg-gray-600 px-2 py-1"><%= channel.name %> <span class="text-gray-600 dark:text-gray-500">(<%= Enum.count(channel.notes) %>)</span></a>
<% end %>
</section>
<.table id="notes" rows={@notes} row_click={&JS.navigate(~p"/admin/notes/#{&1}")}>
<:col :let={note} label="Name"><%= note.name %></:col>
<:col :let={note} label="Updated at"><%= from_now(note.updated_at) %></:col>
<:col :let={note} label="Published at"><%= from_now(note.published_at) %></:col>
<:action :let={note}>
<div class="sr-only">
<.link navigate={~p"/admin/notes/#{note}"}>Show</.link>
</div>
<.link navigate={~p"/admin/notes/#{note}/edit"}>Edit</.link>
</:action>
<:action :let={note}>
<.link href={~p"/admin/notes/#{note}"} method="delete" data-confirm="Are you sure?">
Delete
</.link>
</:action>
</.table>