Class: Fidelity::Widget::Tab
- Inherits:
-
Object
- Object
- Fidelity::Widget::Tab
- Defined in:
- app/fidelity/widgets/tabs/tabs.rb
Defined Under Namespace
Classes: TabPanel
Instance Attribute Summary collapse
-
#tabs ⇒ Object
Returns the value of attribute tabs.
-
#template ⇒ Object
Returns the value of attribute template.
-
#vertical ⇒ Object
Returns the value of attribute vertical.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(template, options = {}) ⇒ Tab
constructor
A new instance of Tab.
- #tab(label = 'Tab', options = {}, &block) ⇒ Object
Constructor Details
#initialize(template, options = {}) ⇒ Tab
Returns a new instance of Tab.
6 7 8 9 10 |
# File 'app/fidelity/widgets/tabs/tabs.rb', line 6 def initialize template, ={} @template = template @vertical = true if [:orientation] and [:orientation].to_sym == :vertical @tabs = [] end |
Instance Attribute Details
#tabs ⇒ Object
Returns the value of attribute tabs.
5 6 7 |
# File 'app/fidelity/widgets/tabs/tabs.rb', line 5 def tabs @tabs end |
#template ⇒ Object
Returns the value of attribute template.
5 6 7 |
# File 'app/fidelity/widgets/tabs/tabs.rb', line 5 def template @template end |
#vertical ⇒ Object
Returns the value of attribute vertical.
5 6 7 |
# File 'app/fidelity/widgets/tabs/tabs.rb', line 5 def vertical @vertical end |
Instance Method Details
#each ⇒ Object
19 20 21 22 23 |
# File 'app/fidelity/widgets/tabs/tabs.rb', line 19 def each @tabs.each do |tab| yield tab end end |
#tab(label = 'Tab', options = {}, &block) ⇒ Object
12 13 14 15 16 17 |
# File 'app/fidelity/widgets/tabs/tabs.rb', line 12 def tab label='Tab', ={}, &block panel = Proc.new{ [:text] } panel = template.capture(&block) if block_given? state = :active if [:state] @tabs << TabPanel.new(label, panel, state) end |