0
0
Fork 0

Add theme identifier to body classes for easier custom CSS styling (#8439)

Add forgotten custom CSS admin setting strings
This commit is contained in:
Eugen Rochko 2018-08-25 22:55:25 +02:00 committed by GitHub
parent cd049454be
commit 22e46ebad8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 15 deletions

View file

@ -27,11 +27,6 @@ module ApplicationHelper
Setting.open_deletion
end
def add_rtl_body_class(other_classes)
other_classes = "#{other_classes} rtl" if locale_direction == 'rtl'
other_classes
end
def locale_direction
if [:ar, :fa, :he].include?(I18n.locale)
'rtl'
@ -77,4 +72,13 @@ module ApplicationHelper
def react_component(name, props = {})
content_tag(:div, nil, data: { component: name.to_s.camelcase, props: Oj.dump(props) })
end
def body_classes
output = (@body_classes || '').split(' ')
output << "theme-#{current_theme.parameterize}"
output << 'system-font' if current_account&.user&.setting_system_font_ui
output << current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion'
output << 'rtl' if locale_direction == 'rtl'
output.reject(&:blank?).join(' ')
end
end