Socket
Book a DemoInstallSign in
Socket

active_admin-subnav

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active_admin-subnav

1.1.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

ActiveAdmin::Subnav

Gem Version

Enhanced sub-navigation for nested ActiveAdmin resources.

Currently, the base ActiveAdmin resets the top navigation menu to display the nested navigation menu, but it can be confusing to lose the main navigation context. This project keeps the main navigation visible and displays a secondary navigation bar for nested resources.

ActiveAdmin::Subnav Example

Supports both ActiveAdmin v1.0.0+ and older v0.6.4+ versions.

Note: Optional belongs_to configurations are not supported!

Usage

Resource belongs_to configuration does not require any extra configuration beyond the default. Below the Post resource belongs to Site.

# admin/site.rb
ActiveAdmin.register Site

# admin/post.rb
ActiveAdmin.register Post do
  belongs_to :site
end

Registering belongs_to pages requires more setup to properly access the parent record. This is a side effect of how Arbre references parent HTML nodes. Below a new method, #site, is created to provide access to the parent record.

# admin/site_statistics.rb
ActiveAdmin.register_page "Statistics" do
  belongs_to :site

  content do
    statistics = site.statistics
    # ...
  end

  controller do

    # Provide access to the parent resource record: Site.
    #
    # Without this extra setup the parent record will not be accessible. Any
    # calls to `#parent` will return the Arbre parent element and not the
    # ActiveAdmin resource.
    alias_method :site, :parent

    # Expose the method as a helper making it available to the view
    helper_method :site

  end
end

Installation

Add this line to your application's Gemfile:

gem 'active_admin-subnav'

And then execute:

$ bundle

Add the subnav's styles to your active_admin.css.scss stylesheet:

//= require active_admin/subnav

// Align subnav with main navigation by padding the width of the site's
// title.
#header div.subnav {
  padding-left: 8.333em;
}

Contributing

  • Fork it ( https://github.com/zorab47/active_admin-subnav/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

Versioning

Follows Semantic Versioning 2.0.0

FAQs

Package last updated on 24 May 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.