UX: Apply the category class on initial page load

This commit is contained in:
Robin Ward 2016-07-04 12:10:52 -04:00
parent 6129fda8af
commit 72560b5260
2 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,12 @@ module ApplicationHelper
"#{mobile_view? ? 'mobile-view' : 'desktop-view'} #{mobile_device? ? 'mobile-device' : 'not-mobile-device'} #{rtl_class} #{current_user ? '' : 'anon'}"
end
def body_classes
if @category && @category.url.present?
"category-#{@category.url.sub(/^\/c\//, '').gsub(/\//, '-')}"
end
end
def rtl_class
rtl? ? 'rtl' : ''
end

View File

@ -41,7 +41,7 @@
<%= yield :head %>
</head>
<body>
<body class="<%= body_classes %>">
<div class='debug-eyeline'></div>
<noscript data-path="<%= request.env['PATH_INFO'] %>">