This commit is contained in:
Liam 2024-12-20 12:54:55 -05:00
parent d5cf9aeb9d
commit 0d21e49fff
3 changed files with 5 additions and 9 deletions

View file

@ -4,8 +4,6 @@ defmodule PhilomenaWeb.Api.Json.ThemeController do
alias PhilomenaWeb.SettingView
def index(conn, _params) do
conn
|> put_resp_content_type("application/json")
|> send_resp(200, SettingView.theme_paths_json(conn))
json(conn, SettingView.theme_paths())
end
end

View file

@ -88,7 +88,7 @@ h1 Content Settings
= error_tag f, :theme_color
.fieldlabel: i Color of the theme
.fieldlabel: strong Don't forget to save the settings to apply the theme!
.hidden#js-theme-paths data-theme-paths=theme_paths_json(@conn)
.hidden#js-theme-paths data-theme-paths=Jason.encode!(theme_paths())
.field
=> label f, :scale_large_images
=> select f, :scale_large_images, scale_options(), class: "input"

View file

@ -15,12 +15,10 @@ defmodule PhilomenaWeb.SettingView do
end)
end
def theme_paths_json(conn) do
User.themes()
|> Map.new(fn name ->
{name, static_path(conn, "/css/#{name}.css")}
def theme_paths do
Map.new(User.themes(), fn name ->
{name, static_path(PhilomenaWeb.Endpoint, "/css/#{name}.css")}
end)
|> Jason.encode!()
end
def scale_options do