module WonderNavigation::Helper

Public Instance Methods

menu_tree(menu_id, current_user) click to toggle source
navigation_breadcrumb() click to toggle source
navigation_title_breadcrumb(prefix) click to toggle source

Private Instance Methods

breadcrumb(crumbs) click to toggle source
crumbs_for(menu_id, id, object) click to toggle source
# File lib/wonder_navigation/helper.rb, line 37
def crumbs_for(menu_id, id, object)
  menu = WonderNavigation::MenuManager.get(menu_id)
  if menu.item_exists?(id)
    menu.breadcrumb_for(id, object)
  else
    []
  end
end
crumbs_for_current_page(menu_id = :default) click to toggle source
# File lib/wonder_navigation/helper.rb, line 21
def crumbs_for_current_page(menu_id = :default)
  page = @navigation_page

  object = @navigation_object
  unless object
    # If object was not given by set_wonder_navigation_object then try get an instance variable called with the same name that the controller in singular
    mod, resource = controller_path.split("/")
    mod, resource = nil, mod if resource.nil?
    variable_name = [mod, resource.singularize].compact.join("_")
    variable_name = "@#{variable_name}"
    object = controller.instance_variable_get(variable_name.to_sym)
  end
  # object ||= @navigation_parent_object
  crumbs_for(menu_id, page.to_sym, object)
end