Class: Anoubis::Output::MenuItem

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/anoubis/output/menu.rb

Overview

Subclass of menu element.

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  if options.has_key? :mode
    self.mode = options[:mode]
  else
    self.mode = ''
  end

  if options.has_key? :title
    self.title = options[:title]
  else
    self.title = ''
  end

  if options.has_key? :page_title
    self.page_title = options[:page_title]
  else
    self.page_title = ''
  end

  if options.has_key? :short_title
    self.short_title = options[:short_title]
  else
    self.short_title = ''
  end

  if options.has_key? :position
    self.position = options[:position]
  else
    self.position = 0
  end

  if options.has_key? :tab
    self.tab = options[:tab]
  else
    self.tab = 0
  end

  if options.has_key? :action
    self.action = options[:action]
  else
    self.action = 'data'
  end

  if options.has_key? :access
    self.access = options[:access]
  else
    self.access = 'read'
  end

  if options.has_key? :state
    self.state = options[:state]
  else
    self.state = 'visible'
  end

  if options.has_key? :parent
    if options[:parent]
      self.parent = options[:parent]
    else
      self.parent = ''
    end
  else
    self.parent = ''
  end
end

Instance Attribute Details

#accessString

Returns the access to the menu element for current user (‘read’, ‘write’).

Returns:

  • (String)

    the access to the menu element for current user (‘read’, ‘write’).



123
# File 'app/controllers/anoubis/output/menu.rb', line 123

class_attribute :access

#actionString

Returns the action type of the menu element (‘menu’, ‘data’).

Returns:

  • (String)

    the action type of the menu element (‘menu’, ‘data’).



119
# File 'app/controllers/anoubis/output/menu.rb', line 119

class_attribute :action

#modeString

Returns the mode of the menu element. Identificator represents path of controller.

Returns:

  • (String)

    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_titleString

Returns the page title of the menu element. Uses for show in page title.

Returns:

  • (String)

    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

#parentString

Returns the mode of parent menu of the menu element when tab more then 0.

Returns:

  • (String)

    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

#positionNumber

Returns the position of the menu element in current level.

Returns:

  • (Number)

    the position of the menu element in current level.



111
# File 'app/controllers/anoubis/output/menu.rb', line 111

class_attribute :position

#short_titleString

Returns the short title of the menu element. Uses for short menu link.

Returns:

  • (String)

    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

#stateString

Returns the show state of the menu element (‘visible’, ‘hidden’).

Returns:

  • (String)

    the show state of the menu element (‘visible’, ‘hidden’).



127
# File 'app/controllers/anoubis/output/menu.rb', line 127

class_attribute :state

#tabNumber

Returns the level of the menu element.

Returns:

  • (Number)

    the level of the menu element.



115
# File 'app/controllers/anoubis/output/menu.rb', line 115

class_attribute :tab

#titleString

Returns the title of the menu element.

Returns:

  • (String)

    the title of the menu element.



99
# File 'app/controllers/anoubis/output/menu.rb', line 99

class_attribute :title

Instance Method Details

#to_hHash

Generates hash representation of output class

Returns:

  • (Hash)

    hash representation of all data



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