Commit 26e7f6658d9d47584be570c1715a032111306316

Authored by Caio Almeida
Committed by Joenio Costa
1 parent fc7e02f2

Signup interface improvements

(ActionItem2070)
app/controllers/public/account_controller.rb
... ... @@ -60,6 +60,10 @@ class AccountController < ApplicationController
60 60 def signup
61 61 @invitation_code = params[:invitation_code]
62 62 begin
  63 + if params[:user]
  64 + params[:user].delete(:password_confirmation_clear)
  65 + params[:user].delete(:password_clear)
  66 + end
63 67 @user = User.new(params[:user])
64 68 @user.terms_of_use = environment.terms_of_use
65 69 @user.environment = environment
... ... @@ -209,16 +213,26 @@ class AccountController < ApplicationController
209 213 @identifier = params[:identifier]
210 214 valid = Person.is_available?(@identifier, environment)
211 215 if valid
212   - @status = _('Available!')
  216 + @status = _('This login name is available')
213 217 @status_class = 'available'
214 218 else
215   - @status = _('Unavailable!')
  219 + @status = _('This login name is unavailable')
216 220 @status_class = 'unavailable'
217 221 end
218   - @url = environment.top_url + '/' + @identifier
219 222 render :partial => 'identifier_status'
220 223 end
221 224  
  225 + def check_email
  226 + if User.find_by_email_and_environment_id(params[:address], environment.id).nil?
  227 + @status = _('This e-mail address is available')
  228 + @status_class = 'available'
  229 + else
  230 + @status = _('This e-mail address is taken')
  231 + @status_class = 'unavailable'
  232 + end
  233 + render :partial => 'email_status'
  234 + end
  235 +
222 236 def user_data
223 237 user_data =
224 238 if logged_in?
... ...
app/models/person.rb
... ... @@ -116,6 +116,7 @@ class Person < Profile
116 116 contact_phone
117 117 contact_information
118 118 description
  119 + image
119 120 ]
120 121  
121 122 validates_multiparameter_assignments
... ...
app/views/account/_email_status.rhtml 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<div class='status-identifier'>
  2 + <p><span class='<%= @status_class %>'><%= @status %></span></p>
  3 + <script type="text/javascript">
  4 + jQuery('#user_email').removeClass();
  5 + jQuery('#user_email').addClass('<%= @status_class %>');
  6 + </script>
  7 +</div>
... ...
app/views/account/_identifier_status.rhtml
1 1 <div class='status-identifier'>
2   - <p><%= @url %> <span class='<%= @status_class %>'><%= @status %></span> </p>
  2 + <p><span class='<%= @status_class %>'><%= @status %></span></p>
  3 + <script type="text/javascript">
  4 + jQuery('#user_login').removeClass();
  5 + jQuery('#user_login').addClass('<%= @status_class %>');
  6 + </script>
3 7 </div>
... ...
app/views/account/_signup_form.rhtml
1 1 <%= error_messages_for :user, :person %>
2 2  
3   -<% if ! defined? hidden_atention || ! hidden_atention %>
4   -<p/>
5   -<div class="atention">
6   -<%= _('Dear user, welcome to the %s network. To start your participation in this space, fill in the fields below. After this operation, your login and password will be registered, allowing you to create %s and %s in this environment.') % [environment.name, __('communities'), __('enterprises')] %>
7   -</div>
8   -<% end %>
9   -
10   -<% labelled_form_for :user, @user, :html => { :multipart => true } do |f| %>
  3 +<% labelled_form_for :user, @user, :html => { :multipart => true, :id => 'signup-form' } do |f| %>
11 4  
12 5 <%= hidden_field_tag :invitation_code, @invitation_code %>
13 6  
14   -<%= required_fields_message %>
  7 +<div id='signup-form-header'>
15 8  
16   -<div id='signup-email'>
17   - <%= required f.text_field(:email) %>
18   - <%= content_tag(:small,_('This e-mail address will be used to contact you.')) %>
19   -</div>
  9 + <%= label :profile_data, :name %>
  10 + <%= required text_field(:profile_data, :name, :rel => _('Name')) %>
20 11  
21   -<%= required f.text_field(:login, :onchange => 'this.value = convToValidLogin( this.value )') %>
22   -<%= content_tag(:small,_('Insert your login')) %>
23   -<div id='url-check'></div>
  12 + <div id='signup-email'>
  13 + <%= required f.text_field(:email, :rel => _('e-Mail')) %>
  14 + <%= content_tag(:small,_('This e-mail address will be used to contact you.')) %>
  15 + <div id='email-check'><p>&nbsp;</p></div>
  16 + </div>
  17 + <%= observe_field "user_email",
  18 + :url => { :action => "check_email" },
  19 + :with => "address",
  20 + :update => "email-check",
  21 + :loading => "jQuery('#user_email').removeClass().addClass('checking');
  22 + jQuery('#email-check').html('<p><span class=\"checking\">#{_('Checking if e-mail address is already taken...')}</span></p>');",
  23 + :complete => "jQuery('#user_email').removeClass('checking')",
  24 + :before => "if (!( jQuery('#user_email').valid() )) {
  25 + jQuery('#user_email').removeClass().addClass('unavailable');
  26 + jQuery('#email-check').html('<p><span class=\"unavailable\">#{_('This e-mail address is not valid')}</span></p>');
  27 + return false;
  28 + }"
  29 + %>
