summaryrefslogtreecommitdiffstats
path: root/app/helpers/timelog_helper.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-10-21 22:34:39 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-10-21 22:34:39 +0000
commite615266e9a036811c7f73a471ba48b5bbe27adfe (patch)
tree83458d985c737f3cd898278d1066015eac395547 /app/helpers/timelog_helper.rb
parent29301c8a381aa5995a0ce2e10ad91f210dc6464f (diff)
downloadredmine-e615266e9a036811c7f73a471ba48b5bbe27adfe.tar.gz
redmine-e615266e9a036811c7f73a471ba48b5bbe27adfe.zip
Changed the Timelogs to use both the Systemwide and Project specific TimeEntryActivities
* Added Project#activities to return all the Systemwide and Project specific activities, excluding Systemwide ones that are overridden. * Added some tests for TimelogHelper. #4077 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2948 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/timelog_helper.rb')
-rw-r--r--app/helpers/timelog_helper.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 0c3e7e6b6..178929161 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -29,10 +29,16 @@ module TimelogHelper
# Returns a collection of activities for a select field. time_entry
# is optional and will be used to check if the selected TimeEntryActivity
# is active.
- def activity_collection_for_select_options(time_entry=nil)
- activities = TimeEntryActivity.active
+ def activity_collection_for_select_options(time_entry=nil, project=nil)
+ project ||= @project
+ if project.nil?
+ activities = TimeEntryActivity.active
+ else
+ activities = project.activities
+ end
+
collection = []
- if time_entry && !time_entry.activity.active?
+ if time_entry && time_entry.activity && !time_entry.activity.active?
collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ]
else
collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default)