diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-11-19 22:28:43 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-11-19 22:28:43 +0000 |
commit | deb182337d14872c5481059382459f5c21502162 (patch) | |
tree | a46bb4e773e77ae63be280e31c2ac949507d1d6b /app | |
parent | a1f3497ec46881753fc13d25c3cd2cb344ae27d8 (diff) | |
download | redmine-deb182337d14872c5481059382459f5c21502162.tar.gz redmine-deb182337d14872c5481059382459f5c21502162.zip |
* Added time zone support: users can select their time zone on their account view.
* Updated Polish translation (Mariusz Olejnik).
* Fixed: Projects should be listed with case mixed.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@917 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 8 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 8 | ||||
-rw-r--r-- | app/views/my/account.rhtml | 1 |
4 files changed, 17 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 215945423..80694e744 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -79,9 +79,15 @@ module ApplicationHelper def format_time(time, include_date = true) return nil unless time time = time.to_time if time.is_a?(String) + zone = User.current.time_zone + if time.utc? + local = zone ? zone.adjust(time) : time.getlocal + else + local = zone ? zone.adjust(time.getutc) : time + end @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) @time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format) - include_date ? time.strftime("#{@date_format} #{@time_format}") : time.strftime(@time_format) + include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) end def authoring(created, author) diff --git a/app/models/project.rb b/app/models/project.rb index 1fbab2e4d..afaa049c6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -150,7 +150,7 @@ class Project < ActiveRecord::Base end def <=>(project) - name <=> project.name + name.downcase <=> project.name.downcase end def allows_to?(action) diff --git a/app/models/user.rb b/app/models/user.rb index 9c8d1d9a3..2543bed19 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -130,6 +130,10 @@ class User < ActiveRecord::Base self.preference ||= UserPreference.new(:user => self) end + def time_zone + self.pref.time_zone.nil? ? nil : TimeZone[self.pref.time_zone] + end + # Return user's RSS key (a 40 chars long string), used to access feeds def rss_key token = self.rss_token || Token.create(:user => self, :action => 'feeds') @@ -231,6 +235,10 @@ class AnonymousUser < User false end + def time_zone + nil + end + # Anonymous user has no RSS key def rss_key nil diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml index 11bba9c8d..e64051771 100644 --- a/app/views/my/account.rhtml +++ b/app/views/my/account.rhtml @@ -14,6 +14,7 @@ <p><%= f.select :language, lang_options_for_select %></p> <% fields_for :pref, @user.pref, :builder => TabularFormBuilder, :lang => current_language do |pref_fields| %> +<p><%= pref_fields.select :time_zone, TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :include_blank => true %></p> <p><%= pref_fields.check_box :hide_mail %></p> <% end %> </div> |