##// END OF EJS Templates
User preference for monospaced / variable-width font in textareas (#23653)....
Jean-Philippe Lang -
r15371:2342fe9a755f
parent child
Show More
@@ -561,6 +561,9 module ApplicationHelper
561 css << 'project-' + @project.identifier if @project && @project.identifier.present?
561 css << 'project-' + @project.identifier if @project && @project.identifier.present?
562 css << 'controller-' + controller_name
562 css << 'controller-' + controller_name
563 css << 'action-' + action_name
563 css << 'action-' + action_name
564 if UserPreference::TEXTAREA_FONT_OPTIONS.include?(User.current.pref.textarea_font)
565 css << "textarea-#{User.current.pref.textarea_font}"
566 end
564 css.join(' ')
567 css.join(' ')
565 end
568 end
566
569
@@ -30,6 +30,10 module UsersHelper
30 user.valid_notification_options.collect {|o| [l(o.last), o.first]}
30 user.valid_notification_options.collect {|o| [l(o.last), o.first]}
31 end
31 end
32
32
33 def textarea_font_options
34 [[l(:label_font_default), '']] + UserPreference::TEXTAREA_FONT_OPTIONS.map {|o| [l("label_font_#{o}"), o]}
35 end
36
33 def change_status_link(user)
37 def change_status_link(user)
34 url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
38 url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
35
39
@@ -29,7 +29,10 class UserPreference < ActiveRecord::Base
29 'time_zone',
29 'time_zone',
30 'comments_sorting',
30 'comments_sorting',
31 'warn_on_leaving_unsaved',
31 'warn_on_leaving_unsaved',
32 'no_self_notified'
32 'no_self_notified',
33 'textarea_font'
34
35 TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
33
36
34 def initialize(attributes=nil, *args)
37 def initialize(attributes=nil, *args)
35 super
38 super
@@ -76,4 +79,7 class UserPreference < ActiveRecord::Base
76
79
77 def activity_scope; Array(self[:activity_scope]) ; end
80 def activity_scope; Array(self[:activity_scope]) ; end
78 def activity_scope=(value); self[:activity_scope]=value ; end
81 def activity_scope=(value); self[:activity_scope]=value ; end
82
83 def textarea_font; self[:textarea_font] end
84 def textarea_font=(value); self[:textarea_font]=value; end
79 end
85 end
@@ -3,4 +3,5
3 <p><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p>
3 <p><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p>
4 <p><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
4 <p><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
5 <p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
5 <p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
6 <p><%= pref_fields.select :textarea_font, textarea_font_options %></p>
6 <% end %>
7 <% end %>
@@ -364,6 +364,7 en:
364 field_total_estimated_hours: Total estimated time
364 field_total_estimated_hours: Total estimated time
365 field_default_version: Default version
365 field_default_version: Default version
366 field_remote_ip: IP address
366 field_remote_ip: IP address
367 field_textarea_font: Font used for text areas
367
368
368 setting_app_title: Application title
369 setting_app_title: Application title
369 setting_app_subtitle: Application subtitle
370 setting_app_subtitle: Application subtitle
@@ -998,6 +999,9 en:
998 label_relations: Relations
999 label_relations: Relations
999 label_new_project_issue_tab_enabled: Display the "New issue" tab
1000 label_new_project_issue_tab_enabled: Display the "New issue" tab
1000 label_new_object_tab_enabled: Display the "+" drop-down
1001 label_new_object_tab_enabled: Display the "+" drop-down
1002 label_font_default: Default font
1003 label_font_monospace: Monospaced font
1004 label_font_proportional: Proportional font
1001
1005
1002 button_login: Login
1006 button_login: Login
1003 button_submit: Submit
1007 button_submit: Submit
@@ -376,6 +376,7 fr:
376 field_time_entries_visibility: Visibilité du temps passé
376 field_time_entries_visibility: Visibilité du temps passé
377 field_total_estimated_hours: Temps estimé total
377 field_total_estimated_hours: Temps estimé total
378 field_default_version: Version par défaut
378 field_default_version: Version par défaut
379 field_textarea_font: Police utilisée pour les champs texte
379
380
380 setting_app_title: Titre de l'application
381 setting_app_title: Titre de l'application
381 setting_app_subtitle: Sous-titre de l'application
382 setting_app_subtitle: Sous-titre de l'application
@@ -1007,6 +1008,9 fr:
1007 label_relations: Relations
1008 label_relations: Relations
1008 label_new_project_issue_tab_enabled: Afficher l'onglet "Nouvelle demande"
1009 label_new_project_issue_tab_enabled: Afficher l'onglet "Nouvelle demande"
1009 label_new_object_tab_enabled: Afficher le menu déroulant "+"
1010 label_new_object_tab_enabled: Afficher le menu déroulant "+"
1011 label_font_default: Police par défaut
1012 label_font_monospace: Police non proportionnelle
1013 label_font_proportional: Police proportionnelle
1010
1014
1011 button_login: Connexion
1015 button_login: Connexion
1012 button_submit: Soumettre
1016 button_submit: Soumettre
@@ -379,6 +379,8 blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0
379 blockquote blockquote { margin-left: 0;}
379 blockquote blockquote { margin-left: 0;}
380 abbr, span.field-description[title] { border-bottom: 1px dotted #aaa; cursor: help; }
380 abbr, span.field-description[title] { border-bottom: 1px dotted #aaa; cursor: help; }
381 textarea.wiki-edit {width:99%; resize:vertical;}
381 textarea.wiki-edit {width:99%; resize:vertical;}
382 body.textarea-monospace textarea.wiki-edit {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; font-size: 12px;}
383 body.textarea-proportional textarea.wiki-edit {font-family: Verdana, sans-serif; font-size: 12px;}
382 li p {margin-top: 0;}
384 li p {margin-top: 0;}
383 div.issue {background:#ffffdd; padding:6px; margin-bottom:6px; border: 1px solid #d7d7d7; border-radius:3px;}
385 div.issue {background:#ffffdd; padding:6px; margin-bottom:6px; border: 1px solid #d7d7d7; border-radius:3px;}
384 p.breadcrumb { font-size: 0.9em; margin: 4px 0 4px 0;}
386 p.breadcrumb { font-size: 0.9em; margin: 4px 0 4px 0;}
@@ -202,7 +202,8 class UsersControllerTest < Redmine::ControllerTest
202 'hide_mail' => '1',
202 'hide_mail' => '1',
203 'time_zone' => 'Paris',
203 'time_zone' => 'Paris',
204 'comments_sorting' => 'desc',
204 'comments_sorting' => 'desc',
205 'warn_on_leaving_unsaved' => '0'
205 'warn_on_leaving_unsaved' => '0',
206 'textarea_font' => 'proportional'
206 }
207 }
207 }
208 }
208 end
209 end
@@ -212,6 +213,7 class UsersControllerTest < Redmine::ControllerTest
212 assert_equal 'Paris', user.pref.time_zone
213 assert_equal 'Paris', user.pref.time_zone
213 assert_equal 'desc', user.pref[:comments_sorting]
214 assert_equal 'desc', user.pref[:comments_sorting]
214 assert_equal '0', user.pref[:warn_on_leaving_unsaved]
215 assert_equal '0', user.pref[:warn_on_leaving_unsaved]
216 assert_equal 'proportional', user.pref[:textarea_font]
215 end
217 end
216
218
217 def test_create_with_generate_password_should_email_the_password
219 def test_create_with_generate_password_should_email_the_password
@@ -104,6 +104,24 class WelcomeControllerTest < Redmine::ControllerTest
104 assert_select 'script', :text => %r{warnLeavingUnsaved}, :count => 0
104 assert_select 'script', :text => %r{warnLeavingUnsaved}, :count => 0
105 end
105 end
106
106
107 def test_textarea_font_set_to_monospace
108 user = User.find(1)
109 user.pref.textarea_font = 'monospace'
110 user.pref.save!
111 @request.session[:user_id] = 1
112 get :index
113 assert_select 'body.textarea-monospace'
114 end
115
116 def test_textarea_font_set_to_proportional
117 user = User.find(1)
118 user.pref.textarea_font = 'proportional'
119 user.pref.save!
120 @request.session[:user_id] = 1
121 get :index
122 assert_select 'body.textarea-proportional'
123 end
124
107 def test_logout_link_should_post
125 def test_logout_link_should_post
108 @request.session[:user_id] = 2
126 @request.session[:user_id] = 2
109
127
General Comments 0
You need to be logged in to leave comments. Login now