summaryrefslogtreecommitdiffstats
path: root/app/helpers/timelog_helper.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-10-21 22:34:28 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-10-21 22:34:28 +0000
commite76d4c5c4c3f2beb8be1f441148e4627a14d37d1 (patch)
tree8f1ea0620882ad97d3804018d109f8a35f1ed4a0 /app/helpers/timelog_helper.rb
parentac4937a76755de2f9b6a83f6160efa0fde2d03aa (diff)
downloadredmine-e76d4c5c4c3f2beb8be1f441148e4627a14d37d1.tar.gz
redmine-e76d4c5c4c3f2beb8be1f441148e4627a14d37d1.zip
Added an active field track if an Enumeration is active on the frontend view.
* Changed TimelogHelper#activity_collection_for_select_options to only use active TimeEntryActivities. * Changed TimelogHelper#activity_collection_for_select_options to return a blank option if the time_entry's current activity is inactive. #4077 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2946 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/timelog_helper.rb')
-rw-r--r--app/helpers/timelog_helper.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 861c2acc7..0c3e7e6b6 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -25,11 +25,18 @@ module TimelogHelper
links << link_to_issue(@issue) if @issue
breadcrumb links
end
-
- def activity_collection_for_select_options
- activities = TimeEntryActivity.all
+
+ # 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
collection = []
- collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default)
+ if time_entry && !time_entry.activity.active?
+ collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ]
+ else
+ collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default)
+ end
activities.each { |a| collection << [a.name, a.id] }
collection
end