From e9a1132bb4d860fa92a6a1eb13dd291f5acdb978 Mon Sep 17 00:00:00 2001 From: Francis Irving Date: Thu, 15 Jul 2010 16:09:39 +0100 Subject: Make profile photo upload work without javascript (for Matthew :) --- app/controllers/user_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers/user_controller.rb') 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? -- cgit v1.2.3