Skip to content

unmantained-activeadmin-plugins/activeadmin-gallery

Folders and files

NameName
Last commit message
Last commit date
May 23, 2015
Jan 24, 2013
May 25, 2015
May 14, 2013
Oct 24, 2012
Jan 20, 2014
Jan 20, 2014
Jan 20, 2014
Oct 24, 2012
Dec 9, 2014
Jan 20, 2014

Repository files navigation

Active Admin Gallery

⚠️ Unmaintained ⚠️

Sorry, but I no longer work on ActiveAdmin often enough to justify mantaining this gem. Take it as it is. If you are interested to update and maintain the gem, please let me know! ❤️

Description

With activeadmin-gallery, you are able to DRY up your models and freely associate images and galleries to your models. This version is compatible with ActiveAdmin 1.0.x, for the old 0.6.x release see 0-6-stable branch.

Installation

Add activeadmin-gallery to your Gemfile:

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

Run the generator that will create the images table, and migrate.

> rake activeadmin_gallery:install:migrations
> rake db:migrate

Gallery usage

Suppose you want a Page model with an image gallery. In app/models/page.rb:

class Page < ActiveRecord::Base
  has_many_images :album_images
end

No migrations, no models. That's all you need.

In your ActiveAdmin config file:

ActiveAdmin.register Page do

  form do |f|
    # ...
    f.inputs :gallery do
      f.has_many_images :album_images
    end
    # ...
  end

end

Single image usage

Suppose you want a Page model with a single image. Edit app/models/page.rb

class Page < ActiveRecord::Base
  has_image :featured_image
end

No migrations, no models. That's all you need. In your ActiveAdmin config file:

ActiveAdmin.register Page do

  form do |f|
    # ...
    f.inputs :image do
      f.has_image :featured_image
    end
    # ...
  end

end

Copyright

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