Commit 79b3cc8939ada552f1f8906c0f5d6e8b9492832c

Authored by Gabriela Navarro
1 parent 72f615dd
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Save and redirects successfully.

Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
controllers/mpog_software_plugin_controller.rb
... ... @@ -47,13 +47,27 @@ class MpogSoftwarePluginController &lt; ApplicationController
47 47 end
48 48  
49 49 def create_institution_admin
50   -
  50 + @url_token = split_http_referer request.original_url()
  51 +
  52 + if request.post?
  53 + governmental = {}
  54 + juridical = {}
  55 + governmental[:power] = params[:institutions][:governmental_power]
  56 + governmental[:sphere] = params[:institutions][:governmental_sphere]
  57 + juridical[:nature] = params[:institutions][:juridical_nature]
  58 + params[:community][:country] = "BR"
  59 + params[:institutions].delete :governmental_power
  60 + params[:institutions].delete :governmental_sphere
  61 + params[:institutions].delete :juridical_nature
  62 + redirect_to :action => "new_institution", :community => params[:community], :institution => params[:institutions], :governmental => governmental, :juridical => juridical
  63 + end
51 64 end
52 65  
53 66 def split_http_referer http_referer
54 67 split_list = []
55 68 split_list = http_referer.split("/")
56   - return split_list.last
  69 + @url_token = split_list.last
  70 + return @url_token
57 71 end
58 72  
59 73  
... ... @@ -71,7 +85,8 @@ class MpogSoftwarePluginController &lt; ApplicationController
71 85 if request.xhr? and (split_http_referer(request.referer()) != "create_institution_admin")
72 86 render :json => response_message.to_json
73 87 else
74   - session[:notice] = response_message # consume the notice
  88 + session[:notice] = response_message[:message] # consume the notice
  89 + redirect_to :controller => "/admin_panel", :action => "index"
75 90 end
76 91 else
77 92 redirect_to "/"
... ...
views/mpog_software_plugin/_institution.html.erb
... ... @@ -91,10 +91,15 @@
91 91 </span>
92 92 <br />
93 93  
94   - <div>
95   - <%= link_to(_('Save'), '#', :id=>'save_institution_button', :class=>'button with-text icon-add') %>
96   - </div>
97   - <%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>
  94 + <% if @url_token == "create_institution_admin" %>
  95 + <%= submit_button :save, _('Save') %>
  96 + <%else%>
  97 + <div>
  98 + <%= link_to(_('Save'), '#', :id=>'save_institution_button', :class=>'button with-text icon-add') %>
  99 + </div>
  100 + <%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>
  101 + <%end%>
  102 +
98 103 <% end %>
99 104  
100 105 <% end %>
... ...