Class: PanelHelper::PanelCreator
- Inherits:
-
Object
- Object
- PanelHelper::PanelCreator
- Includes:
- ActionView::Helpers, FormatHelper
- Defined in:
- app/helpers/panel_helper.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#content ⇒ Object
Returns the value of attribute content.
-
#options ⇒ Object
Returns the value of attribute options.
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
Instance Method Summary collapse
-
#initialize(content = nil, options, block) ⇒ PanelCreator
constructor
A new instance of PanelCreator.
- #render ⇒ Object
Methods included from FormatHelper
#prepend_class, #squeeze_n_strip
Constructor Details
#initialize(content = nil, options, block) ⇒ PanelCreator
Returns a new instance of PanelCreator.
13 14 15 16 17 |
# File 'app/helpers/panel_helper.rb', line 13 def initialize(content=nil, , block) @content = content @options = @block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
10 11 12 |
# File 'app/helpers/panel_helper.rb', line 10 def block @block end |
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'app/helpers/panel_helper.rb', line 8 def content @content end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'app/helpers/panel_helper.rb', line 9 def @options end |
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
11 12 13 |
# File 'app/helpers/panel_helper.rb', line 11 def output_buffer @output_buffer end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/panel_helper.rb', line 19 def render heading = .delete(:heading) title = .delete(:title) = .delete(:footer) tag = .delete(:tag).try(:to_sym).presence || :div type = get_panel_type(.delete(:type)) prepend_class(, 'panel', type) content_tag tag, do (panel_header(heading, title) + panel_body(content, block) + ()).html_safe end end |