Module: Nesta::Navigation::Renderers

Defined in:
lib/nesta-plugin-metadata-extensions/init.rb

Instance Method Summary collapse

Instance Method Details

Override nesta’s breadcrumb_label to show the menu attribute in the breadcrumbs, if given



123
124
125
# File 'lib/nesta-plugin-metadata-extensions/init.rb', line 123

def breadcrumb_label(page)
  (page.abspath == '/') ? 'Home' : ( page.('menu').nil? ? page.heading : page.('menu') )
end

#display_menu_item(item, options = {}) ⇒ Object

Override nesta’s display_menu_item to show the menu attribute in the menu, if given



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/nesta-plugin-metadata-extensions/init.rb', line 104

def display_menu_item(item, options = {})
  if item.respond_to?(:each)
    if (options[:levels] - 1) > 0
      haml_tag :li do
        display_menu(item, :levels => (options[:levels] - 1))
      end
    end
  else
    html_class = (request.path == item.abspath) ? "current" : nil
    haml_tag :li, :class => html_class do
      haml_tag :a, :<, :href => item.abspath do
        haml_concat item.menu_label
      end
    end
  end
end