From 0d62704c6a4cab765668013a4ad89febcbf377c9 Mon Sep 17 00:00:00 2001 From: Caio SBA Date: Mon, 16 Jan 2012 14:15:18 -0300 Subject: [PATCH] Revert "Signup interface improvements" --- app/controllers/public/account_controller.rb | 20 +++----------------- app/controllers/public/home_controller.rb | 4 ---- app/helpers/account_helper.rb | 12 ------------ app/helpers/application_helper.rb | 10 ---------- app/helpers/profile_helper.rb | 8 ++++++++ app/models/person.rb | 1 - app/models/profile.rb | 1 - app/views/account/_email_status.rhtml | 7 ------- app/views/account/_identifier_status.rhtml | 6 +----- app/views/account/_signup_form.rhtml | 198 +++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------- app/views/account/signup.rhtml | 17 +++-------------- app/views/admin_panel/_site_info.rhtml | 3 --- app/views/admin_panel/_terms_of_use.rhtml | 1 - app/views/admin_panel/index.rhtml | 1 + app/views/admin_panel/site_info.rhtml | 10 ++++------ app/views/admin_panel/terms_of_use.rhtml | 14 ++++++++++++++ app/views/home/terms.rhtml | 2 -- app/views/layouts/application-ng.rhtml | 2 +- app/views/profile_editor/_person.rhtml | 4 +--- app/views/profile_editor/_person_form.rhtml | 41 ++++++++++++++++++----------------------- app/views/profile_editor/edit.rhtml | 2 -- config/routes.rb | 1 - features/signup.feature | 18 +++++++++--------- public/fonts/DroidSerif-Regular.eot | Bin 163066 -> 0 bytes public/fonts/DroidSerif-Regular.ttf | Bin 162864 -> 0 bytes public/images/field-bg.png | Bin 399 -> 0 bytes public/images/login_checking.png | Bin 1117 -> 0 bytes public/images/orange-balloon.png | Bin 1146 -> 0 bytes public/images/orange-bg.png | Bin 191 -> 0 bytes public/images/passwords_match.png | Bin 777 -> 0 bytes public/images/passwords_nomatch.png | Bin 374 -> 0 bytes public/stylesheets/application.css | 379 ++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test/functional/account_controller_test.rb | 52 ---------------------------------------------------- test/functional/admin_panel_controller_test.rb | 12 +++++++++++- test/functional/home_controller_test.rb | 6 ------ test/functional/profile_editor_controller_test.rb | 18 ------------------ test/unit/person_test.rb | 2 +- 37 files changed, 142 insertions(+), 710 deletions(-) delete mode 100644 app/views/account/_email_status.rhtml delete mode 100644 app/views/admin_panel/_site_info.rhtml delete mode 100644 app/views/admin_panel/_terms_of_use.rhtml create mode 100644 app/views/admin_panel/terms_of_use.rhtml delete mode 100644 app/views/home/terms.rhtml delete mode 100644 public/fonts/DroidSerif-Regular.eot delete mode 100644 public/fonts/DroidSerif-Regular.ttf delete mode 100644 public/images/field-bg.png delete mode 100644 public/images/login_checking.png delete mode 100644 public/images/orange-balloon.png delete mode 100644 public/images/orange-bg.png delete mode 100644 public/images/passwords_match.png delete mode 100644 public/images/passwords_nomatch.png diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index c7d8b18..4b5483a 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -60,10 +60,6 @@ class AccountController < ApplicationController def signup @invitation_code = params[:invitation_code] begin - if params[:user] - params[:user].delete(:password_confirmation_clear) - params[:user].delete(:password_clear) - end @user = User.new(params[:user]) @user.terms_of_use = environment.terms_of_use @user.environment = environment @@ -213,26 +209,16 @@ class AccountController < ApplicationController @identifier = params[:identifier] valid = Person.is_available?(@identifier, environment) if valid - @status = _('This login name is available') + @status = _('Available!') @status_class = 'available' else - @status = _('This login name is unavailable') + @status = _('Unavailable!') @status_class = 'unavailable' end + @url = environment.top_url + '/' + @identifier render :partial => 'identifier_status' end - def check_email - if User.find_by_email_and_environment_id(params[:address], environment.id).nil? - @status = _('This e-mail address is available') - @status_class = 'available' - else - @status = _('This e-mail address is taken') - @status_class = 'unavailable' - end - render :partial => 'email_status' - end - def user_data user_data = if logged_in? diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb index eb58dd9..9f85885 100644 --- a/app/controllers/public/home_controller.rb +++ b/app/controllers/public/home_controller.rb @@ -14,8 +14,4 @@ class HomeController < PublicController end end - def terms - @no_design_blocks = true - end - end diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index cddc4d3..6ebab20 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -1,15 +1,3 @@ module AccountHelper - def validation_classes - 'available unavailable valid invalid checking' - end - - def checking_message(key) - case key - when :url - _('Checking availability of login name...') - when :email - _('Checking if e-mail address is already taken...') - end - end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1980c9d..1810d20 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1317,14 +1317,4 @@ module ApplicationHelper ) + content_tag('span', ' | ', :class => 'comment-footer comment-footer-hide') end end - - def render_tabs(tabs) - titles = tabs.inject(''){ |result, tab| result << content_tag(:li, link_to(tab[:title], '#'+tab[:id]), :class => 'tab') } - contents = tabs.inject(''){ |result, tab| result << content_tag(:div, tab[:content], :id => tab[:id]) } - - content_tag :div, :class => 'ui-tabs' do - content_tag(:ul, titles) + contents - end - end - end diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb index fbfb6dd..9ec824b 100644 --- a/app/helpers/profile_helper.rb +++ b/app/helpers/profile_helper.rb @@ -15,4 +15,12 @@ module ProfileHelper end end + def render_tabs(tabs) + titles = tabs.inject(''){ |result, tab| result << content_tag(:li, link_to(tab[:title], '#'+tab[:id]), :class => 'tab') } + contents = tabs.inject(''){ |result, tab| result << content_tag(:div, tab[:content], :id => tab[:id]) } + + content_tag :div, :class => 'ui-tabs' do + content_tag(:ul, titles) + contents + end + end end diff --git a/app/models/person.rb b/app/models/person.rb index c5d825e..6c3c609 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -116,7 +116,6 @@ class Person < Profile contact_phone contact_information description - image ] validates_multiparameter_assignments diff --git a/app/models/profile.rb b/app/models/profile.rb index fa38734..aa80706 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -148,7 +148,6 @@ class Profile < ActiveRecord::Base doc chat plugin - site ] belongs_to :user diff --git a/app/views/account/_email_status.rhtml b/app/views/account/_email_status.rhtml deleted file mode 100644 index b7f1f24..0000000 --- a/app/views/account/_email_status.rhtml +++ /dev/null @@ -1,7 +0,0 @@ -
-

<%= @status %>

- -
diff --git a/app/views/account/_identifier_status.rhtml b/app/views/account/_identifier_status.rhtml index 863651d..26ebf5f 100644 --- a/app/views/account/_identifier_status.rhtml +++ b/app/views/account/_identifier_status.rhtml @@ -1,7 +1,3 @@
-

<%= @status %>

- +

<%= @url %> <%= @status %>

diff --git a/app/views/account/_signup_form.rhtml b/app/views/account/_signup_form.rhtml index b3c7e35..b570615 100644 --- a/app/views/account/_signup_form.rhtml +++ b/app/views/account/_signup_form.rhtml @@ -1,158 +1,66 @@ <%= error_messages_for :user, :person %> -<% labelled_form_for :user, @user, :html => { :multipart => true, :id => 'signup-form' } do |f| %> - -<%= hidden_field_tag :invitation_code, @invitation_code %> - -
- - <%= environment.default_hostname %>/ -
-
- <%= required f.text_field(:login, :onchange => 'this.value = convToValidLogin(this.value);', :rel => s_('signup|Login')) %> -

 

-
- <%= 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') %> -
-
- <%= observe_field 'user_login', - :url => { :action => 'check_url' }, - :with => 'identifier', - :update => 'url-check', - :loading => "jQuery('#user_login').removeClass('#{validation_classes}').addClass('checking'); - jQuery('#url-check').html('

#{checking_message(:url)}

');", - :complete => "jQuery('#user_login').removeClass('checking')" - %> - -
- <%= required f.password_field(:password, :id => 'user_pw') %> - <%= f.text_field(:password_clear, :value => _('password')) %> - <%= content_tag(:small,_('Choose a password that you can remember easily. It must have at least 4 characters.'), :id => 'password-balloon') %> -

 

-
+<% if ! defined? hidden_atention || ! hidden_atention %> +

+

