Skip to content

unmantained-activeadmin-plugins/activeadmin-gallery

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •