2019-11-30 23:40:53 +01:00
|
|
|
defmodule PhilomenaWeb.SettingView do
|
|
|
|
use PhilomenaWeb, :view
|
|
|
|
|
2024-04-28 05:01:16 +02:00
|
|
|
def theme_options do
|
2019-11-30 23:40:53 +01:00
|
|
|
[
|
2020-01-11 05:20:19 +01:00
|
|
|
[
|
|
|
|
key: "Default",
|
|
|
|
value: "default",
|
2024-04-28 05:01:16 +02:00
|
|
|
data: [theme_path: ~p"/css/default.css"]
|
2020-01-11 05:20:19 +01:00
|
|
|
],
|
2024-04-28 05:01:16 +02:00
|
|
|
[key: "Dark", value: "dark", data: [theme_path: ~p"/css/dark.css"]],
|
|
|
|
[key: "Red", value: "red", data: [theme_path: ~p"/css/red.css"]]
|
2019-11-30 23:40:53 +01:00
|
|
|
]
|
|
|
|
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
|
2019-12-21 20:56:54 +01:00
|
|
|
|
|
|
|
def staff?(%{role: role}), do: role != "user"
|
|
|
|
def staff?(_), do: false
|
2019-11-30 23:40:53 +01:00
|
|
|
end
|