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

Render the form from rails and only the actual datepicker in angular.

Henriette Darge68dcf6c147eb
diff --git a/app/components/work_packages/date_picker/dialog_content_component.html.erb b/app/components/work_packages/date_picker/dialog_content_component.html.erb
index dea60f4c1f4..4e47c7e08ca 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.html.erb
+++ b/app/components/work_packages/date_picker/dialog_content_component.html.erb
@@ -6,36 +6,92 @@
end
collection.with_component(Primer::Alpha::Dialog::Body.new) do
- flex_layout do |body|
- body.with_row(mb: 3) do
- flex_layout(align_items: :flex_end, justify_content: :space_between) do |first_row|
- first_row.with_column do
- render(Primer::Alpha::FormControl.new(label: I18n.t("work_packages.datepicker_modal.mode.title"))) do |component|
- component.with_input do
- render(Primer::Alpha::SegmentedControl.new("aria-label": I18n.t("work_packages.datepicker_modal.mode.title"))) do |control|
- control.with_item(tag: :a,
- href: datepicker_dialog_content_work_package_path(manually_scheduled: true),
- data: { turbo_stream: true },
- label: I18n.t("work_packages.datepicker_modal.mode.manual"),
- title: I18n.t("work_packages.datepicker_modal.mode.manual"),
- selected: manually_scheduled)
- control.with_item(tag: :a,
- href: datepicker_dialog_content_work_package_path(manually_scheduled: false),
- data: { turbo_stream: true },
- label: I18n.t("work_packages.datepicker_modal.mode.automatic"),
- title: I18n.t("work_packages.datepicker_modal.mode.automatic"),
- selected: !manually_scheduled)
+ primer_form_with(
+ model: work_package,
+ url: work_package_datepicker_dialog_content_path,
+ method: :put,
+ id: DIALOG_FORM_ID,
+ html: { autocomplete: "off" },
+ ) do |f|
+ flex_layout do |body|
+ body.with_row(mb: 3) do
+ flex_layout(align_items: :flex_end, justify_content: :space_between) do |first_row|
+ first_row.with_column do
+ render(Primer::Alpha::FormControl.new(label: I18n.t("work_packages.datepicker_modal.mode.title"))) do |component|
+ component.with_input do
+ render(Primer::Alpha::SegmentedControl.new("aria-label": I18n.t("work_packages.datepicker_modal.mode.title"))) do |control|
+ control.with_item(tag: :a,
+ href: work_package_datepicker_dialog_content_path(manually_scheduled: true),
+ data: { turbo_stream: true },
+ label: I18n.t("work_packages.datepicker_modal.mode.manual"),
+ title: I18n.t("work_packages.datepicker_modal.mode.manual"),
+ selected: manually_scheduled)
+ control.with_item(tag: :a,
+ href: work_package_datepicker_dialog_content_path(manually_scheduled: false),
+ data: { turbo_stream: true },
+ label: I18n.t("work_packages.datepicker_modal.mode.automatic"),
+ title: I18n.t("work_packages.datepicker_modal.mode.automatic"),
+ selected: !manually_scheduled)
+ end
end
end
end
+
+ first_row.with_column(mb: 1) do
+ render(Primer::Alpha::CheckBox.new(name: "ignore_non_working_days",
+ label: I18n.t("work_packages.datepicker_modal.ignore_non_working_days.title"),
+ checked: work_package.ignore_non_working_days))
+ end
end
+ end
- first_row.with_column(mb: 1) do
- render(Primer::Alpha::CheckBox.new(name: "name",
- label: I18n.t("work_packages.datepicker_modal.ignore_non_working_days.title"),
- checked: work_package.ignore_non_working_days))
+ body.with_row(mb: 3) do
+ flex_layout(justify_content: :space_between) do |second_row|
+ second_row.with_column(mr: 3) do
+ render(Primer::Alpha::TextField.new(name: :start_date,
+ label: I18n.t("attributes.start_date"),
+ data: {
+ focus: focused_field == :start_date,
+ },
+ value: work_package.start_date))
+ end
+ second_row.with_column(mr: 3) do
+ render(Primer::Alpha::TextField.new(name: :due_date,
+ label: I18n.t("attributes.due_date"),
+ data: {
+ focus: focused_field == :start_date,
+ },
+ value: work_package.due_date))
+ end
+ second_row.with_column do
+ render(Primer::Alpha::TextField.new(name: :duration,
+ label: I18n.t("activerecord.attributes.work_package.duration"),
+ value: work_package.duration))
+ end
end
end
+
+ body.with_row(mb: 3) do
+ helpers.angular_component_tag "opce-wp-modal-date-picker",
+ inputs: {
+ start_date: work_package.start_date,
+ due_date: work_package.due_date,
+ ignore_non_working_days: work_package.ignore_non_working_days,
+ schedule_manually: manually_scheduled
+ }
+ end
+ end
+ end
+ end
+
+ collection.with_component(Primer::Alpha::Dialog::Footer.new) do
+ component_collection do |footer|
+ footer.with_component(Primer::ButtonComponent.new) do
+ I18n.t("button_cancel")
+ end
+
+ footer.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit, form: DIALOG_FORM_ID)) do
+ I18n.t("button_submit")
end
end
end
diff --git a/app/components/work_packages/date_picker/dialog_content_component.rb b/app/components/work_packages/date_picker/dialog_content_component.rb
index 338b89310e2..5406e92e15e 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.rb
+++ b/app/components/work_packages/date_picker/dialog_content_component.rb
@@ -33,13 +33,17 @@ module WorkPackages
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
- attr_accessor :work_package, :manually_scheduled
+ DIALOG_FORM_ID = "datepicker-form"
- def initialize(work_package:, manually_scheduled: true)
+ attr_accessor :work_package, :manually_scheduled, :focused_field, :touched_field_map
+
+ def initialize(work_package:, manually_scheduled: true, focused_field: :start_date, touched_field_map: {})
super
@work_package = work_package
@manually_scheduled = ActiveModel::Type::Boolean.new.cast(manually_scheduled)
+ @focused_field = focused_field
+ @touched_field_map = touched_field_map
end
private
diff --git a/app/controllers/work_packages/date_picker_controller.rb b/app/controllers/work_packages/date_picker_controller.rb
new file mode 100644
index 00000000000..d25e4078245
--- /dev/null
+++ b/app/controllers/work_packages/date_picker_controller.rb
@@ -0,0 +1,140 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+class WorkPackages::DatePickerController < ApplicationController
+ include OpTurbo::ComponentStream
+
+ ERROR_PRONE_ATTRIBUTES = %i[start_date
+ due_date
+ duration].freeze
+
+ layout false
+
+ before_action :find_work_package
+ authorization_checked! :show, :update
+
+ attr_accessor :work_package
+
+ def show
+ respond_to do |format|
+ format.html do
+ render :show,
+ locals: { work_package:, manually_scheduled:, params: },
+ layout: false
+ end
+
+ format.turbo_stream do
+ replace_via_turbo_stream(
+ component: WorkPackages::DatePicker::DialogContentComponent.new(work_package:, manually_scheduled:)
+ )
+ render turbo_stream: turbo_streams
+ end
+ end
+ end
+
+ def update
+ service_call = WorkPackages::UpdateService
+ .new(user: current_user,
+ model: @work_package)
+ .call(work_package_datepicker_params)
+
+ if service_call.success?
+ respond_to do |format|
+ format.turbo_stream do
+ render turbo_stream: []
+ end
+ end
+ else
+ respond_to do |format|
+ format.turbo_stream do
+ # Bundle 422 status code into stream response so
+ # Angular has context as to the success or failure of
+ # the request in order to fetch the new set of Work Package
+ # attributes in the ancestry solely on success.
+ render turbo_stream: [
+ turbo_stream.morph("work_package_datepicker_modal", datepicker_modal_component)
+ ], status: :unprocessable_entity
+ end
+ end
+ end
+ end
+
+ private
+
+ def progress_modal_component
+ WorkPackages::DatePicker::DialogContentComponent.new(work_package: @work_package, manually_scheduled:, focused_field:,
+ touched_field_map:)
+ end
+
+ def focused_field
+ params[:field]
+ end
+
+ def find_work_package
+ @work_package = WorkPackage.visible.find(params[:work_package_id])
+ end
+
+ def touched_field_map
+ params.require(:work_package)
+ .slice("schedule_manually_touched",
+ "ignore_non_working_days_touched",
+ "start_date_touched",
+ "due_date_touched",
+ "duration_touched")
+ .transform_values { _1 == "true" }
+ .permit!
+ end
+
+ def manually_scheduled
+ if params[:manually_scheduled].present?
+ params.delete(:manually_scheduled)
+ else
+ work_package.schedule_manually
+ end
+ end
+
+ def work_package_datepicker_params
+ params.require(:work_package)
+ .slice(*allowed_touched_params)
+ .permit!
+ end
+
+ def allowed_touched_params
+ allowed_params.filter { touched?(_1) }
+ end
+
+ def allowed_params
+ %i[schedule_manually ignore_non_working_days start_date due_date duration]
+ end
+
+ def touched?(field)
+ touched_field_map[:"#{field}_touched"]
+ end
+end
diff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rb
index 2cd4f895b35..3cce30d327f 100644
--- a/app/controllers/work_packages_controller.rb
+++ b/app/controllers/work_packages_controller.rb
@@ -38,13 +38,12 @@ class WorkPackagesController < ApplicationController
before_action :authorize_on_work_package,
:project, only: %i[show generate_pdf_dialog generate_pdf]
- before_action :authorize_on_work_package, only: %i[datepicker_dialog_content]
before_action :load_and_authorize_in_optional_project,
:check_allowed_export,
:protect_from_unauthorized_export, only: %i[index export_dialog]
before_action :authorize, only: :show_conflict_flash_message
- authorization_checked! :index, :show, :export_dialog, :generate_pdf_dialog, :generate_pdf, :datepicker_dialog_content
+ authorization_checked! :index, :show, :export_dialog, :generate_pdf_dialog, :generate_pdf
before_action :load_and_validate_query, only: :index, unless: -> { request.format.html? }
before_action :load_work_packages, only: :index, if: -> { request.format.atom? }
@@ -106,29 +105,6 @@ class WorkPackagesController < ApplicationController
redirect_back(fallback_location: work_package_path(work_package))
end
- def datepicker_dialog_content
- manually_scheduled = if params[:manually_scheduled].present?
- params.delete(:manually_scheduled)
- else
- work_package.schedule_manually
- end
-
- respond_to do |format|
- format.html do
- render :datepicker_dialog_content,
- locals: { work_package:, manually_scheduled:, params: },
- layout: false
- end
-
- format.turbo_stream do
- replace_via_turbo_stream(
- component: WorkPackages::DatePicker::DialogContentComponent.new(work_package:, manually_scheduled:)
- )
- render turbo_stream: turbo_streams
- end
- end
- end
-
def work_package_exporter
case params[:template]
when "contract"
diff --git a/app/views/work_packages/datepicker_dialog_content.html.erb b/app/views/work_packages/date_picker/show.html.erb
similarity index 100%
rename from app/views/work_packages/datepicker_dialog_content.html.erb
rename to app/views/work_packages/date_picker/show.html.erb
diff --git a/config/routes.rb b/config/routes.rb
index 75bebd5bb77..9135b56335e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -667,7 +667,8 @@ Rails.application.routes.draw do
get "/export_dialog" => "work_packages#export_dialog", on: :collection, as: "export_dialog"
get :show_conflict_flash_message, on: :collection # we don't need a specific work package for this
- get "/datepicker_dialog_content" => "work_packages#datepicker_dialog_content", on: :member, as: "datepicker_dialog_content"
+
+ resource :datepicker_dialog_content, controller: "work_packages/date_picker", on: :member, as: "datepicker_dialog_content"
get "/split_view/update_counter" => "work_packages/split_view#update_counter",
on: :member
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 9e48dbc96f7..a2ed1bb60c5 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -235,6 +235,7 @@ import { CurrentProjectService } from 'core-app/core/current-project/current-pro
import {
TimeEntriesWorkPackageAutocompleterComponent,
} from 'core-app/shared/components/autocompleter/time-entries-work-package-autocompleter/time-entries-work-package-autocompleter.component';
+import { OpWpModalDatePickerComponent } from 'core-app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component';
export function initializeServices(injector:Injector) {
return () => {
@@ -448,6 +449,7 @@ export class OpenProjectModule implements DoBootstrap {
registerCustomElement('opce-timer-account-menu', TimerAccountMenuComponent, { injector });
registerCustomElement('opce-remote-field-updater', RemoteFieldUpdaterComponent, { injector });
registerCustomElement('opce-modal-single-date-picker', OpModalSingleDatePickerComponent, { injector });
+ registerCustomElement('opce-wp-modal-date-picker', OpWpModalDatePickerComponent, { injector });
registerCustomElement('opce-spot-drop-modal-portal', SpotDropModalPortalComponent, { injector });
registerCustomElement('opce-spot-switch', SpotSwitchComponent, { injector });
registerCustomElement('opce-modal-overlay', OpModalOverlayComponent, { injector });
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index 758d1f448e7..8263a383c59 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -308,7 +308,7 @@ export class PathHelperService {
return `${this.workPackagePath(workPackageId)}/split_view/get_relations_counter`;
}
- public workPackageDatepickerDialogContentPath(workPackageId:string|number) {
+ public workPackageDatepickerDialogContentPath(workPackageId:string|number):string {
return `${this.workPackagePath(workPackageId)}/datepicker_dialog_content`;
}
diff --git a/frontend/src/app/shared/components/datepicker/datepicker.module.ts b/frontend/src/app/shared/components/datepicker/datepicker.module.ts
index dfe83bc5ce2..a059dcefd58 100644
--- a/frontend/src/app/shared/components/datepicker/datepicker.module.ts
+++ b/frontend/src/app/shared/components/datepicker/datepicker.module.ts
@@ -15,6 +15,8 @@ import { OpSpotModule } from 'core-app/spot/spot.module';
import { OpenprojectModalModule } from '../modal/modal.module';
import { OpDatePickerSheetComponent } from 'core-app/shared/components/datepicker/sheet/date-picker-sheet.component';
import { OpenprojectContentLoaderModule } from 'core-app/shared/components/op-content-loader/openproject-content-loader.module';
+import { OpWpMultiDateDialogContentComponent } from 'core-app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-dialog-content.component';
+import { OpWpModalDatePickerComponent } from 'core-app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component';
@NgModule({
imports: [
@@ -37,6 +39,8 @@ import { OpenprojectContentLoaderModule } from 'core-app/shared/components/op-co
OpWpMultiDateFormComponent,
OpWpSingleDateFormComponent,
OpDatePickerSheetComponent,
+ OpWpMultiDateDialogContentComponent,
+ OpWpModalDatePickerComponent,
],
exports: [
@@ -45,6 +49,8 @@ import { OpenprojectContentLoaderModule } from 'core-app/shared/components/op-co
OpWpSingleDateFormComponent,
OpBasicDatePickerModule,
OpDatePickerSheetComponent,
+ OpWpMultiDateDialogContentComponent,
+ OpWpModalDatePickerComponent,
],
})
export class OpDatePickerModule { }
diff --git a/frontend/src/app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component.ts
new file mode 100644
index 00000000000..c28c1549d15
--- /dev/null
+++ b/frontend/src/app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component.ts
@@ -0,0 +1,184 @@
+//-- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) the OpenProject GmbH
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License version 3.
+//
+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+// Copyright (C) 2006-2013 Jean-Philippe Lang
+// Copyright (C) 2010-2013 the ChiliProject Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See COPYRIGHT and LICENSE files for more details.
+//++
+
+import {
+ AfterViewInit,
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ ElementRef,
+ Injector,
+ Input,
+ OnInit,
+ ViewChild,
+} from '@angular/core';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { TimezoneService } from 'core-app/core/datetime/timezone.service';
+import { DayElement } from 'flatpickr/dist/types/instance';
+import flatpickr from 'flatpickr';
+import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
+import { DateModalRelationsService } from 'core-app/shared/components/datepicker/services/date-modal-relations.service';
+import { onDayCreate } from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';
+import { WeekdayService } from 'core-app/core/days/weekday.service';
+import { FocusHelperService } from 'core-app/shared/directives/focus/focus-helper';
+import { DeviceService } from 'core-app/core/browser/device.service';
+import { DatePicker } from '../datepicker';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
+import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
+import { fromEvent } from 'rxjs';
+import { filter } from 'rxjs/operators';
+
+@Component({
+ selector: 'op-wp-modal-date-picker',
+ template: `
+ <input
+ id="flatpickr-input"
+ #flatpickrTarget
+ hidden>
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ styleUrls: [
+ '../styles/datepicker.modal.sass',
+ ],
+})
+export class OpWpModalDatePickerComponent extends UntilDestroyedMixin implements AfterViewInit, OnInit {
+ @Input() public ignoreNonWorkingDays:boolean;
+ @Input() public scheduleManually:boolean;
+
+ @Input() public startDate:Date;
+ @Input() public dueDate:Date;
+
+ @Input() public isSchedulable:boolean = true;
+ @Input() public minimalSchedulingDate:Date|null;
+
+ @Input() fieldName:string = '';
+
+ @ViewChild('flatpickrTarget') flatpickrTarget:ElementRef;
+
+ private datePickerInstance:DatePicker;
+
+ constructor(
+ readonly injector:Injector,
+ readonly cdRef:ChangeDetectorRef,
+ readonly apiV3Service:ApiV3Service,
+ readonly I18n:I18nService,
+ readonly timezoneService:TimezoneService,
+ readonly deviceService:DeviceService,
+ readonly weekdayService:WeekdayService,
+ readonly focusHelper:FocusHelperService,
+ readonly pathHelper:PathHelperService,
+ readonly elementRef:ElementRef,
+ ) {
+ super();
+ populateInputsFromDataset(this);
+ }
+
+ ngOnInit():void {
+ //this.setCurrentActivatedField(this.initialActivatedField);
+ }
+
+ ngAfterViewInit():void {
+ this.initializeDatepicker();
+ }
+
+ private initializeDatepicker() {
+ this.datePickerInstance?.destroy();
+ this.datePickerInstance = new DatePicker(
+ this.injector,
+ '#flatpickr-input',
+ [this.startDate || '', this.dueDate || ''],
+ {
+ mode: 'range',
+ showMonths: this.deviceService.isMobile ? 1 : 2,
+ inline: true,
+ onReady: (_date, _datestr, instance) => {
+ instance.calendarContainer.classList.add('op-datepicker-modal--flatpickr-instance');
+
+ this.ensureHoveredSelection(instance.calendarContainer);
+ },
+ onChange: (dates:Date[], _datestr, instance) => {
+ this.startDate = dates[0];
+ this.dueDate = dates[1];
+
+ /*const activeField = this.currentlyActivatedDateField;
+
+ // When two values are passed from datepicker and we don't have duration set,
+ // just take the range provided by them
+ if (dates.length === 2 && !this.duration) {
+ this.setDatesAndDeriveDuration(dates[0], dates[1]);
+ this.toggleCurrentActivatedField();
+ return;
+ }
+
+ // Update with the same flow as entering a value
+ const { latestSelectedDateObj } = instance as { latestSelectedDateObj:Date };
+ this.datepickerChanged$.next([activeField, latestSelectedDateObj]);*/
+ },
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ onDayCreate: async (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {
+ onDayCreate(
+ dayElem,
+ this.ignoreNonWorkingDays,
+ await this.datePickerInstance?.isNonWorkingDay(dayElem.dateObj),
+ this.isDayDisabled(dayElem),
+ );
+ },
+ },
+ this.flatpickrTarget.nativeElement,
+ );
+ }
+
+ private isDayDisabled(dayElement:DayElement):boolean {
+ const minimalDate = this.minimalSchedulingDate || null;
+ return !this.isSchedulable || (!this.scheduleManually && !!minimalDate && dayElement.dateObj <= minimalDate);
+ }
+
+ /**
+ * When hovering selections in the range datepicker, the range usually
+ * stays active no matter where the cursor is.
+ *
+ * We want to hide any hovered selection preview when we leave the datepicker.
+ * @param calendarContainer
+ * @private
+ */
+ private ensureHoveredSelection(calendarContainer:HTMLDivElement) {
+ fromEvent(calendarContainer, 'mouseenter')
+ .pipe(
+ this.untilDestroyed(),
+ )
+ .subscribe(() => calendarContainer.classList.remove('flatpickr-container-suppress-hover'));
+
+ fromEvent(calendarContainer, 'mouseleave')
+ .pipe(
+ this.untilDestroyed(),
+ filter(() => !(!!this.startDate && !!this.dueDate)),
+ )
+ .subscribe(() => calendarContainer.classList.add('flatpickr-container-suppress-hover'));
+ }
+}
diff --git a/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-dialog-content.component.ts b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-dialog-content.component.ts
new file mode 100644
index 00000000000..3432d342d7d
--- /dev/null
+++ b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-dialog-content.component.ts
@@ -0,0 +1,82 @@
+//-- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) the OpenProject GmbH
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License version 3.
+//
+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+// Copyright (C) 2006-2013 Jean-Philippe Lang
+// Copyright (C) 2010-2013 the ChiliProject Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See COPYRIGHT and LICENSE files for more details.
+//++
+
+import {
+ ChangeDetectionStrategy,
+ Component,
+ HostBinding,
+ Input,
+ OnInit,
+ ViewEncapsulation,
+} from '@angular/core';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
+import { ResourceChangeset } from 'core-app/shared/components/fields/changeset/resource-changeset';
+
+@Component({
+ selector: 'op-wp-multi-date-dialog-content',
+ template: `
+ <turbo-frame *ngIf="turboFrameSrc"
+ [src]="turboFrameSrc"
+ id="wp-datepicker-dialog--content">
+ <op-content-loader viewBox="0 0 100 100">
+ <svg:rect x="5" y="5" width="70" height="5" rx="1"/>
+
+ <svg:rect x="80" y="5" width="15" height="5" rx="1"/>
+
+ <svg:rect x="5" y="15" width="90" height="8" rx="1"/>
+
+ <svg:rect x="5" y="30" width="90" height="12" rx="1"/>
+ </op-content-loader>
+ </turbo-frame>
+ `,
+ styleUrls: [
+ '../styles/datepicker.modal.sass',
+ ],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ encapsulation: ViewEncapsulation.None,
+})
+export class OpWpMultiDateDialogContentComponent extends UntilDestroyedMixin implements OnInit {
+ @HostBinding('class.op-datepicker-modal') className = true;
+
+ @HostBinding('class.op-datepicker-modal_wide') classNameWide = true;
+
+ @Input() changeset:ResourceChangeset;
+
+ public turboFrameSrc:string;
+
+ constructor(
+ readonly pathHelper:PathHelperService,
+ ) {
+ super();
+ }
+
+ ngOnInit():void {
+ this.turboFrameSrc = this.pathHelper.workPackageDatepickerDialogContentPath(this.changeset.id);
+ }
+}
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
index 6e6c66fbde8..626713f1d5b 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
@@ -20,13 +20,18 @@
(save)="save()"
(cancel)="cancel()"
></op-wp-single-date-form>
- <op-wp-multi-date-form
+ <op-wp-multi-date-dialog-content
+ *ngIf="opened && isMultiDate"
+ [changeset]="change"
+ ></op-wp-multi-date-dialog-content>
+
+ <!--<op-wp-multi-date-form
*ngIf="opened && isMultiDate"
[value]="dates"
[changeset]="change"
[fieldName]="name"
(save)="save()"
(cancel)="cancel()"
- ></op-wp-multi-date-form>
+ ></op-wp-multi-date-form>-->
</ng-container>
</spot-drop-modal>