mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-14 03:14:22 +01:00
Upgraded to Rails 2.1. This can have wide ranging consequences, so please help track down any issues introduced by the upgrade. Requires environment.rb modifications.
Changes you will need to make: * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install. Other notes on my changes: * Modified our code to take advantage of Rails 2.1's slick time zone support. * Upgraded will_paginate for compatibility * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
This commit is contained in:
parent
f3bae73868
commit
901a58f8a3
1086 changed files with 51452 additions and 19526 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# Likewise will all the methods added be available for all controllers.
|
||||
|
||||
require_dependency "login_system"
|
||||
require_dependency "source_view"
|
||||
require_dependency "tracks/source_view"
|
||||
require "redcloth"
|
||||
|
||||
require 'date'
|
||||
|
|
@ -20,6 +20,7 @@ class ApplicationController < ActionController::Base
|
|||
layout proc{ |controller| controller.mobile? ? "mobile" : "standard" }
|
||||
|
||||
before_filter :set_session_expiration
|
||||
before_filter :set_time_zone
|
||||
prepend_before_filter :login_required
|
||||
prepend_before_filter :enable_mobile_content_negotiation
|
||||
after_filter :restore_content_type_for_mobile
|
||||
|
|
@ -178,6 +179,14 @@ class ApplicationController < ActionController::Base
|
|||
raise ArgumentError.new("invalid value for Boolean: \"#{s}\"")
|
||||
end
|
||||
|
||||
def self.openid_enabled?
|
||||
Tracks::Config.openid_enabled?
|
||||
end
|
||||
|
||||
def openid_enabled?
|
||||
self.class.openid_enabled?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def parse_date_per_user_prefs( s )
|
||||
|
|
@ -213,4 +222,8 @@ class ApplicationController < ActionController::Base
|
|||
logger.error("ERROR: #{message}") if type == :error
|
||||
end
|
||||
|
||||
def set_time_zone
|
||||
Time.zone = current_user.prefs.time_zone if logged_in?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ class LoginController < ApplicationController
|
|||
skip_before_filter :login_required
|
||||
before_filter :login_optional
|
||||
before_filter :get_current_user
|
||||
open_id_consumer if Tracks::Config.openid_enabled?
|
||||
open_id_consumer if openid_enabled?
|
||||
|
||||
def login
|
||||
@page_title = "TRACKS::Login"
|
||||
@openid_url = cookies[:openid_url] if Tracks::Config.openid_enabled?
|
||||
@openid_url = cookies[:openid_url] if openid_enabled?
|
||||
case request.method
|
||||
when :post
|
||||
if @user = User.authenticate(params['user_login'], params['user_password'])
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ class StatsController < ApplicationController
|
|||
@max=0
|
||||
@actions_creation_hour_array = Array.new(24) { |i| 0}
|
||||
@actions_creation_hour.each do |r|
|
||||
hour = current_user.prefs.tz.adjust(r.created_at).hour
|
||||
hour = r.created_at.hour
|
||||
@actions_creation_hour_array[hour] += 1
|
||||
end
|
||||
0.upto(23) { |i| @max = @actions_creation_hour_array[i] if @actions_creation_hour_array[i] > @max}
|
||||
|
|
@ -423,7 +423,7 @@ class StatsController < ApplicationController
|
|||
# convert to hash to be able to fill in non-existing days
|
||||
@actions_completion_hour_array = Array.new(24) { |i| 0}
|
||||
@actions_completion_hour.each do |r|
|
||||
hour = current_user.prefs.tz.adjust(r.completed_at).hour
|
||||
hour = r.completed_at.hour
|
||||
@actions_completion_hour_array[hour] += 1
|
||||
end
|
||||
0.upto(23) { |i| @max = @actions_completion_hour_array[i] if @actions_completion_hour_array[i] > @max}
|
||||
|
|
@ -446,7 +446,7 @@ class StatsController < ApplicationController
|
|||
@max=0
|
||||
@actions_creation_hour_array = Array.new(24) { |i| 0}
|
||||
@actions_creation_hour.each do |r|
|
||||
hour = current_user.prefs.tz.adjust(r.created_at).hour
|
||||
hour = r.created_at.hour
|
||||
@actions_creation_hour_array[hour] += 1
|
||||
end
|
||||
0.upto(23) { |i| @max = @actions_creation_hour_array[i] if @actions_creation_hour_array[i] > @max}
|
||||
|
|
@ -454,7 +454,7 @@ class StatsController < ApplicationController
|
|||
# convert to hash to be able to fill in non-existing days
|
||||
@actions_completion_hour_array = Array.new(24) { |i| 0}
|
||||
@actions_completion_hour.each do |r|
|
||||
hour = current_user.prefs.tz.adjust(r.completed_at).hour
|
||||
hour = r.completed_at.hour
|
||||
@actions_completion_hour_array[hour] += 1
|
||||
end
|
||||
0.upto(23) { |i| @max = @actions_completion_hour_array[i] if @actions_completion_hour_array[i] > @max}
|
||||
|
|
|
|||
|
|
@ -267,9 +267,9 @@ class TodosController < ApplicationController
|
|||
def completed
|
||||
@page_title = "TRACKS::Completed tasks"
|
||||
@done = current_user.completed_todos
|
||||
@done_today = @done.completed_within current_user.time - 1.day
|
||||
@done_this_week = @done.completed_within current_user.time - 1.week
|
||||
@done_this_month = @done.completed_within current_user.time - 4.week
|
||||
@done_today = @done.completed_within Time.zone.now - 1.day
|
||||
@done_this_week = @done.completed_within Time.zone.now - 1.week
|
||||
@done_this_month = @done.completed_within Time.zone.now - 4.week
|
||||
@count = @done_today.size + @done_this_week.size + @done_this_month.size
|
||||
end
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ class TodosController < ApplicationController
|
|||
@page_title = "TRACKS::Archived completed tasks"
|
||||
@done = current_user.completed_todos
|
||||
@count = @done.size
|
||||
@done_archive = @done.completed_more_than current_user.time - 28.days
|
||||
@done_archive = @done.completed_more_than Time.zone.now - 28.days
|
||||
end
|
||||
|
||||
def list_deferred
|
||||
|
|
@ -392,7 +392,7 @@ class TodosController < ApplicationController
|
|||
|
||||
if params.key?('due')
|
||||
due_within = params['due'].to_i
|
||||
due_within_when = current_user.time + due_within.days
|
||||
due_within_when = Time.zone.now + due_within.days
|
||||
condition_builder.add('todos.due <= ?', due_within_when)
|
||||
due_within_date_s = due_within_when.strftime("%Y-%m-%d")
|
||||
@title << " due today" if (due_within == 0)
|
||||
|
|
@ -402,7 +402,7 @@ class TodosController < ApplicationController
|
|||
|
||||
if params.key?('done')
|
||||
done_in_last = params['done'].to_i
|
||||
condition_builder.add('todos.completed_at >= ?', current_user.time - done_in_last.days)
|
||||
condition_builder.add('todos.completed_at >= ?', Time.zone.now - done_in_last.days)
|
||||
@title << " actions completed"
|
||||
@description << " in the last #{done_in_last.to_s} days"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class UsersController < ApplicationController
|
||||
|
||||
if Tracks::Config.openid_enabled?
|
||||
if openid_enabled?
|
||||
open_id_consumer
|
||||
before_filter :begin_open_id_auth, :only => :update_auth_type
|
||||
end
|
||||
|
|
@ -153,7 +153,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def update_auth_type
|
||||
if (params[:user][:auth_type] == 'open_id') && Tracks::Config.openid_enabled?
|
||||
if (params[:user][:auth_type] == 'open_id') && openid_enabled?
|
||||
case open_id_response.status
|
||||
when OpenID::SUCCESS
|
||||
# The URL was a valid identity URL. Now we just need to send a redirect
|
||||
|
|
@ -179,7 +179,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def complete
|
||||
return unless Tracks::Config.openid_enabled?
|
||||
return unless openid_enabled?
|
||||
openid_url = session['openid_url']
|
||||
if openid_url.blank?
|
||||
notify :error, "expected an openid_url"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue