FEATURE: Add a user's primary group class name to the body tag

This commit is contained in:
Robin Ward 2017-06-15 14:20:04 -04:00
parent bdb848b4f3
commit 6ab4692431
1 changed files with 9 additions and 1 deletions

View File

@ -72,9 +72,17 @@ module ApplicationHelper
end
def body_classes
result = []
if @category && @category.url.present?
"category-#{@category.url.sub(/^\/c\//, '').gsub(/\//, '-')}"
result << "category-#{@category.url.sub(/^\/c\//, '').gsub(/\//, '-')}"
end
if current_user.present? && primary_group_name = current_user.primary_group&.name
result << "primary-group-#{primary_group_name.downcase}"
end
result.join(' ')
end
def rtl_class