From d5a7653393a028d37fb150e7accb789d654f691b Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 15 Dec 2019 21:35:07 -0500 Subject: [PATCH] data-theme should follow the theme --- lib/philomena_web/templates/layout/app.html.slime | 4 ++-- lib/philomena_web/views/layout_view.ex | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/philomena_web/templates/layout/app.html.slime b/lib/philomena_web/templates/layout/app.html.slime index 042600b3..92deaf8f 100644 --- a/lib/philomena_web/templates/layout/app.html.slime +++ b/lib/philomena_web/templates/layout/app.html.slime @@ -20,7 +20,7 @@ html lang="en" = csrf_meta_tag() script type="text/javascript" src=Routes.static_path(@conn, "/js/app.js") async="async" = render PhilomenaWeb.LayoutView, "_opengraph.html", assigns - body data-theme="default" + body data-theme=theme_name(@current_user) = render PhilomenaWeb.LayoutView, "_burger.html", assigns #container class=container_class(@current_user) = render PhilomenaWeb.LayoutView, "_header.html", assigns @@ -28,4 +28,4 @@ html lang="en" main#content class=layout_class(@conn) = render @view_module, @view_template, assigns = render PhilomenaWeb.LayoutView, "_footer.html", assigns - = clientside_data(@conn) \ No newline at end of file + = clientside_data(@conn) diff --git a/lib/philomena_web/views/layout_view.ex b/lib/philomena_web/views/layout_view.ex index b3b334b7..f473f379 100644 --- a/lib/philomena_web/views/layout_view.ex +++ b/lib/philomena_web/views/layout_view.ex @@ -74,6 +74,9 @@ defmodule PhilomenaWeb.LayoutView do def stylesheet_path(conn, _user), 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), do: Enum.filter(tags, & &1.namespace == "artist")