diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 4b5483a..c7d8b18 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -60,6 +60,10 @@ 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 @@ -209,16 +213,26 @@ class AccountController < ApplicationController @identifier = params[:identifier] valid = Person.is_available?(@identifier, environment) if valid - @status = _('Available!') + @status = _('This login name is available') @status_class = 'available' else - @status = _('Unavailable!') + @status = _('This login name is 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 9f85885..eb58dd9 100644 --- a/app/controllers/public/home_controller.rb +++ b/app/controllers/public/home_controller.rb @@ -14,4 +14,8 @@ 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 6ebab20..cddc4d3 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -1,3 +1,15 @@ 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 da9a465..2560ef9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1317,4 +1317,14 @@ 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 9ec824b..fbfb6dd 100644 --- a/app/helpers/profile_helper.rb +++ b/app/helpers/profile_helper.rb @@ -15,12 +15,4 @@ 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 d4c4d1d..5967a81 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -116,6 +116,7 @@ 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 cf7482b..0fc137d 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -148,6 +148,7 @@ 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 new file mode 100644 index 0000000..b7f1f24 --- /dev/null +++ b/app/views/account/_email_status.rhtml @@ -0,0 +1,7 @@ +
+

<%= @status %>

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

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

+

<%= @status %>

+
diff --git a/app/views/account/_signup_form.rhtml b/app/views/account/_signup_form.rhtml index b570615..b3c7e35 100644 --- a/app/views/account/_signup_form.rhtml +++ b/app/views/account/_signup_form.rhtml @@ -1,66 +1,158 @@ <%= error_messages_for :user, :person %> -<% 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 %> - -<% labelled_form_for :user, @user, :html => { :multipart => true } do |f| %> +<% labelled_form_for :user, @user, :html => { :multipart => true, :id => 'signup-form' } do |f| %> <%= hidden_field_tag :invitation_code, @invitation_code %> -<%= required_fields_message %> +
-
- <%= required f.text_field(:email) %> - <%= content_tag(:small,_('This e-mail address will be used to contact you.')) %> -
+ <%= 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.text_field(:login, :onchange => 'this.value = convToValidLogin( this.value )') %> -<%= content_tag(:small,_('Insert your login')) %> -
+
+ <%= 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') %> +

 

+
+ +
+ <%= required f.password_field(:password_confirmation) %> + <%= f.text_field(:password_confirmation_clear, :value => _('password confirmation')) %> +

 

+
+ +
+ <%= 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; + }" + %> -<%= observe_field 'user_login', :url => {:action => 'check_url'}, :with => 'identifier', :update => 'url-check' %> + <%= label :profile_data, :name %> + <%= required text_field(:profile_data, :name, :rel => _('Full name')) %> -
- <%= required f.password_field(:password) %> - <%= content_tag(:small,_('Choose a password that you can remember easily. It must have at least 4 characters.')) %>
-<%= 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 %> - - + +

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

+ <% end -%> + + diff --git a/app/views/account/signup.rhtml b/app/views/account/signup.rhtml index 3ddb693..d43da64 100644 --- a/app/views/account/signup.rhtml +++ b/app/views/account/signup.rhtml @@ -1,7 +1,18 @@ -

<%= _('Signup') %>

<% if @register_pending %> - <%= _('Thanks for signing up! Now check your e-mail to activate your account!') %> -

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

+
+ <%= _("

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')]) %> +
<% 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 new file mode 100644 index 0000000..1506e74 --- /dev/null +++ b/app/views/admin_panel/_site_info.rhtml @@ -0,0 +1,3 @@ +<%= 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 new file mode 100644 index 0000000..79e3a3b --- /dev/null +++ b/app/views/admin_panel/_terms_of_use.rhtml @@ -0,0 +1 @@ +<%= 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 d216ff0..20973c8 100644 --- a/app/views/admin_panel/index.rhtml +++ b/app/views/admin_panel/index.rhtml @@ -15,7 +15,6 @@ <%= 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 15b7d23..f1d8f7b 100644 --- a/app/views/admin_panel/site_info.rhtml +++ b/app/views/admin_panel/site_info.rhtml @@ -4,11 +4,13 @@ <%= render :file => 'shared/tiny_mce' %> -<% labelled_form_for :environment, @environment, :url => {:host => @environment.default_hostname} do |f| %> - <%= 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') %> - +<% labelled_form_for :environment, @environment, :url => {:host => @environment.default_hostname, :port => request.port} 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) %> <% 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 deleted file mode 100644 index a814331..0000000 --- a/app/views/admin_panel/terms_of_use.rhtml +++ /dev/null @@ -1,14 +0,0 @@ -

<%= _('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 new file mode 100644 index 0000000..830f50b --- /dev/null +++ b/app/views/home/terms.rhtml @@ -0,0 +1,2 @@ +

<%= _('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 c70583e..36f671b 100644 --- a/app/views/layouts/application-ng.rhtml +++ b/app/views/layouts/application-ng.rhtml @@ -58,7 +58,7 @@ <%= usermenu_logged_in %>