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

refinerycms-menus

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refinerycms-menus

  • 2.0.7
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Menus extension for Refinery CMS

Build Status Dependency Status Code Climate

About

Refinery Menus allows you to create and edit several custom menus for your Refinery CMS app. It gives you the ability to add links to any kind of model you want. As default are custom links (fx http://google.com, http://github.com etc.) Refinery Pages and Refinery Resources (files). See the screenshot below for an example.

Requirements

  • refinerycms >= 2.0.6

Features

  • Ability to create more than one menu for your application.
  • Ability to link to any number of custom models you want.
  • Ability to link to any custom url.
  • Simple and easy-to-use interface.

Install

Add this line to your applications Gemfile

gem 'refinerycms-menus', '2.0.6'

or for edge version

gem 'refinerycms-menus', git: 'git://github.com/pylonweb/refinerycms-menus.git'

Next run

bundle install
rails generate refinery:menus
rake db:migrate

Now when you start up your Refinery application, you should see a new menus tap in the admin interface.

Usage

Add to your view

Go to app/views/refinery/pages/_header.html.erb in your application. If you don't have this file then Refinery will be using its default. You can override this with

rake refinery:override view=refinery/_header

Then add this code to the header, to generate the custom menu:

<%= render :partial => "/refinery/menu", :locals => {
      :roots => refinery_menu("custom_menu")
    } %>

"custom_menu" must be replaced by the permatitle of your menu.

Rake commands

To show list all your menus and their permatitles run this rake task:

rake refinery:menus:list

You can create a new menu in the rails console, or you can use the following command:

rake refinery:menus:create_menu title=some_title

Configuration

Refinerycms Menus is very flexible and is very easy to setup your own models, so you can link to them in your menus. To add a new model to Refinerycms Menus, just go to the config file (config/initializers/refinery/menus.rb) and follow the instructions on how to add your model to the menu_resources configuration option.

Your model only have to respond to two methods:

  • url which must define which path the menu link should link to.
  • A custom title method that you can specify in the configuration.

Here is a example of how Refinery Pages are added as a custom resource model:

config.menu_resources = refinery_page: {
                klass: 'Refinery::Page',
                title_attr: 'title',
                scope: Proc.new { live.order('lft ASC') }
             }

Questions, problems and contributions

We will very much appreciate all kinds of contributions to refinerycms-menus! Just fork this project, create a new feature branch and open up a pull request. If you don't know how to do this, try to check out RailsCasts episode 300. If you are able, please add tests to your pull requests.

If you have any issues or questions, that you cannot find the answer to here, then please feel free to add an issue on GitHub.

Running tests

Refinery Menus uses RSpec to test. See the documentation on RSpec GitHub page.

  1. To run the test suite, you must first install a dummy refinery app to test against: bundle exec refinery:testing:dummy_app. See the Refinery Testing Guide for more info.
  2. You can run all specs by running the command bundle exec rake.

Screenshot

image

FAQs

Package last updated on 26 Mar 2013

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