Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lolita-menu

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lolita-menu

  • 0.4.2
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

= Lolita Menu Create, sort and publish menus with Lolita.

==Instalation In your project Gemfile put gem 'lolita-menu' And run bundle install Like with other Lolita gems call rails g lolita:menu:install Since this gem comes with migrations rake db:migrate

=== Creating menu To create Menu it's a good practise to do in your db/seeds.rb

menu = Menu.find_or_initialize_by_system_name('main_menu') if menu.new_record? categories_menu.name = 'Main menu' categories_menu.save! [ ['News', '/news'], ['Galleries', '/galleries'], ['About', '/about'] ].each do |item| menu.append MenuItem.create!(:name => item.first, :url => item.last) end puts "=> Main menu created" end

=== Using autocomplete Before that you must follow Install instruction. To use autocomplete you need to add all possible url's in config/lolita-menu-urls.rb ====Example

This will add contacts url and all possible URL's from Page model.

Lolita::Menu::Urls.create do add "/contacts", "Contacts" Pages.each do |page| add "/#{page.friendly_id}", page.title end end After that you can populate all from file in result file by executing rake lolita_menu:generate_urls If you want to add url when some of objects are created, then in your model add after_save or after_create callbacks and in related method add Lolita::Menu::Urls.add("/link", "Label"), unfortuneately it's impossible to use routes helper methods unless you do your own workaround. Enjoy!

==Copyright Copyright © 2011 ITHouse and Arturs Meisters. See LICENSE.txt for further details.

FAQs

Package last updated on 17 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc