Skip to content

Commit

Permalink
Activities from a select list
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Dec 5, 2024
1 parent 5a35543 commit 311f7e5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 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 @@ -53,7 +53,11 @@ class TimeEntryForm < ApplicationForm
}
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"

Expand Down Expand Up @@ -85,5 +89,9 @@ def show_user_field?
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

0 comments on commit 311f7e5

Please sign in to comment.