From e701524fc72a0527e492a4d261273aa9cbe74185 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Tue, 14 Oct 2014 10:34:06 -0300 Subject: [PATCH] Redirect to control panel after save on edit.Cancel button --- controllers/mpog_software_plugin_myprofile_controller.rb | 12 +++++------- views/mpog_software_plugin_myprofile/edit_software.html.erb | 5 ++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/controllers/mpog_software_plugin_myprofile_controller.rb b/controllers/mpog_software_plugin_myprofile_controller.rb index a7e19a8..6dd9882 100644 --- a/controllers/mpog_software_plugin_myprofile_controller.rb +++ b/controllers/mpog_software_plugin_myprofile_controller.rb @@ -114,13 +114,11 @@ class MpogSoftwarePluginMyprofileController < MyProfileController end end - valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries) - valid_database = DatabaseHelper.valid_list_database?(@list_databases) - valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages) - valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems) - valid_software_categories = request.post? && @software_categories.valid? - - @software_info.save! + begin + @software_info.save! + redirect_to :controller => 'profile_editor', :action => 'index' + rescue ActiveRecord::RecordInvalid => invalid + end end end diff --git a/views/mpog_software_plugin_myprofile/edit_software.html.erb b/views/mpog_software_plugin_myprofile/edit_software.html.erb index 515aae0..2f6199b 100644 --- a/views/mpog_software_plugin_myprofile/edit_software.html.erb +++ b/views/mpog_software_plugin_myprofile/edit_software.html.erb @@ -10,5 +10,8 @@ <%= render_tabs(tabs) %> -<%= submit_button(:save, _('Save')) %> +<% button_bar do %> + <%= submit_button(:save, _('Save')) %> + <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> +<% end %> <% end %> \ No newline at end of file -- libgit2 0.21.2