Commit 2e8760ca authored by jplang's avatar jplang

* 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: https://svn.redmine.org/redmine/trunk@917 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 8d8f3298
......@@ -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>
......
class AddUserPreferencesTimeZone < ActiveRecord::Migration
def self.up
add_column :user_preferences, :time_zone, :string
end
def self.down
remove_column :user_preferences, :time_zone
end
end
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -169,6 +169,7 @@ field_assignable: Issues can be assigned to this role
field_redirect_existing_links: Redirect existing links
field_estimated_hours: Estimated time
field_column_names: Columns
field_time_zone: Time zone
setting_app_title: Application title
setting_app_subtitle: Application subtitle
......
......@@ -547,3 +547,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -169,6 +169,7 @@ field_assignable: Demandes assignables à ce rôle
field_redirect_existing_links: Rediriger les liens existants
field_estimated_hours: Temps estimé
field_column_names: Colonnes
field_time_zone: Fuseau horaire
setting_app_title: Titre de l'application
setting_app_subtitle: Sous-titre de l'application
......
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -545,3 +545,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -545,3 +545,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
This diff is collapsed.
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -544,3 +544,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -545,3 +545,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -545,3 +545,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
......@@ -547,3 +547,4 @@ mail_body_account_activation_request: 'A new user (%s) has registered. His accou
label_registration_automatic_activation: automatic account activation
label_registration_manual_activation: manual account activation
notice_account_pending: "Your account was created and is now pending administrator approval."
field_time_zone: Time zone
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment