Module: BootstrapWidgets

Defined in:
lib/dashboard_widget.rb,
lib/bootstrap_widgets.rb,
lib/bootstrap_widgets/engine.rb,
lib/bootstrap_widgets/version.rb

Defined Under Namespace

Classes: DashboardWidget, Engine

Constant Summary collapse

VERSION =
"1.0.3"

Instance Method Summary collapse

Instance Method Details

#widget(widget) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/bootstrap_widgets.rb', line 11

def widget(widget)
  case widget.panel
  when 'single_text'
    TextWidget.single_text_widget(widget)
  when 'text'
    TextWidget.text_widget(widget)
  when 'bar_graph', 'line_graph', 'line_graph', 'donut_graph', 'area_graph'
    GraphWidget.graph_widget(widget)
  end
end

#widget_group(widgets, cols = 3) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/bootstrap_widgets.rb', line 22

def widget_group(widgets, cols=3)
  output = group_header(90/cols)
  widgets.each do |widget|
    output << widget(widget)
  end
  output << "</div>"
  output.html_safe
end