From fb9371a2fd61f789a5668cc2e781f7cf426090b6 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:01:22 +0200 Subject: [PATCH 1/8] lib/chiya_web/controllers/setting_html/setting_form.html.heex aktualisiert --- .../controllers/setting_html/setting_form.html.heex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/chiya_web/controllers/setting_html/setting_form.html.heex b/lib/chiya_web/controllers/setting_html/setting_form.html.heex index 80440e7..089e2fe 100644 --- a/lib/chiya_web/controllers/setting_html/setting_form.html.heex +++ b/lib/chiya_web/controllers/setting_html/setting_form.html.heex @@ -21,6 +21,12 @@ label="Micropub Channel" options={@channels} /> + <.input + field={f[:bookmark_channel_id]} + type="select" + label="Bookmark Channel" + options={@channels} + /> <.input field={f[:default_channel_id]} type="select" From 0674fd4deb5ebece7bf66620e3cdf8522c67e505 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:02:07 +0200 Subject: [PATCH 2/8] lib/chiya_web/controllers/setting_html/show.html.heex aktualisiert --- lib/chiya_web/controllers/setting_html/show.html.heex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/chiya_web/controllers/setting_html/show.html.heex b/lib/chiya_web/controllers/setting_html/show.html.heex index b14102f..f35e2e5 100644 --- a/lib/chiya_web/controllers/setting_html/show.html.heex +++ b/lib/chiya_web/controllers/setting_html/show.html.heex @@ -32,6 +32,9 @@ <:item title="Micropub Channel"> <%= if @setting.micropub_channel, do: @setting.micropub_channel.name %> + <:item title="Bookmark Channel"> + <%= if @setting.bookmark_channel, do: @setting.bookmark_channel.name %> + <:item title="Wiki Channel"> <%= if @setting.micropub_channel, do: @setting.wiki_channel.name %> From 10c53690bd4a8bc7448fb5d0aef1ca79045a1ef7 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:04:29 +0200 Subject: [PATCH 3/8] =?UTF-8?q?priv/repo/migrations/20230729160000=5Fadd?= =?UTF-8?q?=5Fbookmark=5Fchannel=5Fsetting.exs=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230729160000_add_bookmark_channel_setting.exs | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 priv/repo/migrations/20230729160000_add_bookmark_channel_setting.exs diff --git a/priv/repo/migrations/20230729160000_add_bookmark_channel_setting.exs b/priv/repo/migrations/20230729160000_add_bookmark_channel_setting.exs new file mode 100644 index 0000000..03d4100 --- /dev/null +++ b/priv/repo/migrations/20230729160000_add_bookmark_channel_setting.exs @@ -0,0 +1,9 @@ +defmodule Chiya.Repo.Migrations.AddBookmarkChannelSetting do + use Ecto.Migration + + def change do + alter table(:settings) do + add :bookmark_channel_id, references(:channels, on_delete: :nothing) + end + end +end \ No newline at end of file From 9fac76be70e270ddeaf8d1b1ecece4856d46a318 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:05:39 +0200 Subject: [PATCH 4/8] lib/chiya/site/setting.ex aktualisiert --- lib/chiya/site/setting.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/chiya/site/setting.ex b/lib/chiya/site/setting.ex index 1e3ea7f..1e1a437 100644 --- a/lib/chiya/site/setting.ex +++ b/lib/chiya/site/setting.ex @@ -17,6 +17,7 @@ defmodule Chiya.Site.Setting do belongs_to :default_channel, Chiya.Channels.Channel belongs_to :micropub_channel, Chiya.Channels.Channel belongs_to :wiki_channel, Chiya.Channels.Channel + belongs_to :bookmark_channel, Chiya.Channels.Channel field :show_images_on_home, :boolean, default: true @@ -37,6 +38,7 @@ defmodule Chiya.Site.Setting do :default_channel_id, :micropub_channel_id, :wiki_channel_id, + :bookmark_channel_id, :show_images_on_home ]) |> validate_required([ From 1891a82893ba3d937fc3761e118d8409610960c7 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:07:07 +0200 Subject: [PATCH 5/8] lib/chiya_web/router.ex aktualisiert --- lib/chiya_web/router.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/chiya_web/router.ex b/lib/chiya_web/router.ex index 6af3762..d99a44d 100644 --- a/lib/chiya_web/router.ex +++ b/lib/chiya_web/router.ex @@ -138,6 +138,7 @@ defmodule ChiyaWeb.Router do get "/about", PageController, :about get "/wiki", PageController, :wiki + get "/bookmarks", PageController, :bookmarks get "/", PageController, :home end From 6ad008865e849b230aa3d7a73977a33893fca4a4 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:10:02 +0200 Subject: [PATCH 6/8] =?UTF-8?q?lib/chiya=5Fweb/controllers/page=5Fhtml/boo?= =?UTF-8?q?kmarks.html.heex=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/page_html/bookmarks.html.heex | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/chiya_web/controllers/page_html/bookmarks.html.heex diff --git a/lib/chiya_web/controllers/page_html/bookmarks.html.heex b/lib/chiya_web/controllers/page_html/bookmarks.html.heex new file mode 100644 index 0000000..961a504 --- /dev/null +++ b/lib/chiya_web/controllers/page_html/bookmarks.html.heex @@ -0,0 +1,27 @@ +<%= if @channel do %> +
+ <.header> + <%= @channel.name %> + +
+ +
+
+ <%= Markdown.render(@channel.content) |> raw %> +
+ +
+ <.note_list notes={@notes} layout={@channel.layout} show_content={false} /> +
+
+<% else %> +
+ <.header> + Wiki + + +
+ Wiki is not set up. +
+
+<% end %> From 39fc4fed7d9dbbd39b886ac7b64a81f8c962158d Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:28:35 +0200 Subject: [PATCH 7/8] lib/chiya_web/controllers/page_controller.ex aktualisiert --- lib/chiya_web/controllers/page_controller.ex | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/chiya_web/controllers/page_controller.ex b/lib/chiya_web/controllers/page_controller.ex index d8c09a6..c324f09 100644 --- a/lib/chiya_web/controllers/page_controller.ex +++ b/lib/chiya_web/controllers/page_controller.ex @@ -86,4 +86,23 @@ defmodule ChiyaWeb.PageController do page_title: "Wiki" ) end + + def bookmarks(conn, _params) do + [channel, notes] = + case conn.assigns.settings.wiki_channel_id do + nil -> + [nil, nil] + + id -> + channel = Chiya.Channels.get_channel!(id) + notes = Chiya.Notes.list_notes_by_channel_updated(channel, 5) + [channel, notes] + end + + render(conn, :wiki, + channel: channel, + notes: notes, + page_title: "Bookmarks" + ) + end end From bbe29ca0840d6e0780192a9589b99d3b46ed6547 Mon Sep 17 00:00:00 2001 From: inhji Date: Sat, 29 Jul 2023 16:43:12 +0200 Subject: [PATCH 8/8] lib/chiya_web/components/layouts/root_public.html.heex aktualisiert --- .../components/layouts/root_public.html.heex | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index 0093347..48a28a5 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -43,7 +43,7 @@