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
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}
'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
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
<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 %>
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
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
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
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
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;}
'hide_mail' => '1',
'time_zone' => 'Paris',
'comments_sorting' => 'desc',
- 'warn_on_leaving_unsaved' => '0'
+ 'warn_on_leaving_unsaved' => '0',
+ 'textarea_font' => 'proportional'
}
}
end
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
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