Sha256: 7f0c75b257d345162ec5971d4716d992ddce9f2df61b7fb2c0fd7383ee456caf
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 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 = link_to fa_icon('home'), '/', class: 'top-nav-link' - if menu.present? i class='fa fa-angle-right' .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]) li.divider li.descendant = link_to 'View all', '/' - crumbs.each do |crumb| i class='fa fa-angle-right' = link_to crumb[:body], crumb[:url], class: 'top-nav-link'
Version data entries
3 entries across 3 versions & 1 rubygems