+<%= _('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')] %> +
+<% end %> -
- <%= required f.password_field(:password_confirmation) %> - <%= f.text_field(:password_confirmation_clear, :value => _('password confirmation')) %> -

 

-
+<% labelled_form_for :user, @user, :html => { :multipart => true } do |f| %> -
- <%= required f.text_field(:email, :rel => _('e-Mail')) %> - <%= content_tag(:small,_('This e-mail address will be used to contact you.')) %> -

 

-
- <%= observe_field "user_email", - :url => { :action => "check_email" }, - :with => "address", - :update => "email-check", - :loading => "jQuery('#user_email').removeClass('#{validation_classes}').addClass('checking'); - jQuery('#email-check').html('

#{checking_message(:email)}

');", - :complete => "jQuery('#user_email').removeClass('checking')", - :before => "if (!( jQuery('#user_email').valid() )) { - jQuery('#user_email').removeClass('#{validation_classes}').addClass('unavailable'); - jQuery('#email-check').html('

#{_('This e-mail address is not valid')}

'); - return false; - }" - %> +<%= hidden_field_tag :invitation_code, @invitation_code %> - <%= label :profile_data, :name %> - <%= required text_field(:profile_data, :name, :rel => _('Full name')) %> +<%= required_fields_message %> +
+ <%= required f.text_field(:email) %> + <%= content_tag(:small,_('This e-mail address will be used to contact you.')) %>
-
+<%= required f.text_field(:login, :onchange => 'this.value = convToValidLogin( this.value )') %> +<%= content_tag(:small,_('Insert your login')) %> +
- <% labelled_fields_for :profile_data, @person do |f| %> - <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %> - <% end %> +<%= observe_field 'user_login', :url => {:action => 'check_url'}, :with => 'identifier', :update => 'url-check' %> - <% unless @terms_of_use.blank? %> -
- <%= labelled_check_box(_('I accept the %s') % link_to(_('terms of use'), {:controller => 'home', :action => 'terms'}, :target => '_blank'), 'user[terms_accepted]') %> -
- <% end %> - - <% if params[:enterprise_code] %> - <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %> - <%= hidden_field_tag :answer, params[:answer] %> - <%= hidden_field_tag :terms_accepted, params[:terms_accepted] %> - <%= hidden_field_tag :new_user, true %> - <% end %> +
+ <%= required f.password_field(:password) %> + <%= content_tag(:small,_('Choose a password that you can remember easily. It must have at least 4 characters.')) %>
-

- <%= submit_button('save', _('Create my account')) %> -

- +<%= required f.password_field(:password_confirmation) %> +<%= content_tag(:small,_('To confirm, repeat your password.')) %> + +<% labelled_fields_for :profile_data, @person do |f| %> + <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %> +<% end %> + +<% unless @terms_of_use.blank? %> +
+ <%= _("By clicking on 'I accept the terms of use' below you are agreeing to the %s") % + link_to_function(_('Terms of use'), nil) do |page| + page['terms-of-use'].show + end %> + + +

<%= 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]') %>

+
+<% end %> + +<% if params[:enterprise_code] %> + <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %> + <%= hidden_field_tag :answer, params[:answer] %> + <%= hidden_field_tag :terms_accepted, params[:terms_accepted] %> + <%= hidden_field_tag :new_user, true %> +<% end %> + +<% button_bar do %> + <%= submit_button('save', _('Sign up'), :cancel => {:action => 'index'}, :class => 'icon-menu-login') %> +<% end %> <% end -%> - - diff --git a/app/views/account/signup.rhtml b/app/views/account/signup.rhtml index 1fb5bfd..3ddb693 100644 --- a/app/views/account/signup.rhtml +++ b/app/views/account/signup.rhtml @@ -1,18 +1,7 @@ +

<%= _('Signup') %>

