Commit 5db07b8d8bc4242b55f3a39e5cb08ab9b585b82d

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent e9f8d06d

ActionItem1125: adding settings to change text

app/models/environment.rb
... ... @@ -625,6 +625,22 @@ class Environment < ActiveRecord::Base
625 625 settings[:portal_folders] = folders.map(&:id)
626 626 end
627 627  
  628 + def help_message_to_add_enterprise
  629 + self.settings['help_message_to_add_enterprise'] || ''
  630 + end
  631 +
  632 + def help_message_to_add_enterprise=(value)
  633 + self.settings['help_message_to_add_enterprise'] = value
  634 + end
  635 +
  636 + def tip_message_enterprise_activation_question
  637 + self.settings['tip_message_enterprise_activation_question'] || ''
  638 + end
  639 +
  640 + def tip_message_enterprise_activation_question=(value)
  641 + self.settings['tip_message_enterprise_activation_question'] = value
  642 + end
  643 +
628 644 after_create :create_templates
629 645  
630 646 def create_templates
... ...
app/views/account/activation_question.rhtml
... ... @@ -30,7 +30,7 @@
30 30  
31 31 <p><%= _("This is a question to know if you really are part of this enterprise. Pay atention because you have only one chance to answer right and activate your enterprise. If you answer wrong you will not be able to activate the enterprise automaticaly and must get in touch with the admins of %s by email or phone.") % environment.name %> </p>
32 32  
33   - <%= 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'))) %>
  33 + <%= ApplicationHelper::NoosferoFormBuilder::output_field(@question == :foundation_year ? (_("What year your enterprise was founded? It must have 4 digits, eg 1990. %s") % environment.tip_message_enterprise_activation_question) : _('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'))) %>
34 34  
35 35 <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
36 36  
... ...
app/views/account/blocked.rhtml
... ... @@ -3,7 +3,7 @@
3 3 <p><%= _('Unfortunately this enterprise can\'t be activated via the system.') %></p>
4 4 <p>
5 5 <% if @enterprise.blocked? %>
6   - <%= _('There was a failed atempt of activation and the automated acivation was disabled for your security.') %>
  6 + <%= _('There was a failed atempt of activation and the automated activation was disabled for your security.') %>
7 7 <% else %>
8 8 <%= _('We don\'t have enough information about your enterprise to identify you.') %>
9 9 <% end %>
... ...
app/views/profile_editor/index.rhtml
... ... @@ -67,7 +67,8 @@
67 67 <div id='activation_enterprise'>
68 68 <% form_tag({:controller => 'account', :action => 'activation_question'}, {:method => 'get'}) do %>
69 69 <p><strong><%= __('Activate your enterprise') %></strong></p>
70   - <p><%= _("If you received a letter with information about your enterprise activation, add here the activation code that was sent.") %> </p>
  70 + <p><%= _("If you received a letter with information about your enterprise activation, add here the activation code that was sent.") %></p>
  71 + <p><%= environment.help_message_to_add_enterprise %> </p>
71 72 <%= labelled_form_field(__('Enterprise activation code') + ':', text_field_tag('enterprise_code')) %>
72 73 <%= submit_button(:ok, _('Activate')) %>
73 74 <% end %>
... ...
test/unit/environment_test.rb
... ... @@ -758,4 +758,23 @@ class EnvironmentTest &lt; Test::Unit::TestCase
758 758  
759 759 assert_valid role2
760 760 end
  761 +
  762 + should 'have a help_message_to_add_enterprise attribute' do
  763 + env = Environment.new
  764 +
  765 + assert_equal env.help_message_to_add_enterprise, ''
  766 +
  767 + env.help_message_to_add_enterprise = 'help message'
  768 + assert_equal 'help message', env.help_message_to_add_enterprise
  769 + end
  770 +
  771 + should 'have a tip_message_enterprise_activation_question attribute' do
  772 + env = Environment.new
  773 +
  774 + assert_equal env.tip_message_enterprise_activation_question, ''
  775 +
  776 + env.tip_message_enterprise_activation_question = 'tip message'
  777 + assert_equal 'tip message', env.tip_message_enterprise_activation_question
  778 + end
  779 +
761 780 end
... ...