diff --git a/lib/chiya/site/setting.ex b/lib/chiya/site/setting.ex
index 95fc4a8..1e3ea7f 100644
--- a/lib/chiya/site/setting.ex
+++ b/lib/chiya/site/setting.ex
@@ -18,6 +18,8 @@ defmodule Chiya.Site.Setting do
belongs_to :micropub_channel, Chiya.Channels.Channel
belongs_to :wiki_channel, Chiya.Channels.Channel
+ field :show_images_on_home, :boolean, default: true
+
timestamps()
end
@@ -34,8 +36,15 @@ defmodule Chiya.Site.Setting do
:home_channel_id,
:default_channel_id,
:micropub_channel_id,
- :wiki_channel_id
+ :wiki_channel_id,
+ :show_images_on_home
+ ])
+ |> validate_required([
+ :title,
+ :subtitle,
+ :theme,
+ :user_agent,
+ :show_images_on_home
])
- |> validate_required([:title, :subtitle, :theme, :user_agent])
end
end
diff --git a/lib/chiya_web/components/public_components.ex b/lib/chiya_web/components/public_components.ex
index da7f703..c46dc96 100644
--- a/lib/chiya_web/components/public_components.ex
+++ b/lib/chiya_web/components/public_components.ex
@@ -149,7 +149,7 @@ defmodule ChiyaWeb.PublicComponents do
"""
end
- attr :note, :map, required: true
+ attr :notes, :list, required: true
def note_list_microblog(assigns) do
~H"""
@@ -184,6 +184,8 @@ defmodule ChiyaWeb.PublicComponents do
"""
end
+ attr :notes, :list, required: true
+
def note_list_gallery(assigns) do
~H"""
@@ -218,6 +220,8 @@ defmodule ChiyaWeb.PublicComponents do
"""
end
+ attr :note, :map, required: true
+
def featured_images(assigns) do
images = main_images(assigns.note)
@@ -275,13 +279,13 @@ defmodule ChiyaWeb.PublicComponents do
~H"""
+
+ <.featured_image image={assigns.third} size={:thumb} class="flex-1 w-full rounded-bl-lg" />
+ <.featured_image image={assigns.fourth} size={:thumb} class="flex-1 w-full rounded-br-lg" />
+
"""
end
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 5e717bb..80440e7 100644
--- a/lib/chiya_web/controllers/setting_html/setting_form.html.heex
+++ b/lib/chiya_web/controllers/setting_html/setting_form.html.heex
@@ -28,6 +28,8 @@
options={@channels}
/>
<.input field={f[:wiki_channel_id]} type="select" label="Wiki Channel" options={@channels} />
+
+ <.input field={f[:show_images_on_home]} type="checkbox" label="Show Images on Home" />
<:actions>
<.button>Save Setting
diff --git a/lib/chiya_web/controllers/setting_html/show.html.heex b/lib/chiya_web/controllers/setting_html/show.html.heex
index 0806d76..09dc5ee 100644
--- a/lib/chiya_web/controllers/setting_html/show.html.heex
+++ b/lib/chiya_web/controllers/setting_html/show.html.heex
@@ -18,30 +18,29 @@
<.list>
<:item title="Title"><%= @setting.title %>
<:item title="Subtitle"><%= @setting.subtitle %>
- <:item title="Theme">
- <%= @setting.theme %>
-
- <.icon name="hero-heart-solid" class="bg-theme-primary" />
- <.icon name="hero-heart-solid" class="bg-theme-heading" />
- <.icon name="hero-heart-solid" class="bg-theme-base" />
- <.icon name="hero-heart-solid" class="bg-theme-muted" />
- <.icon name="hero-heart-solid" class="bg-theme-dim" />
-
-
- <:item title="User agent"><%= @setting.user_agent %>
<:item title="Custom css"><%= @setting.custom_css %>
<:item title="Custom html"><%= @setting.custom_html %>
- <:item title="Default Channel">
- <%= if @setting.default_channel, do: @setting.default_channel.name %>
-
- <:item title="Home Channel">
- <%= if @setting.home_channel, do: @setting.home_channel.name %>
-
- <:item title="Micropub Channel">
- <%= if @setting.micropub_channel, do: @setting.micropub_channel.name %>
-
- <:item title="Wiki Channel">
- <%= if @setting.micropub_channel, do: @setting.wiki_channel.name %>
+
+
+ <.list>
+ <:item title="Default Channel">
+ <%= if @setting.default_channel, do: @setting.default_channel.name %>
+
+ <:item title="Home Channel">
+ <%= if @setting.home_channel, do: @setting.home_channel.name %>
+
+ <:item title="Micropub Channel">
+ <%= if @setting.micropub_channel, do: @setting.micropub_channel.name %>
+
+ <:item title="Wiki Channel">
+ <%= if @setting.micropub_channel, do: @setting.wiki_channel.name %>
+
+
+
+ <.list>
+ <:item title="Show Images on Home">
+ <%= if @setting.show_images_on_home, do: "✅", else: "❌" %>
+
<% end %>
diff --git a/priv/repo/migrations/20230725045626_add_boolean_settings.exs b/priv/repo/migrations/20230725045626_add_boolean_settings.exs
new file mode 100644
index 0000000..40ffcb5
--- /dev/null
+++ b/priv/repo/migrations/20230725045626_add_boolean_settings.exs
@@ -0,0 +1,9 @@
+defmodule Chiya.Repo.Migrations.AddBooleanSettings do
+ use Ecto.Migration
+
+ def change do
+ alter table(:settings) do
+ add :show_images_on_home, :boolean, default: true
+ end
+ end
+end