diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 85d2eb3f4047b39c1af72fd4b999594de339e1cc..8b3f39752a8db570f468bc4af9873e43991da196 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -4,6 +4,9 @@ class ProfilesController < ApplicationController before_filter :authenticate_user! + + respond_to :html + respond_to :js, :only => :update def edit @person = current_user.person @aspect = :person_edit @@ -37,16 +40,28 @@ class ProfilesController < ApplicationController if current_user.update_profile params[:profile] flash[:notice] = I18n.t 'profiles.update.updated' if current_user.getting_started? - redirect_to getting_started_path + respond_to do |format| + format.js { render :nothing => true, :status => 200 } + format.html { redirect_to getting_started_path } + end else - redirect_to edit_profile_path + respond_to do |format| + format.js { render :nothing => true, :status => 200 } + format.html { redirect_to edit_profile_path } + end end else flash[:error] = I18n.t 'profiles.update.failed' if params[:getting_started] - redirect_to getting_started_path(:step => params[:getting_started]) + respond_to do |format| + format.js { render :nothing => true, :status => 409 } + format.html { redirect_to getting_started_path(:step => params[:getting_started]) } + end else - redirect_to edit_profile_path + respond_to do |format| + format.js { render :nothing => true, :status => 409 } + format.html { redirect_to edit_profile_path } + end end end