Skip to content

Add l_ui_add_body_class helper for composable body modifiers - #102

Merged
thomasgallagher merged 1 commit into
mainfrom
body-class-helper
Jun 14, 2026
Merged

Add l_ui_add_body_class helper for composable body modifiers#102
thomasgallagher merged 1 commit into
mainfrom
body-class-helper

Conversation

@thomasgallagher

Copy link
Copy Markdown
Collaborator

Replaces content_for :l_ui_body_class with an accumulating helper so a shared layout and an individual page can each contribute body modifier classes without clobbering one another. The legacy content_for is still honoured as a temporary bridge.

Replaces content_for :l_ui_body_class with an accumulating helper so a
shared layout and an individual page can each contribute body modifier
classes without clobbering one another. The legacy content_for is still
honoured as a temporary bridge.
@claude

claude Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review

Replaces the single content_for :l_ui_body_class slot with an accumulating l_ui_add_body_class helper so multiple templates in the same request can each contribute body modifier classes without clobbering one another; the legacy content_for path is kept as a deprecated bridge.

No issues found. The implementation is correct: @_l_ui_body_classes is an instance variable on the shared view context so it accumulates naturally across nested templates, token_list (Rails 7.1+, safe given the ~> 8.0 Rails pin) handles deduplication and nil-safety, and the legacy bridge reads content_for without consuming it so calling l_ui_body_classes is idempotent. Tests cover all documented behaviours.


Ship

@thomasgallagher
thomasgallagher merged commit 362a681 into main Jun 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant