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

37 lines
1.4 KiB
Text
Raw Normal View History

2023-03-05 17:23:16 +01:00
<.header>
2023-04-08 09:54:57 +02:00
<.icon name="hero-document-text" /> Notes
<:subtitle>Notes are the content, the heart of your site.</:subtitle>
2023-03-05 17:23:16 +01:00
<:actions>
<.link href={~p"/admin/notes/new"}>
2023-03-05 17:23:16 +01:00
<.button>New Note</.button>
</.link>
2023-04-07 11:37:55 +02:00
<.link href={~p"/admin/notes/import"}>
<.button>Import Note</.button>
</.link>
2023-03-05 17:23:16 +01:00
</:actions>
</.header>
2023-04-08 11:40:41 +02:00
<section class="flex flex-row flex-wrap mt-4 gap-3">
<a href={~p"/admin/notes"} class="text-sm rounded-full bg-gray-300 hover:bg-gray-400 px-2 py-1">All</a>
<%= for channel <- @channels do %>
<a href={~p"/admin/notes?channel=#{channel.slug}"} class="text-sm rounded-full bg-gray-300 hover:bg-gray-400 px-2 py-1"><%= channel.name %> <span class="text-gray-600">(<%= Enum.count(channel.notes) %>)</span></a>
<% end %>
</section>
<.table id="notes" rows={@notes} row_click={&JS.navigate(~p"/admin/notes/#{&1}")}>
2023-03-05 17:23:16 +01:00
<:col :let={note} label="Name"><%= note.name %></:col>
2023-03-30 22:56:58 +02:00
<:col :let={note} label="Updated at"><%= from_now(note.updated_at) %></:col>
2023-03-13 03:27:17 +01:00
<:col :let={note} label="Published at"><%= from_now(note.published_at) %></:col>
2023-03-05 17:23:16 +01:00
<:action :let={note}>
<div class="sr-only">
<.link navigate={~p"/admin/notes/#{note}"}>Show</.link>
2023-03-05 17:23:16 +01:00
</div>
<.link navigate={~p"/admin/notes/#{note}/edit"}>Edit</.link>
2023-03-05 17:23:16 +01:00
</:action>
<:action :let={note}>
<.link href={~p"/admin/notes/#{note}"} method="delete" data-confirm="Are you sure?">
2023-03-05 17:23:16 +01:00
Delete
</.link>
</:action>
</.table>