From 5db07b8d8bc4242b55f3a39e5cb08ab9b585b82d Mon Sep 17 00:00:00 2001 From: Daniela Feitosa Date: Mon, 3 Aug 2009 13:19:46 -0300 Subject: [PATCH] ActionItem1125: adding settings to change text --- app/models/environment.rb | 16 ++++++++++++++++ app/views/account/activation_question.rhtml | 2 +- app/views/account/blocked.rhtml | 2 +- app/views/profile_editor/index.rhtml | 3 ++- test/unit/environment_test.rb | 19 +++++++++++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/app/models/environment.rb b/app/models/environment.rb index b1a957a..403b018 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -625,6 +625,22 @@ class Environment < ActiveRecord::Base settings[:portal_folders] = folders.map(&:id) end + def help_message_to_add_enterprise + self.settings['help_message_to_add_enterprise'] || '' + end + + def help_message_to_add_enterprise=(value) + self.settings['help_message_to_add_enterprise'] = value + end + + def tip_message_enterprise_activation_question + self.settings['tip_message_enterprise_activation_question'] || '' + end + + def tip_message_enterprise_activation_question=(value) + self.settings['tip_message_enterprise_activation_question'] = value + end + after_create :create_templates def create_templates diff --git a/app/views/account/activation_question.rhtml b/app/views/account/activation_question.rhtml index 7259948..2f09dd4 100644 --- a/app/views/account/activation_question.rhtml +++ b/app/views/account/activation_question.rhtml @@ -30,7 +30,7 @@

<%= _("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 %>

- <%= 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'))) %> + <%= 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'))) %> <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %> diff --git a/app/views/account/blocked.rhtml b/app/views/account/blocked.rhtml index 918f640..7ccf32c 100644 --- a/app/views/account/blocked.rhtml +++ b/app/views/account/blocked.rhtml @@ -3,7 +3,7 @@

<%= _('Unfortunately this enterprise can\'t be activated via the system.') %>

<% if @enterprise.blocked? %> - <%= _('There was a failed atempt of activation and the automated acivation was disabled for your security.') %> + <%= _('There was a failed atempt of activation and the automated activation was disabled for your security.') %> <% else %> <%= _('We don\'t have enough information about your enterprise to identify you.') %> <% end %> diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index 575ef51..6c4ef76 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -67,7 +67,8 @@

<% form_tag({:controller => 'account', :action => 'activation_question'}, {:method => 'get'}) do %>

<%= __('Activate your enterprise') %>

-

<%= _("If you received a letter with information about your enterprise activation, add here the activation code that was sent.") %>

+

<%= _("If you received a letter with information about your enterprise activation, add here the activation code that was sent.") %>

+

<%= environment.help_message_to_add_enterprise %>

<%= labelled_form_field(__('Enterprise activation code') + ':', text_field_tag('enterprise_code')) %> <%= submit_button(:ok, _('Activate')) %> <% end %> diff --git a/test/unit/environment_test.rb b/test/unit/environment_test.rb index 53fde0f..d0ffbae 100644 --- a/test/unit/environment_test.rb +++ b/test/unit/environment_test.rb @@ -758,4 +758,23 @@ class EnvironmentTest < Test::Unit::TestCase assert_valid role2 end + + should 'have a help_message_to_add_enterprise attribute' do + env = Environment.new + + assert_equal env.help_message_to_add_enterprise, '' + + env.help_message_to_add_enterprise = 'help message' + assert_equal 'help message', env.help_message_to_add_enterprise + end + + should 'have a tip_message_enterprise_activation_question attribute' do + env = Environment.new + + assert_equal env.tip_message_enterprise_activation_question, '' + + env.tip_message_enterprise_activation_question = 'tip message' + assert_equal 'tip message', env.tip_message_enterprise_activation_question + end + end -- libgit2 0.21.2