mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 23:08:00 +01:00
121 lines
2.7 KiB
Elixir
121 lines
2.7 KiB
Elixir
defmodule PhilomenaWeb.SettingView do
|
|
use PhilomenaWeb, :view
|
|
|
|
def theme_options do
|
|
[
|
|
[
|
|
key: "Red",
|
|
value: "dark-red",
|
|
data: [theme_path: ~p"/css/dark-red.css"]
|
|
],
|
|
[
|
|
key: "Orange",
|
|
value: "dark-orange",
|
|
data: [theme_path: ~p"/css/dark-orange.css"]
|
|
],
|
|
[
|
|
key: "Yellow",
|
|
value: "dark-yellow",
|
|
data: [theme_path: ~p"/css/dark-yellow.css"]
|
|
],
|
|
[
|
|
key: "Green",
|
|
value: "dark-green",
|
|
data: [theme_path: ~p"/css/dark-green.css"]
|
|
],
|
|
[
|
|
key: "Blue",
|
|
value: "dark-blue",
|
|
data: [theme_path: ~p"/css/dark-blue.css"]
|
|
],
|
|
[
|
|
key: "Purple",
|
|
value: "dark-purple",
|
|
data: [theme_path: ~p"/css/dark-purple.css"]
|
|
],
|
|
[
|
|
key: "Cyan",
|
|
value: "dark-cyan",
|
|
data: [theme_path: ~p"/css/dark-cyan.css"]
|
|
],
|
|
[
|
|
key: "Pink",
|
|
value: "dark-pink",
|
|
data: [theme_path: ~p"/css/dark-pink.css"]
|
|
],
|
|
[
|
|
key: "Grey",
|
|
value: "dark-grey",
|
|
data: [theme_path: ~p"/css/dark-grey.css"]
|
|
]
|
|
]
|
|
end
|
|
|
|
def light_theme_options do
|
|
[
|
|
[
|
|
key: "Red",
|
|
value: "light-red",
|
|
data: [theme_path: ~p"/css/light-red.css"]
|
|
],
|
|
[
|
|
key: "Orange",
|
|
value: "light-orange",
|
|
data: [theme_path: ~p"/css/light-orange.css"]
|
|
],
|
|
[
|
|
key: "Yellow",
|
|
value: "light-yellow",
|
|
data: [theme_path: ~p"/css/light-yellow.css"]
|
|
],
|
|
[
|
|
key: "Green",
|
|
value: "light-green",
|
|
data: [theme_path: ~p"/css/light-green.css"]
|
|
],
|
|
[
|
|
key: "Blue",
|
|
value: "light-blue",
|
|
data: [theme_path: ~p"/css/light-blue.css"]
|
|
],
|
|
[
|
|
key: "Purple",
|
|
value: "light-purple",
|
|
data: [theme_path: ~p"/css/light-purple.css"]
|
|
],
|
|
[
|
|
key: "Cyan",
|
|
value: "light-cyan",
|
|
data: [theme_path: ~p"/css/light-cyan.css"]
|
|
],
|
|
[
|
|
key: "Pink",
|
|
value: "light-pink",
|
|
data: [theme_path: ~p"/css/light-pink.css"]
|
|
],
|
|
[
|
|
key: "Grey",
|
|
value: "light-grey",
|
|
data: [theme_path: ~p"/css/light-grey.css"]
|
|
]
|
|
]
|
|
end
|
|
|
|
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
|
|
|
|
def local_tab_class(conn) do
|
|
case conn.assigns.current_user do
|
|
nil -> ""
|
|
_user -> "hidden"
|
|
end
|
|
end
|
|
|
|
def staff?(%{role: role}), do: role != "user"
|
|
def staff?(_), do: false
|
|
end
|