Revision 902c71ef
Added by Dmitri Dolguikh about 10 years ago
app/services/menu/item.rb | ||
---|---|---|
raise ArgumentError, "Cannot set the :parent to be the same as this item" if options[:parent] == name.to_sym
|
||
raise ArgumentError, "Invalid option :children for menu item '#{name}'" if options[:children] && !options[:children].respond_to?(:call)
|
||
@name = name
|
||
@url = options[:url]
|
||
@url_hash = options[:url_hash]
|
||
@condition = options[:if]
|
||
@caption = options[:caption]
|
||
... | ... | |
end
|
||
|
||
def url
|
||
add_relative_path(@context.routes.url_for(url_hash.merge(:only_path=>true)))
|
||
add_relative_path(@url || @context.routes.url_for(url_hash.merge(:only_path=>true)))
|
||
end
|
||
|
||
def url_hash
|
Also available in: Unified diff
fixes #5537: it's possible to specify menu item url directly now