Sha256: f6e5610508412e502d0500957cf2bdde7c2dc2fff3c204b76b22fc5ddcc53d39

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

class PhotosController < ApplicationController
  before_filter :authenticate_admin!, :except => [:show, :overlay]
  def index
    @photos = Photo.all
  end
  
  def show
    @photo = Photo.find(params[:id])
    render :layout => false
  end
  
  def new
    @index = Index.find(params[:index_id])
    @photo = @index.photos.build(:priority => ((@index.assets.first.lowest_priority + 1) rescue 0))
    render :layout => false
  end
  
  def create
    @photo = Photo.new(params[:photo])
    if @photo.save
      flash[:notice] = "Successfully created photo."
      redirect_to :back
    else
      render :action => 'new'
    end
  end
  
  def edit
    @photo = Photo.find(params[:id])
    render :layout => false
  end
  
  def update
    @photo = Photo.find(params[:id])
    if @photo.update_attributes(params[:photo])
      flash[:notice] = "Successfully updated photo."
      redirect_to :back
    else
      render :action => 'edit'
    end
  end
  
  def destroy
    @photo = Photo.find(params[:id])
    @photo.destroy
    flash[:notice] = "Successfully destroyed photo."
    redirect_to :back
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
sbdevcore-0.1.2 app/controllers/photos_controller.rb
sbdevcore-0.1.1 app/controllers/photos_controller.rb
sbdevcore-0.1.0 app/controllers/photos_controller.rb
sbdevcore-0.0.9 app/controllers/photos_controller.rb
sbdevcore-0.0.8 app/controllers/photos_controller.rb
sbdevcore-0.0.7 app/controllers/photos_controller.rb
sbdevcore-0.0.6 app/controllers/photos_controller.rb
sbdevcore-0.0.5 app/controllers/photos_controller.rb
sbdevcore-0.0.4 app/controllers/photos_controller.rb
sbdevcore-0.0.3 app/controllers/photos_controller.rb
sbdevcore-0.0.1 app/controllers/photos_controller.rb
sbdev-core-0.0.1 app/controllers/photos_controller.rb