Merge Request #259
← To merge requests
From
institution_error_highlight
into
master
Institution error highlight
- Adds highlight to institutions input
- Adds individual error messages to institutions additional fields
Commits (1)
-
Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com> Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com>
Showing
4 changed files
Show diff stats
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 "" |
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 "" |
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 "Instituição não pode ser criada!" |
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 "Informações da Instituição" |
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('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
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('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
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 | } | ... | ... |
-
Milestone changed to Extras
-
Como melhoria futura, fica o CSS da tarja de erro (detalhe). Seria o extra do extra.
-
mentioned in commit ba4c0a5b6857f6a22f0ca355aeae5a559a06e232