From 71d57cafd168f5f142c3a902241ecc8a14a3446e Mon Sep 17 00:00:00 2001 From: Inhji Date: Sat, 23 Sep 2023 22:43:06 +0200 Subject: [PATCH 1/2] only show tags which do not have the tag yet --- lib/chiya/notes.ex | 1 + lib/chiya_web/controllers/tag_controller.ex | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/chiya/notes.ex b/lib/chiya/notes.ex index d4d978b..8fc3dd8 100644 --- a/lib/chiya/notes.ex +++ b/lib/chiya/notes.ex @@ -63,6 +63,7 @@ defmodule Chiya.Notes do |> where([n], fragment("? ~ ?", n.name, ^tag.regex)) |> or_where([n], fragment("? ~ ?", n.url, ^tag.regex)) |> or_where([n], fragment("? ~ ?", n.content, ^tag.regex)) + |> preload(^@preloads) |> Repo.all() end diff --git a/lib/chiya_web/controllers/tag_controller.ex b/lib/chiya_web/controllers/tag_controller.ex index 52aa51e..2c9e7ce 100644 --- a/lib/chiya_web/controllers/tag_controller.ex +++ b/lib/chiya_web/controllers/tag_controller.ex @@ -15,7 +15,18 @@ defmodule ChiyaWeb.TagController do def apply_prepare(conn, %{"id" => id}) do tag = Tags.get_tag!(id) - notes = Chiya.Notes.list_apply_notes(tag) + + notes = + tag + |> Chiya.Notes.list_apply_notes() + |> Enum.filter(fn note -> + exists = + note.tags + |> Enum.map(fn t -> t.name end) + |> Enum.member?(tag.name) + + !exists + end) render(conn, :apply_prepare, tag: tag, notes: notes) end -- 2.39.5 From b6f060d1f82f2c8c6d862c31336a4a12473ca01f Mon Sep 17 00:00:00 2001 From: Inhji Date: Sat, 23 Sep 2023 22:43:17 +0200 Subject: [PATCH 2/2] improve header and footer --- assets/css/app.css | 16 ++++++++++------ .../components/layouts/root_public.html.heex | 6 +++--- .../controllers/tag_html/index.html.heex | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/assets/css/app.css b/assets/css/app.css index 0a93ba4..7579304 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -25,8 +25,8 @@ font-feature-settings: "case", "cpsp", "frac", "salt", "ccmp", "cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv09", "cv10", "cv11"; } - body { - @apply bg-gradient-to-br from-background from-50% to-rose-100 text-foreground; + body#site-body { + @apply bg-gradient-to-br from-background from-50% to-rose-100 dark:to-rose-950 text-foreground; } .stack > * + * { @@ -49,7 +49,7 @@ /* === SITE HEADER === */ #site-header { - @apply block px-3 py-6 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white print:hidden; + @apply sticky top-0 block px-3 py-6 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white print:hidden; & nav ul { @apply flex; @@ -58,6 +58,10 @@ & a { @apply p-3 rounded transition border border-transparent hover:border-white; } + + & #site-title { + @apply font-bold uppercase; + } } /* === PRIMARY SIDEBAR === */ @@ -67,7 +71,7 @@ @apply prose-a:no-underline; & nav { - @apply flex justify-around md:flex-row lg:flex-col mb-6 lg:mb-0; + @apply flex justify-between md:flex-row lg:flex-col mb-6 lg:mb-0; } & h3 { @@ -83,7 +87,7 @@ #site-content { @apply grid grid-cols-1 lg:grid-cols-5 gap-0 lg:gap-12; - @apply sm:mt-12 px-3 sm:px-0; + @apply mt-6 sm:mt-12 px-6 sm:px-0; #content-wrapper { @apply col-span-4; @@ -97,7 +101,7 @@ /* === SITE FOOTER === */ #site-footer { - @apply mt-8 prose max-w-none; + @apply p-8 mt-8 max-w-none bg-foreground/20 border-t border-foreground/10; } /* === CONCERNING MULTIPLE LAYOUT BLOCKS === */ diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index 4f6f4c3..901162c 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -35,12 +35,12 @@ <%= @settings.custom_css %> - +