Commit 745d2b02 authored by Nivaldo Neto's avatar Nivaldo Neto

modify singnup form

parent bebce272
<% @profile_data = @person %>
<%= javascript_include_tag('sign_up_password_rate') %>
<%= javascript_include_tag "signup_form" %>
<%= error_messages_for :user, :person, :header_message => _('The account could not be created') %>
<%= labelled_form_for :user, :html => { multipart: true, id: 'signup-form', class: 'form-with-captcha', honeypot: true } do |f| %>
<%= hidden_field_tag :invitation_code, @invitation_code %>
<div id='signup-form-header'>
<div class='separator-msg'><%= 'Os campos abaixo serão mostrados publicamente no seu perfil pessoal' %></div>
<div id='signup-username-section'>
<div class='label-wrapper required-field'>
<%= label(:user, :login, _('Username'), { class: 'formlabel' }) %>
<%= tooltip(_('Your username identifies you inside the network, and '\
'will be used to generate a custom address to your pages. '\
'Choose wisely, you will not be able to change it.'), :large) %>
</div>
<p><%= _('Example of good usernames: jose-silva, maria.santos, josecosta') %></p>
<div id='signup-username-form-line'>
<span id="signup-domain"><%= environment.default_hostname %>/</span>
<div id='signup-login'>
<div id='signup-login-field' class='formfield'>
<%= text_field(:user, :login, :id => 'user_login',
:onchange => 'this.value = convToValidUsername(this.value);') %>
</div>
<div id='url-check'><p>&nbsp;</p></div>
<span id='checking-message' class='validated checking'>
<%= _('Checking availability of login name...') %>
</span>
</div>
</div>
</div>
<div id='signup-password-section'>
<div class='label-wrapper required-field'>
<%= label(:user, :password, _('Password'), { class: 'formlabel' }) %>
<%= tooltip(_('You also need a password in order to access the network. '\
'Choose something with at least 4 characters that you will '\
'remember later.'), :large) %>
</div>
<div id='signup-password'>
<div class='formfield'>
<%= text_field(:user, :password, id: 'user_pw', placeholder: _('Password'), type: :password) %>
</div>
</div>
<div id='signup-password-confirmation'>
<div class='formfield'>
<%= text_field(:user, :password_confirmation, placeholder: _('Type your password again'),
type: :password) %>
</div>
<p id='password-check'>
<span class='invalid'><%= _('Passwords don\'t match') %></span>
</p>
<p id='password-rate'>
<span class="invalid" id='result-blank'>
&nbsp;
</span>
<span class="invalid hidden" id='result-short'>
<%=_('Too Short') %>
</span>
<span class="invalid hidden" id='result-bad'>
<%=_('Bad') %>
</span>
<span class="invalid hidden" id='result-good'>
<%=_('Good') %>
</span>
<span class="invalid hidden" id='result-strong'>
<%=_('Strong') %>
</span>
</p>
</div>
</div>
<div id='signup-name'>
<%= required labelled_form_field(_('Full name'),
text_field(:profile_data, :name, placeholder: _('E.g.: Maria Silva'))) %>
</div>
<div id='signup-avatar'>
<label class='formlabel'><%= _('Profile Image')%></label>
<%= render :partial => 'shared/change_image', :locals => { :for_attr => 'profile_data[image_builder]', :type => 'profile' } %>
</div>
<br>
<div class='separator-msg'><%= 'Os campos abaixo não serão disponibilizados publicamente. Eles são utilizados internamente para facilitar o contato da gestão da RBAC com você:' %></div>
<div id='signup-email'>
<%= required labelled_form_field(_('Email Address'),
text_field(:user, :email, placeholder: _('E.g.: [email protected]'))) %>
<div id='email-check'><p>&nbsp;</p></div>
</div>
<%= 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('<p><span class=\"checking\">#{checking_message(:email)}</span></p>');",
:complete => "jQuery('#user_email').removeClass('checking')",
:before => "var field = jQuery('#user_email');
if (field.val()=='') {
field.parent('.formfield').removeClass('#{validation_classes}');
jQuery('#email-check').html('<p>&nbsp;</p>');
return false;
}
if (!( field.valid() )) {
field.parent('.formfield').removeClass('#{validation_classes}').addClass('invalid');
jQuery('#email-check').html('<p><span class=\"invalid\">#{_('This e-mail address is not valid')}</span></p>');
return false;
}" %>
</div>
<div id="signup-form-profile">
<%= labelled_fields_for :profile_data, @person do |f| %>
<%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %>
<% end %>
<%= safe_join(@plugins.dispatch(:signup_extra_contents).collect { |content| instance_eval(&content) }, "") %>
<%= render :partial => 'shared/custom_fields', :locals => {:f => f, :profile => @person, :signup => true} %>
<%= template_options(:people, 'profile_data') %>
<%= render :partial => 'shared/profile_kinds', :locals => {:form_field => 'profile_data'} %>
<% unless @terms_of_use.blank? %>
<div id='terms-of-use-box' class='formfieldline'>
<%= labelled_check_box(_('I accept the %s').html_safe % link_to(_('terms of use'), {:controller => 'home', :action => 'terms'}, :target => '_blank'), 'user[terms_accepted]') %>
</div>
<% 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 %>
</div>
<%= captcha_tags(:signup, nil, environment) %>
<%= button_bar do %>
<%= submit_button(:add_user, _('Create my account')) %>
<% end %>
<%= required_fields_message %>
<% end -%>
<% @person ||= @profile %>
<% editing_profile ||= false %>
<%= optional_field(@person, 'nickname') do %>
<%= f.text_field(:nickname, :size => 30, :rel => _('Nickname')) %>
<div>
<small><%= _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') %></small>
</div>
<% end %>
<%= optional_field(@person, 'description', f.text_area(:description, :rows => 5, :rel => _('Description'))) %>
<%= optional_field(@person, 'preferred_domain', select_preferred_domain(:profile_data)) %>
<%= optional_field(@person, 'contact_information', f.text_field(:contact_information, :rel => _('Contact information'))) %>
<%= optional_field(@person, 'contact_phone', labelled_form_field(_('Home phone'), text_field(:profile_data, :contact_phone, :rel => _('Contact phone'),
:placeholder => _('With area code, only numbers')))) %>
<%= optional_field(@person, 'cell_phone', f.text_field(:cell_phone, :rel => _('Cell phone'), :placeholder => _('With area code, only numbers'))) %>
<%= optional_field(@person, 'comercial_phone', f.text_field(:comercial_phone, :rel => _('Comercial phone'), :placeholder => _('With area code, only numbers'))) %>
<%= optional_field(@person, 'jabber_id', f.text_field(:jabber_id, :rel => _('Jabber'))) %>
<%= optional_field(@person, 'personal_website', f.text_field(:personal_website, :rel => _('Personal website'))) %>
<div class='separator-msg'><%= 'Os campos abaixo não serão disponibilizados publicamente. Eles são utilizados internamente para análise geral dos participantes da Rede Brasileira de Aprendizagem Criativa:' %></div>
<%= optional_field(@person, 'sex', f.radio_group(:profile_data, :sex, [ ['male',_('Male')], ['female',_('Female')], ['other',_('Outro')] ])) %>
<%= optional_field(@person, 'birth_date', labelled_form_field(_('Birth date'), date_field('profile_data[birth_date]', @profile_data. birth_date, {:change_month => true, :change_year => true, :year_range => '-100:-5'}, {:id => 'profile_data_birth_date'}))) %>
<%= optional_field(@person, 'nationality', labelled_form_field(_('Nationality'), select_nationality('profile_data', 'nationality', {:class => 'select-nationality'}) )) %>
<%= optional_field(@person, 'image', labelled_form_field(_('Image'), file_field(:file, :image, :rel => _('Image')))) %>
<%= render partial: 'shared/location_form', locals: { f: f, profile: @person } unless editing_profile %>
<% @plugins.dispatch(:extra_optional_fields).each do |field| %>
<%= optional_field(@person, field[:name], labelled_form_field(field[:label], text_field(field[:object_name], field[:method], :rel => field[:label], :value => field[:value]))) %>
<% end %>
<%= optional_field(@person, 'schooling') do %>
<div class="formfieldline">
<label class='formlabel' for='profile_data_schooling'><%= _('Schooling') %></label>
<div class="formfield type-select">
<%= select_schooling('profile_data', 'schooling', {:class => 'select-schooling'}) %>
<%= select_schooling_status('profile_data', 'schooling_status', {:class => 'select-schooling'}) %>
</div>
</div>
<% end %>
<%= javascript_include_tag('city_state_validation') %>
<script type='text/javascript'>
function toggle_text_field(id, span_id) {
if ($(id).value == "Others") {
$(span_id).show(); return false;
} else {
$(span_id).hide(); return false;
}
}
</script>
<%= optional_field(@person, 'formation', select_area(_('Education'), 'profile_data', 'formation', {:class => 'type-select-full-line'})) %>
<span id='profile_data_custom_formation_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.formation) %> >
<%= optional_field(@person, 'custom_formation', f.text_field(:custom_formation, :rel => _('Custom formation'))) %>
</span>
<%= observe_field 'profile_data_formation', :function =>'toggle_text_field("profile_data_formation", "profile_data_custom_formation_span")' %>
<%= optional_field(@person, 'area_of_study', select_area(_('Area of study'), 'profile_data', 'area_of_study', {:class => 'type-select-full-line'})) %>
<span id='profile_data_custom_area_of_study_span' <%= "style='display:none'" if ! ['Others', nil].include?(@person.area_of_study) %> >
<%= optional_field(@person, 'custom_area_of_study', f.text_field(:custom_area_of_study, :rel => _('Custom area of study'))) %>
</span>
<%= observe_field 'profile_data_area_of_study', :function =>'toggle_text_field("profile_data_area_of_study", "profile_data_custom_area_of_study_span")' %>
<%= optional_field(@person, 'professional_activity', f.text_field(:professional_activity, :rel => _('Professional activity'))) %>
<%= optional_field(@person, 'organization', f.text_field(:organization, :rel => _('Organization'))) %>
<%= optional_field(@person, 'organization_website', f.text_field(:organization_website, :rel => _('Organization website'))) %>
<%= javascript_include_tag 'address_fields' %>
<div class='address-fields formfield'>
<label class="formlabel">CEP</label>
<%= optional_field(profile, 'zip_code', text_field(f.object_name, :zip_code, placeholder: _('Zip code'), class: 'profile-zip-code')) %>
<label class="formlabel">País</label>
<%= optional_field(profile, 'country', select_profile_country(f.object_name, profile, class: 'profile-country')) %>
<label class="formlabel">Estado</label>
<%= optional_field(profile, 'state', select_profile_state(f.object_name, profile, class: 'profile-state')) %>
<label class="formlabel">Cidade</label>
<%= optional_field(profile, 'city', select_profile_city(f.object_name, profile, class: 'profile-city')) %>
<label class="formlabel">Bairro</label>
<%= optional_field(profile, 'district', text_field(f.object_name, :district, placeholder: _('District'), class: 'profile-district')) %>
<label class="formlabel">Endereço</label>
<%= optional_field(profile, 'address', text_field(f.object_name, :address, placeholder: _('Address'), class: 'profile-address')) %>
</div>
<% if (profile.active_fields & Profile::LOCATION_FIELDS).present? ||
profile.active_fields.include?('location') %>
<h1><%= _('Location') %></h1>
<div class='separator-msg'><%= 'Os campos a seguir permitirão a inserção do seu usuário no mapa da Rede Brasileira de Aprendizagem Criativa. Vale notar que a rua da sua localização não será disponibilizada publicamente' %></div>
<br>
<div id='address-and-location'>
<%= render partial: 'shared/address_fields',
locals: { profile: profile, f: f } %>
<% field = optional_field(profile, 'location') do %>
<p class='help-message'>
<%= _('Drag the balloon to set your location.') %>
</p>
<% end %>
<% unless field.blank? %>
<% if (profile.active_fields & Profile::LOCATION_FIELDS).present? %>
<div class='location-bar button-bar'>
<p class='help-message'>
<%= _('Fill an address to find it easier in the map') %>
</p>
<%= button_to_function :search, _('Locate in the map'), "addressToPoint()",
title: _("Locate the address informed above in the map below (note that you'll probably need to adjust the marker to get a precise position)") %>
</div>
<% end %>
<div id='location-fields'>
<div style='overflow: hidden'>
<div id="location-map"></div>
</div>
<%= field %>
<%= f.hidden_field :lat, :id => 'profile_data_lat' %>
<%= f.hidden_field :lng, :id => 'profile_data_lng' %>
<%= content_tag('script', '', :src => "https://maps.googleapis.com/maps/api/js?key=#{GoogleMaps.js_api_key}", :type => 'text/javascript') %>
<%= content_tag('script', render(:partial => 'maps/google_map.js', :locals => { profile: profile }), :type => 'text/javascript') %>
</div>
<% end %>
</div>
<% end %>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment