Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Activities from a select list

Klaus Zanders2adc5ff255cb
diff --git a/modules/costs/app/components/time_entries/time_entry_form.rb b/modules/costs/app/components/time_entries/time_entry_form.rb
index ac6f2f95a89..c615ac8f57b 100644
--- a/modules/costs/app/components/time_entries/time_entry_form.rb
+++ b/modules/costs/app/components/time_entries/time_entry_form.rb
@@ -53,7 +53,11 @@ module TimeEntries
}
end
- f.text_field name: :activity_id, label: "Activity"
+ f.select_list name: :activity_id, label: TimeEntry.human_attribute_name(:activity) do |list|
+ activities.each do |activity|
+ list.option(value: activity.id, label: activity.name)
+ end
+ end
f.text_field name: :comments, label: "Comments"
@@ -85,5 +89,9 @@ module TimeEntries
def show_start_and_end_time_fields?
TimeEntry.can_track_start_and_end_time?
end
+
+ def activities
+ TimeEntryActivity.active_in_project(project)
+ end
end
end