chiya/lib/chiya_web/controllers/note_html/index.html.heex
2023-09-12 07:20:43 +02:00

52 lines
2.1 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><.icon name="hero-plus-small" /> New Note</.button>
</.link>
<.link href={~p"/admin/notes/import"}>
<.button><.icon name="hero-arrow-down-tray" /> Import Note</.button>
</.link>
</:actions>
</.header>
<section class="flex flex-row flex-wrap mt-6 -mb-6 gap-3">
<a
href="#"
class="text-sm dark:text-gray-300 rounded-full bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 px-4 py-2 border border-gray-300 dark:border-gray-600 shadow-sm transition"
phx-click="update-channel"
phx-value-channelid={nil}
>
All <span class="text-gray-600 dark:text-gray-500">(<%= Enum.count(@notes) %>)</span>
</a>
<%= for channel <- @channels do %>
<a
href="#"
class="text-sm dark:text-gray-300 rounded-full bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 px-4 py-2 border border-gray-300 dark:border-gray-600 shadow-sm transition"
phx-click="update-channel"
phx-value-channelid={channel.id}
>
<%= 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>
</.table>
<.filter_form fields={[:name]} meta={@meta} id="user-filter-form" />
<Flop.Phoenix.table items={@notes} meta={@meta} path={~p"/admin/notes"}>
<:col :let={note} label="Name" field={:name}><%= note.name %></:col>
<:col :let={note} label="Updated at" field={:updated_at}><%= from_now(note.updated_at) %></:col>
<:col :let={note} label="Published at" field={:published_at}>
<%= from_now(note.published_at) %>
</:col>
</Flop.Phoenix.table>
<Flop.Phoenix.pagination meta={@meta} path={~p"/admin/notes"} />