From df0af6af460fe426a1d335270291d872c40688f0 Mon Sep 17 00:00:00 2001
From: Inhji
Date: Thu, 25 May 2023 21:23:04 +0200
Subject: [PATCH] fix identities on home page and in head, mix format
---
config/config.exs | 3 +-
lib/chiya/channels/channel.ex | 24 ++++---
lib/chiya_web/components/core_components.ex | 3 +-
.../components/layouts/app.html.heex | 70 +++++++++----------
.../components/layouts/root_app.html.heex | 4 +-
.../components/layouts/root_public.html.heex | 31 +++++---
lib/chiya_web/components/public_components.ex | 14 ++--
.../controllers/page_html/home.html.heex | 30 ++++----
.../controllers/page_html/note.html.heex | 38 +++++++---
lib/chiya_web/global_assigns.ex | 10 ++-
lib/chiya_web/indie/micropub_handler.ex | 15 ++++
lib/chiya_web/live/note_show_live.ex | 16 +++--
lib/chiya_web/router.ex | 12 ++++
mix.exs | 3 +-
mix.lock | 1 +
15 files changed, 172 insertions(+), 102 deletions(-)
create mode 100644 lib/chiya_web/indie/micropub_handler.ex
diff --git a/config/config.exs b/config/config.exs
index ec59312..3b30196 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -61,8 +61,7 @@ config :waffle,
storage_dir_prefix: "priv/waffle/public"
# Configure Timezones with :tz
-config :elixir,
- :time_zone_database, Tz.TimeZoneDatabase
+config :elixir, :time_zone_database, Tz.TimeZoneDatabase
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
diff --git a/lib/chiya/channels/channel.ex b/lib/chiya/channels/channel.ex
index c22aced..15d2e1f 100644
--- a/lib/chiya/channels/channel.ex
+++ b/lib/chiya/channels/channel.ex
@@ -8,16 +8,20 @@ defmodule Chiya.Channels.Channel do
field :content, :string
field :name, :string
field :slug, ChannelSlug.Type
- field :visibility, Ecto.Enum, values: [
- :public,
- :private,
- :unlisted
- ]
- field :layout, Ecto.Enum, values: [
- :default,
- :microblog,
- :gallery
- ]
+
+ field :visibility, Ecto.Enum,
+ values: [
+ :public,
+ :private,
+ :unlisted
+ ]
+
+ field :layout, Ecto.Enum,
+ values: [
+ :default,
+ :microblog,
+ :gallery
+ ]
many_to_many :notes, Chiya.Notes.Note,
join_through: "channels_notes",
diff --git a/lib/chiya_web/components/core_components.ex b/lib/chiya_web/components/core_components.ex
index 605d369..5520d24 100644
--- a/lib/chiya_web/components/core_components.ex
+++ b/lib/chiya_web/components/core_components.ex
@@ -333,7 +333,8 @@ defmodule ChiyaWeb.CoreComponents do
attr :multiple, :boolean, default: false, doc: "the multiple flag for select inputs"
attr :rest, :global,
- include: ~w(autocomplete accept cols disabled form max maxlength min minlength pattern placeholder readonly required rows size step)
+ include:
+ ~w(autocomplete accept cols disabled form max maxlength min minlength pattern placeholder readonly required rows size step)
slot :inner_block
diff --git a/lib/chiya_web/components/layouts/app.html.heex b/lib/chiya_web/components/layouts/app.html.heex
index 344d604..60d32fe 100644
--- a/lib/chiya_web/components/layouts/app.html.heex
+++ b/lib/chiya_web/components/layouts/app.html.heex
@@ -1,42 +1,42 @@
<% items = [
- %{
- path: ~p"/admin/notes",
- icon: "hero-document-text-solid",
- name: "Notes"
- },
- %{
- path: ~p"/admin/comments",
- icon: "hero-chat-bubble-oval-left-ellipsis-solid",
- name: "Comments"
- },
- %{
- path: ~p"/admin/channels",
- icon: "hero-speaker-wave-solid",
- name: "Channels"
- },
- %{
- path: ~p"/admin/identities",
- icon: "hero-user-solid",
- name: "Identities"
- },
- %{
- path: ~p"/admin/settings",
- icon: "hero-wrench-screwdriver-solid",
- name: "Settings"
- }
- ] %>
+ %{
+ path: ~p"/admin/notes",
+ icon: "hero-document-text-solid",
+ name: "Notes"
+ },
+ %{
+ path: ~p"/admin/comments",
+ icon: "hero-chat-bubble-oval-left-ellipsis-solid",
+ name: "Comments"
+ },
+ %{
+ path: ~p"/admin/channels",
+ icon: "hero-speaker-wave-solid",
+ name: "Channels"
+ },
+ %{
+ path: ~p"/admin/identities",
+ icon: "hero-user-solid",
+ name: "Identities"
+ },
+ %{
+ path: ~p"/admin/settings",
+ icon: "hero-wrench-screwdriver-solid",
+ name: "Settings"
+ }
+ ] %>
- <%= for item <- items do %>
- <.link
- href={item.path}
- class="text-xs font-semibold leading-6 text-gray-900 hover:text-gray-700 dark:text-gray-200"
- >
- <.icon name={item.icon} class="w-4 h-4" />
- <%= item.name %>
-
- <% end %>
+ <%= for item <- items do %>
+ <.link
+ href={item.path}
+ class="text-xs font-semibold leading-6 text-gray-900 hover:text-gray-700 dark:text-gray-200"
+ >
+ <.icon name={item.icon} class="w-4 h-4" />
+ <%= item.name %>
+
+ <% end %>
diff --git a/lib/chiya_web/components/layouts/root_app.html.heex b/lib/chiya_web/components/layouts/root_app.html.heex
index 2cc9da7..5eaaaca 100644
--- a/lib/chiya_web/components/layouts/root_app.html.heex
+++ b/lib/chiya_web/components/layouts/root_app.html.heex
@@ -10,8 +10,8 @@
<.favicon />
-
-
+
+
diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex
index a6470b1..2f6db51 100644
--- a/lib/chiya_web/components/layouts/root_public.html.heex
+++ b/lib/chiya_web/components/layouts/root_public.html.heex
@@ -10,8 +10,12 @@
<.favicon />
-
-
+ <%= for identity <- @identities do %>
+
+ <% end %>
+
+
+
@@ -31,7 +35,12 @@
@@ -47,17 +56,17 @@
<.dot />
Made by Inhji
<.dot />
- Struggling to make a decent website since 2011
+ Struggling to make a decent website since 2011
-
+
- <%= for identity <- @identities do %>
- <%= identity.name %>
+ <%= for identity <- @public_identities do %>
+ <%= identity.name %>
+ <.dot />
+ <% end %>
+ About
<.dot />
- <% end %>
- About
- <.dot />
- Admin
+ Admin