Commit da9bf73dd673df50ea10dc2a3521d93555302ae2

Authored by Rodrigo Souto
1 parent c8036845

[template-welcome-page] Add back_to to welcome_page edition

app/controllers/my_profile/profile_editor_controller.rb
@@ -4,6 +4,7 @@ class ProfileEditorController < MyProfileController @@ -4,6 +4,7 @@ class ProfileEditorController < MyProfileController
4 protect 'destroy_profile', :profile, :only => [:destroy_profile] 4 protect 'destroy_profile', :profile, :only => [:destroy_profile]
5 5
6 before_filter :access_welcome_page, :only => [:welcome_page] 6 before_filter :access_welcome_page, :only => [:welcome_page]
  7 + before_filter :back_to
7 helper_method :has_welcome_page 8 helper_method :has_welcome_page
8 9
9 def index 10 def index
@@ -108,4 +109,9 @@ class ProfileEditorController < MyProfileController @@ -108,4 +109,9 @@ class ProfileEditorController < MyProfileController
108 render_access_denied 109 render_access_denied
109 end 110 end
110 end 111 end
  112 +
  113 + #TODO Consider using this as a general controller feature to be available on every action.
  114 + def back_to
  115 + @back_to = params[:back_to] || request.referer
  116 + end
111 end 117 end
app/views/profile_editor/welcome_page.html.erb
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 </div> 14 </div>
15 15
16 <% button_bar do%> 16 <% button_bar do%>
17 - <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> 17 + <%= submit_button('save', _('Save'), :cancel => @back_to) %>
18 <% end %> 18 <% end %>
19 <% end %> 19 <% end %>
20 20