Commit 0a3a013b13cea733c4a317422370aeea505bdbcc

Authored by Gabriel Silva
1 parent 418b9fca

Fix edit institution form

Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Signed-off-by: Omar Junior <omarroinuj@gmail.com>
src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb
1 1 class GovUserPluginMyprofileController < MyProfileController
2 2 append_view_path File.join(File.dirname(__FILE__) + '/../views')
3 3  
  4 + protect "edit_institution", :profile
  5 +
4 6 def index
5 7 end
6 8  
... ...
src/noosfero-spb/gov_user/public/views/create-institution.js
... ... @@ -270,8 +270,8 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
270 270  
271 271  
272 272 function show_hide_cnpj_city(country) {
273   - var cnpj = $("#institutions_cnpj").parent();
274   - var city = $("#community_city").parent();
  273 + var cnpj = $("#institutions_cnpj").parent().parent();
  274 + var city = $("#community_city").parent().parent();
275 275 var state = $("#community_state").parent();
276 276 var inst_type = $("input[name='institutions[type]']:checked").val();
277 277  
... ...
src/noosfero-spb/gov_user/public/views/new-community.js
... ... @@ -2,11 +2,6 @@
2 2  
3 3 modulejs.define("NewCommunity", ['jquery'], function($) {
4 4  
5   - function replace_mandatory_message() {
6   - $(".required-field").first()
7   - .replaceWith("<span class='required-field'> Os campos em destaque<label class='pseudoformlabel'> (*)</label> são obrigatórios. </span>");
8   - }
9   -
10 5 function remove_image_builder_text() {
11 6 $("label:contains('Image builder')").hide();
12 7 }
... ... @@ -22,7 +17,6 @@ modulejs.define(&quot;NewCommunity&quot;, [&#39;jquery&#39;], function($) {
22 17 },
23 18  
24 19 init: function() {
25   - replace_mandatory_message();
26 20 remove_image_builder_text();
27 21 hide_organization_template_fields();
28 22 }
... ...
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb
... ... @@ -40,6 +40,7 @@ class GovUserPluginMyprofileControllerTest &lt; ActionController::TestCase
40 40 "12.345.678/9012-45"
41 41 )
42 42  
  43 + institution.community.add_admin @person
43 44 identifier = institution.community.identifier
44 45  
45 46 fields = InstitutionTestHelper.generate_form_fields(
... ...
src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb
... ... @@ -19,6 +19,10 @@
19 19  
20 20 <div id = 'create_institution_errors' class='errorExplanation hide-field'></div>
21 21  
  22 +<div class="spb-row spb-col spb-col-12 required-field">
  23 + <%= _("The highlighted fields are mandatory") %>
  24 +</div>
  25 +
22 26 <div>
23 27 <%= labelled_form_for :community,:html => { :multipart => true, :id=>"institution_form" } do |f| %>
24 28 <%= hidden_field_tag "edit_institution_page", true %>
... ... @@ -39,10 +43,10 @@
39 43 <%= required f.text_field(:name, :value => @institution.community.name) %>
40 44 <%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %>
41 45  
42   - <span class='required-field'>
  46 + <span>
43 47 <div class="formfield type-text">
44 48 <%= inst.label "corporate_name", _("Corporate Name"), :class=>"formlabel" %>
45   - <%= required inst.text_field(:corporate_name, :value => @institution.corporate_name) %>
  49 + <%= inst.text_field(:corporate_name, :value => @institution.corporate_name) %>
46 50 </div>
47 51 </span>
48 52  
... ...
src/noosfero-spb/software_communities/public/views/new-community.js
1 1 modulejs.define("NewCommunity", ['jquery'], function($) {
2 2  
3   - function replace_mandatory_message() {
4   - $(".required-field").first()
5   - .replaceWith("<span class='required-field'> Os campos em destaque<label class='pseudoformlabel'> (*)</label> são obrigatórios. </span>");
6   - }
7   -
8 3 function remove_image_builder_text() {
9 4 $("label:contains('Image builder')").hide();
10 5 }
... ... @@ -20,7 +15,6 @@ modulejs.define(&quot;NewCommunity&quot;, [&#39;jquery&#39;], function($) {
20 15 },
21 16  
22 17 init: function() {
23   - replace_mandatory_message();
24 18 remove_image_builder_text();
25 19 hide_organization_template_fields();
26 20 }
... ...