a user may now choose a custom theme in his preferences

pull/778/head
Philipp Tessenow 11 years ago
parent 1646b5e6bb
commit 00c1d98c7d
  1. 10
      app/models/user_preference.rb
  2. 1
      app/views/users/_preferences.html.erb

@ -39,7 +39,7 @@ class UserPreference < ActiveRecord::Base
attr_accessible :hide_mail, :time_zone, :impaired
# shortcut methods to others hash
attr_accessible :comments_sorting, :warn_on_leaving_unsaved
attr_accessible :comments_sorting, :warn_on_leaving_unsaved, :theme
after_initialize :init_other_preferences
@ -59,6 +59,14 @@ class UserPreference < ActiveRecord::Base
others[:comments_sorting] = order
end
def theme
others[:theme]
end
def theme=(order)
others[:theme] = order
end
def warn_on_leaving_unsaved
others.fetch(:warn_on_leaving_unsaved) { '1' }
end

@ -32,5 +32,6 @@ See doc/COPYRIGHT.rdoc for more details.
<p><%= pref_fields.select :time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :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 :theme, OpenProject::Themes.all.map {|t| [t.name, t.identifier]} %></p>
<% end %>

Loading…
Cancel
Save