From 89ed7fced09a2850dbfdfb62b4509c5b9cba1908 Mon Sep 17 00:00:00 2001 From: Inhji Date: Sat, 9 Sep 2023 15:06:16 +0200 Subject: [PATCH] tags --- assets/css/app.css | 6 +- lib/chiya_web/components/public_components.ex | 33 ----------- lib/chiya_web/controllers/page_html.ex | 5 +- .../controllers/page_html/bookmarks.html.heex | 2 +- .../controllers/page_html/channel.html.heex | 2 +- .../controllers/page_html/note.html.heex | 56 +++++++++---------- .../page_html/note_list_default.html.heex | 2 +- .../page_html/note_list_microblog.html.heex | 8 ++- .../controllers/page_html/tag.html.heex | 2 +- .../controllers/page_html/tag_bar.html.heex | 18 ++++++ .../controllers/page_html/tag_list.html.heex | 34 +++++------ .../controllers/page_html/wiki.html.heex | 2 +- 12 files changed, 81 insertions(+), 89 deletions(-) create mode 100644 lib/chiya_web/controllers/page_html/tag_bar.html.heex diff --git a/assets/css/app.css b/assets/css/app.css index 19f0485..a86fef4 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -104,7 +104,11 @@ */ @layer components { .divider { - @apply flex items-center my-8 before:flex-1 after:flex-1 before:content-[''] after:content-[''] before:p-[0.5px] after:p-[0.5px] w-full mx-auto last:hidden; + @apply flex items-center my-8 before:flex-1 after:flex-1 before:content-[''] after:content-[''] before:p-[0.5px] after:p-[0.5px] w-full mx-auto last:hidden before:bg-slate-500/25 after:bg-slate-500/25 before:mr-2 after:ml-2; + } + + .dot { + @apply before:content-['·'] } } diff --git a/lib/chiya_web/components/public_components.ex b/lib/chiya_web/components/public_components.ex index bfc3729..6d49acd 100644 --- a/lib/chiya_web/components/public_components.ex +++ b/lib/chiya_web/components/public_components.ex @@ -35,16 +35,6 @@ defmodule ChiyaWeb.PublicComponents do """ end - @doc """ - Renders a middot as divider - """ - attr :class, :string, default: "text-theme-primary" - - def dot(assigns), - do: ~H""" - · - """ - @doc """ Renders a horizontal line """ @@ -52,29 +42,6 @@ defmodule ChiyaWeb.PublicComponents do do: ~H"""
""" - - attr :note, :map, required: true - attr :class_tag, :string, default: "" - attr :linked, :boolean, default: true - - def tags(assigns) do - ~H""" - - <%= for tag <- @note.tags do %> - <%= if assigns.linked do %> - - <%= tag.name %> - - <% else %> - - <%= tag.name %> - - <% end %> - <.dot class="last:hidden" /> - <% end %> - - """ - end @doc """ Renders a note-header with title. diff --git a/lib/chiya_web/controllers/page_html.ex b/lib/chiya_web/controllers/page_html.ex index 27cd57f..0d29996 100644 --- a/lib/chiya_web/controllers/page_html.ex +++ b/lib/chiya_web/controllers/page_html.ex @@ -22,8 +22,9 @@ defmodule ChiyaWeb.PageHTML do attr :show_content, :boolean, default: true def note_list_gallery(assigns) - def tag_list([]), do: "No Tags" - def tag_list(tags), do: Enum.map_join(tags, ", ", fn t -> t.name end) + attr :note, :map, required: true + attr :linked, :boolean, default: true + def tag_list(assigns) def render_outline(note) do note.content diff --git a/lib/chiya_web/controllers/page_html/bookmarks.html.heex b/lib/chiya_web/controllers/page_html/bookmarks.html.heex index a6bd6f2..a3ad633 100644 --- a/lib/chiya_web/controllers/page_html/bookmarks.html.heex +++ b/lib/chiya_web/controllers/page_html/bookmarks.html.heex @@ -8,7 +8,7 @@ diff --git a/lib/chiya_web/controllers/page_html/channel.html.heex b/lib/chiya_web/controllers/page_html/channel.html.heex index 9820a05..c782297 100644 --- a/lib/chiya_web/controllers/page_html/channel.html.heex +++ b/lib/chiya_web/controllers/page_html/channel.html.heex @@ -9,6 +9,6 @@ diff --git a/lib/chiya_web/controllers/page_html/note.html.heex b/lib/chiya_web/controllers/page_html/note.html.heex index a7a6baf..a0a9993 100644 --- a/lib/chiya_web/controllers/page_html/note.html.heex +++ b/lib/chiya_web/controllers/page_html/note.html.heex @@ -33,25 +33,6 @@ <% end %> @@ -80,6 +61,33 @@ diff --git a/lib/chiya_web/controllers/page_html/note_list_default.html.heex b/lib/chiya_web/controllers/page_html/note_list_default.html.heex index f686e10..ef482dc 100644 --- a/lib/chiya_web/controllers/page_html/note_list_default.html.heex +++ b/lib/chiya_web/controllers/page_html/note_list_default.html.heex @@ -22,7 +22,7 @@ <%= if not Enum.empty?(note.tags) do %> - <.tags note={note} linked={false} /> + <.tag_list note={note} linked={false} /> <% end %> diff --git a/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex b/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex index 30494d9..9764282 100644 --- a/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex +++ b/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex @@ -13,17 +13,19 @@ <%= raw(Markdown.render(note.content)) %> -