Commit e701524fc72a0527e492a4d261273aa9cbe74185

Authored by Gabriela Navarro
Committed by Fabio Teixeira
1 parent da1dcd8c

Redirect to control panel after save on edit.Cancel button

Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
controllers/mpog_software_plugin_myprofile_controller.rb
... ... @@ -114,13 +114,11 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
114 114 end
115 115 end
116 116  
117   - valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries)
118   - valid_database = DatabaseHelper.valid_list_database?(@list_databases)
119   - valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages)
120   - valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems)
121   - valid_software_categories = request.post? && @software_categories.valid?
122   -
123   - @software_info.save!
  117 + begin
  118 + @software_info.save!
  119 + redirect_to :controller => 'profile_editor', :action => 'index'
  120 + rescue ActiveRecord::RecordInvalid => invalid
  121 + end
124 122 end
125 123 end
126 124  
... ...
views/mpog_software_plugin_myprofile/edit_software.html.erb
... ... @@ -10,5 +10,8 @@
10 10  
11 11 <%= render_tabs(tabs) %>
12 12  
13   -<%= submit_button(:save, _('Save')) %>
  13 +<% button_bar do %>
  14 + <%= submit_button(:save, _('Save')) %>
  15 + <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
  16 +<% end %>
14 17 <% end %>
15 18 \ No newline at end of file
... ...