Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 26th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.   def gallery_options(options)
  2.     gallery = {}
  3.  
  4.     if not options[:item_id].nil? or not options[:publication_id].nil?
  5.       conditions = {}
  6.       conditions[:item_id]        = options[:item_id] unless options[:item_id].nil?
  7.       conditions[:publication_id] = options[:publication_id] unless options[:publication_id].nil?
  8.  
  9.       images = Gallery.find(:first, :conditions => conditions)
  10.  
  11.       unless images.nil?
  12.         images = images.gallery_image
  13.         images = images.paginate( :page => params[:page], :per_page => options[:paginate] ) unless options[:paginate].nil?
  14.         if params[:image_id]
  15.           img = GalleryImage.find(params[:image_id])
  16.         else
  17.           img = images.first
  18.         end
  19.         gallery[:img] = img
  20.         gallery[:images] = images
  21.       end
  22.     end
  23.     gallery
  24.   end