Methods
Included Modules
- Helper
- ActionController::UrlWriter
Attributes
| [R] | items | |
| [R] | name | |
| [R] | options |
Public Instance methods
Add a new submenu to the menu
[ show source ]
# File lib/access_control/base.rb, line 203
203: def add(name, path=nil, options={}, &block)
204: @items << Menu.new(name, path, options, &block)
205: end
Return allowed controllers
[ show source ]
# File lib/access_control/base.rb, line 208
208: def allowed
209: @items.each { |i| @allowed.concat i.allowed }
210: @allowed.uniq
211: end
Return ExtJs Config for this menu
[ show source ]
# File lib/access_control/base.rb, line 224
224: def config
225: if @url.blank? && @items.empty?
226: options = human_name
227: else
228: options = @options.merge(:text => human_name)
229: options.merge!(:menu => @items.collect(&:config)) if @items.size > 0
230: options.merge!(:handler => "function(){ Backend.app.load('#{url}') }".to_l) if !@url.blank?
231: end
232: options
233: end
Return the original name or try to translate or humanize the symbol
[ show source ]
# File lib/access_control/base.rb, line 214
214: def human_name
215: @name.is_a?(Symbol) ? I18n.t("backend.menus.#{@name}", :default => @name.to_s.humanize) : @name
216: end
Return a unique id for the given project module
[ show source ]
# File lib/access_control/base.rb, line 219
219: def uid
220: @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')
221: end
Return the url of this menu
[ show source ]
# File lib/access_control/base.rb, line 198
198: def url
199: @url.is_a?(Hash) ? url_for(@url.merge(:only_path => true)) : @url
200: end