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:
Luke Melia 2008-06-17 01:13:25 -04:00
parent f3bae73868
commit 901a58f8a3
1086 changed files with 51452 additions and 19526 deletions

20
lib/tracks/config.rb Normal file
View file

@ -0,0 +1,20 @@
module Tracks
class Config
def self.salt
SALT
end
def self.auth_schemes
AUTHENTICATION_SCHEMES
end
def self.openid_enabled?
auth_schemes.include?('open_id')
end
end
end

64
lib/tracks/source_view.rb Normal file
View file

@ -0,0 +1,64 @@
# Inspiration from Bruce Williams [http://codefluency.com/articles/2006/07/01/rails-views-getting-in-context/]
module Tracks
module SourceViewSwitching
class Responder
def initialize(source_view)
@source_view = source_view.underscore.gsub(/\s+/,'_').to_sym rescue nil
end
def nil?
yield if @source_view.nil? && block_given?
end
def method_missing(check_source_view,*args)
yield if check_source_view == @source_view && block_given?
end
end
module Controller
def self.included(base)
base.send(:helper, Tracks::SourceViewSwitching::Helper)
base.send(:helper_method, :source_view)
end
def source_view_is( s )
s == (params[:_source_view] || @source_view).to_sym
end
def source_view_is_one_of( *s )
s.include?(params[:_source_view].to_sym)
end
def source_view
responder = Tracks::SourceViewSwitching::Responder.new(params[:_source_view] || @source_view)
block_given? ? yield(responder) : responder
end
end
module Helper
def source_view_tag(name)
hidden_field_tag :_source_view, name.underscore.gsub(/\s+/,'_')
end
def source_view_is( s )
s == (params[:_source_view] || @source_view).to_sym
end
def source_view_is_one_of( *s )
s.include?(params[:_source_view].to_sym)
end
end
end
end
ActionController::Base.send(:include, Tracks::SourceViewSwitching::Controller)

55
lib/tracks/todo_list.rb Normal file
View file

@ -0,0 +1,55 @@
module Tracks
module TodoList
def not_done_todos(opts={})
@not_done_todos ||= self.find_not_done_todos(opts)
end
def done_todos
@done_todos ||= self.find_done_todos
end
def deferred_todos
@deferred_todos ||= self.find_deferred_todos
end
def find_not_done_todos(opts={})
with_not_done_scope(opts) do
self.todos.find(:all, :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
end
end
def find_deferred_todos(opts={})
self.todos.find_in_state(:all, :deferred, :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
end
def find_done_todos
self.todos.find_in_state(:all, :completed, :order => "todos.completed_at DESC", :limit => self.user.prefs.show_number_completed)
end
def not_done_todo_count(opts={})
with_not_done_scope(opts) do
self.todos.count
end
end
def with_not_done_scope(opts={})
conditions = ["todos.state = ?", 'active']
if opts.has_key?(:include_project_hidden_todos) && (opts[:include_project_hidden_todos] == true)
conditions = ["(todos.state = ? or todos.state = ?)", 'active', 'project_hidden']
end
self.todos.send :with_scope, :find => {:conditions => conditions} do
yield
end
end
def done_todo_count
self.todos.count_in_state(:completed)
end
def deferred_todo_count
self.todos.count_in_state(:deferred)
end
end
end