class Geri::Config::MenuItem

Attributes

icon[R]
is_parent[R]
menu_items[R]
priority[R]
title[R]

Public Class Methods

new(title, path_or_options=nil, options={}) click to toggle source
# File lib/geri/config/menu_item.rb, line 6
def initialize(title, path_or_options=nil, options={})
  if !path_or_options || path_or_options.is_a?(Hash)
    options = path_or_options if path_or_options
    @is_parent = true
  else
    @path = path_or_options
  end
  @icon       = options[:icon]
  @title      = title
  @priority   = options[:priority] || 0
  @menu_items = []
end

Public Instance Methods

path() click to toggle source
# File lib/geri/config/menu_item.rb, line 25
def path
  "#{Geri::Config.admin_path}#{@path}"
end
register_menu_item(title, path_or_options=nil, options={}) { |item| ... } click to toggle source
# File lib/geri/config/menu_item.rb, line 19
def register_menu_item(title, path_or_options=nil, options={})
  self.menu_items << item = MenuItem.new(title, path_or_options, options)
  yield item if block_given?
  self.menu_items.sort! { |a, b| a.priority <=> b.priority }
end
to_partial_path() click to toggle source
# File lib/geri/config/menu_item.rb, line 29
def to_partial_path
  'shared/menu_item'
end