devel #196
3 changed files with 55 additions and 54 deletions
|
@ -49,6 +49,7 @@ defmodule Chiya.Notes do
|
|||
def list_notes_by_channel_published(%Chiya.Channels.Channel{} = channel) do
|
||||
list_notes_by_channel_query(channel)
|
||||
|> order_by([n], desc: n.published_at)
|
||||
|> where([n], not is_nil(n.published_at))
|
||||
|> Repo.all()
|
||||
|> Repo.preload(@preloads)
|
||||
end
|
||||
|
@ -56,6 +57,7 @@ defmodule Chiya.Notes do
|
|||
def list_notes_by_channel_updated(%Chiya.Channels.Channel{} = channel) do
|
||||
list_notes_by_channel_query(channel)
|
||||
|> order_by([n], desc: n.published_at)
|
||||
|> where([n], not is_nil(n.published_at))
|
||||
|> Repo.all()
|
||||
|> Repo.preload(@preloads)
|
||||
end
|
||||
|
|
|
@ -1,59 +1,58 @@
|
|||
<section class="max-w-2xl mx-auto">
|
||||
<article class="h-entry hentry">
|
||||
<.header class_title="p-name">
|
||||
<:title><%= @note.name %></:title>
|
||||
</.header>
|
||||
<article class="h-entry hentry">
|
||||
<.header class_title="max-w-2xl mx-auto | p-name">
|
||||
<:title><%= @note.name %></:title>
|
||||
</.header>
|
||||
|
||||
<section class="mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
|
||||
<%= Markdown.render(@note.content) |> raw %>
|
||||
</section>
|
||||
<section class="mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
|
||||
<%= Markdown.render(@note.content) |> raw %>
|
||||
</section>
|
||||
|
||||
<footer class="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>
|
||||
<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 %>
|
||||
<.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 %>
|
||||
<.dot />
|
||||
<span>Tags</span>
|
||||
<.tags note={@note} />
|
||||
<% end %>
|
||||
<%= if @current_user do %>
|
||||
<.dot />
|
||||
<a href={~p"/admin/notes/#{@note}"} class="underline-link font-semibold">Show in Admin</a>
|
||||
<% end %>
|
||||
<span>Tags</span>
|
||||
<.tags note={@note} />
|
||||
<% end %>
|
||||
<%= if @current_user do %>
|
||||
<.dot />
|
||||
<a href={~p"/admin/notes/#{@note}"} class="underline-link font-semibold">Show in Admin</a>
|
||||
<% 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>
|
||||
<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 class="mt-8">
|
||||
<%= if !Enum.empty?(@note.images) do %>
|
||||
<.line />
|
||||
<section class="max-w-2xl mx-auto mt-8">
|
||||
<%= if !Enum.empty?(@note.images) do %>
|
||||
<.line />
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<section class="mx-auto max-w-2xl">
|
||||
<.header>
|
||||
<:title>Wiki</:title>
|
||||
<:title><%= @channel.name %></:title>
|
||||
</.header>
|
||||
|
||||
<section class="prose prose-gruvbox mt-6">
|
||||
|
|
Loading…
Reference in a new issue