Module: Layered::Ui::BodyHelper

Defined in:
app/helpers/layered/ui/body_helper.rb

Instance Method Summary collapse

Instance Method Details

#l_ui_add_body_class(*modifiers) ⇒ Object

Register one or more body modifier classes from any template or layout. Calls accumulate, so a shared layout and an individual page can each contribute without clobbering one another. Pass full class names, e.g. l_ui_add_body_class “l-ui-body–hide-header”, “l-ui-body–glass-header”.



8
9
10
11
# File 'app/helpers/layered/ui/body_helper.rb', line 8

def l_ui_add_body_class(*modifiers)
  (@_l_ui_body_classes ||= []).concat(modifiers.flatten.compact)
  nil
end

#l_ui_body_classesObject

Render the full <body> class string, including the base l-ui-body class. Deduplicates and space-joins, so repeated or multi-token modifiers are safe.

The legacy ‘content_for :l_ui_body_class` is still honoured as a temporary bridge so existing host apps keep working; prefer l_ui_add_body_class.



18
19
20
# File 'app/helpers/layered/ui/body_helper.rb', line 18

def l_ui_body_classes
  token_list("l-ui-body", *(@_l_ui_body_classes || []), content_for(:l_ui_body_class))
end