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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Make datepicker today links input dates in new fashion
Oliver Günthere10dcc47112b
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.tsindex 64d317c28f6..06a84da4562 100644--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts@@ -346,15 +346,10 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi}setToday(key:DateKeys):void {- const today = parseDate(new Date());- this.dates[key] = this.timezoneService.formattedISODate(today);+ this.datepickerChanged$.next([key, new Date()]);- if (today instanceof Date) {- this.enforceManualChangesToDatepicker(today);- this.toggleCurrentActivatedField();- } else {- this.enforceManualChangesToDatepicker();- }+ const nextActive = key === 'start' ? 'end' : 'start';+ this.setCurrentActivatedField(nextActive);}// eslint-disable-next-line class-methods-use-thisdiff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rbindex 3b68e1e2707..80e58ac7c76 100644--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb@@ -686,7 +686,7 @@ describe 'Datepicker modal logic test cases (WP #43539)',endend- context 'when setting ignore NWD to true for a milesotone' do+ context 'when setting ignore NWD to true for a milestone' dolet(:date_attribute) { :date }let(:work_package) { milestone_wp }let(:current_attributes) do@@ -713,4 +713,39 @@ describe 'Datepicker modal logic test cases (WP #43539)',ignore_non_working_days: trueendend++ context 'when setting start and due date through today links' do+ let(:current_attributes) do+ {+ start_date: nil,+ due_date: nil,+ duration: nil,+ ignore_non_working_days: true+ }+ end++ it 'allows to persist that value (Regression #44140)' do+ datepicker.expect_start_date ''+ datepicker.expect_due_date ''+ datepicker.expect_duration ''++ today = Time.zone.today+ today_str = today.iso8601++ # Setting start will set active to due+ datepicker.set_today 'start'+ datepicker.expect_start_date today_str+ datepicker.expect_due_highlighted++ datepicker.set_today 'due'+ datepicker.expect_due_date today_str+ datepicker.expect_start_highlighted++ datepicker.expect_duration 1++ apply_and_expect_saved start_date: today,+ due_date: today,+ duration: 1+ end+ endenddiff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rbindex 193542c7dbc..e400421562e 100644--- a/spec/support/components/datepicker/work_package_datepicker.rb+++ b/spec/support/components/datepicker/work_package_datepicker.rb@@ -135,6 +135,20 @@ module Componentsdue_date_field.clickend+ def set_today(date)+ key =+ case date.to_s+ when 'due'+ 'end'+ else+ date+ end++ page.within("[data-qa-selector='datepicker-#{key}-date']") do+ find('a', text: 'Today').click+ end+ end+def set_duration(value)focus_durationfill_in 'duration', with: value, fill_options: { clear: :backspace }