From d28d0372ef7a0d37aed65f664f74e46cb3db7e49 Mon Sep 17 00:00:00 2001 From: David Carlos Date: Tue, 19 Aug 2014 11:11:37 -0300 Subject: [PATCH] institution_fields: Restrict SISP visualization field. --- lib/mpog_software_plugin.rb | 8 +++++++- views/institution_editor_extras.html.erb | 15 ++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 7635847..80b3114 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -16,6 +16,11 @@ class MpogSoftwarePlugin < Noosfero::Plugin _("Add Public Software and MPOG features.") end + def show_sisp_field current_user + @show_sisp_field = current_user.login == "adminuser" + @show_sisp_field + end + def signup_extra_contents institutions = Institution.all @@ -60,7 +65,8 @@ class MpogSoftwarePlugin < Noosfero::Plugin end end - def profile_editor_extras + def profile_editor_extras show_sisp_field + @show_sisp_field = show_sisp_field if context.profile.person? expanded_template('person_editor_extras.html.erb') elsif context.profile.respond_to? :software_info and !context.profile.software_info.nil? diff --git a/views/institution_editor_extras.html.erb b/views/institution_editor_extras.html.erb index 2423c42..0663856 100644 --- a/views/institution_editor_extras.html.erb +++ b/views/institution_editor_extras.html.erb @@ -36,12 +36,13 @@ +<% if @show_sisp_field[0] %> -
- <%= _("SISP?") %> - <%= labelled_radio_button(_('Yes'), 'institution[sisp]', 'true', context.profile.institution.sisp)%> - <%= labelled_radio_button(_('No'), 'institution[sisp]', 'false', !context.profile.institution.sisp)%> -
-
- +
+ <%= _("SISP?") %> + <%= labelled_radio_button(_('Yes'), 'institution[sisp]', 'true', context.profile.institution.sisp)%> + <%= labelled_radio_button(_('No'), 'institution[sisp]', 'false', !context.profile.institution.sisp)%> +
+ +<% end %> <% end %> -- libgit2 0.21.2