GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 8e5af512 authored by jplang's avatar jplang

User preference for monospaced / variable-width font in textareas (#23653).

git-svn-id: https://svn.redmine.org/redmine/trunk@15753 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 7f5c008b
......@@ -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
......
......@@ -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}
......
......@@ -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
......@@ -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 %>
......@@ -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
......
......@@ -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
......
......@@ -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;}
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment