Sha256: 7b86a828a619476b5401b6efe85c851873f6778fcb93eceb409d0de155a17464

Contents?: true

Size: 1.4 KB

Versions: 20

Compression:

Stored size: 1.4 KB

Contents

/ Parameters
/   menu: Array of hashes. This is what goes in the dropdown menu
/     body: This is the link text
/     url: This is where the link will go. Gets processed by url_for()
/   crumbs: (optional) Array of hashes. These are the crumbs after the main menu
/   add_crumbs: (optional) Array of hashes. These get pushed onto the default crumbs
/
/ Example:
/ = wcms_component('navigation/site_nav', { menu: [ \
/   {body: 'Academic Programs', url: :academic_programs_path},
/   {body: 'Schools', url: :schools_path},
/   {body: 'ULOs', url: :university_learning_outcomes_path},
/ ]})
/

ruby:
  menu ||= []
  default_crumbs = []

  # Set @parent if you have nested routes.
  _root_controller = @parent ? @parent.class.to_s.tableize : controller_name
  default_crumbs = [{
    body: _root_controller.titleize,
    url: {controller: _root_controller, action: :index}
  }]

  crumbs ||= default_crumbs
  crumbs += Array(add_crumbs) if defined?(add_crumbs)


#wcms_site_navigation
  .container
    - if menu.present?
      .dropdown.custom-dropdown
        a.dropdown-toggle href='#' data-toggle='dropdown' role='button' Menu
        ul.dropdown-menu
          - menu.each do |link|
            = nav_link(link[:body], link[:url])
    - else
      = link_to 'Home', root_url, class: 'top-nav-link'

    - crumbs.each do |crumb|
      i class='fa fa-angle-right'
      = link_to crumb[:body], crumb[:url], class: 'top-nav-link'

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
biola_wcms_components-0.15.3 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.15.2 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.15.1 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.15.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.14.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.13.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.12.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.11.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.10.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.9.1 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.9.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.8.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.7.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.6.1 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.6.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.5.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.4.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.3.0 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.2.1 app/views/wcms_components/navigation/_site_nav.html.slim
biola_wcms_components-0.2.0 app/views/wcms_components/navigation/_site_nav.html.slim