Last active
August 29, 2015 14:21
-
-
Save anitagraham/dd767187c428544774ec to your computer and use it in GitHub Desktop.
Zurb Foundation menu presenter for Refinery CMS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/app/views/refinery/shared/_header.html.erb | |
... | |
<section class="top-bar-section" id="menu"> | |
<%= zurb_menu(refinery_menu_pages, list_tag_css: 'left').to_html %> | |
<ul class='right'> | |
<li> <a href="/contact">Contact Us</a></li> | |
</ul> | |
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/helpers/ApplciationHelper | |
Module ApplicationHelper | |
# Creates a dropdown menu with items matching Refinery pages | |
# and tags/css matching Foundation markup | |
# | |
# Options: | |
# * +:menu_tag+ - A wrapper for the lists | |
# * +:dom_id+ - The dom id for the wrapper | |
# * +:css+ - The css class for the wrapper | |
# * +:list_dropdown_css+ - The css class of the submenu list | |
# * +:list_item_dropdown_css+ - The css class of the main menu item that has a dropdown | |
# * +:list_tag_css+ - The css class of the main menu | |
# * +:selected_css+ - The css class denoting a selected/active menu item | |
def zurb_menu(items, options = {}) | |
presenter = Refinery::Pages::ZurbMenuPresenter.new(items, self) | |
%w(menu_tag dom_id css list_dropdown_css list_item_dropdown_css list_tag_css selected_css).map(&:to_sym).each do |k| | |
presenter.send("#{k}=", options[k]) if options.has_key?(k) | |
end | |
presenter | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment