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 4 protect 'destroy_profile', :profile, :only => [:destroy_profile]
5 5  
6 6 before_filter :access_welcome_page, :only => [:welcome_page]
  7 + before_filter :back_to
7 8 helper_method :has_welcome_page
8 9  
9 10 def index
... ... @@ -108,4 +109,9 @@ class ProfileEditorController < MyProfileController
108 109 render_access_denied
109 110 end
110 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 117 end
... ...
app/views/profile_editor/welcome_page.html.erb
... ... @@ -14,7 +14,7 @@
14 14 </div>
15 15  
16 16 <% button_bar do%>
17   - <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %>
  17 + <%= submit_button('save', _('Save'), :cancel => @back_to) %>
18 18 <% end %>
19 19 <% end %>
20 20  
... ...