chiya/lib/chiya_web/controllers/page_html/note.html.heex
2023-09-09 16:08:30 +02:00

109 lines
3 KiB
Text

<section class="page-grid">
<section>
<article class="h-entry hentry | stack container">
<header>
<h1 class="p-name | text-3xl leading-10 font-bold text-theme-base1">
<%= @note.name %>
</h1>
</header>
<aside>
<.featured_images note={@note} />
</aside>
<section class="p-summary e-content | prose max-w-none">
<%= Markdown.render(@note.content) |> raw %>
</section>
<%= if not Enum.empty?(@note.links_to) do %>
<section class="prose ">
Notes linking here:
<ul>
<%= for link <- @note.links_to do %>
<li><a href={~p"/note/#{link.slug}"}><%= link.name %></a></li>
<% end %>
</ul>
</section>
<% end %>
<%= if String.length(@note.url || "") > 0 do %>
<section class="text-center">
<.icon name="hero-link" /> <a href={@note.url}><%= @note.url %></a>
</section>
<% end %>
<footer>
<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>
<section>
<%= if !Enum.empty?(@note.images) do %>
<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>
</section>
<aside class="prose max-w-none">
<h3>Outline</h3>
<%= if has_outline?(@note) do %>
<section>
<%= raw(render_outline(@note)) %>
</section>
<% end %>
<h3>Properties</h3>
<section>
<ul>
<li>
<%= if @note.published_at do %>
<strong>Published</strong>
<% else %>
<strong>Unpublished</strong>
<% end %>
<time class="dt-published"><%= pretty_date(@note.published_at) %></time>
</li>
<li>
<strong>Last updated</strong>
<time class="dt-published"><%= pretty_date(@note.published_at) %></time>
</li>
<li><strong>Tags</strong> <.tag_list note={@note} /></li>
<li><strong>Kind</strong> <%= @note.kind %></li>
</ul>
</section>
<h3>Admin</h3>
<section>
<ul>
<li>
<a href={~p"/admin/notes/#{@note}/edit"} class="button">
Edit
</a>
</li>
<li>
<a href={~p"/admin/notes/#{@note}"} class="button">
Show in Admin
</a>
</li>
</ul>
</section>
</aside>
</section>