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

more proper input stuff

Klaus Zandersd938ddbdc617
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 8ffcb8ba5c5..29a333cd6a0 100644
--- a/modules/costs/app/components/time_entries/time_entry_form.rb
+++ b/modules/costs/app/components/time_entries/time_entry_form.rb
@@ -22,9 +22,14 @@ module TimeEntries
}
)
- f.text_field name: :spent_on, label: "Date"
+ # TODO: Repalce with single date picker from
+ # https://github.com/opf/openproject/pull/17223/commits/db765ac3862ded78139e6b8827e33cf2b8b3bce8
+ f.text_field name: :spent_on,
+ type: "date",
+ label: "Date"
f.group(layout: :horizontal) do |g|
+ # TODO: Add a time picker based on the date picker linked above
g.text_field name: :start_time,
label: "Start time",
data: { "time-entry-target" => "startTimeInput" }
@@ -42,7 +47,8 @@ module TimeEntries
f.work_package_autocompleter name: :work_package_id,
label: "Work package",
autocomplete_options: {
- append_to: "#time-entry-dialog"
+ append_to: "#time-entry-dialog",
+ filters: [{ name: "project_id", operator: "=", values: [model.project_id] }]
}
end
diff --git a/modules/costs/app/controllers/projects/time_entries_controller.rb b/modules/costs/app/controllers/projects/time_entries_controller.rb
index ef84455136e..798361ed2d6 100644
--- a/modules/costs/app/controllers/projects/time_entries_controller.rb
+++ b/modules/costs/app/controllers/projects/time_entries_controller.rb
@@ -41,7 +41,7 @@ module Projects
# TODO: Properly handle authorization
TimeEntry.find_by(id: params[:time_entry_id])
else
- TimeEntry.new(project: @project)
+ TimeEntry.new(project: @project, user: User.current)
end
end