wip save on blur

This commit is contained in:
Ilya Zhitomirskiy 2011-10-18 13:51:18 -07:00 committed by danielgrippi
parent c7838debcf
commit 80216cb024

View file

@ -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