24 30  
25   -<%= observe_field 'user_login', :url => {:action => 'check_url'}, :with => 'identifier', :update => 'url-check' %>
  31 + <div id='signup-password'>
  32 + <%= required f.password_field(:password, :id => 'user_pw') %>
  33 + <%= f.text_field(:password_clear, :value => _('password')) %>
  34 + <%= content_tag(:small,_('Choose a password that you can remember easily. It must have at least 4 characters.')) %>
  35 + </div>
26 36  
27   -<div id='signup-password'>
28   - <%= required f.password_field(:password) %>
29   - <%= content_tag(:small,_('Choose a password that you can remember easily. It must have at least 4 characters.')) %>
30   -</div>
  37 + <div id='signup-password-confirmation'>
  38 + <%= required f.password_field(:password_confirmation) %>
  39 + <%= f.text_field(:password_confirmation_clear, :value => _('password confirmation')) %>
  40 + <%= content_tag(:small, _('Passwords must match'), :id => 'password-balloon') %>
  41 + </div>
  42 +
  43 + <span id="signup-domain"><%= @environment.top_url.gsub(/^http:\/\//, '') %>/</span>
31 44  
32   -<%= required f.password_field(:password_confirmation) %>
33   -<%= content_tag(:small,_('To confirm, repeat your password.')) %>
34   -
35   -<% labelled_fields_for :profile_data, @person do |f| %>
36   - <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %>
37   -<% end %>
38   -
39   -<% unless @terms_of_use.blank? %>
40   - <div id='terms-of-use-box' class='formfieldline'>
41   - <%= _("By clicking on 'I accept the terms of use' below you are agreeing to the %s") %
42   - link_to_function(_('Terms of use'), nil) do |page|
43   - page['terms-of-use'].show
44   - end %>
45   -
46   - <div id='terms-of-use' style='display: none;'>
47   - <%= @terms_of_use %>
48   - <%= link_to_function(_('Hide'), nil) do |page|
49   - page['terms-of-use'].hide
50   - end %>
  45 + <div id='signup-login'>
  46 + <div id='signup-login-field'>
  47 + <%= required f.text_field(:login, :onchange => 'this.value = convToValidLogin(this.value);', :rel => _('Login')) %>
  48 + <div id='url-check'><p>&nbsp;</p></div>
51 49 </div>
52   - <p><%= labelled_check_box(environment.terms_of_use_acceptance_text.blank? ? _('I accept the terms of use') : environment.terms_of_use_acceptance_text, 'user[terms_accepted]') %></p>
  50 + <%= 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') %>
  51 + <br style="clear: both;" />
53 52 </div>
54   -<% end %>
55   -
56   -<% if params[:enterprise_code] %>
57   - <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
58   - <%= hidden_field_tag :answer, params[:answer] %>
59   - <%= hidden_field_tag :terms_accepted, params[:terms_accepted] %>
60   - <%= hidden_field_tag :new_user, true %>
61   -<% end %>
62   -
63   -<% button_bar do %>
64   - <%= submit_button('save', _('Sign up'), :cancel => {:action => 'index'}, :class => 'icon-menu-login') %>
65   -<% end %>
  53 +
  54 + <%= observe_field 'user_login',
  55 + :url => { :action => 'check_url' },
  56 + :with => 'identifier',
  57 + :update => 'url-check',
  58 + :loading => "jQuery('#user_login').removeClass().addClass('checking');
  59 + jQuery('#url-check').html('<p><span class=\"checking\">#{_('Checking availability of login name...')}</span></p>');",
  60 + :complete => "jQuery('#user_login').removeClass('checking')"
  61 + %>
  62 +
  63 +</div>
  64 +
  65 +<div id="signup-form-profile">
  66 +
  67 + <% labelled_fields_for :profile_data, @person do |f| %>
  68 + <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %>
  69 + <% end %>
  70 +
  71 + <% unless @terms_of_use.blank? %>
  72 + <div id='terms-of-use-box' class='formfieldline'>
  73 + <%= labelled_check_box(
  74 + _('I accept the %s') % link_to_function(
  75 + _('terms of use'),
  76 + "jQuery.colorbox({ width : '400px', height : '400px', html : '#{escape_javascript(@terms_of_use) +
  77 + content_tag(:p, button(:cancel, _('Close'), {}, :onclick => 'jQuery.colorbox.close(); return false;'), :style => 'text-align: center')}' })"
  78 + ),
  79 + 'user[terms_accepted]'
  80 + ) %>
  81 + </div>
  82 + <% end %>
  83 +
  84 + <% if params[:enterprise_code] %>
  85 + <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
  86 + <%= hidden_field_tag :answer, params[:answer] %>
  87 + <%= hidden_field_tag :terms_accepted, params[:terms_accepted] %>
  88 + <%= hidden_field_tag :new_user, true %>
  89 + <% end %>
  90 +</div>
  91 +
  92 +<p style="text-align: center">
  93 + <%= submit_button('save', _('Sign up')) %>
  94 +</p>
  95 +
