Commit ad887e182d4faceb404c1c7d05ecffa340deb0b0

Authored by Daniela Feitosa
Committed by Daniela Feitosa
1 parent 19ece8ee

Small refactoring on code for signup

Removing unused code
app/views/account/_signup_form.rhtml
... ... @@ -11,7 +11,7 @@
11 11 <span id="signup-domain"><%= environment.default_hostname %>/</span>
12 12 <div id='signup-login'>
13 13 <div id='signup-login-field' class='formfield'>
14   - <%= required text_field(:profile_data, :login, :id => 'user_login', :onchange => 'this.value = convToValidLogin(this.value);') %>
  14 + <%= required text_field(:user, :login, :id => 'user_login', :onchange => 'this.value = convToValidLogin(this.value);') %>
15 15 <div id='url-check'><p>&nbsp;</p></div>
16 16 </div>
17 17 <%= content_tag(:small, _('Choose your login name carefully! It will be your network access and you will not be able to change it later.'), :id => 'signup-balloon') %>
... ... @@ -107,28 +107,14 @@ jQuery(function($) {
107 107 $('#signup-form #user_login').css('width', 335 - $('#signup-domain').outerWidth());
108 108  
109 109 $('#signup-form input[type=text], #signup-form textarea').each(function() {
110   - if ($(this).attr('rel')) var default_value = $(this).attr('rel').toLowerCase();
111   - if ($(this).val() == '') $(this).val(default_value);
112   - $(this).bind('focus', function() {
113   - if ($(this).val() == default_value) $(this).val('');
114   - });
115 110 $(this).bind('blur', function() {
116 111 if ($(this).val() == '') {
117   - $(this).val(default_value);
118 112 $(this).removeClass('filled-in');
119 113 }
120 114 else $(this).addClass('filled-in');
121 115 });
122 116 });
123 117  
124   - $('#signup-form').bind('submit', function() {
125   - $('#signup-form input[type=text], #signup-form textarea').each(function() {
126   - if ($(this).attr('rel')) var default_value = $(this).attr('rel').toLowerCase();
127   - if ($(this).val() == default_value) $(this).val('');
128   - });
129   - return true;
130   - });
131   -
132 118 $('#user_pw').focus(function() {
133 119 $('#password-balloon').fadeIn('slow');
134 120 });
... ...
plugins/stoa/lib/stoa_plugin.rb
... ... @@ -20,7 +20,8 @@ class StoaPlugin &lt; Noosfero::Plugin
20 20 def signup_extra_contents
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   - content_tag(:small, _('The usp id grants you special powers in the network. Don\'t forget to fill it wth a valid number if you have one.'), :id => 'usp-id-balloon'), :id => 'signup-usp-id') +
  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 25 content_tag('div', required(labelled_form_field(_('Birth date (yyyy-mm-dd)'), text_field_tag('birth_date', ''))) +
25 26 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') +
26 27 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 3 jQuery(this).addClass('checking').removeClass('validated');
4   -// jQuery(this.parentNode).addClass('checking')
5 4 jQuery.getJSON('/plugin/stoa/check_usp_id?usp_id='+me.value,
6 5 function(data){
7 6 if(data.exists) {
... ... @@ -21,12 +20,10 @@ jQuery(&quot;#usp_id_field&quot;).observe_field(1, function(){
21 20 }
22 21 jQuery('#signup-form .submit').attr('disabled', false);
23 22 jQuery(me).removeClass('checking').addClass('validated');
24   - // jQuery(me.parentNode).removeClass('checking')
25 23 });
26 24 }
27 25 else {
28 26 jQuery(me).removeClass('checking');
29   -// jQuery(me.parentNode).removeClass('checking')
30 27 if(me.value) {
31 28 jQuery('#signup-form .submit').attr('disabled', true);
32 29 jQuery(me).addClass('invalid');
... ...
plugins/stoa/public/style.css
... ... @@ -34,8 +34,8 @@
34 34 background: transparent url(/images/orange-balloon.png) bottom center no-repeat;
35 35 position: absolute;
36 36 z-index: 2;
37   - right: 20px;
38   - top: -75px;
  37 + right: 10px;
  38 + top: -80px;
39 39 }
40 40  
41 41 .controller-profile_editor input.checking {
... ... @@ -45,3 +45,13 @@
45 45 .controller-profile_editor div.checking {
46 46 background: transparent url(/images/loading-small.gif) 153px center no-repeat;
47 47 }
  48 +
  49 +#signup-form .invalid.valid.filled-in {
  50 + background-image: url("/images/passwords_nomatch.png");
  51 + border-color: #FFA000;
  52 +}
  53 +
  54 +#signup-form .invalid.valid.filled-in.validated {
  55 + background-image: url("/images/passwords_match.png");
  56 + border-color: #88BD00;
  57 +}
... ...
public/stylesheets/application.css
... ... @@ -5597,7 +5597,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5597 5597 #email-check,
5598 5598 #fake-check,
5599 5599 #password-check {
5600   - margin: -2px 171px -5px 0;
  5600 + margin: -2px 176px -5px 13px;
5601 5601 text-align: right;
5602 5602 clear: both;
5603 5603 }
... ... @@ -5674,7 +5674,6 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5674 5674  
5675 5675 #signup-form select,
5676 5676 #signup-form textarea,
5677   -#signup-form #profile_data_name,
5678 5677 #signup-form input {
5679 5678 padding: 7px 30px 10px 7px;
5680 5679 height: 20px;
... ... @@ -5690,7 +5689,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5690 5689  
5691 5690 #signup-form .filled-in,
5692 5691 #signup-form .invalid,
5693   -#signup-form .validated,
  5692 +#signup-form input.validated,
5694 5693 #signup-form .checking {
5695 5694 border-width: 2px;
5696 5695 border-style: solid;
... ... @@ -5765,10 +5764,6 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5765 5764 display: block;
5766 5765 }
5767 5766  
5768   -#signup-form #profile_data_name {
5769   - padding-left: 10px;
5770   -}
5771   -
5772 5767 #signup-form .invalid {
5773 5768 border-color: #FFA000;
5774 5769 background-image: url(/images/passwords_nomatch.png);
... ... @@ -5793,7 +5788,8 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5793 5788 color: #4A4A4A;
5794 5789 }
5795 5790  
5796   -#signup-form .validated {
  5791 +#signup-form .validated,
  5792 +#signup-form .valid.filled-in {
