chiya/lib/chiya_web/controllers/page_html/note.html.heex

97 lines
3 KiB
Text
Raw Normal View History

<article class="h-entry hentry">
<.header class="max-w-2xl mx-auto" class_title="p-name">
2023-07-09 20:01:03 +02:00
<%= @note.name %>
</.header>
2023-07-20 20:30:15 +02:00
<%= if @current_user do %>
<section class="max-w-2xl mx-auto mt-8">
<ul class="flex gap-3">
2023-07-24 18:39:25 +02:00
<li>
<a href={~p"/admin/notes/#{@note}/edit"} class="button">
<.icon name="hero-pencil-square" /> Edit
</a>
</li>
2023-07-20 20:30:15 +02:00
<li><a href={~p"/admin/notes/#{@note}"} class="button">Show in Admin</a></li>
</ul>
</section>
<% end %>
2023-07-19 22:40:32 +02:00
<%= if has_outline?(@note) do %>
2023-07-24 18:39:25 +02:00
<aside class="max-w-2xl mx-auto mt-8 prose prose-gruvbox">
<div class="bg-theme-background1 rounded p-2">
<%= raw(render_outline(@note)) %>
</div>
</aside>
2023-07-19 22:40:32 +02:00
<% end %>
2023-07-11 07:23:07 +02:00
2023-07-18 07:27:27 +02:00
<section class="mt-8 mx-auto prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
<%= Markdown.render(@note.content) |> raw %>
</section>
2023-03-13 03:26:39 +01:00
2023-07-13 07:34:21 +02:00
<%= if not Enum.empty?(@note.links_to) do %>
2023-07-16 17:16:44 +02:00
<section class="mt-8 prose prose-gruvbox max-w-2xl mx-auto">
<.divider text="" /> Notes linking here:
<ul class="">
<%= for link <- @note.links_to do %>
<li><a href={~p"/note/#{link.slug}"}><%= link.name %></a></li>
<% end %>
</ul>
</section>
2023-07-13 07:34:21 +02:00
<% end %>
2023-07-18 07:35:32 +02:00
<%= if String.length(@note.url || "") > 0 do %>
2023-07-18 07:27:27 +02:00
<section class="mt-8 max-w-2xl mx-auto text-center text-lg">
<.divider text=" " />
<.icon name="hero-link" /> <a href={@note.url}><%= @note.url %></a>
</section>
<% end %>
<footer class="max-w-2xl mx-auto mt-8 text-theme-base">
<%= if @note.published_at do %>
<span>Published</span>
<% else %>
<span>Unpublished</span>
<% end %>
<time class="font-semibold | dt-published"><%= pretty_date(@note.published_at) %></time>
<.dot />
<span>Last Updated</span>
<time class="font-semibold" datetime={datetime(@note.updated_at)}>
<%= pretty_date(@note.updated_at) %>
</time>
<%= if not Enum.empty?(@note.tags) do %>
2023-07-04 06:57:13 +02:00
<.dot />
<span>Tags</span>
<.tags note={@note} />
<% end %>
2023-07-19 23:10:44 +02:00
<%= if @note.kind != :post do %>
<.dot />
<span><%= @note.kind %></span>
<% end %>
<a href={~p"/"} class="hidden | h-card u-author">Inhji</a>
<a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a>
</footer>
2023-07-04 06:57:13 +02:00
<section class="max-w-2xl mx-auto mt-8">
<%= if !Enum.empty?(@note.images) do %>
<.line />
2023-06-30 13:18:32 +02:00
<div class="flex flex-wrap gap-3">
<%= for image <- @note.images do %>
<a
href={ChiyaWeb.Uploaders.NoteImage.url({image.path, image}, :full_dithered)}
class="lightbox | w-28"
data-gallery="note"
data-description={ChiyaWeb.Markdown.render(image.content)}
>
<img
src={ChiyaWeb.Uploaders.NoteImage.url({image.path, image}, :thumb_dithered)}
class="rounded"
/>
</a>
<% end %>
</div>
<% end %>
</section>
</article>