0
class PhotosController < ApplicationController
0
+ # before_filter :login_required
0
+ # before_filter :correct_user_required, :only => [ :edit, :update, :destroy ]
0
+ # before_filter :cancellation, :only => [ :create ]
0
+ # @person = Person.find_by_hashed_id(params[:person_id])
0
+ # @photos = @person.photos
0
+ # respond_to do |format|
0
+ # format.html # index.html.erb
0
+ # format.xml { render :xml => @photos }
0
+ # # GET /photos/new.xml
0
+ # respond_to do |format|
0
+ # format.html # new.html.erb
0
+ # format.xml { render :xml => @photo }
0
+ # # GET /photos/1/edit
0
+ # @photo = Photo.find_by_hashed_id(params[:id])
0
+ # @display_photo = @photo
0
+ # if params[:photo][:uploaded_data].blank?
0
+ # flash[:error] = "Please choose an image"
0
+ # redirect_to new_photo_url and return
0
+ # @photo = Photo.new(params[:photo].merge(
0
+ # { :person => current_person,
0
+ # :primary => current_person.photos.empty? }))
0
+ # respond_to do |format|
0
+ # format.html { redirect_to(edit_person_path(current_person)) }
0
+ # format.xml { render :xml => @photo, :status => :created, :location => @photo }
0
+ # format.html { render :action => "new" }
0
+ # format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }
0
+ # @photo = Photo.find_by_hashed_id(params[:id])
0
+ # redirect_to edit_person_url(current_person) and return if @photo.nil?
0
+ # # This should only have one entry, but be paranoid.
0
+ # # Also, subtract out current photo in case some idiot puts to this
0
+ # @old_primary = current_person.photos.select(&:primary?) - [@photo]
0
+ # respond_to do |format|
0
+ # if @photo.update_attributes(:primary => true)
0
+ # @old_primary.each { |p| p.update_attributes!(:primary => false) }
0
+ # format.html { redirect_to(edit_person_path(current_person)) }
0
+ # format.xml { head :ok }
0
+ # flash[:error] = "Invalid image!"
0
+ # redirect_to home_url
0
+ # format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }
0
+ # # DELETE /photos/1.xml
0
+ # @photo = Photo.find_by_hashed_id(params[:id])
0
+ # redirect_to edit_person_url(current_person) and return if @photo.nil?
0
+ # first_non_primary = current_person.photos.reject(&:primary?).first
0
+ # unless first_non_primary.nil?
0
+ # first_non_primary.update_attributes!(:primary => true)
0
+ # respond_to do |format|
0
+ # format.html { redirect_to edit_person_url(current_person) }
0
+ # format.xml { head :ok }
0
+ # def correct_user_required
0
+ # photo = Photo.find_by_hashed_id(params[:id])
0
+ # redirect_to edit_person_url(current_person) and return if photo.nil?
0
+ # unless photo.person == current_person
0
+ # redirect_to login_url
0
+ # cancel = params[:commit] == "Cancel"
0
+ # redirect_to edit_person_url(current_person) if cancel
Comments
No one has commented yet.