Skip to content

Commit

Permalink
Added user timezone setting (defaults to Brisbane).
Browse files Browse the repository at this point in the history
WARNING: finding original audio recordings may not work with user time zone other than Brisbane - test this!
  • Loading branch information
cofiem committed Sep 6, 2014
1 parent 29f17dc commit 790ba84
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class User < ActiveRecord::Base

attr_accessible :user_name, :email, :password, :password_confirmation, :remember_me,
:roles, :roles_mask, :preferences,
:image, :login
:image, :login, :time_zone_name

# Virtual attribute for authenticating by either :user_name or :email
# This is in addition to real persisted fields.
Expand Down
1 change: 1 addition & 0 deletions app/views/devise/registrations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
= f.input :user_name, required: true, autofocus: true
= f.input :password, required: true
= f.input :password_confirmation, required: true
= f.time_zone_select :time_zone_name, /Australia/, default: 'Brisbane', required: true
= f.input :email, required: true
.form-actions
= f.button :submit, 'Sign up'
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Application < Rails::Application
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
#config.time_zone - 'UTC'
# used as default when user is not logged in
# for detecting user daylight savings time, see http://stackoverflow.com/a/11888430/31567
config.time_zone = 'Brisbane'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20140906231545_add_time_zone_name_to_user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddTimeZoneNameToUser < ActiveRecord::Migration
def change
add_column :users, :time_zone_name, :string, null:false, default: 'Brisbane'
end
end

0 comments on commit 790ba84

Please sign in to comment.