From b8715f088a9bea23ef95fdc562a82b56d0f7d129 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Thu, 14 Aug 2014 08:20:30 -0400 Subject: [PATCH] Add country, state, city in institution registration --- public/mpog-institution-validations.js | 8 ++++++-- views/mpog_software_plugin/create_institution.html.erb | 4 ++++ views/profile/_institution_tab.html.erb | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/public/mpog-institution-validations.js b/public/mpog-institution-validations.js index 5ba4062..66d85f4 100644 --- a/public/mpog-institution-validations.js +++ b/public/mpog-institution-validations.js @@ -48,11 +48,15 @@ function get_post_data() { return { - community : { name : jQuery("#community_name").val()}, + community : { name : jQuery("#community_name").val(), + country : jQuery("#community_country").val(), + state : jQuery("#community_state").val(), + city : jQuery("#community_city").val() + }, governmental : { power : jQuery("#institutions_governmental_power").selected().val(), sphere : jQuery("#institutions_governmental_sphere").selected().val() - } , + }, institution : { cnpj: jQuery("#institutions_cnpj").val(), type: get_selected_institution_type(), diff --git a/views/mpog_software_plugin/create_institution.html.erb b/views/mpog_software_plugin/create_institution.html.erb index d02c46e..79c26f1 100644 --- a/views/mpog_software_plugin/create_institution.html.erb +++ b/views/mpog_software_plugin/create_institution.html.erb @@ -24,6 +24,10 @@ <%= required f.text_field(:name) %> <%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %> + <%= required select_country(_('Country'), f, 'country', {:class => 'type-select', :id => "community_country"}) %> + <%= required f.text_field(:state) %> + <%= required f.text_field(:city) %> + <%= fields_for :institutions do |inst| %> diff --git a/views/profile/_institution_tab.html.erb b/views/profile/_institution_tab.html.erb index 72beb4f..1f82177 100644 --- a/views/profile/_institution_tab.html.erb +++ b/views/profile/_institution_tab.html.erb @@ -6,6 +6,9 @@ <%= display_field(_('Type:'), profile.institution, :type, true) %> <%= display_field(_('CNPJ:'), profile.institution, :cnpj, true) %> <%= display_field(_('Last modification:'), profile.institution, :date_modification, true) %> + <%= display_field(_('Country:'), profile.institution.community, :country, true) %> + <%= display_field(_('State:'), profile.institution.community, :state, true) %> + <%= display_field(_('City:'), profile.institution.community, :city, true) %> <% if profile.institution.type == "PrivateInstitution"%> <%= display_field(_('Fantasy Name:'), profile.institution, :acronym, true) %> <% else %> -- libgit2 0.21.2