Sha256: 0084116f24be1cc31387308a79dcfbff19acaace843d8a72ad5766be79e538b9

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

class PhotoAlbumsController < ApplicationController

  respond_to :html, :json, :xml
  layout Spud::Photos.base_layout

  if Spud::Photos.galleries_enabled
    before_filter :get_gallery
  end

  def index
    if @photo_gallery
      @photo_albums = @photo_gallery.albums.order('created_at desc')
    else
      @photo_albums = SpudPhotoAlbum.order('created_at desc')
    end
    respond_with @photo_albums
  end

  def show
    @photo_album = SpudPhotoAlbum.where(:url_name => params[:id]).first
    if @photo_album.blank?
      raise Spud::NotFoundError.new(:item => 'photo album')
    else
      respond_with @photo_album
    end
  end

private

  def get_gallery
    @photo_gallery = SpudPhotoGallery.where(:url_name => params[:photo_gallery_id]).first
    if @photo_gallery.blank?
      raise Spud::NotFoundError.new(:item => 'photo gallery')
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tb_photos-1.0.6 app/controllers/photo_albums_controller.rb
tb_photos-1.0.5 app/controllers/photo_albums_controller.rb
tb_photos-1.0.4 app/controllers/photo_albums_controller.rb