From 0a3a013b13cea733c4a317422370aeea505bdbcc Mon Sep 17 00:00:00 2001 From: Gabriel Silva Date: Tue, 12 Jan 2016 17:43:23 +0000 Subject: [PATCH] Fix edit institution form --- src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb | 2 ++ src/noosfero-spb/gov_user/public/views/create-institution.js | 4 ++-- src/noosfero-spb/gov_user/public/views/new-community.js | 6 ------ src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb | 1 + src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb | 8 ++++++-- src/noosfero-spb/software_communities/public/views/new-community.js | 6 ------ 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb b/src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb index 1571c77..d049cec 100644 --- a/src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb +++ b/src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb @@ -1,6 +1,8 @@ class GovUserPluginMyprofileController < MyProfileController append_view_path File.join(File.dirname(__FILE__) + '/../views') + protect "edit_institution", :profile + def index end diff --git a/src/noosfero-spb/gov_user/public/views/create-institution.js b/src/noosfero-spb/gov_user/public/views/create-institution.js index 61578c1..d216a9a 100644 --- a/src/noosfero-spb/gov_user/public/views/create-institution.js +++ b/src/noosfero-spb/gov_user/public/views/create-institution.js @@ -270,8 +270,8 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] function show_hide_cnpj_city(country) { - var cnpj = $("#institutions_cnpj").parent(); - var city = $("#community_city").parent(); + var cnpj = $("#institutions_cnpj").parent().parent(); + var city = $("#community_city").parent().parent(); var state = $("#community_state").parent(); var inst_type = $("input[name='institutions[type]']:checked").val(); diff --git a/src/noosfero-spb/gov_user/public/views/new-community.js b/src/noosfero-spb/gov_user/public/views/new-community.js index 0de70c7..f9834d2 100644 --- a/src/noosfero-spb/gov_user/public/views/new-community.js +++ b/src/noosfero-spb/gov_user/public/views/new-community.js @@ -2,11 +2,6 @@ modulejs.define("NewCommunity", ['jquery'], function($) { - function replace_mandatory_message() { - $(".required-field").first() - .replaceWith(" Os campos em destaque são obrigatórios. "); - } - function remove_image_builder_text() { $("label:contains('Image builder')").hide(); } @@ -22,7 +17,6 @@ modulejs.define("NewCommunity", ['jquery'], function($) { }, init: function() { - replace_mandatory_message(); remove_image_builder_text(); hide_organization_template_fields(); } diff --git a/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb b/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb index 61c48b1..0e30a2d 100644 --- a/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb +++ b/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb @@ -40,6 +40,7 @@ class GovUserPluginMyprofileControllerTest < ActionController::TestCase "12.345.678/9012-45" ) + institution.community.add_admin @person identifier = institution.community.identifier fields = InstitutionTestHelper.generate_form_fields( diff --git a/src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb b/src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb index 7b0f936..e29c871 100644 --- a/src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb +++ b/src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb @@ -19,6 +19,10 @@
+
+ <%= _("The highlighted fields are mandatory") %> +
+
<%= labelled_form_for :community,:html => { :multipart => true, :id=>"institution_form" } do |f| %> <%= hidden_field_tag "edit_institution_page", true %> @@ -39,10 +43,10 @@ <%= required f.text_field(:name, :value => @institution.community.name) %> <%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %> - +
<%= inst.label "corporate_name", _("Corporate Name"), :class=>"formlabel" %> - <%= required inst.text_field(:corporate_name, :value => @institution.corporate_name) %> + <%= inst.text_field(:corporate_name, :value => @institution.corporate_name) %>
diff --git a/src/noosfero-spb/software_communities/public/views/new-community.js b/src/noosfero-spb/software_communities/public/views/new-community.js index b665e8f..a5e585e 100644 --- a/src/noosfero-spb/software_communities/public/views/new-community.js +++ b/src/noosfero-spb/software_communities/public/views/new-community.js @@ -1,10 +1,5 @@ modulejs.define("NewCommunity", ['jquery'], function($) { - function replace_mandatory_message() { - $(".required-field").first() - .replaceWith(" Os campos em destaque são obrigatórios. "); - } - function remove_image_builder_text() { $("label:contains('Image builder')").hide(); } @@ -20,7 +15,6 @@ modulejs.define("NewCommunity", ['jquery'], function($) { }, init: function() { - replace_mandatory_message(); remove_image_builder_text(); hide_organization_template_fields(); } -- libgit2 0.21.2