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:
parent
bdb848b4f3
commit
6ab4692431
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue