Merge Request #259

Merged
softwarepublico/softwarepublico!259
Created by Marcos Pereira

Institution error highlight

  • Adds highlight to institutions input
  • Adds individual error messages to institutions additional fields
Assignee: Melissa Wen
Milestone: Extras

Merged by Melissa Wen

Source branch has been removed
Commits (1)
3 participants
src/noosfero-spb/gov_user/lib/ext/organization_rating.rb
... ... @@ -19,9 +19,15 @@ OrganizationRating.class_eval do
19 19 end
20 20  
21 21 def verify_organization_rating_values
22   - if self.institution.nil? && (self.people_benefited || self.saved_value)
23   - self.errors.add :institution, _("Report values cannot be saved without an institution")
24   - false
  22 + if self.institution.nil?
  23 + if self.people_benefited
  24 + self.errors.add _('institution'), _("needs to be valid to save the number of people benefited")
  25 + false
  26 + end
  27 + if self.saved_value
  28 + self.errors.add _('institution'), _("needs to be valid to save report values")
  29 + false
  30 + end
25 31 end
26 32 end
27 33  
... ...
src/noosfero-spb/gov_user/po/gov_user.pot
... ... @@ -8,8 +8,8 @@ msgid ""
8 8 msgstr ""
9 9 "Project-Id-Version: PACKAGE VERSION\n"
10 10 "Report-Msgid-Bugs-To: \n"
11   -"POT-Creation-Date: 2016-05-30 11:46-0300\n"
12   -"PO-Revision-Date: 2016-05-30 11:46-0300\n"
  11 +"POT-Creation-Date: 2016-05-30 17:16-0300\n"
  12 +"PO-Revision-Date: 2016-05-30 17:16-0300\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
15 15 "Language: \n"
... ... @@ -50,8 +50,17 @@ msgstr &quot;&quot;
50 50 msgid "institution not found"
51 51 msgstr ""
52 52  
53   -#: ../lib/ext/organization_rating.rb:23
54   -msgid "Report values cannot be saved without an institution"
  53 +#: ../lib/ext/organization_rating.rb:24 ../lib/ext/organization_rating.rb:28
  54 +#: ../lib/institution.rb:6
  55 +msgid "institution"
  56 +msgstr ""
  57 +
  58 +#: ../lib/ext/organization_rating.rb:24
  59 +msgid "needs to be valid to save the number of people benefited"
  60 +msgstr ""
  61 +
  62 +#: ../lib/ext/organization_rating.rb:28
  63 +msgid "needs to be valid to save report values"
55 64 msgstr ""
56 65  
57 66 #: ../lib/ext/search_controller.rb:6
... ... @@ -80,10 +89,6 @@ msgstr &quot;&quot;
80 89 msgid "Institution"
81 90 msgstr ""
82 91  
83   -#: ../lib/institution.rb:6
84   -msgid "institution"
85   -msgstr ""
86   -
87 92 #: ../lib/institution.rb:68
88 93 msgid "invalid, only public and private institutions are allowed."
89 94 msgstr ""
... ...
src/noosfero-spb/gov_user/po/pt/gov_user.po
... ... @@ -36,8 +36,14 @@ msgstr &quot;Instituição não pode ser criada!&quot;
36 36 msgid "institution not found"
37 37 msgstr "Nenhuma instituição encontrada"
38 38  
39   -msgid "Report values cannot be saved without an institution"
40   -msgstr "Recursos economizados não podem ser salvos sem uma instituição"
  39 +msgid "institution"
  40 +msgstr "instituição"
  41 +
  42 +msgid "needs to be valid to save the number of people benefited"
  43 +msgstr "precisa ser válida para salvar o número de pessoas beneficiadas"
  44 +
  45 +msgid "needs to be valid to save report values"
  46 +msgstr "precisa ser válida para salvar valores de recursos economizados"
41 47  
42 48 msgid "Communities Search"
43 49 msgstr "Buscar Comunidades"
... ... @@ -57,9 +63,6 @@ msgstr &quot;Informações da Instituição&quot;
57 63 msgid "Institution"
58 64 msgstr "Instituição"
59 65  
60   -msgid "institution"
61   -msgstr "instituição"
62   -
63 66 msgid "invalid, only public and private institutions are allowed."
64 67 msgstr "Inválido, somente instituições públicas e privadas são permitidas."
65 68  
... ...
src/noosfero-spb/gov_user/public/views/create-institution.js
... ... @@ -208,6 +208,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
208 208  
209 209 if( result.length === 0 ) {
210 210 $('#institution_empty_ajax_message').switchClass("hide-field", "show-field");
  211 + $('#input_institution').addClass("highlight-error");
211 212 $('#add_institution_link').hide();
212 213 toggle_extra_fields_style_status(true);
213 214 $("#institution_modal").css({display: "none"});
... ... @@ -224,6 +225,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
224 225 select : function (event, selected) {
225 226 $('#institution_empty_ajax_message').switchClass("show-field", "hide-field");
226 227 $('#add_institution_link').show();
  228 + $('#input_institution').removeClass("highlight-error");
227 229 toggle_extra_fields_style_status(false);
228 230 $("#institution_selected").val(selected.item.id).attr("data-name", selected.item.label);
229 231 }
... ...