summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/application_helper.rb3
-rw-r--r--app/helpers/users_helper.rb4
-rw-r--r--app/models/user_preference.rb8
-rw-r--r--app/views/users/_preferences.html.erb1
-rw-r--r--config/locales/en.yml4
-rw-r--r--config/locales/fr.yml4
-rw-r--r--public/stylesheets/application.css2
-rw-r--r--test/functional/users_controller_test.rb4
-rw-r--r--test/functional/welcome_controller_test.rb18
9 files changed, 46 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index aade3cc4d..1b3273838 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -561,6 +561,9 @@ module ApplicationHelper
css << 'project-' + @project.identifier if @project && @project.identifier.present?
css << 'controller-' + controller_name
css << 'action-' + action_name
+ if UserPreference::TEXTAREA_FONT_OPTIONS.include?(User.current.pref.textarea_font)
+ css << "textarea-#{User.current.pref.textarea_font}"
+ end
css.join(' ')
end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 8b85e9f50..97e7a8bd6 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -30,6 +30,10 @@ module UsersHelper
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
end
+ def textarea_font_options
+ [[l(:label_font_default), '']] + UserPreference::TEXTAREA_FONT_OPTIONS.map {|o| [l("label_font_#{o}"), o]}
+ end
+
def change_status_link(user)
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 52d120c74..4a07e990c 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -29,7 +29,10 @@ class UserPreference < ActiveRecord::Base
'time_zone',
'comments_sorting',
'warn_on_leaving_unsaved',
- 'no_self_notified'
+ 'no_self_notified',
+ 'textarea_font'
+
+ TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
def initialize(attributes=nil, *args)
super
@@ -76,4 +79,7 @@ class UserPreference < ActiveRecord::Base
def activity_scope; Array(self[:activity_scope]) ; end
def activity_scope=(value); self[:activity_scope]=value ; end
+
+ def textarea_font; self[:textarea_font] end
+ def textarea_font=(value); self[:textarea_font]=value; end
end
diff --git a/app/views/users/_preferences.html.erb b/app/views/users/_preferences.html.erb
index fb19bb3e5..f8769125e 100644
--- a/app/views/users/_preferences.html.erb
+++ b/app/views/users/_preferences.html.erb
@@ -3,4 +3,5 @@
<p><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p>
<p><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
<p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
+<p><%= pref_fields.select :textarea_font, textarea_font_options %></p>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a6501c38a..56a06c7d5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -364,6 +364,7 @@ en:
field_total_estimated_hours: Total estimated time
field_default_version: Default version
field_remote_ip: IP address
+ field_textarea_font: Font used for text areas
setting_app_title: Application title
setting_app_subtitle: Application subtitle
@@ -998,6 +999,9 @@ en:
label_relations: Relations
label_new_project_issue_tab_enabled: Display the "New issue" tab
label_new_object_tab_enabled: Display the "+" drop-down
+ label_font_default: Default font
+ label_font_monospace: Monospaced font
+ label_font_proportional: Proportional font
button_login: Login
button_submit: Submit
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 50fe2b923..d0ef34c46 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -376,6 +376,7 @@ fr:
field_time_entries_visibility: Visibilité du temps passé
field_total_estimated_hours: Temps estimé total
field_default_version: Version par défaut
+ field_textarea_font: Police utilisée pour les champs texte
setting_app_title: Titre de l'application
setting_app_subtitle: Sous-titre de l'application
@@ -1007,6 +1008,9 @@ fr:
label_relations: Relations
label_new_project_issue_tab_enabled: Afficher l'onglet "Nouvelle demande"
label_new_object_tab_enabled: Afficher le menu déroulant "+"
+ label_font_default: Police par défaut
+ label_font_monospace: Police non proportionnelle
+ label_font_proportional: Police proportionnelle
button_login: Connexion
button_submit: Soumettre
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index da89fe245..bbc32992e 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -379,6 +379,8 @@ blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0
blockquote blockquote { margin-left: 0;}
abbr, span.field-description[title] { border-bottom: 1px dotted #aaa; cursor: help; }
textarea.wiki-edit {width:99%; resize:vertical;}
+body.textarea-monospace textarea.wiki-edit {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; font-size: 12px;}
+body.textarea-proportional textarea.wiki-edit {font-family: Verdana, sans-serif; font-size: 12px;}
li p {margin-top: 0;}
div.issue {background:#ffffdd; padding:6px; margin-bottom:6px; border: 1px solid #d7d7d7; border-radius:3px;}
p.breadcrumb { font-size: 0.9em; margin: 4px 0 4px 0;}
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 78a8b6c39..f899e631a 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -202,7 +202,8 @@ class UsersControllerTest < Redmine::ControllerTest
'hide_mail' => '1',
'time_zone' => 'Paris',
'comments_sorting' => 'desc',
- 'warn_on_leaving_unsaved' => '0'
+ 'warn_on_leaving_unsaved' => '0',
+ 'textarea_font' => 'proportional'
}
}
end
@@ -212,6 +213,7 @@ class UsersControllerTest < Redmine::ControllerTest
assert_equal 'Paris', user.pref.time_zone
assert_equal 'desc', user.pref[:comments_sorting]
assert_equal '0', user.pref[:warn_on_leaving_unsaved]
+ assert_equal 'proportional', user.pref[:textarea_font]
end
def test_create_with_generate_password_should_email_the_password
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb
index 88b160bc9..004fb674a 100644
--- a/test/functional/welcome_controller_test.rb
+++ b/test/functional/welcome_controller_test.rb
@@ -104,6 +104,24 @@ class WelcomeControllerTest < Redmine::ControllerTest
assert_select 'script', :text => %r{warnLeavingUnsaved}, :count => 0
end
+ def test_textarea_font_set_to_monospace
+ user = User.find(1)
+ user.pref.textarea_font = 'monospace'
+ user.pref.save!
+ @request.session[:user_id] = 1
+ get :index
+ assert_select 'body.textarea-monospace'
+ end
+
+ def test_textarea_font_set_to_proportional
+ user = User.find(1)
+ user.pref.textarea_font = 'proportional'
+ user.pref.save!
+ @request.session[:user_id] = 1
+ get :index
+ assert_select 'body.textarea-proportional'
+ end
+
def test_logout_link_should_post
@request.session[:user_id] = 2