aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/user_controller.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-07-15 16:09:39 +0100
committerFrancis Irving <francis@mysociety.org>2010-07-15 16:09:39 +0100
commite9a1132bb4d860fa92a6a1eb13dd291f5acdb978 (patch)
tree7cf70cccff33577bbbd2775f145308596415f6b0 /app/controllers/user_controller.rb
parent160645b6f067ff0a8bb43118aafe5bd0a4370a91 (diff)
Make profile photo upload work without javascript (for Matthew :)
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r--app/controllers/user_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index e2998333c..85d09abc7 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -372,6 +372,16 @@ class UserController < ApplicationController
end
@draft_profile_photo.save
+ if params[:automatically_crop]
+ # no javascript, crop automatically
+ @profile_photo = ProfilePhoto.new(:data => @draft_profile_photo.data, :draft => false)
+ @user.set_profile_photo(@profile_photo)
+ @draft_profile_photo.destroy
+ flash[:notice] = "Thank you for updating your profile photo"
+ redirect_to user_url(@user)
+ return
+ end
+
render :template => 'user/set_crop_profile_photo.rhtml'
return
elsif !params[:submitted_crop_profile_photo].nil?