Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Generating hierarchical menus in Rails should utilize Rails' built-in partial views instead of using some kind on HTML code generators. This gem just do that.
After installing the gem you can generate the views and the config file to create your own menus, even more than one can be generated by using name prefixes.
rails generate partial_menu:yaml
This will generate an example menu description yaml file in config/main_menu.yaml
You can have multiple menu definitiions in an app. For this you can use the --type
parameter to set the name of the file
rails generate partial_menu:yaml -t side
This will create config/side_menu.yaml
You can define your menu structure in the generated yaml file:
---
menu: # Marks the beginnin of the menu
- first_item: # Adds a menu item. Text here will be parsed as id for the item.
title: "First item" # Optional title of the item. If not set, ID will be used
uri: root # Optional URI, in any format url_for would parse
icon: test # Optional icon for the item.
- second_item: separator # A second menu item, specifing that its just a separator.
- third_item:
icontype: glyph # You can add any arbitarty property to an item, it will be parsed and can be used in templates.
menu: # Here comes the submenu
- first_submenu: link # First submenu, with specifing its link as a shortcut.
- second_submenu:
title: menu.second_submenu.title # You can use any text as title. In your template you can use it as you whish, like translate it with I18N::t()
uri: second
Customizing views:
rails generate partial_menu:views -d side
This will create:
app/views/side_menu/_menu.html.erb
-- menu root templateapp/views/side_menu/_item.html.erb
-- menu items templateapp/views/side_menu/_separator.html.erb
-- separator templateapp/views/side_menu/_submenu_item.html.erb
-- submenu root templateapp/views/side_menu/_item.html.erb
-- submenu items templateAdd this line to your application's Gemfile:
gem 'partial_menu'
And then execute:
$ bundle
Or install it yourself as:
$ gem install partial_menu
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that partial_menu demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.