Class: Anoubis::Output::TabItem
- Inherits:
-
Object
- Object
- Anoubis::Output::TabItem
- Defined in:
- app/controllers/anoubis/output/frame.rb
Overview
Subclass of tab element.
Instance Attribute Summary collapse
-
#button_items ⇒ Array
The array of tab elements FrameButtonItem.
-
#buttons ⇒ Hash
The hash of menu elements FrameButtonItem with ‘key’ as a key.
-
#export ⇒ Boolean
Sets into true when tab has export button.
-
#filter ⇒ Boolean
Sets into true when tab has filter button.
-
#hint ⇒ string
The tab hint (value may not be present).
-
#tab ⇒ string
The tab identificator.
-
#title ⇒ string
The tab title.
Instance Method Summary collapse
-
#addButton(options) ⇒ Object
Adds new button into frame buttons hash hash.
-
#initialize(options = {}) ⇒ TabItem
constructor
Initializes tab element data.
-
#to_h ⇒ Hash
Generates hash representation of output class.
Constructor Details
#initialize(options = {}) ⇒ TabItem
Initializes tab element data. Generates default values.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'app/controllers/anoubis/output/frame.rb', line 100 def initialize( = {}) if .has_key? :tab self.tab = [:tab].to_s else self.tab = '' end if .has_key? :title self.title = [:title] else self.title = '' end if .has_key? :hint self.hint = [:hint] else self.hint = '' end if .has_key? :filter self.filter = [:filter] else self.filter = true end if .has_key? :export self.export = [:export] else self.export = true end self. = [] self. = {} if .has_key? :buttons [:buttons].each do |key, | [:key] = key.to_s self.addButton() end end end |
Instance Attribute Details
#button_items ⇒ Array
Returns the array of tab elements FrameButtonItem.
84 |
# File 'app/controllers/anoubis/output/frame.rb', line 84 class_attribute :button_items |
#buttons ⇒ Hash
Returns the hash of menu elements FrameButtonItem with ‘key’ as a key.
88 |
# File 'app/controllers/anoubis/output/frame.rb', line 88 class_attribute :buttons |
#export ⇒ Boolean
Returns sets into true when tab has export button.
96 |
# File 'app/controllers/anoubis/output/frame.rb', line 96 class_attribute :export |
#filter ⇒ Boolean
Returns sets into true when tab has filter button.
92 |
# File 'app/controllers/anoubis/output/frame.rb', line 92 class_attribute :filter |
#hint ⇒ string
Returns the tab hint (value may not be present).
80 |
# File 'app/controllers/anoubis/output/frame.rb', line 80 class_attribute :hint |
#tab ⇒ string
Returns the tab identificator.
72 |
# File 'app/controllers/anoubis/output/frame.rb', line 72 class_attribute :tab |
#title ⇒ string
Returns the tab title.
76 |
# File 'app/controllers/anoubis/output/frame.rb', line 76 class_attribute :title |
Instance Method Details
#addButton(options) ⇒ Object
Adds new button into frame buttons hash hash
148 149 150 151 152 |
# File 'app/controllers/anoubis/output/frame.rb', line 148 def addButton() = FrameButtonItem.new self..push self.[.key.to_s.to_sym] = self.[self..count-1] end |
#to_h ⇒ Hash
Generates hash representation of output class
157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'app/controllers/anoubis/output/frame.rb', line 157 def to_h result = { tab: self.tab, title: self.title, buttons: [], filter: self.filter, export: self.export } result[:hint] = self.hint if self.hint != '' self..each { |item| result[:buttons].push(item.to_h) if item } result end |