diff options
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r-- | app/controllers/user_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index a07701208..e2998333c 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -375,8 +375,12 @@ class UserController < ApplicationController render :template => 'user/set_crop_profile_photo.rhtml' return elsif !params[:submitted_crop_profile_photo].nil? - # change user's photo + # crop the draft photo according to jquery parameters and set it as the users photo + draft_profile_photo = ProfilePhoto.find(params[:draft_profile_photo_id]) + @profile_photo = ProfilePhoto.new(:data => draft_profile_photo.data, :draft => false, + :x => params[:x], :y => params[:y], :w => params[:w], :h => params[:h]) @user.set_profile_photo(@profile_photo) + draft_profile_photo.destroy flash[:notice] = "Thank you for updating your profile photo" redirect_to user_url(@user) else |