/activeadmin-extra

Primary LanguageRubyMIT LicenseMIT

Active Admin Extra

Description

Extra candies for your ActiveAdmin apps.

Installation

Add activeadmin-extra to your Gemfile:

   gem 'activeadmin-extra', github: 'stefanoverna/activeadmin-extra'

Replace active_admin stylesheets and javascripts with:

   @import "active_admin/extra/base"
   #= require active_admin/extra

Custom inputs usage

Spice up your admin forms with these brand new inputs:

Title

String field with a larger font.

   ActiveAdmin.register Page do

     form do |f|
       f.input :name, :as => :title
     end

   end

Chosen

The infamous jquery combobox. To use add to your Gemfile:

   gem 'chosen-rails', group: :assets

and then in your assets:

   #= require chosen-jquery
   @import "chosen"

Usage:

   ActiveAdmin.register Product do

     form do |f|
       f.input :material, as: :chosen, create_option: true
     end

   end

For the create_option alternative use koenpunt's fork.

Measure

Number with unit of measure symbol

   ActiveAdmin.register Product do

     form do |f|
       f.input :price, :as => :measure, :symbol => '€'
     end

   end

Numbers set

A row of numeric inputs side by side. Basic usage:

   ActiveAdmin.register Box do

     form do |f|
       f.input :height, :as => :numbers_set # default displays a height_min and a height_max field
     end

   end

Multiple options:

   ActiveAdmin.register Box do

     form do |f|
       f.input :height, :as => :numbers_set, :numbers_set => [:mm, :in, :ft]
     end

   end

Copyright

Copyright (c) 2012 Stefano Verna, Cantiere Creativo See the file LICENSE.txt for details.