Commit 5d82defd5261844f835be6067662a696d75d9b18

Authored by MoisesMachado
1 parent 43b95223

ActionItem603: made some cosmetic changes and added a script to check

wrong answers to activation questions for enterprises


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/branches/0.10.x@2379 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/forms_helper.rb
... ... @@ -40,7 +40,8 @@ module FormsHelper
40 40 the_class << ' ' << html_options[:class]
41 41 end
42 42  
43   - bt_submit = submit_tag(label, html_options.merge(:class => the_class))
  43 + # FIXME: should be in stylesheet
  44 + bt_submit = submit_tag(label, html_options.merge(:style => 'height:28px; cursor:pointer', :class => the_class))
44 45  
45 46 bt_submit + bt_cancel
46 47 end
... ...
app/views/account/_signup_form.rhtml
1   -<h1><%= _('Register') %></h1>
2   -
3 1 <%= error_messages_for :user %>
4 2 <% labelled_form_for :user, @user,
5 3 :html => { :help=>_('Fill all this fields to join in this environment.' +
... ...
app/views/account/accept_terms.rhtml
1   -<h2><%= _('Enterprise activation') + ' - ' + (logged_in? ? _('part 2 of 2') : _(' part 2 of 3')) %></h2>
  1 +<div class=activation-box>
  2 + <h2><%= _('Enterprise activation') + ' - ' + (logged_in? ? _('part 2 of 2') : _(' part 2 of 3')) %></h2>
2 3  
3   -<div id='terms-of-enterprise-use'><%= @terms_of_enterprise_use %></div>
  4 + <div id='terms-of-enterprise-use'><%= @terms_of_enterprise_use %></div>
4 5  
5   -<% button_bar do %>
6   - <%= link_to( _('I accept the terms'), { :action => 'activate_enterprise', :terms_accepted => true, :enterprise_code => params[:enterprise_code], :answer => params[:answer] } ) %>
7   - <%= link_to( _('I do NOT accept the terms'), { :controller => 'home', :action => 'index' } ) %>
8   -<% end %>
  6 + <% form_tag :action => 'activate_enterprise' do %>
  7 + <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
  8 + <%= hidden_field_tag :answer, params[:answer] %>
  9 +
  10 + <%= labelled_check_box _('I read the terms of use and accepted them'), :terms_accepted %>
  11 + <% button_bar do %>
  12 + <%= button 'cancel', _('Cancel'), :controller => 'home', :action => 'index' %>
  13 + <%= submit_button 'forward', _('Continue') %>
  14 + <% end %>
  15 + <% end %>
  16 +</div>
... ...
app/views/account/activate_enterprise.rhtml
  1 +<div class='activation-box'>
1 2 <h2><%= _('Enterprise activation - part 3 of 3') %></h2>
2 3  
3   -<p><%= _('Well, now for you manage your enterprise you have to associate an individual account to the enterprise.') %></p>
4   -
5 4 <%= error_messages_for :user %>
6 5  
  6 +<p><%= _('Well, now for you manage your enterprise you have to associate an individual account to the enterprise.') %></p>
  7 +<p><%= _('Do you have a user account?') %></p>
  8 +
7 9 <div id="enterprise-activation-create-user-or-login-button">
8   - <%= button_to_function 'login', _('I am already a registered user'), "$('enterprise-activation-create-user-form').hide(); $('enterprise-activation-login-form').show()" %>
9   - <%= button_to_function 'add', _('I want to register as an user now'), "$('enterprise-activation-login-form').hide(); $('enterprise-activation-create-user-form').show()" %>
  10 + <%= button_to_function 'login', _('Yes'), "$('enterprise-activation-create-user-form').hide(); $('enterprise-activation-login-form').show()" %>
  11 + <%= button_to_function 'add', _('No'), "$('enterprise-activation-login-form').hide(); $('enterprise-activation-create-user-form').show()" %>
10 12 </div>
11 13  
12 14 <div id="enterprise-activation-create-user-form" style="display: none">
... ... @@ -14,6 +16,6 @@
14 16 </div>
15 17  
16 18 <div id="enterprise-activation-login-form" style="display: none">
17   - <h1> <%= _('Login') %></h1>
18 19 <%= render :partial => 'login_form' %>
19 20 </div>
  21 +</div>
... ...
app/views/account/activation_question.rhtml
1   -<h2><%= _('Enterprise activation') + ' - ' + (logged_in? ? _('part 1 of 2') : _('part 1 of 3')) %></h2>
  1 +<script language="JavaScript1.2">
  2 + function check_valid_year(form) {
  3 + var answer = parseInt(form.answer.value);
  4 + var val = form.answer.value;
  5 + if (!answer || (val.length != 4)) {
  6 + alert(<%= _('An year have 4 digits').inspect %>);
  7 + return false;
  8 + } else {
  9 + return true;
  10 + }
  11 + }
2 12  
3   -<% form_tag :action => 'accept_terms', :method => 'get' do %>
  13 + function check_valid_cnpj(form) {
  14 + var answer = parseInt(form.answer.value);
  15 + var val = form.answer.value;
  16 + if (!answer || (val.length != 14)) {
  17 + alert(<%= _('An CNPJ have 14 digits').inspect %>);
  18 + return false;
  19 + } else {
  20 + return true;
  21 + }
  22 + }
  23 +</script>
4 24  
5   - <%= ApplicationHelper::NoosferoFormBuilder::output_field(@question == :foundation_year ? _('What year your enterprise was founded?') : _('What is the CNPJ of your enterprise?'), text_field_tag(:answer, nil,:help => help=_('We need to be sure that this is your enterprise'))) %>
  25 +<div class='activation-box'>
  26 + <h2><%= _('Enterprise activation') + ' - ' + (logged_in? ? _('part 1 of 2') : _('part 1 of 3')) %></h2>
  27 + <% form_tag( {:action => 'accept_terms'}, {:method => 'get', :onsubmit => (@question == :foundation_year ? 'return check_valid_year(this)' : 'return check_valid_cnpj(this)')}) do %>
6 28  
7   - <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
  29 + <%= ApplicationHelper::NoosferoFormBuilder::output_field(@question == :foundation_year ? _('What year your enterprise was founded?') : _('What is the CNPJ of your enterprise?'), text_field_tag(:answer, nil, :id => 'enterprise-activation-answer', :help => help=_('We need to be sure that this is your enterprise'))) %>
8 30  
9   - <% button_bar do %>
10   - <%= submit_button('answer', _('Answer'), :cancel => {:action => 'index'} ) %>
  31 + <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
  32 +
  33 + <% button_bar do %>
  34 + <%= button 'cancel', _('Cancel'), :action => 'index' %>
  35 + <%= submit_button 'forward', _('Continue') %>
  36 + <% end %>
11 37 <% end %>
12   -<% end %>
  38 +</div>
... ...
app/views/account/signup.rhtml
1   -<%= render :partial => 'signup_form' %>
  1 +<h1><%= _('Signup') %></h1>
  2 +<%= render :partial => 'signup_form' %>
... ...
public/designs/icons/default/style.css
... ... @@ -18,6 +18,7 @@
18 18 .icon-up { background-image: url(go-up-HC.gif) }
19 19 .icon-up-red { background-image: url(go-up-red-HC.gif) }
20 20 .icon-down { background-image: url(go-down-HC.gif) }
  21 +.icon-forward { background-image: url(go-forward-HC.gif) }
21 22 .icon-search { background-image: url(search-HC.gif) }
22 23 .icon-ok { background-image: url(ok-HC.gif) }
23 24 .icon-login { background-image: url(key-HC.gif) }
... ...
public/designs/themes/ecosol/stylesheets/controller_account.css
1   -
2 1 .main-block form {
3 2 border: 2px solid #3465A4;
4 3 padding: 10px 5px 10px 20px;
5 4 background: #B8CFE7;
6 5 }
7 6  
  7 +.activation-box {
  8 + border: 2px solid #3465A4;
  9 + padding: 10px 5px 10px 20px;
  10 + background: #B8CFE7;
  11 +}
  12 +
  13 +.activation-box form {
  14 + border: 0px;
  15 + padding: 0px 0px 0px 0px;
  16 +}
  17 +
8 18 .main-block label {
9 19 font-weight: bold;
10 20 }
... ...