From eadf3233096c9101b50a11b0814dffd52b357b51 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Thu, 14 Aug 2014 11:56:27 -0300 Subject: [PATCH] Add new fields on institution edit and visualization view --- lib/mpog_software_plugin.rb | 5 +++++ views/institution_editor_extras.html.erb | 18 +++++++++++++++++- views/profile/_institution_tab.html.erb | 4 +++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 5b8c002..7635847 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -256,6 +256,11 @@ class MpogSoftwarePlugin < Noosfero::Plugin context.profile.institution.save! end + if context.params.has_key?(:juridical_nature) + context.profile.institution.juridical_nature_id = context.params[:juridical_nature] + context.profile.institution.save! + end + if context.params.has_key?(:institution) Institution.transaction do context.profile.institution.update_attributes!(context.params[:institution]) diff --git a/views/institution_editor_extras.html.erb b/views/institution_editor_extras.html.erb index bd6fbc7..2423c42 100644 --- a/views/institution_editor_extras.html.erb +++ b/views/institution_editor_extras.html.erb @@ -28,4 +28,20 @@ <%= select_tag(:governmental_sphere, options_for_select(GovernmentalSphere.all.map {|s| [s.name, s.id]}, :selected => context.profile.institution.governmental_sphere_id), :class=>"formlabel") %> -<% end %> \ No newline at end of file + + +
+ <%= label_tag('juridical_nature', _("Juridical Nature")) %> + <%= select_tag(:juridical_nature, options_for_select(JuridicalNature.all.map {|j| [j.name, j.id]}, :selected => context.profile.institution.juridical_nature_id), :class=>"formlabel") %> +
+
+ + +
+ <%= _("SISP?") %> + <%= labelled_radio_button(_('Yes'), 'institution[sisp]', 'true', context.profile.institution.sisp)%> + <%= labelled_radio_button(_('No'), 'institution[sisp]', 'false', !context.profile.institution.sisp)%> +
+
+ +<% end %> diff --git a/views/profile/_institution_tab.html.erb b/views/profile/_institution_tab.html.erb index 1f82177..cc8aaaf 100644 --- a/views/profile/_institution_tab.html.erb +++ b/views/profile/_institution_tab.html.erb @@ -15,5 +15,7 @@ <%= display_field(_('Acronym:'), profile.institution, :acronym, true) %> <%= display_field(_('Governmental Power:'), profile.institution.governmental_power, :name, true) %> <%= display_field(_('Governmental Sphere:'), profile.institution.governmental_sphere, :name, true) %> + <%= display_field(_('Juridical Nature:'), profile.institution.juridical_nature, :name, true) %> + <%= content_tag('tr', content_tag('td', _("SISP:")) + content_tag('td', profile.institution.sisp ? _("Yes") : _("No"))) %> <% end %> - \ No newline at end of file + -- libgit2 0.21.2