From 0ea75ecc41fd1921db5577f74db5fbbb55c8df25 Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Tue, 3 Dec 2024 16:11:15 +0100 Subject: [PATCH] more proper input stuff --- .../app/components/time_entries/time_entry_form.rb | 10 ++++++++-- .../controllers/projects/time_entries_controller.rb | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) 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 8ffcb8ba5c59..29a333cd6a09 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 @@ class TimeEntryForm < ApplicationForm } ) - 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 @@ class TimeEntryForm < ApplicationForm 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 ef84455136e0..798361ed2d6d 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 @@ def dialog # 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