Class: JqrHelpers::Helpers::PanelRenderer
- Inherits:
-
Object
- Object
- JqrHelpers::Helpers::PanelRenderer
- Defined in:
- lib/jqr-helpers/helpers.rb
Overview
A renderer used for tabs, accordions, etc.
Instance Attribute Summary (collapse)
Instance Method Summary (collapse)
-
- (PanelRenderer) initialize
constructor
A new instance of PanelRenderer.
-
- (Object) panel(title, url_or_options = {}, options = {}, &block)
Render a panel in the parent container.
Constructor Details
- (PanelRenderer) initialize
A new instance of PanelRenderer
13 14 15 |
# File 'lib/jqr-helpers/helpers.rb', line 13 def initialize self.panels = [] end |
Instance Attribute Details
- (Array<Hash>) panels
11 12 13 |
# File 'lib/jqr-helpers/helpers.rb', line 11 def panels @panels end |
Instance Method Details
- (Object) panel(title, url_or_options = {}, options = {}, &block)
Render a panel in the parent container. The panel must have either a URL or a block containing content.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/jqr-helpers/helpers.rb', line 25 def panel(title, ={}, ={}, &block) if .is_a?(String) url = content = nil id = nil else = content = block id = Helpers._random_string url = '#' + id end .merge!(:id => id) panels << { :title => title, :url => url, :options => , :content => content } nil # suppress output end |