<% if @register_pending %> -
- <%= _("

Welcome to %s!

-

Thanks for signing up, we're thrilled to have you on our social network!

-

Firsty, some tips for getting started:

-

Confirm your account!

-

You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.

-

You won't appear as a user until your account is confirmed.

-

What to do next?

-

Customize your profile. Upload an avatar and sign up for activity notifications under Account.

-

Learn the guidelines. Read the Documentation for more details on how to use new social network!

-

Invite and find your Gmail, Yahoo and Hotmail contacts!

-

Start exploring and Have fun!

" % [environment.name, url_for(:controller => :browse, :action => :people, :filter => 'more_recent')]) %> -
+ <%= _('Thanks for signing up! Now check your e-mail to activate your account!') %> +

<%= link_to(_('Go to the homepage'), '/') %>

<% else %> -

<%= _('Sign up for %s!') % environment.name %>

<%= render :partial => 'signup_form' %> <% end %> diff --git a/app/views/admin_panel/_site_info.rhtml b/app/views/admin_panel/_site_info.rhtml deleted file mode 100644 index 1506e74..0000000 --- a/app/views/admin_panel/_site_info.rhtml +++ /dev/null @@ -1,3 +0,0 @@ -<%= required labelled_form_field(_('Site name'), text_field(:environment, :name)) %> -<%= required f.text_field(:reports_lower_bound, :size => 3) %> -<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => 'mceEditor') %> diff --git a/app/views/admin_panel/_terms_of_use.rhtml b/app/views/admin_panel/_terms_of_use.rhtml deleted file mode 100644 index 79e3a3b..0000000 --- a/app/views/admin_panel/_terms_of_use.rhtml +++ /dev/null @@ -1 +0,0 @@ -<%= f.text_area :terms_of_use, :cols => 40, :style => 'width: 90%', :class => 'mceEditor' %> diff --git a/app/views/admin_panel/index.rhtml b/app/views/admin_panel/index.rhtml index 20973c8..d216ff0 100644 --- a/app/views/admin_panel/index.rhtml +++ b/app/views/admin_panel/index.rhtml @@ -15,6 +15,7 @@ <%= link_to _('Edit Templates'), :action => 'edit_templates' %> <%= link_to _('Manage Fields'), :controller => 'features', :action => 'manage_fields' %> <%= link_to _('Set Portal'), :action => 'set_portal_community' %> + <%= link_to _('Terms of use'), :action => 'terms_of_use' %> <% @plugins.map(:admin_panel_links).each do |link| %> <%= link_to link[:title], link[:url] %> <% end %> diff --git a/app/views/admin_panel/site_info.rhtml b/app/views/admin_panel/site_info.rhtml index b1143cd..15b7d23 100644 --- a/app/views/admin_panel/site_info.rhtml +++ b/app/views/admin_panel/site_info.rhtml @@ -5,12 +5,10 @@ <%= render :file => 'shared/tiny_mce' %> <% labelled_form_for :environment, @environment, :url => {:host => @environment.default_hostname} do |f| %> - <% tabs = [] %> - <% tabs << {:title => _('Site info'), :id => 'site-info', - :content => (render :partial => 'site_info', :locals => {:f => f})} %> - <% tabs << {:title => _('Terms of use'), :id => 'terms-of-use', - :content => (render :partial => 'terms_of_use', :locals => {:f => f})} %> - <%= render_tabs(tabs) %> + <%= required labelled_form_field(_('Site name'), text_field(:environment, :name)) %> + <%= required f.text_field(:reports_lower_bound, :size => 3) %> + <%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => 'mceEditor') %> + <% button_bar do %> <%= submit_button(:save, _('Save'), :cancel => {:action => 'index'}) %> <% end %> diff --git a/app/views/admin_panel/terms_of_use.rhtml b/app/views/admin_panel/terms_of_use.rhtml new file mode 100644 index 0000000..a814331 --- /dev/null +++ b/app/views/admin_panel/terms_of_use.rhtml @@ -0,0 +1,14 @@ +

<%= _('Terms of use') %>

+ +<%= render :file => 'shared/tiny_mce' %> + +<% labelled_form_for :environment, @environment, :url => {:action => 'site_info'} do |f| %> + + <%= f.text_area :terms_of_use, :cols => 40, :style => 'width: 90%' %> + + <% button_bar do %> + <%= submit_button(:save, _('Save')) %> + <%= button(:cancel, _('Cancel'), :action => 'index') %> + <% end %> + +<% end %> diff --git a/app/views/home/terms.rhtml b/app/views/home/terms.rhtml deleted file mode 100644 index 830f50b..0000000 --- a/app/views/home/terms.rhtml +++ /dev/null @@ -1,2 +0,0 @@ -

<%= _('Terms of use - %s') % environment.name %>

-<%= environment.terms_of_use %> diff --git a/app/views/layouts/application-ng.rhtml b/app/views/layouts/application-ng.rhtml index 7f64e20..95af2c0 100644 --- a/app/views/layouts/application-ng.rhtml +++ b/app/views/layouts/application-ng.rhtml @@ -58,7 +58,7 @@ <%= usermenu_logged_in %>