66 96 <% end -%>
  97 +
  98 +<script type="text/javascript">
  99 +jQuery(function($) {
  100 + $('#signup-form input[type=text], #signup-form textarea').each(function() {
  101 + if ($(this).attr('rel')) var default_value = $(this).attr('rel').toLowerCase();
  102 + if ($(this).val() == '') $(this).val(default_value);
  103 + $(this).bind('focus', function() {
  104 + if ($(this).val() == default_value) $(this).val('');
  105 + });
  106 + $(this).bind('blur', function() {
  107 + if ($(this).val() == '') $(this).val(default_value);
  108 + });
  109 + });
  110 +
  111 + $('#signup-form').bind('submit', function() {
  112 + $('#signup-form input[type=text], #signup-form textarea').each(function() {
  113 + if ($(this).attr('rel')) var default_value = $(this).attr('rel').toLowerCase();
  114 + if ($(this).val() == default_value) $(this).val('');
  115 + });
  116 + return true;
  117 + });
  118 +
  119 + $('#user_password_clear, #user_password_confirmation_clear').show();
  120 + $('#user_password_clear, #user_password_confirmation_clear').unbind();
  121 + $('#user_pw, #user_password_confirmation').hide();
  122 + $('#user_password_clear').focus(function() {
  123 + $(this).hide();
  124 + $('#user_pw').show();
  125 + $('#user_pw').focus();
  126 + });
  127 + $('#user_pw').blur(function() {
  128 + if ($(this).val() == '') {
  129 + $('#user_password_clear').show();
  130 + $(this).hide();
  131 + }
  132 + });
  133 + $('#user_password_confirmation_clear').focus(function() {
  134 + $(this).hide();
  135 + $('#user_password_confirmation').show();
  136 + $('#user_password_confirmation').focus();
  137 + });
  138 + $('#user_password_confirmation').blur(function() {
  139 + if ($(this).val() == '') {
  140 + $('#user_password_confirmation_clear').show();
  141 + $(this).hide();
  142 + } else if ($(this).val() == $('#user_pw').val()) {
  143 + $(this).addClass('passwords_match');
  144 + $(this).removeClass('passwords_differ');
  145 + $('#password-balloon').fadeOut('slow');
  146 + } else if ($(this).val() != $('#user_pw').val()) {
  147 + $(this).removeClass('passwords_match');
  148 + $(this).addClass('passwords_differ');
  149 + $('#password-balloon').fadeIn('slow');
  150 + $('#signup-balloon').fadeOut('slow');
  151 + }
  152 + });
  153 + $('#user_login').focus(function() {
  154 + $('#signup-balloon').fadeIn('slow');
  155 + $('#password-balloon').fadeOut('slow');
  156 + });
  157 + $('#user_login').blur(function() { $('#signup-balloon').fadeOut('slow'); });
  158 + $('#signup-form').validate({ rules: { 'user[email]': { email: true } }, messages: { 'user[email]' : '' } });
  159 +});
  160 +</script>
... ...
app/views/account/signup.rhtml
1   -<h1><%= _('Signup') %></h1>
  1 +<h1><%= _('Sign up for %s!') % environment.name %></h1>
2 2 <% if @register_pending %>
3 3 <%= _('Thanks for signing up! Now check your e-mail to activate your account!') %>
4 4 <p style="text-align: center"><%= link_to(_('Go to the homepage'), '/') %></p>
... ...
app/views/profile_editor/_person.rhtml
... ... @@ -2,6 +2,8 @@
2 2  
3 3 <%= required_fields_message %>
4 4  
5   - <%= required f.text_field(:email)%>
  5 + <%= required f.text_field(:name) %>
  6 +
  7 + <%= required f.text_field(:email) %>
6 8  
7 9 <%= render :partial => 'person_form', :locals => {:f => f} %>
... ...
app/views/profile_editor/_person_form.rhtml
1 1 <% @person ||= @profile %>
2 2  
3   -<%= required f.text_field(:name) %>
4   -
5 3 <% optional_field(@person, 'nickname') do %>
6   - <%= f.text_field(:nickname, :maxlength => 16, :size => 30) %>
  4 + <%= f.text_field(:nickname, :maxlength => 16, :size => 30, :rel => _('Nickname')) %>
7 5 <div>
8 6 <small><%= _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') %></small>
9 7 </div>
10 8 <% end %>
11 9  
12   -<%= optional_field(@person, 'description', f.text_area(:description, :rows => 5)) %>
  10 +<%= optional_field(@person, 'description', f.text_area(:description, :rows => 5, :rel => _('Description'))) %>
