From 71545d5a8bcbcdbfc281274d4bf4d83ecc9a0dd3 Mon Sep 17 00:00:00 2001 From: Inhji Date: Thu, 27 Jul 2023 20:31:23 +0200 Subject: [PATCH] improve wiki --- lib/chiya_web/components/public_components.ex | 7 ++-- .../controllers/page_html/wiki.html.heex | 33 ++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/lib/chiya_web/components/public_components.ex b/lib/chiya_web/components/public_components.ex index 088379c..1386f78 100644 --- a/lib/chiya_web/components/public_components.ex +++ b/lib/chiya_web/components/public_components.ex @@ -107,6 +107,7 @@ defmodule ChiyaWeb.PublicComponents do attr :layout, :atom, default: :list attr :notes, :list, required: true + attr :show_content, :boolean, default: true def note_list(assigns) do case assigns.layout do @@ -133,9 +134,9 @@ defmodule ChiyaWeb.PublicComponents do <%= for note <- assigns.notes do %> -
+
<%= note.name %> @@ -144,9 +145,11 @@ defmodule ChiyaWeb.PublicComponents do
+ <%= if assigns.show_content do %>

<%= String.slice(note.content, 0..150) %>

+ <% end %>
<% end %> diff --git a/lib/chiya_web/controllers/page_html/wiki.html.heex b/lib/chiya_web/controllers/page_html/wiki.html.heex index 41a9d5d..f38c9e8 100644 --- a/lib/chiya_web/controllers/page_html/wiki.html.heex +++ b/lib/chiya_web/controllers/page_html/wiki.html.heex @@ -3,25 +3,28 @@ <.header> <%= @channel.name %> + -
+
+
<%= Markdown.render(@channel.content) |> raw %>
+ +
- -
-
-

Recently Updated

- - <.note_list notes={@notes_updated} layout={@channel.layout} /> -
- -
-

Recently Published

- - <.note_list notes={@notes_published} layout={@channel.layout} /> -
-
+ <% else %>
<.header>