2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

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

View file

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