13 11 <%= optional_field(@person, 'preferred_domain', select_preferred_domain(:profile_data)) %>
14   -<%= optional_field(@person, 'contact_information', f.text_field(:contact_information)) %>
15   -<%= optional_field(@person, 'contact_phone', labelled_form_field(_('Home phone'), text_field(:profile_data, :contact_phone))) %>
16   -<%= optional_field(@person, 'cell_phone', f.text_field(:cell_phone)) %>
17   -<%= optional_field(@person, 'comercial_phone', f.text_field(:comercial_phone)) %>
  12 +<%= optional_field(@person, 'contact_information', f.text_field(:contact_information, :rel => _('Contact information'))) %>
  13 +<%= optional_field(@person, 'contact_phone', labelled_form_field(_('Home phone'), text_field(:profile_data, :contact_phone, :rel => _('Contact phone')))) %>
  14 +<%= optional_field(@person, 'cell_phone', f.text_field(:cell_phone, :rel => _('Cell phone'))) %>
  15 +<%= optional_field(@person, 'comercial_phone', f.text_field(:comercial_phone, :rel => _('Comercial phone'))) %>
18 16 <%= optional_field(@person, 'sex', f.radio_group(:profile_data, :sex, [ ['male',_('Male')], ['female',_('Female')] ])) %>
19 17 <%= optional_field(@person, 'birth_date', labelled_form_field(_('Birth date'), '<div class="select-birth-date">' + pick_date(:profile_data, :birth_date, {:start_year => (Date.today.year - 100), :end_year => (Date.today.year - 5)}) + '</div>')) %>
20   -<%= optional_field(@person, 'nationality', f.text_field(:nationality)) %>
  18 +<%= optional_field(@person, 'nationality', f.text_field(:nationality, :rel => _('Nationality'))) %>
21 19 <%= optional_field(@person, 'country', select_country(_('Country'), 'profile_data', 'country', {:class => 'type-select'})) %>
22   -<%= optional_field(@person, 'state', f.text_field(:state)) %>
23   -<%= optional_field(@person, 'city', f.text_field(:city)) %>
24   -<%= optional_field(@person, 'zip_code', labelled_form_field(_('ZIP code'), text_field(:profile_data, :zip_code))) %>
25   -<%= optional_field(@person, 'address', labelled_form_field(_('Address (street and number)'), text_field(:profile_data, :address))) %>
  20 +<%= optional_field(@person, 'state', f.text_field(:state, :rel => _('State'))) %>
  21 +<%= optional_field(@person, 'city', f.text_field(:city, :rel => _('City'))) %>
  22 +<%= optional_field(@person, 'zip_code', labelled_form_field(_('ZIP code'), text_field(:profile_data, :zip_code, :rel => _('ZIP code')))) %>
  23 +<%= optional_field(@person, 'address', labelled_form_field(_('Address (street and number)'), text_field(:profile_data, :address, :rel => _('Address')))) %>
26 24  
27 25 <% optional_field(@person, 'schooling') do %>
28 26 <div class="formfieldline">
... ... @@ -47,18 +45,25 @@
47 45 <%= optional_field(@person, 'formation', select_area(_('Education'), 'profile_data', 'formation', {:class => 'type-select-full-line'})) %>
48 46  
49 47 <span id='profile_data_custom_formation_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.formation) %> >
50   - <%= optional_field(@person, 'custom_formation', f.text_field(:custom_formation)) %>
  48 + <%= optional_field(@person, 'custom_formation', f.text_field(:custom_formation, :rel => _('Custom formation'))) %>
51 49 </span>
52 50 <%= observe_field 'profile_data_formation', :function =>'toggle_text_field("profile_data_formation", "profile_data_custom_formation_span")' %>
53 51  
54 52 <%= optional_field(@person, 'area_of_study', select_area(_('Area of study'), 'profile_data', 'area_of_study', {:class => 'type-select-full-line'})) %>
55 53  
56 54 <span id='profile_data_custom_area_of_study_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.area_of_study) %> >
57   - <%= optional_field(@person, 'custom_area_of_study', f.text_field(:custom_area_of_study)) %>
  55 + <%= optional_field(@person, 'custom_area_of_study', f.text_field(:custom_area_of_study, :rel => _('Custom area of study'))) %>
58 56 </span>
59 57 <%= observe_field 'profile_data_area_of_study', :function =>'toggle_text_field("profile_data_area_of_study", "profile_data_custom_area_of_study_span")' %>
60 58  
61   -<%= optional_field(@person, 'professional_activity', f.text_field(:professional_activity)) %>
62   -<%= optional_field(@person, 'organization', f.text_field(:organization)) %>
63   -<%= optional_field(@person, 'organization_website', f.text_field(:organization_website)) %>
  59 +<%= optional_field(@person, 'professional_activity', f.text_field(:professional_activity, :rel => _('Professional activity'))) %>
  60 +<%= optional_field(@person, 'organization', f.text_field(:organization, :rel => _('Organization'))) %>
  61 +<%= optional_field(@person, 'organization_website', f.text_field(:organization_website, :rel => _('Organization website'))) %>
64 62  
  63 +<% optional_field(@person, 'image') do %>
  64 + <div id="profile_choose_picture">
  65 + <% f.fields_for :image_builder, @person.image do |i| %>
  66 + <%= file_field_or_thumbnail(_('Image:'), @person.image, i) %><span class="person_image_maxsize"><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %></span>
  67 + <% end %>
  68 + </div>
  69 +<% end %>