5797 5793 border-color: #88BD00;
5798 5794 background-image: url(/images/passwords_match.png);
5799 5795 }
... ... @@ -5809,7 +5805,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5809 5805 vertical-align: middle;
5810 5806 background: #EEE;
5811 5807 border: 1px solid #CFCFCF;
5812   - line-height: 37px;
  5808 + line-height: 35px;
5813 5809 padding: 0px 7px;
5814 5810 color: #4A4A4A;
5815 5811 font-size: 20px;
... ... @@ -5822,10 +5818,6 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5822 5818 padding-right: 30px;
5823 5819 }
5824 5820  
5825   -#url-check {
5826   - width: 239px;
5827   -}
5828   -
5829 5821 #signup-login-field {
5830 5822 float: left;
5831 5823 }
... ... @@ -5855,27 +5847,18 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
5855 5847 background: transparent url(/images/orange-balloon.png) bottom center no-repeat;
5856 5848 position: absolute;
5857 5849 z-index: 2;
5858   - right: 30px;
  5850 + right: 10px;
5859 5851 }
5860 5852  
5861 5853 #signup-form small#signup-balloon {
5862 5854 top: -110px;
5863 5855 }
5864 5856  
5865   -#signup-form small#password-balloon {
5866   - top: -85px;
5867   -}
5868   -
5869   -#signup-form small#password-confirmation-balloon {
5870   - top: -85px;
5871   -}
5872   -
5873   -#signup-form small#email-balloon {
5874   - top: -85px;
5875   -}
5876   -
  5857 +#signup-form small#password-balloon,
  5858 +#signup-form small#password-confirmation-balloon,
  5859 +#signup-form small#email-balloon,
5877 5860 #signup-form small#name-balloon {
5878   - top: -85px;
  5861 + top: -80px;
5879 5862 }
5880 5863  
5881 5864 #signup-form .required-field label,
... ...