Commit ddf733374ec2df74cc8e83871ca4f607e3df693e
1 parent
6adbff04
Exists in
master
and in
28 other branches
Added messages on usp id validations
Showing
5 changed files
with
43 additions
and
15 deletions
Show diff stats
app/views/account/_signup_form.rhtml
... | ... | @@ -152,6 +152,10 @@ jQuery(function($) { |
152 | 152 | }); |
153 | 153 | $('#profile_data_name').blur(function() { |
154 | 154 | $('#name-balloon').fadeOut('slow'); |
155 | + if ($(this).val() == '') { | |
156 | + $(this).removeClass('validated'); | |
157 | + } | |
158 | + else $(this).addClass('validated'); | |
155 | 159 | }); |
156 | 160 | }); |
157 | 161 | </script> | ... | ... |
plugins/stoa/lib/stoa_plugin.rb
... | ... | @@ -21,7 +21,8 @@ class StoaPlugin < Noosfero::Plugin |
21 | 21 | lambda { |
22 | 22 | content_tag(:div, labelled_form_field(_('USP number'), text_field_tag('profile_data[usp_id]', '', :id => 'usp_id_field')) + |
23 | 23 | content_tag(:small, _('The usp id grants you special powers in the network. Don\'t forget to fill it with a valid number if you have one.'), :id => 'usp-id-balloon') + |
24 | - content_tag('div', '', :id => 'usp-id-check'), :id => 'signup-usp-id') + | |
24 | + content_tag('p', _("This usp number is not valid or doesn't exists"), :id => 'usp-id-invalid') + | |
25 | + content_tag('p', _('Checking usp number...'), :id => 'usp-id-checking'), :id => 'signup-usp-id') + | |
25 | 26 | content_tag('div', required(labelled_form_field(_('Birth date (yyyy-mm-dd)'), text_field_tag('birth_date', ''))) + |
26 | 27 | content_tag(:small, _('Confirm your birth date. Pay attention to the format: yyyy-mm-dd.'), :id => 'usp-birth-date-balloon'), :id => 'signup-birth-date', :style => 'display: none') + |
27 | 28 | content_tag('div', required(labelled_form_field(_('CPF'), text_field_tag('cpf', ''))) + | ... | ... |
plugins/stoa/public/javascripts/signup_complement.js
1 | 1 | jQuery("#usp_id_field").observe_field(1, function(){ |
2 | 2 | var me=this; |
3 | + jQuery('#usp-id-invalid').hide(); | |
3 | 4 | jQuery(this).addClass('checking').removeClass('validated'); |
5 | + jQuery('#usp-id-checking').show(); | |
4 | 6 | jQuery.getJSON('/plugin/stoa/check_usp_id?usp_id='+me.value, |
5 | 7 | function(data){ |
8 | + jQuery('#usp-id-checking').hide(); | |
6 | 9 | if(data.exists) { |
10 | + jQuery('#usp-id-invalid').hide(); | |
7 | 11 | jQuery.getJSON('/plugin/stoa/check_cpf?usp_id='+me.value, |
8 | 12 | function(data){ |
9 | 13 | if(data.exists){ |
... | ... | @@ -27,6 +31,7 @@ jQuery("#usp_id_field").observe_field(1, function(){ |
27 | 31 | if(me.value) { |
28 | 32 | jQuery('#signup-form .submit').attr('disabled', true); |
29 | 33 | jQuery(me).addClass('invalid'); |
34 | + jQuery('#usp-id-invalid').show(); | |
30 | 35 | } |
31 | 36 | else { |
32 | 37 | jQuery('#signup-form .submit').attr('disabled', false); |
... | ... | @@ -58,6 +63,12 @@ jQuery('#signup-birth-date #birth_date').focus(function() { |
58 | 63 | }); |
59 | 64 | jQuery('#signup-birth-date #birth_date').blur(function() { |
60 | 65 | jQuery('#usp-birth-date-balloon').fadeOut('slow'); |
66 | + if (jQuery(this).val() == '') { | |
67 | + jQuery(this).removeClass('validated'); | |
68 | + } | |
69 | + else { | |
70 | + jQuery(this).addClass('validated'); | |
71 | + } | |
61 | 72 | }); |
62 | 73 | |
63 | 74 | jQuery('#signup-cpf #cpf').focus(function() { |
... | ... | @@ -65,4 +76,8 @@ jQuery('#signup-cpf #cpf').focus(function() { |
65 | 76 | }); |
66 | 77 | jQuery('#signup-cpf #cpf').blur(function() { |
67 | 78 | jQuery('#usp-cpf-balloon').fadeOut('slow'); |
79 | + if (jQuery(this).val() == '') { | |
80 | + jQuery(this).removeClass('validated'); | |
81 | + } | |
82 | + else jQuery(this).addClass('validated'); | |
68 | 83 | }); | ... | ... |
plugins/stoa/public/style.css
... | ... | @@ -34,24 +34,33 @@ |
34 | 34 | background: transparent url(/images/orange-balloon.png) bottom center no-repeat; |
35 | 35 | position: absolute; |
36 | 36 | z-index: 2; |
37 | - right: 10px; | |
38 | - top: -80px; | |
37 | + right: -150px; | |
38 | + top: -75px; | |
39 | 39 | } |
40 | 40 | |
41 | -.controller-profile_editor input.checking { | |
42 | - cursor: progress; | |
41 | +#usp-id-invalid, | |
42 | +#usp-id-checking { | |
43 | + display: none; | |
44 | + margin: 0px; | |
45 | + margin: -2px 16px -5px 13px; | |
46 | + text-align: right; | |
47 | + clear: both; | |
48 | + font-size: 11px; | |
49 | + text-transform: lowercase; | |
43 | 50 | } |
44 | 51 | |
45 | -.controller-profile_editor div.checking { | |
46 | - background: transparent url(/images/loading-small.gif) 153px center no-repeat; | |
52 | +#usp-id-invalid{ | |
53 | + color: #FFA000; | |
47 | 54 | } |
48 | 55 | |
49 | -#signup-form .invalid.valid.filled-in { | |
50 | - background-image: url("/images/passwords_nomatch.png"); | |
51 | - border-color: #FFA000; | |
56 | +#usp-id-checking { | |
57 | + color: #4A4A4A; | |
52 | 58 | } |
53 | 59 | |
54 | -#signup-form .invalid.valid.filled-in.validated { | |
55 | - background-image: url("/images/passwords_match.png"); | |
56 | - border-color: #88BD00; | |
60 | +.controller-profile_editor input.checking { | |
61 | + cursor: progress; | |
62 | +} | |
63 | + | |
64 | +.controller-profile_editor div.checking { | |
65 | + background: transparent url(/images/loading-small.gif) 153px center no-repeat; | |
57 | 66 | } | ... | ... |
public/stylesheets/application.css
... | ... | @@ -5783,8 +5783,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img { |
5783 | 5783 | color: #4A4A4A; |
5784 | 5784 | } |
5785 | 5785 | |
5786 | -#signup-form .validated, | |
5787 | -#signup-form .valid.filled-in { | |
5786 | +#signup-form .validated { | |
5788 | 5787 | border-color: #88BD00; |
5789 | 5788 | background-image: url(/images/passwords_match.png); |
5790 | 5789 | } | ... | ... |