Skip to content

Commit

Permalink
select default activity
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Dec 5, 2024
1 parent 6015304 commit 19ca25c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/costs/app/components/time_entries/time_entry_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class TimeEntryForm < ApplicationForm

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

Expand Down

0 comments on commit 19ca25c

Please sign in to comment.