From 6ab46924311919a4b1b54005e5f1187b17bd37e1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 15 Jun 2017 14:20:04 -0400 Subject: [PATCH] FEATURE: Add a user's primary group class name to the body tag --- app/helpers/application_helper.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d087594227e..4a4ab33218a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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