Class: Anoubis::Output::MenuItem
- Inherits:
-
Object
- Object
- Anoubis::Output::MenuItem
- Defined in:
- app/controllers/anoubis/output/menu.rb
Overview
Subclass of menu element.
Instance Attribute Summary collapse
-
#access ⇒ String
The access to the menu element for current user (‘read’, ‘write’).
-
#action ⇒ String
The action type of the menu element (‘menu’, ‘data’).
-
#mode ⇒ String
The mode of the menu element.
-
#page_title ⇒ String
The page title of the menu element.
-
#parent ⇒ String
The mode of parent menu of the menu element when tab more then 0.
-
#position ⇒ Number
The position of the menu element in current level.
-
#short_title ⇒ String
The short title of the menu element.
-
#state ⇒ String
The show state of the menu element (‘visible’, ‘hidden’).
-
#tab ⇒ Number
The level of the menu element.
-
#title ⇒ String
The title of the menu element.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MenuItem
constructor
Initializes menu element data.
-
#to_h ⇒ Hash
Generates hash representation of output class.
Constructor Details
#initialize(options = {}) ⇒ MenuItem
Initializes menu element data. Generates default values.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'app/controllers/anoubis/output/menu.rb', line 135 def initialize( = {}) if .has_key? :mode self.mode = [:mode] else self.mode = '' end if .has_key? :title self.title = [:title] else self.title = '' end if .has_key? :page_title self.page_title = [:page_title] else self.page_title = '' end if .has_key? :short_title self.short_title = [:short_title] else self.short_title = '' end if .has_key? :position self.position = [:position] else self.position = 0 end if .has_key? :tab self.tab = [:tab] else self.tab = 0 end if .has_key? :action self.action = [:action] else self.action = 'data' end if .has_key? :access self.access = [:access] else self.access = 'read' end if .has_key? :state self.state = [:state] else self.state = 'visible' end if .has_key? :parent if [:parent] self.parent = [:parent] else self.parent = '' end else self.parent = '' end end |
Instance Attribute Details
#access ⇒ String
Returns the access to the menu element for current user (‘read’, ‘write’).
123 |
# File 'app/controllers/anoubis/output/menu.rb', line 123 class_attribute :access |
#action ⇒ String
Returns the action type of the menu element (‘menu’, ‘data’).
119 |
# File 'app/controllers/anoubis/output/menu.rb', line 119 class_attribute :action |
#mode ⇒ String
Returns the mode of the menu element. Identificator represents path of controller.
95 |
# File 'app/controllers/anoubis/output/menu.rb', line 95 class_attribute :mode |
#page_title ⇒ String
Returns the page title of the menu element. Uses for show in page title.
103 |
# File 'app/controllers/anoubis/output/menu.rb', line 103 class_attribute :page_title |
#parent ⇒ String
Returns the mode of parent menu of the menu element when tab more then 0.
131 |
# File 'app/controllers/anoubis/output/menu.rb', line 131 class_attribute :parent |
#position ⇒ Number
Returns the position of the menu element in current level.
111 |
# File 'app/controllers/anoubis/output/menu.rb', line 111 class_attribute :position |
#short_title ⇒ String
Returns the short title of the menu element. Uses for short menu link.
107 |
# File 'app/controllers/anoubis/output/menu.rb', line 107 class_attribute :short_title |
#state ⇒ String
Returns the show state of the menu element (‘visible’, ‘hidden’).
127 |
# File 'app/controllers/anoubis/output/menu.rb', line 127 class_attribute :state |
#tab ⇒ Number
Returns the level of the menu element.
115 |
# File 'app/controllers/anoubis/output/menu.rb', line 115 class_attribute :tab |
#title ⇒ String
Returns the title of the menu element.
99 |
# File 'app/controllers/anoubis/output/menu.rb', line 99 class_attribute :title |
Instance Method Details
#to_h ⇒ Hash
Generates hash representation of output class
204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'app/controllers/anoubis/output/menu.rb', line 204 def to_h { mode: self.mode, title: self.title, page_title: self.page_title, short_title: self.short_title, position: self.position, tab: self.tab, action: self.action, access: self.access, state:self.state, parent: self.parent } end |