Skip to content

Commit

Permalink
use the proper date picker
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Dec 5, 2024
1 parent da963ec commit cdca30b
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions modules/costs/app/components/time_entries/time_entry_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ class TimeEntryForm < ApplicationForm
}
)

# TODO: Repalce with single date picker from
# https://github.com/opf/openproject/pull/17223/commits/db765ac3862ded78139e6b8827e33cf2b8b3bce8
f.text_field name: :spent_on,
type: "date",
required: true,
label: TimeEntry.human_attribute_name(:spent_on)
f.single_date_picker name: :spent_on,
type: "date",
required: true,
datepicker_options: { inDialog: true },
label: TimeEntry.human_attribute_name(:spent_on)

f.group(layout: :horizontal) do |g|
# TODO: Add a time picker based on the date picker linked above
Expand All @@ -48,17 +47,15 @@ class TimeEntryForm < ApplicationForm
label: TimeEntry.human_attribute_name(:hours),
data: { "time-entry-target" => "hoursInput" }

if show_work_package_field?
f.work_package_autocompleter name: :work_package_id,
label: TimeEntry.human_attribute_name(:work_package),
autocomplete_options: {
focusDirectly: false,
append_to: "#time-entry-dialog",
filters: [
{ name: "project_id", operator: "=", values: [model.project_id] }
]
}
end
f.work_package_autocompleter name: :work_package_id,
label: TimeEntry.human_attribute_name(:work_package),
autocomplete_options: {
focusDirectly: false,
append_to: "#time-entry-dialog",
filters: [
{ name: "project_id", operator: "=", values: [model.project_id] }
]
}

f.select_list name: :activity_id, label: TimeEntry.human_attribute_name(:activity), include_blank: true do |list|
activities.each do |activity|
Expand All @@ -84,10 +81,6 @@ def custom_fields
@custom_fields ||= model.available_custom_fields
end

def show_work_package_field?
work_package.blank?
end

def show_user_field?
# Only allow setting a different user, when the user has the
# permission to log time for others in the project
Expand Down

0 comments on commit cdca30b

Please sign in to comment.