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
Use a modal instead of a drop-modal for the datepicker
Henriette Darge780e41b2516e
diff --git a/app/components/work_packages/date_picker/banner_component.rb b/app/components/work_packages/date_picker/banner_component.rbindex 5b93786924d..dd264a7a04e 100644--- a/app/components/work_packages/date_picker/banner_component.rb+++ b/app/components/work_packages/date_picker/banner_component.rb@@ -181,7 +181,8 @@ module WorkPackagesscheme:,full: true,icon: :info,- test_selector:+ test_selector:,+ pr: 3}endenddiff --git a/app/components/work_packages/date_picker/form_component.html.erb b/app/components/work_packages/date_picker/form_component.html.erbindex 85d479f647a..f1b404d1351 100644--- a/app/components/work_packages/date_picker/form_component.html.erb+++ b/app/components/work_packages/date_picker/form_component.html.erb@@ -96,7 +96,7 @@endbody.with_row("aria-hidden": true) do- helpers.angular_component_tag "opce-wp-modal-date-picker",+ helpers.angular_component_tag "opce-wp-date-picker-instance",inputs: {start_date: work_package.start_date,due_date: work_package.due_date,diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.tsindex 7c188dd3e5d..d08f9538010 100644--- a/frontend/src/app/app.module.ts+++ b/frontend/src/app/app.module.ts@@ -232,7 +232,7 @@ import { CurrentProjectService } from 'core-app/core/current-project/current-proimport {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';+import { OpWpDatePickerInstanceComponent } from 'core-app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker-instance.component';export function initializeServices(injector:Injector) {return () => {@@ -445,7 +445,7 @@ export class OpenProjectModule implements DoBootstrap {registerCustomElement('opce-wp-split-view', WorkPackageSplitViewEntryComponent, { injector });registerCustomElement('opce-timer-account-menu', TimerAccountMenuComponent, { injector });registerCustomElement('opce-remote-field-updater', RemoteFieldUpdaterComponent, { injector });- registerCustomElement('opce-wp-modal-date-picker', OpWpModalDatePickerComponent, { injector });+ registerCustomElement('opce-wp-date-picker-instance', OpWpDatePickerInstanceComponent, { 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/shared/components/datepicker/datepicker.module.ts b/frontend/src/app/shared/components/datepicker/datepicker.module.tsindex dc22fd0861e..e29dd925553 100644--- a/frontend/src/app/shared/components/datepicker/datepicker.module.ts+++ b/frontend/src/app/shared/components/datepicker/datepicker.module.ts@@ -13,7 +13,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 { OpWpModalDatePickerComponent } from 'core-app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component';+import { OpWpDatePickerInstanceComponent } from 'core-app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker-instance.component';+import { OpWpDatePickerModalComponent } from 'core-app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal';@NgModule({imports: [@@ -34,14 +35,16 @@ import { OpWpModalDatePickerComponent } from 'core-app/shared/components/datepicdeclarations: [OpModalSingleDatePickerComponent,OpDatePickerSheetComponent,- OpWpModalDatePickerComponent,+ OpWpDatePickerInstanceComponent,+ OpWpDatePickerModalComponent,],exports: [OpModalSingleDatePickerComponent,OpBasicDatePickerModule,OpDatePickerSheetComponent,- OpWpModalDatePickerComponent,+ OpWpDatePickerInstanceComponent,+ OpWpDatePickerModalComponent,],})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-date-picker-modal/wp-date-picker-instance.component.tssimilarity index 98%rename from frontend/src/app/shared/components/datepicker/wp-modal-date-picker/wp-modal-date-picker.component.tsrename to frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker-instance.component.tsindex 513912bbb91..cb2a06472b0 100644--- 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-date-picker-modal/wp-date-picker-instance.component.ts@@ -54,7 +54,7 @@ import * as _ from 'lodash';export type DateMode = 'single'|'range';@Component({- selector: 'op-wp-modal-date-picker',+ selector: 'op-wp-date-picker-instance',template: `<inputid="flatpickr-input"@@ -63,7 +63,7 @@ export type DateMode = 'single'|'range';`,changeDetection: ChangeDetectionStrategy.OnPush,})-export class OpWpModalDatePickerComponent extends UntilDestroyedMixin implements AfterViewInit {+export class OpWpDatePickerInstanceComponent extends UntilDestroyedMixin implements AfterViewInit {@Input() public ignoreNonWorkingDays:boolean;@Input() public scheduleManually:boolean;diff --git a/frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal.html b/frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal.htmlnew file mode 100644index 00000000000..30bf16de231--- /dev/null+++ b/frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal.html@@ -0,0 +1,25 @@+<div+ class="spot-modal spot-modal_auto-size loading-indicator--location"+ data-indicator-name="modal"+ tabindex="0"+>+ <turbo-frame *ngIf="turboFrameSrc"+ [src]="turboFrameSrc"+ opModalWithTurboContent+ [change]="locals.change"+ [resource]="locals.resource"+ (successfulCreate)="handleSuccessfulCreate($event)"+ (successfulUpdate)="handleSuccessfulUpdate()"+ (cancel)="handleCancel()"+ 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>+</div>diff --git a/frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal.ts b/frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal.tsnew file mode 100644index 00000000000..f49f65fb40e--- /dev/null+++ b/frontend/src/app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal.ts@@ -0,0 +1,131 @@+//-- 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,+ ChangeDetectorRef,+ Component,+ ElementRef,+ Inject,+ OnInit,+} from '@angular/core';++import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';+import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';+import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';++@Component({+ templateUrl: './wp-date-picker.modal.html',+ changeDetection: ChangeDetectionStrategy.OnPush,+})+export class OpWpDatePickerModalComponent extends OpModalComponent implements OnInit {+ turboFrameSrc:string;++ constructor(+ readonly elementRef:ElementRef,+ @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,+ readonly cdRef:ChangeDetectorRef,+ readonly pathHelper:PathHelperService,+ ) {+ super(locals, cdRef, elementRef);+ }++ ngOnInit() {+ super.ngOnInit();+ this.updateFrameSrc();+ }++ public handleSuccessfulCreate(JSONResponse:{ duration:number, startDate:Date, dueDate:Date, includeNonWorkingDays:boolean, scheduleManually:boolean }):void {+ document.dispatchEvent(+ new CustomEvent('date-picker-modal:create', {+ detail: JSONResponse,+ }),+ );++ this.closeModal();+ }++ public handleSuccessfulUpdate():void {+ document.dispatchEvent(new CustomEvent('date-picker-modal:update'));++ this.closeModal();+ }++ public handleCancel():void {+ document.dispatchEvent(new CustomEvent('date-picker-modal:cancel'));++ this.closeModal();+ }++ public closeModal():void {+ this.closeMe();+ }++ public updateFrameSrc():void {+ const url = new URL(+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access+ this.pathHelper.workPackageDatepickerDialogContentPath(this.locals.resource.id as string),+ window.location.origin,+ );++ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('field', this.locals.name);+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('work_package[initial][start_date]', this.nullAsEmptyStringFormatter(this.locals.resource.startDate));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('work_package[initial][due_date]', this.nullAsEmptyStringFormatter(this.locals.resource.dueDate));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('work_package[initial][duration]', this.nullAsEmptyStringFormatter(this.locals.resource.duration));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument+ url.searchParams.set('work_package[initial][ignore_non_working_days]', this.nullAsEmptyStringFormatter(this.locals.resource.includeNonWorkingDays));++ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('work_package[start_date]', this.nullAsEmptyStringFormatter(this.locals.resource.startDate));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('work_package[due_date]', this.nullAsEmptyStringFormatter(this.locals.resource.dueDate));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access+ url.searchParams.set('work_package[duration]', this.nullAsEmptyStringFormatter(this.locals.resource.duration));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument+ url.searchParams.set('work_package[ignore_non_working_days]', this.nullAsEmptyStringFormatter(this.locals.resource.includeNonWorkingDays));+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access+ if (this.locals.resource?.id === 'new' && this.locals.resource.startDate) {+ url.searchParams.set('work_package[start_date_touched]', 'true');+ }++ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access+ this.turboFrameSrc = url.toString();+ }++ private nullAsEmptyStringFormatter(value:null|undefined|string):string {+ if (value === undefined || value === null) {+ return '';+ }+ return value;+ }+}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.htmlindex aa8eea2efbd..11668a3a84f 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@@ -1,36 +1,7 @@-<spot-drop-modal- [opened]="opened"- (closed)="onModalClosed()"- alignment="bottom-center"->- <input- slot="trigger"- type="text"- class="spot-input"- (click)="onInputClick($event)"- [value]="dates"- (focus)="showDatePickerModal()"- />-- <ng-container slot="body">- <turbo-frame *ngIf="turboFrameSrc && opened"- [src]="turboFrameSrc"- opModalWithTurboContent- [change]="change"- [resource]="resource"- (successfulCreate)="handleSuccessfulCreate($event)"- (successfulUpdate)="handleSuccessfulUpdate()"- (cancel)="cancel()"- 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>- </ng-container>-</spot-drop-modal>+<input+ type="text"+ class="inline-edit--field op-input"+ (click)="onInputClick($event)"+ [value]="dates"+ (focus)="showDatePickerModal()"+/>diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.tsindex a8f6ae71630..401e32265fa 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts@@ -57,13 +57,8 @@ export class CombinedDateEditFieldComponent extends DatePickerEditFieldComponentevent.stopPropagation();}- public showDatePickerModal():void {- this.updateFrameSrc();- this.opened = true;- }-public onModalClosed():void {- this.opened = false;+ super.onModalClosed();if (!this.handler.inEditMode) {this.handler.deactivate(false);diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.tsindex d5f262f6b71..4e9bef518d8 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts@@ -27,13 +27,13 @@*/import {+ ChangeDetectorRef,Directive,- OnDestroy,- OnInit,- Injector,ElementRef,Inject,- ChangeDetectorRef,+ Injector,+ OnDestroy,+ OnInit,} from '@angular/core';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { TimezoneService } from 'core-app/core/datetime/timezone.service';@@ -50,6 +50,8 @@ import { ResourceChangeset } from 'core-app/shared/components/fields/changeset/rimport { HalResource } from 'core-app/features/hal/resources/hal-resource';import { IFieldSchema } from 'core-app/shared/components/fields/field.base';import { EditFieldHandler } from 'core-app/shared/components/fields/edit/editing-portal/edit-field-handler';+import { OpModalService } from 'core-app/shared/components/modal/modal.service';+import { OpWpDatePickerModalComponent } from 'core-app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker.modal';@Directive()export abstract class DatePickerEditFieldComponent extends EditFieldComponent implements OnInit, OnDestroy {@@ -58,6 +60,11 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent im@InjectField() deviceService:DeviceService;turboFrameSrc:string;+ opened = false;++ private createHandler:EventListener = this.handleSuccessfulCreate.bind(this);+ private updateHandler:EventListener = this.handleSuccessfulUpdate.bind(this);+ private cancelHandler:EventListener = this.cancel.bind(this);constructor(readonly I18n:I18nService,@@ -68,6 +75,7 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent imreadonly cdRef:ChangeDetectorRef,readonly injector:Injector,readonly pathHelper:PathHelperService,+ readonly opModalService:OpModalService,) {super(I18n, elementRef, change, schema, handler, cdRef, injector);}@@ -84,25 +92,47 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent im.subscribe(() => {this.showDatePickerModal();});++ document.addEventListener('date-picker-modal:create', this.createHandler);+ document.addEventListener('date-picker-modal:update', this.updateHandler);+ document.addEventListener('date-picker-modal:cancel', this.cancelHandler);}ngOnDestroy():void {super.ngOnDestroy();++ document.removeEventListener('date-picker-modal:create', this.createHandler);+ document.removeEventListener('date-picker-modal:update', this.updateHandler);+ document.removeEventListener('date-picker-modal:cancel', this.cancelHandler);}- public showDatePickerModal():void { }+ public showDatePickerModal():void {+ this.opModalService.show(+ OpWpDatePickerModalComponent,+ this.injector,+ { resource: this.resource, name: this.name },+ );+ this.opened = true;+ }++ public handleSuccessfulCreate(event:CustomEvent):void {+ const { detail: {+ duration,+ startDate,+ dueDate,+ includeNonWorkingDays,+ scheduleManually } } = event as { detail:{ duration:number, startDate:Date, dueDate:Date, includeNonWorkingDays:boolean, scheduleManually:boolean } };- public handleSuccessfulCreate(JSONResponse:{ duration:number, startDate:Date, dueDate:Date, includeNonWorkingDays:boolean, scheduleManually:boolean }):void {// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment- this.resource.duration = JSONResponse.duration ? this.timezoneService.toISODuration(JSONResponse.duration, 'days') : null;+ this.resource.duration = duration ? this.timezoneService.toISODuration(duration, 'days') : null;// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment- this.resource.dueDate = JSONResponse.dueDate;+ this.resource.dueDate = dueDate;// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment- this.resource.startDate = JSONResponse.startDate;+ this.resource.startDate = startDate;// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment- this.resource.includeNonWorkingDays = JSONResponse.includeNonWorkingDays;+ this.resource.includeNonWorkingDays = includeNonWorkingDays;// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment- this.resource.scheduleManually = JSONResponse.scheduleManually;+ this.resource.scheduleManually = scheduleManually;this.onModalClosed();}@@ -111,46 +141,13 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent imthis.onModalClosed();}- public onModalClosed():void { }+ public onModalClosed():void {+ this.opened = false;- public updateFrameSrc():void {- const url = new URL(- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access- this.pathHelper.workPackageDatepickerDialogContentPath(this.resource.id as string),- window.location.origin,- );-- url.searchParams.set('field', this.name);- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access- url.searchParams.set('work_package[initial][start_date]', this.nullAsEmptyStringFormatter(this.resource.startDate));- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access- url.searchParams.set('work_package[initial][due_date]', this.nullAsEmptyStringFormatter(this.resource.dueDate));- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access- url.searchParams.set('work_package[initial][duration]', this.nullAsEmptyStringFormatter(this.resource.duration));- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument- url.searchParams.set('work_package[initial][ignore_non_working_days]', this.nullAsEmptyStringFormatter(this.resource.includeNonWorkingDays));-- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access- url.searchParams.set('work_package[start_date]', this.nullAsEmptyStringFormatter(this.resource.startDate));- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access- url.searchParams.set('work_package[due_date]', this.nullAsEmptyStringFormatter(this.resource.dueDate));- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access- url.searchParams.set('work_package[duration]', this.nullAsEmptyStringFormatter(this.resource.duration));- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument- url.searchParams.set('work_package[ignore_non_working_days]', this.nullAsEmptyStringFormatter(this.resource.includeNonWorkingDays));- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access- if (this.resource?.id === 'new' && this.resource.startDate) {- url.searchParams.set('work_package[start_date_touched]', 'true');+ if (!this.handler.inEditMode) {+ this.handler.deactivate(false);}-- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access- this.turboFrameSrc = url.toString();}- private nullAsEmptyStringFormatter(value:null|undefined|string):string {- if (value === undefined || value === null) {- return '';- }- return value;- }+ public cancel():void {}}diff --git a/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.html b/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.htmlindex 5636743b389..0d60a952a0c 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.html+++ b/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.html@@ -1,36 +1,8 @@-<spot-drop-modal- [opened]="opened"- (closed)="cancel()"- alignment="bottom-center"->- <input- type="number"- slot="trigger"- class="inline-edit--field op-input"- [ngModel]="formattedValue"- (click)="onInputClick($event)"- (focus)="showDatePickerModal()"- [id]="handler.htmlId"- />- <ng-container slot="body">- <turbo-frame *ngIf="turboFrameSrc && opened"- [src]="turboFrameSrc"- opModalWithTurboContent- [change]="change"- [resource]="resource"- (successfulCreate)="handleSuccessfulCreate($event)"- (successfulUpdate)="handleSuccessfulUpdate()"- (cancel)="cancel()"- 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>- </ng-container>-</spot-drop-modal>+<input+ type="number"+ class="inline-edit--field op-input"+ [ngModel]="formattedValue"+ (click)="onInputClick($event)"+ (focus)="showDatePickerModal()"+ [id]="handler.htmlId"+/>diff --git a/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.tsindex 7234dabb497..38da9b497a6 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.ts@@ -37,8 +37,6 @@ import * as moment from 'moment-timezone';templateUrl: './days-duration-edit-field.component.html',})export class DaysDurationEditFieldComponent extends DatePickerEditFieldComponent implements OnInit {- opened = false;-public get formattedValue():number {return Number(moment.duration(this.value).asDays().toFixed(0));}@@ -51,14 +49,9 @@ export class DaysDurationEditFieldComponent extends DatePickerEditFieldComponentevent.stopPropagation();}- showDatePickerModal():void {- this.updateFrameSrc();- this.opened = true;- }-onModalClosed() {+ super.onModalClosed();void this.handler.handleUserSubmit();- this.opened = false;}cancel():void {diff --git a/frontend/src/app/shared/components/fields/openproject-fields.module.ts b/frontend/src/app/shared/components/fields/openproject-fields.module.tsindex ef4a2c64b97..754f0baaeae 100644--- a/frontend/src/app/shared/components/fields/openproject-fields.module.ts+++ b/frontend/src/app/shared/components/fields/openproject-fields.module.ts@@ -26,7 +26,12 @@// See COPYRIGHT and LICENSE files for more details.//++-import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Injector, NgModule } from '@angular/core';+import {+ APP_INITIALIZER,+ CUSTOM_ELEMENTS_SCHEMA,+ Injector,+ NgModule,+} from '@angular/core';import { CommonModule } from '@angular/common';import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';import { OpenprojectEditorModule } from 'core-app/shared/components/editor/openproject-editor.module';@@ -39,74 +44,35 @@ import { DisplayFieldService } from 'core-app/shared/components/fields/display/dimport { initializeCoreEditFields } from 'core-app/shared/components/fields/edit/edit-field.initializer';import { initializeCoreDisplayFields } from 'core-app/shared/components/fields/display/display-field.initializer';import { FloatEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/float-edit-field.component';-import {- MultiSelectEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/multi-select-edit-field.component';-import {- EditFormPortalComponent,-} from 'core-app/shared/components/fields/edit/editing-portal/edit-form-portal.component';-import {- SelectAutocompleterRegisterService,-} from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-autocompleter-register.service';+import { MultiSelectEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/multi-select-edit-field.component';+import { EditFormPortalComponent } from 'core-app/shared/components/fields/edit/editing-portal/edit-form-portal.component';+import { SelectAutocompleterRegisterService } from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-autocompleter-register.service';import { EditFormComponent } from 'core-app/shared/components/fields/edit/edit-form/edit-form.component';-import {- WorkPackageEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/work-package-edit-field.component';-import {- EditableAttributeFieldComponent,-} from 'core-app/shared/components/fields/edit/field/editable-attribute-field.component';-import {- ProjectStatusEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/project-status-edit-field.component';-import {- PlainFormattableEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/plain-formattable-edit-field.component';+import { WorkPackageEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/work-package-edit-field.component';+import { EditableAttributeFieldComponent } from 'core-app/shared/components/fields/edit/field/editable-attribute-field.component';+import { ProjectStatusEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/project-status-edit-field.component';+import { PlainFormattableEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/plain-formattable-edit-field.component';import { AttributeValueMacroComponent } from 'core-app/shared/components/fields/macros/attribute-value-macro.component';import { AttributeLabelMacroComponent } from 'core-app/shared/components/fields/macros/attribute-label-macro.component';-import {- WorkPackageQuickinfoMacroComponent,-} from 'core-app/shared/components/fields/macros/work-package-quickinfo-macro.component';+import { WorkPackageQuickinfoMacroComponent } from 'core-app/shared/components/fields/macros/work-package-quickinfo-macro.component';import { DisplayFieldComponent } from 'core-app/shared/components/fields/display/display-field.component';-import {- OpenprojectAutocompleterModule,-} from 'core-app/shared/components/autocompleter/openproject-autocompleter.module';-import {- BooleanEditFieldModule,-} from 'core-app/shared/components/fields/edit/field-types/boolean-edit-field/boolean-edit-field.module';-import {- IntegerEditFieldModule,-} from 'core-app/shared/components/fields/edit/field-types/integer-edit-field/integer-edit-field.module';-import {- TextEditFieldModule,-} from 'core-app/shared/components/fields/edit/field-types/text-edit-field/text-edit-field.module';-import {- DateEditFieldModule,-} from 'core-app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.module';-import {- SelectEditFieldModule,-} from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.module';-import {- FormattableEditFieldModule,-} from 'core-app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.module';-import {- EditFieldControlsModule,-} from 'core-app/shared/components/fields/edit/field-controls/edit-field-controls.module';+import { OpenprojectAutocompleterModule } from 'core-app/shared/components/autocompleter/openproject-autocompleter.module';+import { BooleanEditFieldModule } from 'core-app/shared/components/fields/edit/field-types/boolean-edit-field/boolean-edit-field.module';+import { IntegerEditFieldModule } from 'core-app/shared/components/fields/edit/field-types/integer-edit-field/integer-edit-field.module';+import { TextEditFieldModule } from 'core-app/shared/components/fields/edit/field-types/text-edit-field/text-edit-field.module';+import { DateEditFieldModule } from 'core-app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.module';+import { SelectEditFieldModule } from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.module';+import { FormattableEditFieldModule } from 'core-app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.module';+import { EditFieldControlsModule } from 'core-app/shared/components/fields/edit/field-controls/edit-field-controls.module';import { ProjectEditFieldComponent } from './edit/field-types/project-edit-field.component';-import {- HoursDurationEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/hours-duration-edit-field.component';-import {- ProgressPopoverEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/progress-popover-edit-field.component';+import { HoursDurationEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/hours-duration-edit-field.component';+import { ProgressPopoverEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/progress-popover-edit-field.component';import { OpExclusionInfoComponent } from 'core-app/shared/components/fields/display/info/op-exclusion-info.component';import { UserEditFieldComponent } from './edit/field-types/user-edit-field.component';-import {- DaysDurationEditFieldComponent,-} from 'core-app/shared/components/fields/edit/field-types/days-duration-edit-field.component';+import { DaysDurationEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/days-duration-edit-field.component';import { CombinedDateEditFieldComponent } from './edit/field-types/combined-date-edit-field.component';import { NgSelectModule } from '@ng-select/ng-select';import { FormsModule } from '@angular/forms';-import { ModalWithTurboContentDirective } from 'core-app/shared/components/fields/edit/modal-with-turbo-content/modal-with-turbo-content.directive';@NgModule({imports: [@@ -170,8 +136,6 @@ import { ModalWithTurboContentDirective } from 'core-app/shared/components/fieldAttributeLabelMacroComponent,WorkPackageQuickinfoMacroComponent,-- ModalWithTurboContentDirective,],schemas: [CUSTOM_ELEMENTS_SCHEMA],})diff --git a/frontend/src/app/shared/components/modal/modal.module.ts b/frontend/src/app/shared/components/modal/modal.module.tsindex ebae80a4730..d818530ee0e 100644--- a/frontend/src/app/shared/components/modal/modal.module.ts+++ b/frontend/src/app/shared/components/modal/modal.module.ts@@ -8,6 +8,7 @@ import { OpModalBannerComponent } from 'core-app/shared/components/modal/modal-bimport { OpModalOverlayComponent } from 'core-app/shared/components/modal/modal-overlay.component';import { CommonModule } from '@angular/common';import { OpCustomModalOverlayComponent } from 'core-app/shared/components/modal/custom-modal-overlay.component';+import { ModalWithTurboContentDirective } from 'core-app/shared/components/fields/edit/modal-with-turbo-content/modal-with-turbo-content.directive';@NgModule({imports: [@@ -21,6 +22,7 @@ import { OpCustomModalOverlayComponent } from 'core-app/shared/components/modal/OpModalOverlayComponent,OpCustomModalOverlayComponent,OpModalBannerComponent,+ ModalWithTurboContentDirective,],providers: [OpModalWrapperAugmentService,@@ -29,6 +31,7 @@ import { OpCustomModalOverlayComponent } from 'core-app/shared/components/modal/OpModalBannerComponent,OpModalOverlayComponent,OpCustomModalOverlayComponent,+ ModalWithTurboContentDirective,],})export class OpenprojectModalModule { }diff --git a/frontend/src/app/spot/styles/sass/components/modal.sass b/frontend/src/app/spot/styles/sass/components/modal.sassindex 36d07131083..1d70c693480 100644--- a/frontend/src/app/spot/styles/sass/components/modal.sass+++ b/frontend/src/app/spot/styles/sass/components/modal.sass@@ -30,6 +30,11 @@width: 60remmin-height: 40vh+ &_auto-size+ @media #{$spot-mq-desktop}+ width: auto+ min-height: auto+&--header@include spot-subheader-bigdiff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rbindex b454192d4ea..7ed8cd17a68 100644--- a/spec/support/edit_fields/date_edit_field.rb+++ b/spec/support/edit_fields/date_edit_field.rb@@ -88,7 +88,7 @@ class DateEditField < EditFieldif active?modal_element.find(input_selector)else- page.find(".#{property_name} .spot-input")+ page.find(".#{property_name} .op-input")endend@@ -149,7 +149,7 @@ class DateEditField < EditFieldenddef expect_value(value)- expect(page).to have_css(".#{property_name} .spot-input", value:)+ expect(page).to have_css(".#{property_name} .op-input", value:)enddef set_active_date(value)