Module: BootstrapLeather::WidgetsHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/bootstrap_leather/widgets_helper.rb

Overview

Widgets (my term, not bootstrap’s), such as a right sidebar with separate sections

Instance Method Summary collapse

Instance Method Details

#add_widget(html_options = {}, &block) ⇒ Object



7
8
9
10
# File 'app/helpers/bootstrap_leather/widgets_helper.rb', line 7

def add_widget(html_options = {}, &block)
  @widgets ||= []
  @widgets << { html_options: html_options, body: capture(&block) }
end

#render_widgets(device_class = 'md', column_width = 3) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/bootstrap_leather/widgets_helper.rb', line 18

def render_widgets(device_class = 'md', column_width = 3)
  render(
    partial: 'bootstrap_leather/widgets/widgets',
    locals: {
      widgets: widgets,
      column_width: column_width,
      device_class: device_class
    }
  )
end

#widgetsObject



12
13
14
15
16
# File 'app/helpers/bootstrap_leather/widgets_helper.rb', line 12

def widgets
  mine = @widgets
  @widgets = nil
  mine
end