Project

cssmenu

0.0
No commit activity in last 3 years
No release in over 3 years
This is a set of functions to simplify management of a CSS based menu system.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Css Menu System¶ ↑

This set of functions makes adding a CSS configured menu as simple as possible. Because it uses CSS for all formatting, it will work even if javascript is turned off. If there is no styling, it will degrade gracefully to a simple unordered list. That means it will work even with a text based browser.

A note about images in the menus¶ ↑

This will search the /public/images and /public/images/icons directories for image files of type .png, .gif, and .jpg, so any image that is of one of those types and located in those directories will be found automatically. You do not need to supply any more than the file base name. If you want to use a file that does not meet those assumptions, you may still supply the full file specification.

Typical Example:¶ ↑

<%= menubar do -%>
  <%= menu_item('Back to Home', 'house', root_path()) %>
  <%= menu_item('New Registration', 'user_add', new_registration_path) %>
<%- end -%>

Extended Example:¶ ↑

<%= menubar do -%>
  <%= menu_item('Back to Home', 'house', root_path()) %>
  <%= sub_menu('Tagged Actions', 'tag') do -%>
    <%= menu_item('Send Mail', 'email', nil, nil, :onclick => js_submit('email')) %>
    <%= menu_item('Delete', 'delete', nil, nil, {:onclick => js_submit('delete', :confirm => "Are you sure you want to delete the tagged registrations?"}) ) %>
  <%- end -%>
  <%= sub_menu('Tools', 'cog') do -%>
    <%= menu_item('Export as CSV', 'report_disk', url_for(:controller=>:registrations, :action=>:index, :format=>:csv)) %>
    <%= menu_item('Manage Statuses', 'application_view_list', statuses_path) %>
    <%= menu_item('Manage Documents', 'page_copy', documents_path) %>
    <%= sub_menu('Sub Item 2', 'add') do -%>
      <%= menu_item('Sub Sub Item 1', 'add', '#') %>
      <%= menu_item('Sub Sub Item 2', 'add', '#') %>
    <%- end -%>
    <%= menu_item('Sub Item 4', 'add') %>
  <%- end -%>
  <%= menu_item('New Registration', 'user_add', new_registration_path) %>
<%- end -%>

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 wmerrell. See LICENSE for details.