* 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
This commit is contained in:
1 parent
a1f3497ec4
commit
deb182337d
24 files changed
+104
-61
No files matched your search
@@ -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)
|
||||
|
||||
@@ -150,7 +150,7 @@ class Project < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def <=>(project)
|
||||
name <=> project.name
|
||||
name.downcase <=> project.name.downcase
|
||||
end
|
||||
|
||||
def allows_to?(action)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user