Class: Trestle::ContainerHelper::Context
- Inherits:
-
Object
- Object
- Trestle::ContainerHelper::Context
- Defined in:
- app/helpers/trestle/container_helper.rb
Instance Method Summary collapse
-
#initialize(template) ⇒ Context
constructor
A new instance of Context.
-
#sidebar(**attributes, &block) ⇒ Object
Captures or renders the sidebar for a container block.
Constructor Details
#initialize(template) ⇒ Context
Returns a new instance of Context.
38 39 40 |
# File 'app/helpers/trestle/container_helper.rb', line 38 def initialize(template) @template = template end |
Instance Method Details
#sidebar(**attributes, &block) ⇒ Object
Captures or renders the sidebar for a container block.
When passed a block, the block content is captured as the sidebar content, and nil is returned. When no block is provided, the sidebar tag is returned (if defined).
attributes - Additional HTML attributes to add to the <div> tag
48 49 50 51 52 53 54 55 |
# File 'app/helpers/trestle/container_helper.rb', line 48 def (**attributes, &block) if block_given? @sidebar = @template.tag.aside(**.merge(attributes), &block) nil else @sidebar end end |