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
|
|
|
[
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Red",
|
|
|
|
value: "dark-red",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-red.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
2024-05-20 21:25:43 +02:00
|
|
|
[
|
|
|
|
key: "Orange",
|
|
|
|
value: "dark-orange",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-orange.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
key: "Yellow",
|
|
|
|
value: "dark-yellow",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-yellow.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Green",
|
|
|
|
value: "dark-green",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-green.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
2024-05-20 21:25:43 +02:00
|
|
|
[
|
|
|
|
key: "Blue",
|
|
|
|
value: "dark-blue",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-blue.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Purple",
|
|
|
|
value: "dark-purple",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-purple.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
key: "Cyan",
|
|
|
|
value: "dark-cyan",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-cyan.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
2024-05-20 21:25:43 +02:00
|
|
|
[
|
|
|
|
key: "Pink",
|
|
|
|
value: "dark-pink",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-pink.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Grey",
|
|
|
|
value: "dark-grey",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/dark-grey.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
def light_theme_options do
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
[
|
|
|
|
key: "Red",
|
|
|
|
value: "light-red",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-red.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
2024-05-20 21:25:43 +02:00
|
|
|
[
|
|
|
|
key: "Orange",
|
|
|
|
value: "light-orange",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-orange.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
key: "Yellow",
|
|
|
|
value: "light-yellow",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-yellow.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Green",
|
|
|
|
value: "light-green",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-green.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
2024-05-20 21:25:43 +02:00
|
|
|
[
|
|
|
|
key: "Blue",
|
|
|
|
value: "light-blue",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-blue.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Purple",
|
|
|
|
value: "light-purple",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-purple.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
key: "Cyan",
|
|
|
|
value: "light-cyan",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-cyan.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
],
|
2024-05-20 21:25:43 +02:00
|
|
|
[
|
|
|
|
key: "Pink",
|
|
|
|
value: "light-pink",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-pink.css"]
|
2024-05-20 21:25:43 +02:00
|
|
|
],
|
2024-05-07 19:33:56 +02:00
|
|
|
[
|
|
|
|
key: "Grey",
|
|
|
|
value: "light-grey",
|
2024-06-06 22:11:43 +02:00
|
|
|
data: [theme_path: ~p"/css/light-grey.css"]
|
2024-05-07 19:33:56 +02:00
|
|
|
]
|
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
|