Merge pull request 'devel' (#196) from devel into main

Reviewed-on: #196
This commit is contained in:
inhji 2023-07-07 14:31:29 +02:00
commit 47a06707f3
3 changed files with 55 additions and 54 deletions

View file

@ -49,6 +49,7 @@ defmodule Chiya.Notes do
def list_notes_by_channel_published(%Chiya.Channels.Channel{} = channel) do def list_notes_by_channel_published(%Chiya.Channels.Channel{} = channel) do
list_notes_by_channel_query(channel) list_notes_by_channel_query(channel)
|> order_by([n], desc: n.published_at) |> order_by([n], desc: n.published_at)
|> where([n], not is_nil(n.published_at))
|> Repo.all() |> Repo.all()
|> Repo.preload(@preloads) |> Repo.preload(@preloads)
end end
@ -56,6 +57,7 @@ defmodule Chiya.Notes do
def list_notes_by_channel_updated(%Chiya.Channels.Channel{} = channel) do def list_notes_by_channel_updated(%Chiya.Channels.Channel{} = channel) do
list_notes_by_channel_query(channel) list_notes_by_channel_query(channel)
|> order_by([n], desc: n.published_at) |> order_by([n], desc: n.published_at)
|> where([n], not is_nil(n.published_at))
|> Repo.all() |> Repo.all()
|> Repo.preload(@preloads) |> Repo.preload(@preloads)
end end

View file

@ -1,6 +1,5 @@
<section class="max-w-2xl mx-auto"> <article class="h-entry hentry">
<article class="h-entry hentry"> <.header class_title="max-w-2xl mx-auto | p-name">
<.header class_title="p-name">
<:title><%= @note.name %></:title> <:title><%= @note.name %></:title>
</.header> </.header>
@ -8,7 +7,7 @@
<%= Markdown.render(@note.content) |> raw %> <%= Markdown.render(@note.content) |> raw %>
</section> </section>
<footer class="mt-8 text-theme-base"> <footer class="max-w-2xl mx-auto mt-8 text-theme-base">
<%= if @note.published_at do %> <%= if @note.published_at do %>
<span>Published</span> <span>Published</span>
<% else %> <% else %>
@ -34,7 +33,7 @@
<a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a> <a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a>
</footer> </footer>
<section class="mt-8"> <section class="max-w-2xl mx-auto mt-8">
<%= if !Enum.empty?(@note.images) do %> <%= if !Enum.empty?(@note.images) do %>
<.line /> <.line />
@ -55,5 +54,5 @@
</div> </div>
<% end %> <% end %>
</section> </section>
</article> </article>
</section>

View file

@ -1,6 +1,6 @@
<section class="mx-auto max-w-2xl"> <section class="mx-auto max-w-2xl">
<.header> <.header>
<:title>Wiki</:title> <:title><%= @channel.name %></:title>
</.header> </.header>
<section class="prose prose-gruvbox mt-6"> <section class="prose prose-gruvbox mt-6">