... ...
app/views/profile_editor/edit.rhtml
... ... @@ -6,12 +6,14 @@
6 6  
7 7 <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
8 8  
  9 + <% unless @profile.person? && @environment.active_person_fields.include?('image') %>
9 10 <div id="profile_change_picture">
10 11 <h2><%= _('Change picture') %></h2>
11 12 <% f.fields_for :image_builder, @profile.image do |i| %>
12 13 <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %>
13 14 <% end %>
14 15 </div>
  16 + <% end %>
15 17  
16 18 <h2><%= _('Privacy options') %></h2>
17 19  
... ...
public/fonts/DroidSerif-Regular.ttf 0 → 100644
No preview for this file type
public/images/field-bg.png 0 → 100644

399 Bytes

public/images/login_checking.png 0 → 100644

1.09 KB

public/images/orange-balloon.png 0 → 100644

1.12 KB

public/images/orange-bg.png 0 → 100644

191 Bytes

public/images/passwords_match.png 0 → 100644

777 Bytes

public/images/passwords_nomatch.png 0 → 100644

374 Bytes

public/stylesheets/application.css
... ... @@ -6173,33 +6173,355 @@ h1#agenda-title {
6173 6173  
6174 6174 /* Captcha */
6175 6175  
6176   -.comment_reply #recaptcha_area {
6177   - margin-bottom: 3px !important;
6178   -}
  6176 +/* Colorbox */
