Class: Trestle::ContainerHelper::Context

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/trestle/container_helper.rb

Instance Method Summary collapse

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

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 sidebar(**attributes, &block)
  if block_given?
    @sidebar = @template.tag.aside(**default_sidebar_options.merge(attributes), &block)
    nil
  else
    @sidebar
  end
end