philomena/lib/philomena_web/views/setting_view.ex

68 lines
1.8 KiB
Elixir
Raw Normal View History

2019-11-30 23:40:53 +01:00
defmodule PhilomenaWeb.SettingView do
use PhilomenaWeb, :view
2024-07-03 21:32:27 +02:00
def themes do
2019-11-30 23:40:53 +01:00
[
2024-07-03 21:32:27 +02:00
Dark: "dark",
Light: "light"
2024-05-07 19:33:56 +02:00
]
end
2024-07-03 21:32:27 +02:00
def theme_colors do
2024-05-07 19:33:56 +02:00
[
2024-07-03 21:32:27 +02:00
Red: "red",
Orange: "orange",
Yellow: "yellow",
Green: "green",
Blue: "blue",
Purple: "purple",
Cyan: "cyan",
Pink: "pink",
"Silver/Charcoal": "silver"
2019-11-30 23:40:53 +01:00
]
end
2024-07-03 22:00:12 +02:00
def theme_paths_json do
Jason.encode!(
%{
"dark-red": ~p"/css/dark-red.css",
"dark-orange": ~p"/css/dark-orange.css",
"dark-yellow": ~p"/css/dark-yellow.css",
"dark-blue": ~p"/css/dark-blue.css",
"dark-green": ~p"/css/dark-green.css",
"dark-purple": ~p"/css/dark-purple.css",
"dark-cyan": ~p"/css/dark-cyan.css",
"dark-pink": ~p"/css/dark-pink.css",
"dark-silver": ~p"/css/dark-silver.css",
"light-red": ~p"/css/light-red.css",
"light-orange": ~p"/css/light-orange.css",
"light-yellow": ~p"/css/light-yellow.css",
"light-blue": ~p"/css/light-blue.css",
"light-green": ~p"/css/light-green.css",
"light-purple": ~p"/css/light-purple.css",
"light-cyan": ~p"/css/light-cyan.css",
"light-pink": ~p"/css/light-pink.css",
"light-silver": ~p"/css/light-silver.css"
}
)
end
2021-09-27 03:54:47 +02:00
def scale_options do
[
[key: "Load full images on image pages", value: "false"],
[key: "Load full images on image pages, sized to fit the page", value: "partscaled"],
[key: "Scale large images down before downloading", value: "true"]
]
end
2019-11-30 23:40:53 +01:00
def local_tab_class(conn) do
case conn.assigns.current_user do
2020-01-11 05:20:19 +01:00
nil -> ""
2019-11-30 23:40:53 +01:00
_user -> "hidden"
end
end
def staff?(%{role: role}), do: role != "user"
def staff?(_), do: false
2019-11-30 23:40:53 +01:00
end