philomena/lib/philomena_web/views/setting_view.ex

26 lines
650 B
Elixir
Raw Normal View History

2019-11-30 23:40:53 +01:00
defmodule PhilomenaWeb.SettingView do
use PhilomenaWeb, :view
def theme_options(conn) do
[
2020-01-11 05:20:19 +01:00
[
key: "Default",
value: "default",
data: [theme_path: Routes.static_path(conn, "/css/default.css")]
],
2019-11-30 23:40:53 +01:00
[key: "Dark", value: "dark", data: [theme_path: Routes.static_path(conn, "/css/dark.css")]],
[key: "Red", value: "red", data: [theme_path: Routes.static_path(conn, "/css/red.css")]]
]
end
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