tracks/tracks/app/controllers/application.rb
bsag 8406a482d5 Merged branches/TRY-BSAG-ajax back to the trunk.
...and we're back!


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@86 a4c988fc-2ded-0310-b66e-134b36920a42
2005-05-28 14:08:44 +00:00

32 lines
No EOL
905 B
Ruby

# The filters added to this controller will be run for all controllers in the application.
# Likewise will all the methods added be available for all controllers.
require_dependency "login_system"
require 'date'
class ApplicationController < ActionController::Base
helper :application
include LoginSystem
# Contstants from settings.yml
DATE_FORMAT = app_configurations["formats"]["date"]
WEEK_STARTS_ON = app_configurations["formats"]["week_starts"]
NO_OF_ACTIONS = app_configurations["formats"]["hp_completed"]
def count_shown_items(hidden)
count = 0
sub = 0
hidden.each do |h|
sub = Todo.find_all("done=0 AND context_id=#{h.id}").length + sub
end
total = Todo.find_all("done=0").length - sub
end
# Returns all the errors on the page for an object...
def errors_for( obj )
error_messages_for( obj ) unless instance_eval("@#{obj}").nil?
end
end