diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index e06532b..b564754 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -4,6 +4,7 @@ class ProfileEditorController < MyProfileController protect 'destroy_profile', :profile, :only => [:destroy_profile] before_filter :access_welcome_page, :only => [:welcome_page] + before_filter :back_to helper_method :has_welcome_page def index @@ -108,4 +109,9 @@ class ProfileEditorController < MyProfileController render_access_denied end end + + #TODO Consider using this as a general controller feature to be available on every action. + def back_to + @back_to = params[:back_to] || request.referer + end end diff --git a/app/views/profile_editor/welcome_page.html.erb b/app/views/profile_editor/welcome_page.html.erb index 3b3cc24..45f984d 100644 --- a/app/views/profile_editor/welcome_page.html.erb +++ b/app/views/profile_editor/welcome_page.html.erb @@ -14,7 +14,7 @@ <% button_bar do%> - <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> + <%= submit_button('save', _('Save'), :cancel => @back_to) %> <% end %> <% end %> -- libgit2 0.21.2