6179 6177  
6180   -.comment_reply .recaptchatable tr td + td + td {
  6178 +#cboxClose {
6181 6179 display: none !important;
6182 6180 }
6183 6181  
6184   -.comment_reply .recaptcha-container {
  6182 +/* Signup interface */
  6183 +
  6184 +#url-check {
  6185 + margin: 0 0 2px 0;
6185 6186 width: 100%;
6186   - overflow: hidden;
  6187 + text-align: right;
6187 6188 }
6188 6189  
6189   -.comment_reply .recaptcha-container:hover {
6190   - overflow: visible;
  6190 +#email-check {
  6191 + margin: -2px 171px 2px 0;
  6192 + text-align: right;
  6193 + clear: both;
  6194 +}
  6195 +
  6196 +#email-check p {
  6197 + margin: 0;
  6198 +}
  6199 +
  6200 +.available {
  6201 + color: #88BD00;
  6202 +}
  6203 +
  6204 +.unavailable {
  6205 + color: #FFA000;
  6206 +}
  6207 +
  6208 +.checking {
  6209 + color: #4A4A4A;
6191 6210 }
6192 6211  
6193   -.comment_reply .recaptcha-container tr:hover td {
  6212 +#email-check p, #url-check p {
  6213 + margin: 0;
  6214 + text-transform: lowercase;
  6215 + font-size: 11px;
  6216 + clear: both;
  6217 +}
  6218 +
  6219 +.action-account-signup #main-content-wrapper-8 {
  6220 + background: #ECECEC;
  6221 +}
  6222 +
  6223 +@font-face {
  6224 + font-family: droidserif;
  6225 + src: url('/fonts/DroidSerif-Regular.ttf');
  6226 +}
  6227 +
  6228 +.action-account-signup #content .no-boxes h1 {
  6229 + font-variant: normal;
  6230 + border-bottom: 0;
  6231 + color: #666666;
  6232 + font-family: droidserif, serif;
  6233 + font-weight: lighter;
  6234 + text-align: center;
  6235 + margin-top: 35px;
  6236 + margin-left: 12px;
  6237 +}
  6238 +
  6239 +.action-account-signup #wrap-1 .formfield select,
  6240 +.action-account-signup #wrap-1 .formfield textarea,
  6241 +.action-account-signup #wrap-1 #profile_data_name,
  6242 +.action-account-signup #wrap-1 .formfield input {
  6243 + background: transparent url(/images/field-bg.png) left top no-repeat;
  6244 + padding: 7px 3px 10px 7px;
  6245 + height: 24px;
  6246 + width: 335px;
  6247 + color: #6d786e;
  6248 + font-size: 20px;
  6249 + font-family: droidserif, serif;
  6250 + margin: 9px 14px 0;
  6251 + border: 0;
  6252 +}
  6253 +
  6254 +.action-account-signup #wrap-1 .formfield select {
  6255 + height: auto;
  6256 +}
  6257 +
  6258 +.action-account-signup #wrap-1 .formfield .select-birth-date select {
  6259 + width: 93px;
  6260 + margin-right: 2px;
  6261 + margin-left: 0;
  6262 +}
  6263 +
  6264 +.webkit.action-account-signup #wrap-1 .formfield select {
  6265 + background: #fff;
  6266 +}
  6267 +
  6268 +.action-account-signup #wrap-1 .formfield textarea {
  6269 + height: 335px;
  6270 + background: #fff;
  6271 +}
  6272 +
  6273 +.action-account-signup #wrap-1 .formfield input[type=file] {
  6274 + font-size: 12px;
  6275 +}
  6276 +
  6277 +.action-account-signup #wrap-1 .formfield textarea {
  6278 + height: 100px;
  6279 +}
  6280 +
  6281 +.action-account-signup #wrap-1 label,
  6282 +.action-account-signup #wrap-1 small,
  6283 +.action-account-signup #wrap-1 #user_password,
  6284 +.action-account-signup #wrap-1 #user_password_confirmation {
  6285 + display: none;
  6286 +}
  6287 +
  6288 +.action-account-signup #wrap-1 input[type=radio] {
  6289 + height: auto;
  6290 + margin: 0;
  6291 + margin-left: 3px;
  6292 +}
  6293 +
  6294 +.action-account-signup #wrap-1 .fieldgroup {
  6295 + margin: 5px 10px;
  6296 +}
  6297 +
  6298 +.action-account-signup #wrap-1 label[for=profile_data_sex_female],
  6299 +.action-account-signup #wrap-1 label[for=profile_data_sex_male] {
  6300 + color: #6d786e;
  6301 + font-size: 20px;
  6302 + font-family: droidserif;
  6303 + text-transform: lowercase;
  6304 + display: inline;
  6305 + margin-left: 8px;
  6306 +}
  6307 +
  6308 +.action-account-signup #wrap-1 label[for=profile_data_country],
  6309 +.action-account-signup #wrap-1 label[for=profile_data_preferred_domain_id],
  6310 +.action-account-signup #wrap-1 label[for=profile_data_birth_date_2i],
  6311 +.action-account-signup #wrap-1 label[for=profile_data_birth_date_3i],
  6312 +.action-account-signup #wrap-1 label[for=profile_data_schooling],
  6313 +.action-account-signup #wrap-1 label[for=profile_data_formation],
  6314 +.action-account-signup #wrap-1 label[for=profile_data_area_of_study],
  6315 +.action-account-signup #wrap-1 label[for=profile_data_image_builder_uploaded_data] {
  6316 + display: block;
  6317 +}
  6318 +
  6319 +.action-account-signup #wrap-1 .formfield input[type=password] {
  6320 + margin-bottom: -6px;
  6321 + margin-top: 15px;
  6322 +}
  6323 +
  6324 +.action-account-signup #wrap-1 .formfield textarea,
  6325 +.action-account-signup #wrap-1 .formfield input[type=password],
  6326 +.action-account-signup #wrap-1 #profile_data_name,
  6327 +.action-account-signup #wrap-1 .formfield input[type=text] {
  6328 + width: 400px;
  6329 +}
  6330 +
  6331 +.action-account-signup #wrap-1 #profile_data_name {
  6332 + padding-left: 10px;
  6333 + margin-top: 12px;
  6334 + margin-bottom: 3px;
  6335 +}
  6336 +
  6337 +.action-account-signup #wrap-1 #signup-form-header {
  6338 + background: #E3E3E3;
  6339 + padding-top: 10px;
  6340 + -moz-border-radius: 8px;
  6341 + border-radius: 8px;
  6342 + -webkit-border-radius: 8px;
  6343 + margin: 75px auto 20px;
  6344 + position: relative;
  6345 + width: 563px;
  6346 +}
  6347 +
  6348 +.action-account-signup #wrap-1 #user_email,
  6349 +.action-account-signup #wrap-1 .formfield input.passwords_match,
  6350 +.action-account-signup #wrap-1 .formfield input.passwords_differ {
  6351 + width: 338px;
  6352 + padding-right: 30px;
  6353 +}
  6354 +
  6355 +.action-account-signup #wrap-1 #user_login.available,
  6356 +.action-account-signup #wrap-1 #user_email.available,
  6357 +.action-account-signup #wrap-1 #user_login.unavailable,
  6358 +.action-account-signup #wrap-1 #user_email.unavailable,
  6359 +.action-account-signup #wrap-1 #user_email.checking,
  6360 +.action-account-signup #wrap-1 #user_login.checking,
  6361 +.action-account-signup #wrap-1 #user_login.available,
  6362 +.action-account-signup #wrap-1 #user_email.available,
  6363 +.action-account-signup #wrap-1 .formfield input.passwords_differ,
  6364 +.action-account-signup #wrap-1 .formfield input.passwords_match {
  6365 + border-width: 2px;
  6366 + border-style: solid;
  6367 + background-color: #fff;
  6368 + background-position: right center;
  6369 + background-repeat: no-repeat;
  6370 + padding: 5px 30px 8px 5px;
  6371 +}
  6372 +
  6373 +.action-account-signup #wrap-1 #user_login.unavailable,
  6374 +.action-account-signup #wrap-1 #user_email.unavailable,
  6375 +.action-account-signup #wrap-1 .formfield input.passwords_differ {
  6376 + border-color: #FFA000;
  6377 + background-image: url(/images/passwords_nomatch.png);
  6378 +}
  6379 +
  6380 +.action-account-signup #wrap-1 #user_email.checking,
  6381 +.action-account-signup #wrap-1 #user_login.checking {
  6382 + border-color: #4A4A4A;
  6383 + background-image: url(/images/login_checking.png);
  6384 +}
  6385 +
  6386 +.action-account-signup #wrap-1 #user_login.available,
  6387 +.action-account-signup #wrap-1 #user_email.available,
  6388 +.action-account-signup #wrap-1 .formfield input.passwords_match {
  6389 + border-color: #88BD00;
  6390 + background-image: url(/images/passwords_match.png);
  6391 +}
  6392 +
  6393 +#signup-domain {
  6394 + float: left;
  6395 + display: inline-block;
  6396 + vertical-align: middle;
  6397 + background: #EAEAEA;
  6398 + border-right: 2px solid #FFFFFF;
  6399 + border-top: 2px solid #FFFFFF;
  6400 + border-left: 2px solid #CFCFCF;
  6401 + border-bottom: 2px solid #CFCFCF;
  6402 + line-height: 37px;
  6403 + padding: 0px 7px;
  6404 + color: #4A4A4A;
  6405 + font-size: 20px;
  6406 + font-family: droidserif;
  6407 + text-transform: lowercase;
  6408 + margin: 14px 0 0 14px;
  6409 +}
  6410 +
  6411 +.action-account-signup #wrap-1 #signup-form-header #user_login {
  6412 + margin: 0;
  6413 + width: 200px;
  6414 + padding-right: 30px;
  6415 +}
  6416 +
  6417 +#url-check {
  6418 + width: 239px;
  6419 +}
  6420 +
  6421 +#signup-login-field {
  6422 + float: left;
  6423 + margin: 11px 0 0 0;
  6424 +}
  6425 +
  6426 +.action-account-signup #wrap-1 #signup-password-confirmation,
  6427 +.action-account-signup #wrap-1 #signup-login {
  6428 + position: relative;
  6429 +}
  6430 +
  6431 +.action-account-signup #wrap-1 small#signup-balloon,
  6432 +.action-account-signup #wrap-1 small#password-balloon {
  6433 + display: none;
  6434 + width: 142px;
  6435 + height: 69px;
  6436 + color: #FFFFFF;
  6437 + font-weight: bold;
  6438 + font-size: 11px;
  6439 + padding: 5px 10px 45px 10px;
  6440 + margin: 0;
  6441 + line-height: 1.5em;
  6442 + background: transparent url(/images/orange-balloon.png) bottom center no-repeat;
  6443 + position: absolute;
  6444 + z-index: 2;
  6445 + right: -40px;
  6446 + top: -80px;
  6447 +}
  6448 +
  6449 +.action-account-signup #wrap-1 .required-field label,
  6450 +.action-account-signup #wrap-1 .formlabel {
  6451 + color: #b4b9b5;
  6452 + font-size: 20px;
  6453 + text-transform: lowercase;
  6454 + font-weight: normal;
  6455 + margin-left: 15px;
  6456 + font-family: droidserif;
  6457 +}
  6458 +
  6459 +.action-account-signup #wrap-1 .required-field label::after {
  6460 + content: '';
  6461 +}
  6462 +
  6463 +.action-account-signup #wrap-1 div.fieldWithErrors {
6194 6464 background: transparent;
6195 6465 }
6196 6466  
6197   -.comment_reply .recaptcha_image_cell {
6198   - background: transparent !important;
  6467 +.person_image_maxsize {
  6468 + margin: 0 18px;
  6469 + font: 13px sans-serif;
  6470 + color: #BABABA;
6199 6471 }
6200 6472  
6201   -/* Colorbox */
  6473 +#terms-of-use-box {
  6474 + margin: 20px 0 30px 40px;
  6475 + color: #B3B3B3;
  6476 +}
6202 6477  
6203   -#cboxClose {
6204   - display: none !important;
  6478 +#terms-of-use-box input[type=checkbox] {
  6479 + border: 1px solid #FFA514;
  6480 + background: #FFF;
  6481 +}
  6482 +
  6483 +.action-account-signup #terms-of-use-box label {
  6484 + display: inline;
  6485 + font-size: 14px;
  6486 +}
  6487 +
  6488 +.action-account-signup #terms-of-use-box label a {
  6489 + color: #FF7F2A;
  6490 +}
  6491 +
  6492 +.action-account-signup #content form input.button.submit {
  6493 + border: 0;
  6494 + padding: 8px 36px 12px;
  6495 + background: transparent url(/images/orange-bg.png) left center repeat-x;
  6496 + font-size: 17px;
  6497 + font-family: droidserif;
  6498 + color: #FFFFD5;
  6499 + text-align: center;
  6500 + text-shadow: #d45500 0 -1px 0;
  6501 + border-radius: 7px;
  6502 + -moz-border-radius: 7px;
  6503 + -webkit-border-radius: 7px;
  6504 + max-height: none;
  6505 + height: 39px;
  6506 +}
  6507 +
  6508 +.action-account-signup .no-boxes {
  6509 + margin-left: 128px;
  6510 + margin-right: 128px;
  6511 +}
  6512 +
  6513 +#signup-password {
  6514 + margin-top: -19px;
  6515 +}
  6516 +
  6517 +#signup-password-confirmation {
  6518 + margin-top: -5px;
  6519 +}
  6520 +
  6521 +#signup-form-profile {
  6522 + margin: 30px 0 0 40px;
  6523 +}
  6524 +
  6525 +.select-birth-date {
  6526 + margin-left: 14px;
6205 6527 }
... ...
test/functional/account_controller_test.rb
... ... @@ -666,6 +666,22 @@ class AccountControllerTest &lt; Test::Unit::TestCase
666 666 assert_equal 'unavailable', assigns(:status_class)
667 667 end
668 668  
  669 + should 'check if e-mail is available on environment' do
  670 + env = fast_create(Environment, :name => 'Environment test')
  671 + @controller.expects(:environment).returns(env).at_least_once
  672 + profile = create_user('mylogin', :email => 'mylogin@noosfero.org', :environment_id => fast_create(Environment).id)
  673 + get :check_email, :address => 'mylogin@noosfero.org'
  674 + assert_equal 'available', assigns(:status_class)
  675 + end
  676 +
  677 + should 'check if e-mail is not available on environment' do
  678 + env = fast_create(Environment, :name => 'Environment test')
  679 + @controller.expects(:environment).returns(env).at_least_once
  680 + profile = create_user('mylogin', :email => 'mylogin@noosfero.org', :environment_id => env)
  681 + get :check_email, :address => 'mylogin@noosfero.org'
  682 + assert_equal 'unavailable', assigns(:status_class)
  683 + end
  684 +
