Commit 9e178cd34bde4d12e19a1228a6a4333671e25327

Authored by Gabriela Navarro
Committed by Fabio Teixeira
1 parent 774f7bc0
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

Add new fields on create institution view

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Parley Martins <parley@outlook.com>
controllers/mpog_software_plugin_controller.rb
... ... @@ -163,7 +163,9 @@ class MpogSoftwarePluginController &lt; ApplicationController
163 163 begin
164 164 govPower = GovernmentalPower.find params[:governmental][:power]
165 165 govSphere = GovernmentalSphere.find params[:governmental][:sphere]
  166 + jur_nature = JuridicalNature.find params[:juridical][:nature]
166 167  
  168 + institution.juridical_nature = jur_nature
167 169 institution.governmental_power = govPower
168 170 institution.governmental_sphere = govSphere
169 171 rescue
... ...
lib/institution.rb
1 1 class Institution < ActiveRecord::Base
2 2 belongs_to :governmental_power
3 3 belongs_to :governmental_sphere
  4 + belongs_to :juridical_nature
4 5  
5   - attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type,
6   - :juridical_nature, :sub_juridical_nature, :normalization_level,
7   - :version, :cnpj, :type, :governmental_power, :governmental_sphere
8 6 has_and_belongs_to_many :users
9 7  
  8 + attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type,
  9 + :sub_juridical_nature, :normalization_level,
  10 + :version, :cnpj, :type, :governmental_power, :governmental_sphere,
  11 + :sisp, :juridical_nature
  12 +
10 13 validates :name, :presence=>true, :uniqueness=>true
11 14  
12 15 before_save :verify_institution_type
... ...
public/mpog-institution-validations.js
... ... @@ -57,10 +57,13 @@
57 57 power : jQuery("#institutions_governmental_power").selected().val(),
58 58 sphere : jQuery("#institutions_governmental_sphere").selected().val()
59 59 },
  60 + juridical : {
  61 + nature : jQuery("#institutions_juridical_nature").selected().val()
  62 + },
60 63 institution : {
61 64 cnpj: jQuery("#institutions_cnpj").val(),
62 65 type: get_selected_institution_type(),
63   - acronym : jQuery("#institutions_acronym").val()
  66 + acronym : jQuery("#institutions_acronym").val(),
64 67 },
65 68 authenticity_token : jQuery("input[name='authenticity_token']").val(),
66 69 recaptcha_response_field : jQuery('#recaptcha_response_field').val(),
... ...
views/mpog_software_plugin/create_institution.html.erb
... ... @@ -69,6 +69,12 @@
69 69 </div>
70 70 </span>
71 71  
  72 + <span class='required-field public-institutions-fields'>
  73 + <div class="formfield type-text">
  74 + <%= inst.label("juridical_nature_id" ,_("Juridical Nature:"), :class=>"formlabel") %>
  75 + <%= inst.select(:juridical_nature, [[_("Select a Juridical Nature"), 0]]|JuridicalNature.all.map {|j| [j.name, j.id]}, {:selected=>0})%>
  76 + </div>
  77 + </span>
72 78 <br />
73 79  
74 80 <div>
... ...