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



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

class_attribute :access

#actionString



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

class_attribute :action

#modeString



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

class_attribute :mode

#page_titleString



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

class_attribute :page_title

#parentString



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

class_attribute :parent

#positionNumber



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

class_attribute :position

#short_titleString



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

class_attribute :short_title

#stateString



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

class_attribute :state

#tabNumber



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

class_attribute :tab

#titleString



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

class_attribute :title

Instance Method Details

#to_hHash

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