Coder Social home page Coder Social logo

activeadmin-select2's Introduction

ActiveAdmin Select2

Description

Incorporate Select2 JQuery into your ActiveAdmin apps.

Installation

Add activeadmin, jquery-rails and select2-rails to your Gemfile:

   gem 'activeadmin'
   gem 'jquery-rails'
   gem 'select2-rails'

And add activeadmin-select2 to your Gemfile:

   gem 'activeadmin-select2', github: 'mfairburn/activeadmin-select2'

Add the activeadmin-select2 calls to the active_admin stylesheets and javascripts with:

   @import "active_admin/select2/base";
   #= require active_admin/select2

Usage

Filters

Standard :select filters will automagically be converted to Select2 filters. If you want a multi-select combo-box then use:

   ActiveAdmin.register Products do

      filter :fruits, as: :select2_multiple, collection: [:apples, :bananas, :oranges]

   end

Select Lists

To use a Select2 style list simply change from :select to :select2 or :select2_multiple

   ActiveAdmin.register Products do

     form do |f|
       f.input :fruit, as: :select2
     end

     form do |f|
       f.inputs "Product" do
         f.has_many :fruits, allow_destroy: true, new_record: "Add Fruit" do |e|
           e.input :fruit, as: :select2_multiple
         end
       end
     end

   end

Acknowledgements

Copyright

Copyright (c) 2014 Mark Fairburn, Praxitar Ltd See the file LICENSE.txt for details.

activeadmin-select2's People

Contributors

arambert avatar kiddrew avatar mfairburn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.