Sha256: 4bbc1fe5edb2b3eef92ac85c4b9180dd7e244d2b9073aab20e4b65e12e660b39

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

module SofaGalleryHelper
  
  def sofa_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 => SofaGallery.config.form_builder.to_s.constantize)),
      &proc
    )
  end
  
  def render_gallery(slug, type = 'thumbnails')
    @gallery = SofaGallery::Gallery.find_by_slug(slug)
    if (@gallery)
      render :partial => "sofa_gallery/#{type}"
    else
      render :text => 'Gallery not found.', :status => 404
    end
  end
  
  def render_galleries(type = 'list_galleries')
    @galleries = SofaGallery::Gallery.all
    if (@galleries)
      render :partial => "sofa_gallery/#{type}"
    else
      render :text => 'Gallery not found.', :status => 404
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sofa_gallery-0.0.6 app/helpers/sofa_gallery_helper.rb