Skip to content

webpulser/sortable_pictures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sortable pictures

You can manage & sort pictures

How to use ?

Model


 class Model < ActiveRecord::Base
   sortable_pictures
 end

Controller


 def create
   @model = Model.find params[:id]
   picture = Picture.new params[:picture]
   if picture.save
     sortable_pictures = picture.sortable_pictures.new
     sortable_picture.picturable = @model
     sortable_picture.save
   end
 end

View


 <% @model.pictures.each do |picture| %>
   <%= image_tag(picture.public_filename :thumb) %>
 <% end %>

Configuration file

in RAILS_ROOT + config/sortable_pictures.yml

  
storage: :file_system file_system_path: 'public/images/sortable_pictures' content_type: 'image' thumbnails: :big: '500x500', :normal: '200x200' :small: '100x100' :thumb: '50x50'

About

Desert plugin to associate objects with pictures

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages