Commit de8d57493e7b1adda7edee71aa684160a15605c5
1 parent
776820ff
Exists in
master
and in
28 other branches
Revert "Signup interface improvements"
This reverts commit 26e7f6658d9d47584be570c1715a032111306316.
Showing
20 changed files
with
92 additions
and
613 deletions
Show diff stats
app/controllers/public/account_controller.rb
| @@ -60,10 +60,6 @@ class AccountController < ApplicationController | @@ -60,10 +60,6 @@ class AccountController < ApplicationController | ||
| 60 | def signup | 60 | def signup |
| 61 | @invitation_code = params[:invitation_code] | 61 | @invitation_code = params[:invitation_code] |
| 62 | begin | 62 | begin |
| 63 | - if params[:user] | ||
| 64 | - params[:user].delete(:password_confirmation_clear) | ||
| 65 | - params[:user].delete(:password_clear) | ||
| 66 | - end | ||
| 67 | @user = User.new(params[:user]) | 63 | @user = User.new(params[:user]) |
| 68 | @user.terms_of_use = environment.terms_of_use | 64 | @user.terms_of_use = environment.terms_of_use |
| 69 | @user.environment = environment | 65 | @user.environment = environment |
| @@ -213,26 +209,16 @@ class AccountController < ApplicationController | @@ -213,26 +209,16 @@ class AccountController < ApplicationController | ||
| 213 | @identifier = params[:identifier] | 209 | @identifier = params[:identifier] |
| 214 | valid = Person.is_available?(@identifier, environment) | 210 | valid = Person.is_available?(@identifier, environment) |
| 215 | if valid | 211 | if valid |
| 216 | - @status = _('This login name is available') | 212 | + @status = _('Available!') |
| 217 | @status_class = 'available' | 213 | @status_class = 'available' |
| 218 | else | 214 | else |
| 219 | - @status = _('This login name is unavailable') | 215 | + @status = _('Unavailable!') |
| 220 | @status_class = 'unavailable' | 216 | @status_class = 'unavailable' |
| 221 | end | 217 | end |
| 218 | + @url = environment.top_url + '/' + @identifier | ||
| 222 | render :partial => 'identifier_status' | 219 | render :partial => 'identifier_status' |
| 223 | end | 220 | end |
| 224 | 221 | ||
| 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 | - | ||
| 236 | def user_data | 222 | def user_data |
| 237 | user_data = | 223 | user_data = |
| 238 | if logged_in? | 224 | if logged_in? |
app/models/person.rb
| @@ -116,7 +116,6 @@ class Person < Profile | @@ -116,7 +116,6 @@ class Person < Profile | ||
| 116 | contact_phone | 116 | contact_phone |
| 117 | contact_information | 117 | contact_information |
| 118 | description | 118 | description |
| 119 | - image | ||
| 120 | ] | 119 | ] |
| 121 | 120 | ||
| 122 | validates_multiparameter_assignments | 121 | validates_multiparameter_assignments |
app/views/account/_email_status.rhtml
app/views/account/_identifier_status.rhtml
| 1 | <div class='status-identifier'> | 1 | <div class='status-identifier'> |
| 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> | 2 | + <p><%= @url %> <span class='<%= @status_class %>'><%= @status %></span> </p> |
| 7 | </div> | 3 | </div> |
app/views/account/_signup_form.rhtml
| 1 | <%= error_messages_for :user, :person %> | 1 | <%= error_messages_for :user, :person %> |
| 2 | 2 | ||
| 3 | -<% labelled_form_for :user, @user, :html => { :multipart => true, :id => 'signup-form' } do |f| %> | ||
| 4 | - | ||
| 5 | -<%= hidden_field_tag :invitation_code, @invitation_code %> | ||
| 6 | - | ||
| 7 | -<div id='signup-form-header'> | ||
| 8 | - | ||
| 9 | - <%= label :profile_data, :name %> | ||
| 10 | - <%= required text_field(:profile_data, :name, :rel => _('Name')) %> | ||
| 11 | - | ||
| 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> </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 | - %> | ||
| 30 | - | ||
| 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> | ||
| 36 | - | ||
| 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> | 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 %> | ||
| 42 | 9 | ||
| 43 | - <span id="signup-domain"><%= @environment.top_url.gsub(/^http:\/\//, '') %>/</span> | 10 | +<% labelled_form_for :user, @user, :html => { :multipart => true } do |f| %> |
| 44 | 11 | ||
| 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> </p></div> | ||
| 49 | - </div> | ||
| 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;" /> | ||
| 52 | - </div> | 12 | +<%= hidden_field_tag :invitation_code, @invitation_code %> |
| 53 | 13 | ||
| 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 | - %> | 14 | +<%= required_fields_message %> |
| 62 | 15 | ||
| 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.')) %> | ||
| 63 | </div> | 19 | </div> |
| 64 | 20 | ||
| 65 | -<div id="signup-form-profile"> | 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> | ||
| 66 | 24 | ||
| 67 | - <% labelled_fields_for :profile_data, @person do |f| %> | ||
| 68 | - <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %> | ||
| 69 | - <% end %> | 25 | +<%= observe_field 'user_login', :url => {:action => 'check_url'}, :with => 'identifier', :update => 'url-check' %> |
| 70 | 26 | ||
| 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 %> | 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.')) %> | ||
| 90 | </div> | 30 | </div> |
| 91 | 31 | ||
| 92 | -<p style="text-align: center"> | ||
| 93 | - <%= submit_button('save', _('Sign up')) %> | ||
| 94 | -</p> | ||
| 95 | - | 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 %> | ||
| 51 | + </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> | ||
| 53 | + </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 %> | ||
| 96 | <% end -%> | 66 | <% 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><%= _('Sign up for %s!') % environment.name %></h1> | 1 | +<h1><%= _('Signup') %></h1> |
| 2 | <% if @register_pending %> | 2 | <% if @register_pending %> |
| 3 | <%= _('Thanks for signing up! Now check your e-mail to activate your account!') %> | 3 | <%= _('Thanks for signing up! Now check your e-mail to activate your account!') %> |
| 4 | <p style="text-align: center"><%= link_to(_('Go to the homepage'), '/') %></p> | 4 | <p style="text-align: center"><%= link_to(_('Go to the homepage'), '/') %></p> |
app/views/profile_editor/_person.rhtml
| @@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
| 2 | 2 | ||
| 3 | <%= required_fields_message %> | 3 | <%= required_fields_message %> |
| 4 | 4 | ||
| 5 | - <%= required f.text_field(:name) %> | ||
| 6 | - | ||
| 7 | - <%= required f.text_field(:email) %> | 5 | + <%= required f.text_field(:email)%> |
| 8 | 6 | ||
| 9 | <%= render :partial => 'person_form', :locals => {:f => f} %> | 7 | <%= render :partial => 'person_form', :locals => {:f => f} %> |
app/views/profile_editor/_person_form.rhtml
| 1 | <% @person ||= @profile %> | 1 | <% @person ||= @profile %> |
| 2 | 2 | ||
| 3 | +<%= required f.text_field(:name) %> | ||
| 4 | + | ||
| 3 | <% optional_field(@person, 'nickname') do %> | 5 | <% optional_field(@person, 'nickname') do %> |
| 4 | - <%= f.text_field(:nickname, :maxlength => 16, :size => 30, :rel => _('Nickname')) %> | 6 | + <%= f.text_field(:nickname, :maxlength => 16, :size => 30) %> |
| 5 | <div> | 7 | <div> |
| 6 | <small><%= _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') %></small> | 8 | <small><%= _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') %></small> |
| 7 | </div> | 9 | </div> |
| 8 | <% end %> | 10 | <% end %> |
| 9 | 11 | ||
| 10 | -<%= optional_field(@person, 'description', f.text_area(:description, :rows => 5, :rel => _('Description'))) %> | 12 | +<%= optional_field(@person, 'description', f.text_area(:description, :rows => 5)) %> |
| 11 | <%= optional_field(@person, 'preferred_domain', select_preferred_domain(:profile_data)) %> | 13 | <%= optional_field(@person, 'preferred_domain', select_preferred_domain(:profile_data)) %> |
| 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'))) %> | 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)) %> | ||
| 16 | <%= optional_field(@person, 'sex', f.radio_group(:profile_data, :sex, [ ['male',_('Male')], ['female',_('Female')] ])) %> | 18 | <%= optional_field(@person, 'sex', f.radio_group(:profile_data, :sex, [ ['male',_('Male')], ['female',_('Female')] ])) %> |
| 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>')) %> | 19 | <%= 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>')) %> |
| 18 | -<%= optional_field(@person, 'nationality', f.text_field(:nationality, :rel => _('Nationality'))) %> | 20 | +<%= optional_field(@person, 'nationality', f.text_field(:nationality)) %> |
| 19 | <%= optional_field(@person, 'country', select_country(_('Country'), 'profile_data', 'country', {:class => 'type-select'})) %> | 21 | <%= optional_field(@person, 'country', select_country(_('Country'), 'profile_data', 'country', {:class => 'type-select'})) %> |
| 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')))) %> | 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))) %> | ||
| 24 | 26 | ||
| 25 | <% optional_field(@person, 'schooling') do %> | 27 | <% optional_field(@person, 'schooling') do %> |
| 26 | <div class="formfieldline"> | 28 | <div class="formfieldline"> |
| @@ -45,25 +47,18 @@ | @@ -45,25 +47,18 @@ | ||
| 45 | <%= optional_field(@person, 'formation', select_area(_('Education'), 'profile_data', 'formation', {:class => 'type-select-full-line'})) %> | 47 | <%= optional_field(@person, 'formation', select_area(_('Education'), 'profile_data', 'formation', {:class => 'type-select-full-line'})) %> |
| 46 | 48 | ||
| 47 | <span id='profile_data_custom_formation_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.formation) %> > | 49 | <span id='profile_data_custom_formation_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.formation) %> > |
| 48 | - <%= optional_field(@person, 'custom_formation', f.text_field(:custom_formation, :rel => _('Custom formation'))) %> | 50 | + <%= optional_field(@person, 'custom_formation', f.text_field(:custom_formation)) %> |
| 49 | </span> | 51 | </span> |
| 50 | <%= observe_field 'profile_data_formation', :function =>'toggle_text_field("profile_data_formation", "profile_data_custom_formation_span")' %> | 52 | <%= observe_field 'profile_data_formation', :function =>'toggle_text_field("profile_data_formation", "profile_data_custom_formation_span")' %> |
| 51 | 53 | ||
| 52 | <%= optional_field(@person, 'area_of_study', select_area(_('Area of study'), 'profile_data', 'area_of_study', {:class => 'type-select-full-line'})) %> | 54 | <%= optional_field(@person, 'area_of_study', select_area(_('Area of study'), 'profile_data', 'area_of_study', {:class => 'type-select-full-line'})) %> |
| 53 | 55 | ||
| 54 | <span id='profile_data_custom_area_of_study_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.area_of_study) %> > | 56 | <span id='profile_data_custom_area_of_study_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.area_of_study) %> > |
| 55 | - <%= optional_field(@person, 'custom_area_of_study', f.text_field(:custom_area_of_study, :rel => _('Custom area of study'))) %> | 57 | + <%= optional_field(@person, 'custom_area_of_study', f.text_field(:custom_area_of_study)) %> |
| 56 | </span> | 58 | </span> |
| 57 | <%= observe_field 'profile_data_area_of_study', :function =>'toggle_text_field("profile_data_area_of_study", "profile_data_custom_area_of_study_span")' %> | 59 | <%= observe_field 'profile_data_area_of_study', :function =>'toggle_text_field("profile_data_area_of_study", "profile_data_custom_area_of_study_span")' %> |
| 58 | 60 | ||
| 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'))) %> | 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)) %> | ||
| 62 | 64 | ||
| 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,14 +6,12 @@ | @@ -6,14 +6,12 @@ | ||
| 6 | 6 | ||
| 7 | <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> | 7 | <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> |
| 8 | 8 | ||
| 9 | - <% unless @profile.person? && @environment.active_person_fields.include?('image') %> | ||
| 10 | <div id="profile_change_picture"> | 9 | <div id="profile_change_picture"> |
| 11 | <h2><%= _('Change picture') %></h2> | 10 | <h2><%= _('Change picture') %></h2> |
| 12 | <% f.fields_for :image_builder, @profile.image do |i| %> | 11 | <% f.fields_for :image_builder, @profile.image do |i| %> |
| 13 | <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> | 12 | <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> |
| 14 | <% end %> | 13 | <% end %> |
| 15 | </div> | 14 | </div> |
| 16 | - <% end %> | ||
| 17 | 15 | ||
| 18 | <h2><%= _('Privacy options') %></h2> | 16 | <h2><%= _('Privacy options') %></h2> |
| 19 | 17 |
public/fonts/DroidSerif-Regular.ttf
No preview for this file type
public/images/field-bg.png
399 Bytes
public/images/login_checking.png
1.09 KB
public/images/orange-balloon.png
1.12 KB
public/images/orange-bg.png
191 Bytes
public/images/passwords_match.png
777 Bytes
public/images/passwords_nomatch.png
374 Bytes
public/stylesheets/application.css
| @@ -6180,355 +6180,33 @@ h1#agenda-title { | @@ -6180,355 +6180,33 @@ h1#agenda-title { | ||
| 6180 | 6180 | ||
| 6181 | /* Captcha */ | 6181 | /* Captcha */ |
| 6182 | 6182 | ||
| 6183 | -/* Colorbox */ | 6183 | +.comment_reply #recaptcha_area { |
| 6184 | + margin-bottom: 3px !important; | ||
| 6185 | +} | ||
| 6184 | 6186 | ||
| 6185 | -#cboxClose { | 6187 | +.comment_reply .recaptchatable tr td + td + td { |
| 6186 | display: none !important; | 6188 | display: none !important; |
| 6187 | } | 6189 | } |
| 6188 | 6190 | ||
| 6189 | -/* Signup interface */ | ||
| 6190 | - | ||
| 6191 | -#url-check { | ||
| 6192 | - margin: 0 0 2px 0; | 6191 | +.comment_reply .recaptcha-container { |
| 6193 | width: 100%; | 6192 | width: 100%; |
| 6194 | - text-align: right; | ||
| 6195 | -} | ||
| 6196 | - | ||
| 6197 | -#email-check { | ||
| 6198 | - margin: -2px 171px 2px 0; | ||
| 6199 | - text-align: right; | ||
| 6200 | - clear: both; | ||
| 6201 | -} | ||
| 6202 | - | ||
| 6203 | -#email-check p { | ||
| 6204 | - margin: 0; | ||
| 6205 | -} | ||
| 6206 | - | ||
| 6207 | -.available { | ||
| 6208 | - color: #88BD00; | ||
| 6209 | -} | ||
| 6210 | - | ||
| 6211 | -.unavailable { | ||
| 6212 | - color: #FFA000; | ||
| 6213 | -} | ||
| 6214 | - | ||
| 6215 | -.checking { | ||
| 6216 | - color: #4A4A4A; | ||
| 6217 | -} | ||
| 6218 | - | ||
| 6219 | -#email-check p, #url-check p { | ||
| 6220 | - margin: 0; | ||
| 6221 | - text-transform: lowercase; | ||
| 6222 | - font-size: 11px; | ||
| 6223 | - clear: both; | ||
| 6224 | -} | ||
| 6225 | - | ||
| 6226 | -.action-account-signup #main-content-wrapper-8 { | ||
| 6227 | - background: #ECECEC; | ||
| 6228 | -} | ||
| 6229 | - | ||
| 6230 | -@font-face { | ||
| 6231 | - font-family: droidserif; | ||
| 6232 | - src: url('/fonts/DroidSerif-Regular.ttf'); | ||
| 6233 | -} | ||
| 6234 | - | ||
| 6235 | -.action-account-signup #content .no-boxes h1 { | ||
| 6236 | - font-variant: normal; | ||
| 6237 | - border-bottom: 0; | ||
| 6238 | - color: #666666; | ||
| 6239 | - font-family: droidserif, serif; | ||
| 6240 | - font-weight: lighter; | ||
| 6241 | - text-align: center; | ||
| 6242 | - margin-top: 35px; | ||
| 6243 | - margin-left: 12px; | ||
| 6244 | -} | ||
| 6245 | - | ||
| 6246 | -.action-account-signup #wrap-1 .formfield select, | ||
| 6247 | -.action-account-signup #wrap-1 .formfield textarea, | ||
| 6248 | -.action-account-signup #wrap-1 #profile_data_name, | ||
| 6249 | -.action-account-signup #wrap-1 .formfield input { | ||
| 6250 | - background: transparent url(/images/field-bg.png) left top no-repeat; | ||
| 6251 | - padding: 7px 3px 10px 7px; | ||
| 6252 | - height: 24px; | ||
| 6253 | - width: 335px; | ||
| 6254 | - color: #6d786e; | ||
| 6255 | - font-size: 20px; | ||
| 6256 | - font-family: droidserif, serif; | ||
| 6257 | - margin: 9px 14px 0; | ||
| 6258 | - border: 0; | ||
| 6259 | -} | ||
| 6260 | - | ||
| 6261 | -.action-account-signup #wrap-1 .formfield select { | ||
| 6262 | - height: auto; | ||
| 6263 | -} | ||
| 6264 | - | ||
| 6265 | -.action-account-signup #wrap-1 .formfield .select-birth-date select { | ||
| 6266 | - width: 93px; | ||
| 6267 | - margin-right: 2px; | ||
| 6268 | - margin-left: 0; | ||
| 6269 | -} | ||
| 6270 | - | ||
| 6271 | -.webkit.action-account-signup #wrap-1 .formfield select { | ||
| 6272 | - background: #fff; | ||
| 6273 | -} | ||
| 6274 | - | ||
| 6275 | -.action-account-signup #wrap-1 .formfield textarea { | ||
| 6276 | - height: 335px; | ||
| 6277 | - background: #fff; | ||
| 6278 | -} | ||
| 6279 | - | ||
| 6280 | -.action-account-signup #wrap-1 .formfield input[type=file] { | ||
| 6281 | - font-size: 12px; | ||
| 6282 | -} | ||
| 6283 | - | ||
| 6284 | -.action-account-signup #wrap-1 .formfield textarea { | ||
| 6285 | - height: 100px; | ||
| 6286 | -} | ||
| 6287 | - | ||
| 6288 | -.action-account-signup #wrap-1 label, | ||
| 6289 | -.action-account-signup #wrap-1 small, | ||
| 6290 | -.action-account-signup #wrap-1 #user_password, | ||
| 6291 | -.action-account-signup #wrap-1 #user_password_confirmation { | ||
| 6292 | - display: none; | ||
| 6293 | -} | ||
| 6294 | - | ||
| 6295 | -.action-account-signup #wrap-1 input[type=radio] { | ||
| 6296 | - height: auto; | ||
| 6297 | - margin: 0; | ||
| 6298 | - margin-left: 3px; | ||
| 6299 | -} | ||
| 6300 | - | ||
| 6301 | -.action-account-signup #wrap-1 .fieldgroup { | ||
| 6302 | - margin: 5px 10px; | ||
| 6303 | -} | ||
| 6304 | - | ||
| 6305 | -.action-account-signup #wrap-1 label[for=profile_data_sex_female], | ||
| 6306 | -.action-account-signup #wrap-1 label[for=profile_data_sex_male] { | ||
| 6307 | - color: #6d786e; | ||
| 6308 | - font-size: 20px; | ||
| 6309 | - font-family: droidserif; | ||
| 6310 | - text-transform: lowercase; | ||
| 6311 | - display: inline; | ||
| 6312 | - margin-left: 8px; | ||
| 6313 | -} | ||
| 6314 | - | ||
| 6315 | -.action-account-signup #wrap-1 label[for=profile_data_country], | ||
| 6316 | -.action-account-signup #wrap-1 label[for=profile_data_preferred_domain_id], | ||
| 6317 | -.action-account-signup #wrap-1 label[for=profile_data_birth_date_2i], | ||
| 6318 | -.action-account-signup #wrap-1 label[for=profile_data_birth_date_3i], | ||
| 6319 | -.action-account-signup #wrap-1 label[for=profile_data_schooling], | ||
| 6320 | -.action-account-signup #wrap-1 label[for=profile_data_formation], | ||
| 6321 | -.action-account-signup #wrap-1 label[for=profile_data_area_of_study], | ||
| 6322 | -.action-account-signup #wrap-1 label[for=profile_data_image_builder_uploaded_data] { | ||
| 6323 | - display: block; | ||
| 6324 | -} | ||
| 6325 | - | ||
| 6326 | -.action-account-signup #wrap-1 .formfield input[type=password] { | ||
| 6327 | - margin-bottom: -6px; | ||
| 6328 | - margin-top: 15px; | ||
| 6329 | -} | ||
| 6330 | - | ||
| 6331 | -.action-account-signup #wrap-1 .formfield textarea, | ||
| 6332 | -.action-account-signup #wrap-1 .formfield input[type=password], | ||
| 6333 | -.action-account-signup #wrap-1 #profile_data_name, | ||
| 6334 | -.action-account-signup #wrap-1 .formfield input[type=text] { | ||
| 6335 | - width: 400px; | ||
| 6336 | -} | ||
| 6337 | - | ||
| 6338 | -.action-account-signup #wrap-1 #profile_data_name { | ||
| 6339 | - padding-left: 10px; | ||
| 6340 | - margin-top: 12px; | ||
| 6341 | - margin-bottom: 3px; | ||
| 6342 | -} | ||
| 6343 | - | ||
| 6344 | -.action-account-signup #wrap-1 #signup-form-header { | ||
| 6345 | - background: #E3E3E3; | ||
| 6346 | - padding-top: 10px; | ||
| 6347 | - -moz-border-radius: 8px; | ||
| 6348 | - border-radius: 8px; | ||
| 6349 | - -webkit-border-radius: 8px; | ||
| 6350 | - margin: 75px auto 20px; | ||
| 6351 | - position: relative; | ||
| 6352 | - width: 563px; | ||
| 6353 | -} | ||
| 6354 | - | ||
| 6355 | -.action-account-signup #wrap-1 #user_email, | ||
| 6356 | -.action-account-signup #wrap-1 .formfield input.passwords_match, | ||
| 6357 | -.action-account-signup #wrap-1 .formfield input.passwords_differ { | ||
| 6358 | - width: 338px; | ||
| 6359 | - padding-right: 30px; | ||
| 6360 | -} | ||
| 6361 | - | ||
| 6362 | -.action-account-signup #wrap-1 #user_login.available, | ||
| 6363 | -.action-account-signup #wrap-1 #user_email.available, | ||
| 6364 | -.action-account-signup #wrap-1 #user_login.unavailable, | ||
| 6365 | -.action-account-signup #wrap-1 #user_email.unavailable, | ||
| 6366 | -.action-account-signup #wrap-1 #user_email.checking, | ||
| 6367 | -.action-account-signup #wrap-1 #user_login.checking, | ||
| 6368 | -.action-account-signup #wrap-1 #user_login.available, | ||
| 6369 | -.action-account-signup #wrap-1 #user_email.available, | ||
| 6370 | -.action-account-signup #wrap-1 .formfield input.passwords_differ, | ||
| 6371 | -.action-account-signup #wrap-1 .formfield input.passwords_match { | ||
| 6372 | - border-width: 2px; | ||
| 6373 | - border-style: solid; | ||
| 6374 | - background-color: #fff; | ||
| 6375 | - background-position: right center; | ||
| 6376 | - background-repeat: no-repeat; | ||
| 6377 | - padding: 5px 30px 8px 5px; | ||
| 6378 | -} | ||
| 6379 | - | ||
| 6380 | -.action-account-signup #wrap-1 #user_login.unavailable, | ||
| 6381 | -.action-account-signup #wrap-1 #user_email.unavailable, | ||
| 6382 | -.action-account-signup #wrap-1 .formfield input.passwords_differ { | ||
| 6383 | - border-color: #FFA000; | ||
| 6384 | - background-image: url(/images/passwords_nomatch.png); | ||
| 6385 | -} | ||
| 6386 | - | ||
| 6387 | -.action-account-signup #wrap-1 #user_email.checking, | ||
| 6388 | -.action-account-signup #wrap-1 #user_login.checking { | ||
| 6389 | - border-color: #4A4A4A; | ||
| 6390 | - background-image: url(/images/login_checking.png); | ||
| 6391 | -} | ||
| 6392 | - | ||
| 6393 | -.action-account-signup #wrap-1 #user_login.available, | ||
| 6394 | -.action-account-signup #wrap-1 #user_email.available, | ||
| 6395 | -.action-account-signup #wrap-1 .formfield input.passwords_match { | ||
| 6396 | - border-color: #88BD00; | ||
| 6397 | - background-image: url(/images/passwords_match.png); | ||
| 6398 | -} | ||
| 6399 | - | ||
| 6400 | -#signup-domain { | ||
| 6401 | - float: left; | ||
| 6402 | - display: inline-block; | ||
| 6403 | - vertical-align: middle; | ||
| 6404 | - background: #EAEAEA; | ||
| 6405 | - border-right: 2px solid #FFFFFF; | ||
| 6406 | - border-top: 2px solid #FFFFFF; | ||
| 6407 | - border-left: 2px solid #CFCFCF; | ||
| 6408 | - border-bottom: 2px solid #CFCFCF; | ||
| 6409 | - line-height: 37px; | ||
| 6410 | - padding: 0px 7px; | ||
| 6411 | - color: #4A4A4A; | ||
| 6412 | - font-size: 20px; | ||
| 6413 | - font-family: droidserif; | ||
| 6414 | - text-transform: lowercase; | ||
| 6415 | - margin: 14px 0 0 14px; | ||
| 6416 | -} | ||
| 6417 | - | ||
| 6418 | -.action-account-signup #wrap-1 #signup-form-header #user_login { | ||
| 6419 | - margin: 0; | ||
| 6420 | - width: 200px; | ||
| 6421 | - padding-right: 30px; | ||
| 6422 | -} | ||
| 6423 | - | ||
| 6424 | -#url-check { | ||
| 6425 | - width: 239px; | ||
| 6426 | -} | ||
| 6427 | - | ||
| 6428 | -#signup-login-field { | ||
| 6429 | - float: left; | ||
| 6430 | - margin: 11px 0 0 0; | ||
| 6431 | -} | ||
| 6432 | - | ||
| 6433 | -.action-account-signup #wrap-1 #signup-password-confirmation, | ||
| 6434 | -.action-account-signup #wrap-1 #signup-login { | ||
| 6435 | - position: relative; | ||
| 6436 | -} | ||
| 6437 | - | ||
| 6438 | -.action-account-signup #wrap-1 small#signup-balloon, | ||
| 6439 | -.action-account-signup #wrap-1 small#password-balloon { | ||
| 6440 | - display: none; | ||
| 6441 | - width: 142px; | ||
| 6442 | - height: 69px; | ||
| 6443 | - color: #FFFFFF; | ||
| 6444 | - font-weight: bold; | ||
| 6445 | - font-size: 11px; | ||
| 6446 | - padding: 5px 10px 45px 10px; | ||
| 6447 | - margin: 0; | ||
| 6448 | - line-height: 1.5em; | ||
| 6449 | - background: transparent url(/images/orange-balloon.png) bottom center no-repeat; | ||
| 6450 | - position: absolute; | ||
| 6451 | - z-index: 2; | ||
| 6452 | - right: -40px; | ||
| 6453 | - top: -80px; | ||
| 6454 | -} | ||
| 6455 | - | ||
| 6456 | -.action-account-signup #wrap-1 .required-field label, | ||
| 6457 | -.action-account-signup #wrap-1 .formlabel { | ||
| 6458 | - color: #b4b9b5; | ||
| 6459 | - font-size: 20px; | ||
| 6460 | - text-transform: lowercase; | ||
| 6461 | - font-weight: normal; | ||
| 6462 | - margin-left: 15px; | ||
| 6463 | - font-family: droidserif; | 6193 | + overflow: hidden; |
| 6464 | } | 6194 | } |
| 6465 | 6195 | ||
| 6466 | -.action-account-signup #wrap-1 .required-field label::after { | ||
| 6467 | - content: ''; | 6196 | +.comment_reply .recaptcha-container:hover { |
| 6197 | + overflow: visible; | ||
| 6468 | } | 6198 | } |
| 6469 | 6199 | ||
| 6470 | -.action-account-signup #wrap-1 div.fieldWithErrors { | 6200 | +.comment_reply .recaptcha-container tr:hover td { |
| 6471 | background: transparent; | 6201 | background: transparent; |
| 6472 | } | 6202 | } |
| 6473 | 6203 | ||
| 6474 | -.person_image_maxsize { | ||
| 6475 | - margin: 0 18px; | ||
| 6476 | - font: 13px sans-serif; | ||
| 6477 | - color: #BABABA; | ||
| 6478 | -} | ||
| 6479 | - | ||
| 6480 | -#terms-of-use-box { | ||
| 6481 | - margin: 20px 0 30px 40px; | ||
| 6482 | - color: #B3B3B3; | ||
| 6483 | -} | ||
| 6484 | - | ||
| 6485 | -#terms-of-use-box input[type=checkbox] { | ||
| 6486 | - border: 1px solid #FFA514; | ||
| 6487 | - background: #FFF; | ||
| 6488 | -} | ||
| 6489 | - | ||
| 6490 | -.action-account-signup #terms-of-use-box label { | ||
| 6491 | - display: inline; | ||
| 6492 | - font-size: 14px; | ||
| 6493 | -} | ||
| 6494 | - | ||
| 6495 | -.action-account-signup #terms-of-use-box label a { | ||
| 6496 | - color: #FF7F2A; | ||
| 6497 | -} | ||
| 6498 | - | ||
| 6499 | -.action-account-signup #content form input.button.submit { | ||
| 6500 | - border: 0; | ||
| 6501 | - padding: 8px 36px 12px; | ||
| 6502 | - background: transparent url(/images/orange-bg.png) left center repeat-x; | ||
| 6503 | - font-size: 17px; | ||
| 6504 | - font-family: droidserif; | ||
| 6505 | - color: #FFFFD5; | ||
| 6506 | - text-align: center; | ||
| 6507 | - text-shadow: #d45500 0 -1px 0; | ||
| 6508 | - border-radius: 7px; | ||
| 6509 | - -moz-border-radius: 7px; | ||
| 6510 | - -webkit-border-radius: 7px; | ||
| 6511 | - max-height: none; | ||
| 6512 | - height: 39px; | ||
| 6513 | -} | ||
| 6514 | - | ||
| 6515 | -.action-account-signup .no-boxes { | ||
| 6516 | - margin-left: 128px; | ||
| 6517 | - margin-right: 128px; | 6204 | +.comment_reply .recaptcha_image_cell { |
| 6205 | + background: transparent !important; | ||
| 6518 | } | 6206 | } |
| 6519 | 6207 | ||
| 6520 | -#signup-password { | ||
| 6521 | - margin-top: -19px; | ||
| 6522 | -} | ||
| 6523 | - | ||
| 6524 | -#signup-password-confirmation { | ||
| 6525 | - margin-top: -5px; | ||
| 6526 | -} | ||
| 6527 | - | ||
| 6528 | -#signup-form-profile { | ||
| 6529 | - margin: 30px 0 0 40px; | ||
| 6530 | -} | 6208 | +/* Colorbox */ |
| 6531 | 6209 | ||
| 6532 | -.select-birth-date { | ||
| 6533 | - margin-left: 14px; | 6210 | +#cboxClose { |
| 6211 | + display: none !important; | ||
| 6534 | } | 6212 | } |
test/functional/account_controller_test.rb
| @@ -666,22 +666,6 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -666,22 +666,6 @@ class AccountControllerTest < Test::Unit::TestCase | ||
| 666 | assert_equal 'unavailable', assigns(:status_class) | 666 | assert_equal 'unavailable', assigns(:status_class) |
| 667 | end | 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 | - | ||
| 685 | should 'merge user data with extra stuff from plugins' do | 669 | should 'merge user data with extra stuff from plugins' do |
| 686 | class Plugin1 < Noosfero::Plugin | 670 | class Plugin1 < Noosfero::Plugin |
| 687 | def user_data_extras | 671 | def user_data_extras |
| @@ -735,42 +719,6 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -735,42 +719,6 @@ class AccountControllerTest < Test::Unit::TestCase | ||
| 735 | assert_redirected_to '/bli' | 719 | assert_redirected_to '/bli' |
| 736 | end | 720 | end |
| 737 | 721 | ||
| 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 | - | ||
| 774 | protected | 722 | protected |
| 775 | def new_user(options = {}, extra_options ={}) | 723 | def new_user(options = {}, extra_options ={}) |
| 776 | data = {:profile_data => person_data} | 724 | data = {:profile_data => person_data} |
test/functional/profile_editor_controller_test.rb
| @@ -878,22 +878,4 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -878,22 +878,4 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
| 878 | assert_tag :tag => 'a', :content => plugin2_button[:title], :attributes => {:class => /#{plugin2_button[:icon]}/, :href => /#{plugin2_button[:url]}/} | 878 | assert_tag :tag => 'a', :content => plugin2_button[:title], :attributes => {:class => /#{plugin2_button[:icon]}/, :href => /#{plugin2_button[:url]}/} |
| 879 | end | 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 | - | ||
| 899 | end | 881 | end |
test/unit/person_test.rb
| @@ -64,7 +64,7 @@ class PersonTest < Test::Unit::TestCase | @@ -64,7 +64,7 @@ class PersonTest < Test::Unit::TestCase | ||
| 64 | 64 | ||
| 65 | should "have person info fields" do | 65 | should "have person info fields" do |
| 66 | p = Person.new(:environment => Environment.default) | 66 | p = Person.new(:environment => Environment.default) |
| 67 | - [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code, :image ].each do |i| | 67 | + [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code ].each do |i| |
| 68 | assert_respond_to p, i | 68 | assert_respond_to p, i |
| 69 | end | 69 | end |
| 70 | end | 70 | end |