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

select default activity

Klaus Zanders0f52abf1dbdd
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 fb1e3ebfed1..4f1014e47e1 100644
--- a/modules/costs/app/components/time_entries/time_entry_form.rb
+++ b/modules/costs/app/components/time_entries/time_entry_form.rb
@@ -55,7 +55,8 @@ module TimeEntries
f.select_list name: :activity_id, label: TimeEntry.human_attribute_name(:activity), include_blank: true do |list|
activities.each do |activity|
- list.option(value: activity.id, label: activity.name)
+ selected = (model.activity_id == activity.id) || (model.activity_id.blank? && activity.is_default?)
+ list.option(value: activity.id, label: activity.name, selected:)
end
end