diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-08-30 19:59:29 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-08-30 19:59:29 +0000 |
commit | 2342fe9a755ff6a4ed509d0eb866fde1d744b791 (patch) | |
tree | 79096e67e6ae82c0312ca32cea99d7a7528d57b0 /app | |
parent | b405a0be535b365276dfdfbf092107bb07c70713 (diff) | |
download | redmine-2342fe9a755ff6a4ed509d0eb866fde1d744b791.tar.gz redmine-2342fe9a755ff6a4ed509d0eb866fde1d744b791.zip |
User preference for monospaced / variable-width font in textareas (#23653).
git-svn-id: http://svn.redmine.org/redmine/trunk@15753 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 3 | ||||
-rw-r--r-- | app/helpers/users_helper.rb | 4 | ||||
-rw-r--r-- | app/models/user_preference.rb | 8 | ||||
-rw-r--r-- | app/views/users/_preferences.html.erb | 1 |
4 files changed, 15 insertions, 1 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 %> |