data-theme should follow the theme

This commit is contained in:
byte[] 2019-12-15 21:35:07 -05:00
parent af1781dcd0
commit d5a7653393
2 changed files with 5 additions and 2 deletions

View file

@ -20,7 +20,7 @@ html lang="en"
= csrf_meta_tag() = csrf_meta_tag()
script type="text/javascript" src=Routes.static_path(@conn, "/js/app.js") async="async" script type="text/javascript" src=Routes.static_path(@conn, "/js/app.js") async="async"
= render PhilomenaWeb.LayoutView, "_opengraph.html", assigns = render PhilomenaWeb.LayoutView, "_opengraph.html", assigns
body data-theme="default" body data-theme=theme_name(@current_user)
= render PhilomenaWeb.LayoutView, "_burger.html", assigns = render PhilomenaWeb.LayoutView, "_burger.html", assigns
#container class=container_class(@current_user) #container class=container_class(@current_user)
= render PhilomenaWeb.LayoutView, "_header.html", assigns = render PhilomenaWeb.LayoutView, "_header.html", assigns
@ -28,4 +28,4 @@ html lang="en"
main#content class=layout_class(@conn) main#content class=layout_class(@conn)
= render @view_module, @view_template, assigns = render @view_module, @view_template, assigns
= render PhilomenaWeb.LayoutView, "_footer.html", assigns = render PhilomenaWeb.LayoutView, "_footer.html", assigns
= clientside_data(@conn) = clientside_data(@conn)

View file

@ -74,6 +74,9 @@ defmodule PhilomenaWeb.LayoutView do
def stylesheet_path(conn, _user), def stylesheet_path(conn, _user),
do: Routes.static_path(conn, "/css/default.css") do: Routes.static_path(conn, "/css/default.css")
def theme_name(%{theme: theme}), do: theme
def theme_name(_user), do: "default"
def artist_tags(tags), def artist_tags(tags),
do: Enum.filter(tags, & &1.namespace == "artist") do: Enum.filter(tags, & &1.namespace == "artist")