Sha256: 4ee2fd9ba30e25d18afa3d57b90f8d7ca3da29cecd1fd03ecc20ad68d5317c00

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

module Gallery::ApplicationHelper
  
  def comfy_gallery_form_for(record_or_name_or_array, *args, &proc)
    options = args.extract_options!
    form_for(
      record_or_name_or_array,
      *(args << options.merge(:builder => ComfyGallery.config.form_builder.to_s.constantize)),
      &proc
    )
  end
  
  def render_gallery(slug, type = 'thumbnails')
    @gallery = Gallery::Gallery.find_by_slug(slug)
    if (@gallery)
      render :partial => "gallery/#{type}"
    else
      render :text => 'Gallery not found', :status => 404
    end
  end
  
  def render_galleries(type = 'list_galleries')
    @galleries = Gallery::Gallery.all
    if (@galleries)
      render :partial => "gallery/#{type}"
    else
      render :text => 'Gallery not found', :status => 404
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comfy_gallery-0.1.1 app/helpers/gallery/application_helper.rb
comfy_gallery-0.1.0 app/helpers/gallery/application_helper.rb