Commit 619b7714b72f233b336c79f6b015d58adec7237f
1 parent
1a2ee096
Exists in
master
and in
28 other branches
[stoa] Adding usp fields to profile basic info
* And tweaking interface * TODO: build filter to deal with controller logics
Showing
3 changed files
with
23 additions
and
2 deletions
Show diff stats
plugins/stoa/lib/stoa_plugin.rb
... | ... | @@ -27,6 +27,16 @@ class StoaPlugin < Noosfero::Plugin |
27 | 27 | } |
28 | 28 | end |
29 | 29 | |
30 | + def profile_info_extra_contents | |
31 | + lambda { | |
32 | + labelled_form_field(_('USP number'), text_field_tag('profile_data[usp_id]', '', :id => 'usp_id_field')) + | |
33 | + content_tag(:small, _('The usp id grants you special powers in the network. Don\'t forget to fill it if you have one.')) + | |
34 | + content_tag('div', required(labelled_form_field(_('Birth date (yyyy-mm-dd)'), text_field_tag('birth_date', ''))), :id => 'signup-birth-date', :style => 'display: none') + | |
35 | + content_tag('div', required(labelled_form_field(_('CPF'), text_field_tag('cpf', ''))), :id => 'signup-cpf', :style => 'display:none') + | |
36 | + javascript_include_tag('../plugins/stoa/javascripts/jquery.observe_field', '../plugins/stoa/javascripts/signup_complement') | |
37 | + } if context.profile.person? && context.profile.usp_id.blank? | |
38 | + end | |
39 | + | |
30 | 40 | def account_controller_filters |
31 | 41 | block = lambda do |
32 | 42 | params[:profile_data] ||= {} | ... | ... |
plugins/stoa/public/javascripts/signup_complement.js
1 | 1 | jQuery("#usp_id_field").observe_field(1, function(){ |
2 | 2 | var me=this; |
3 | 3 | jQuery(this).addClass('checking').removeClass('validated'); |
4 | + jQuery(this.parentNode).addClass('checking') | |
4 | 5 | jQuery.getJSON('/plugin/stoa/check_usp_id?usp_id='+me.value, |
5 | 6 | function(data){ |
6 | 7 | if(data.exists) { |
... | ... | @@ -18,12 +19,14 @@ jQuery("#usp_id_field").observe_field(1, function(){ |
18 | 19 | jQuery('#confirmation_field').remove(); |
19 | 20 | jQuery('#signup-form').append('<input id="confirmation_field" type="hidden" value="birth_date" name="confirmation_field">') |
20 | 21 | } |
21 | - jQuery('#signup-form .submit').attr('disabled', false); | |
22 | - jQuery(me).removeClass('checking').addClass('validated'); | |
22 | + jQuery('#signup-form .submit').attr('disabled', false); | |
23 | + jQuery(me).removeClass('checking').addClass('validated'); | |
24 | + jQuery(me.parentNode).removeClass('checking') | |
23 | 25 | }); |
24 | 26 | } |
25 | 27 | else { |
26 | 28 | jQuery(me).removeClass('checking'); |
29 | + jQuery(me.parentNode).removeClass('checking') | |
27 | 30 | if(me.value) { |
28 | 31 | jQuery('#signup-form .submit').attr('disabled', true); |
29 | 32 | jQuery(me).addClass('invalid'); | ... | ... |
plugins/stoa/public/style.css
... | ... | @@ -29,3 +29,11 @@ |
29 | 29 | right: 20px; |
30 | 30 | bottom: 110px; |
31 | 31 | } |
32 | + | |
33 | +.controller-profile_editor input.checking { | |
34 | + cursor: progress; | |
35 | +} | |
36 | + | |
37 | +.controller-profile_editor div.checking { | |
38 | + background: transparent url(/images/loading-small.gif) 153px center no-repeat; | |
39 | +} | ... | ... |