diff --git a/controllers/mpog_software_plugin_controller.rb b/controllers/mpog_software_plugin_controller.rb index 5d80214..f58c589 100644 --- a/controllers/mpog_software_plugin_controller.rb +++ b/controllers/mpog_software_plugin_controller.rb @@ -163,7 +163,9 @@ class MpogSoftwarePluginController < ApplicationController begin govPower = GovernmentalPower.find params[:governmental][:power] govSphere = GovernmentalSphere.find params[:governmental][:sphere] + jur_nature = JuridicalNature.find params[:juridical][:nature] + institution.juridical_nature = jur_nature institution.governmental_power = govPower institution.governmental_sphere = govSphere rescue diff --git a/lib/institution.rb b/lib/institution.rb index 159eafc..c8b5cc9 100644 --- a/lib/institution.rb +++ b/lib/institution.rb @@ -1,12 +1,15 @@ class Institution < ActiveRecord::Base belongs_to :governmental_power belongs_to :governmental_sphere + belongs_to :juridical_nature - attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type, - :juridical_nature, :sub_juridical_nature, :normalization_level, - :version, :cnpj, :type, :governmental_power, :governmental_sphere has_and_belongs_to_many :users + attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type, + :sub_juridical_nature, :normalization_level, + :version, :cnpj, :type, :governmental_power, :governmental_sphere, + :sisp, :juridical_nature + validates :name, :presence=>true, :uniqueness=>true before_save :verify_institution_type diff --git a/public/mpog-institution-validations.js b/public/mpog-institution-validations.js index 66d85f4..26e4dbc 100644 --- a/public/mpog-institution-validations.js +++ b/public/mpog-institution-validations.js @@ -57,10 +57,13 @@ power : jQuery("#institutions_governmental_power").selected().val(), sphere : jQuery("#institutions_governmental_sphere").selected().val() }, + juridical : { + nature : jQuery("#institutions_juridical_nature").selected().val() + }, institution : { cnpj: jQuery("#institutions_cnpj").val(), type: get_selected_institution_type(), - acronym : jQuery("#institutions_acronym").val() + acronym : jQuery("#institutions_acronym").val(), }, authenticity_token : jQuery("input[name='authenticity_token']").val(), recaptcha_response_field : jQuery('#recaptcha_response_field').val(), diff --git a/views/mpog_software_plugin/create_institution.html.erb b/views/mpog_software_plugin/create_institution.html.erb index 79c26f1..1cfd64b 100644 --- a/views/mpog_software_plugin/create_institution.html.erb +++ b/views/mpog_software_plugin/create_institution.html.erb @@ -69,6 +69,12 @@ + +
+ <%= inst.label("juridical_nature_id" ,_("Juridical Nature:"), :class=>"formlabel") %> + <%= inst.select(:juridical_nature, [[_("Select a Juridical Nature"), 0]]|JuridicalNature.all.map {|j| [j.name, j.id]}, {:selected=>0})%> +
+

-- libgit2 0.21.2