0.0
No commit activity in last 3 years
No release in over 3 years
Automatically includes action links (show, edit, destroy) based on the current page and user roles/permissions
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Action_Links automatically includes action links (show, edit, destroy) based on the current page and user roles/permissions.

Installation¶ ↑

Add the following to your Gemfile

gem "action_links"

From the command line

> bundle install

Action Links is built to work with Declarative Authorization

Configuration¶ ↑

Configuration is optional. Everything will work out of the box.

ActionLinks.configure do |config|
  @bootstrap_action_classes = { :show => 'btn', :edit => 'btn', :destroy => 'btn btn-danger' }
  @bootstrap_action_icons = { :show => 'icon-eye-open', :edit => 'icon-pencil', :destroy => 'icon-remove icon-white' }
  @action_icons = { :show => 'eye-open', :edit => 'pencil', :destroy => 'remove' }
end

Usage¶ ↑

  • Basic Usage

    action_links @user
    
  • Include actions

    action_links @user, :include => [:download]
    
  • Exclude actions

    action_links @user, :exclude => [:edit, :destroy]
    
  • Pass in block

    action_links @user do
      link_to "Hello World", dashboard_path
    end
    
  • Bootstrap buttons. See configuration to customize button types and icons.

    bootstrap_action_links @user
    
  • Namespaced objects

    action_links [:manage, @product]
    
  • Return just the link with optional parameters

    =action_link :edit, @event
    // or more advanced
    =action_link :clone, @event, link_wrapper: :li, url: url_for([:clone, @event]), icon: 'copy', text: 'Copy', class: 'btn'
  • You can even pass in custom attributes with the :html tag

    =action_link :clone, @event, class: 'btn', html: { id: 'super_cool_clone_button' }
    // NOTE: if you define 'class' in the :html hash, it will overwrite the default class,
    //       otherwise you can define class outside of the :html hash like in the above example 
    //       and it will be added to the default value.