669 685 should 'merge user data with extra stuff from plugins' do
670 686 class Plugin1 < Noosfero::Plugin
671 687 def user_data_extras
... ... @@ -719,6 +735,42 @@ class AccountControllerTest &lt; Test::Unit::TestCase
719 735 assert_redirected_to '/bli'
720 736 end
721 737  
  738 + should 'be able to upload an image' do
  739 + new_user({}, :profile_data => { :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } })
  740 + assert_not_nil Person.last.image
  741 + end
  742 +
  743 + should 'not be able to upload an image bigger than max size' do
  744 + Image.any_instance.stubs(:size).returns(Image.attachment_options[:max_size] + 1024)
  745 + new_user({}, :profile_data => { :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } })
  746 + assert_nil Person.last.image
  747 + end
  748 +
  749 + should 'display error message when image has more than max size' do
  750 + Image.any_instance.stubs(:size).returns(Image.attachment_options[:max_size] + 1024)
  751 + new_user({}, :profile_data => { :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } })
  752 + assert_tag :tag => 'div', :attributes => { :class => 'errorExplanation', :id => 'errorExplanation' }
  753 + end
  754 +
  755 + should 'not display error message when image has less than max size' do
  756 + Image.any_instance.stubs(:size).returns(Image.attachment_options[:max_size] - 1024)
  757 + new_user({}, :profile_data => { :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } })
  758 + assert_no_tag :tag => 'div', :attributes => { :class => 'errorExplanation', :id => 'errorExplanation' }
  759 + end
  760 +
  761 + should 'not redirect when some file has errors' do
  762 + Image.any_instance.stubs(:size).returns(Image.attachment_options[:max_size] + 1024)
  763 + new_user({}, :profile_data => { :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } })
  764 + assert_response :success
  765 + assert_template 'signup'
  766 + end
  767 +
  768 + should 'remove useless user data on signup' do
  769 + assert_nothing_raised do
  770 + new_user :password_clear => 'nothing', :password_confirmation_clear => 'nothing'
  771 + end
  772 + end
  773 +
722 774 protected
723 775 def new_user(options = {}, extra_options ={})
724 776 data = {:profile_data => person_data}
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -878,4 +878,22 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
878 878 assert_tag :tag => 'a', :content => plugin2_button[:title], :attributes => {:class => /#{plugin2_button[:icon]}/, :href => /#{plugin2_button[:url]}/}
879 879 end
880 880  
  881 + should 'show image upload field from environment person fields' do
  882 + env = Environment.default
  883 + env.custom_person_fields = { 'image' => {'active' => 'true', 'required' => 'true'} }
  884 + env.save!
  885 + get :edit, :profile => profile.identifier
  886 + assert_tag :tag => 'input', :attributes => { :name => 'profile_data[image_builder][uploaded_data]' }
  887 + assert_no_tag :tag => 'div', :attributes => { :id => 'profile_change_picture' }
  888 + end
  889 +
  890 + should 'show image upload field from profile editor' do
  891 + env = Environment.default
  892 + env.custom_person_fields = { }
  893 + env.save!
  894 + get :edit, :profile => profile.identifier
  895 + assert_tag :tag => 'input', :attributes => { :name => 'profile_data[image_builder][uploaded_data]' }
  896 + assert_tag :tag => 'div', :attributes => { :id => 'profile_change_picture' }
  897 + end
  898 +
881 899 end
... ...
test/unit/person_test.rb
... ... @@ -64,7 +64,7 @@ class PersonTest &lt; Test::Unit::TestCase
64 64  
65 65 should "have person info fields" do
66 66 p = Person.new(:environment => Environment.default)
67   - [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code ].each do |i|
  67 + [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code, :image ].each do |i|
68 68 assert_respond_to p, i
69 69 end
70 70 end
... ...