Module: Plutonium::Definition::PageWidths
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base, Interaction::Base
- Defined in:
- lib/plutonium/definition/page_widths.rb
Overview
Per-resource width for detail-style pages. page_width sets both the
form and the show page; form_width / display_width override one
surface without disturbing the other.
Plutonium.configure { |c| c.default_page_width = :md } # global
class PostDefinition < ResourceDefinition
page_width :lg # this resource's form AND show page
display_width :full # ...except the show page, which goes full
end
Resolution, most specific first: the surface-specific setting, then
page_width, then Plutonium.configuration.default_page_width. All
three inherit to subclasses (so a portal-specific definition keeps its
parent's width unless it says otherwise), which is why these are
inheritable_config_attr rather than plain class attributes.
Instance Method Summary collapse
- #display_width_classes ⇒ Object
-
#form_width_classes ⇒ Object
The classes to put on the surface, or nil for
:full. - #resolved_display_width ⇒ Object
-
#resolved_form_width ⇒ Object
The resolved token for each surface.
Instance Method Details
#display_width_classes ⇒ Object
62 |
# File 'lib/plutonium/definition/page_widths.rb', line 62 def display_width_classes = Plutonium::UI::PageWidth.classes_for(resolved_display_width) |
#form_width_classes ⇒ Object
The classes to put on the surface, or nil for :full.
60 |
# File 'lib/plutonium/definition/page_widths.rb', line 60 def form_width_classes = Plutonium::UI::PageWidth.classes_for(resolved_form_width) |
#resolved_display_width ⇒ Object
53 54 55 56 57 |
# File 'lib/plutonium/definition/page_widths.rb', line 53 def resolved_display_width self.class.display_width_config || self.class.page_width_config || Plutonium.configuration.default_page_width end |
#resolved_form_width ⇒ Object
The resolved token for each surface. Nil-coalescing rather than
||-on-a-boolean, so an explicit :full (a legitimate choice) is
honoured instead of being treated as "unset".
47 48 49 50 51 |
# File 'lib/plutonium/definition/page_widths.rb', line 47 def resolved_form_width self.class.form_width_config || self.class.page_width_config || Plutonium.configuration.default_page_width end |