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

Improve the confirmation modal

bsatarnejad31ac0d39ef01
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 7c15bc6c318..fd0487c941a 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -948,7 +948,7 @@ en:
deletes_children: "All child work packages and their descendants will also be recursively deleted."
destroy_time_entry:
title: "Confirm deletion of time entry"
- text: "Are you sure you want to delete the following time entry ?"
+ text: "Are you sure you want to delete the following time entry?"
notice_no_results_to_display: "No visible results to display."
notice_successful_create: "Successful creation."
diff --git a/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.html b/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.html
index a89b44a087d..3cb5ab13967 100644
--- a/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.html
+++ b/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.html
@@ -1,28 +1,30 @@
-<div class="op-modal--portal ">
+<div class="op-modal--portal confirm-form-submit--modal ngdialog-theme-openproject">
<div class="op-modal--modal-container confirm-dialog--modal loading-indicator--location"
data-indicator-name="modal"
tabindex="0">
<div class="op-modal--modal-header">
<a class="op-modal--modal-close-button" *ngIf="showClose">
- <i
- class="icon-close"
- (click)="closeMe($event)"
- [attr.title]="text.close_popup">
+ <i
+ class="icon-close"
+ (click)="closeMe($event)"
+ [attr.title]="text.close_popup">
</i>
</a>
</div>
<form class="form"
- [ngClass]="options.classes?.form">
+ [ngClass]="classes?.form">
<section class="form--section -inner-scrolling">
- <h3 class="form--section-title" [textContent]="text.title"></h3>
+ <h3 class="icon-context icon-attention form--section-title" [textContent]="text.title"></h3>
<div class="modal-inner-scrolling-container">
<ng-container>
<p>
<span [textContent]="text.text"></span>
- <br/>
- <strong>{{options.passedData}}</strong>
+ <span *ngFor="let data of passedData">
+ <br/>
+ <strong>{{data}}</strong>
+ </span>
</p>
</ng-container>
</div>
@@ -30,7 +32,7 @@
<div class="form--space -left-spacing">
<button class="confirm-form-submit--continue button"
- [ngClass]="options.classes?.button ? options.classes?.button : '-highlight'"
+ [ngClass]="classes.button"
(click)="confirmAndClose($event)" [textContent]="text.button_continue"
[attr.title]="text.button_continue">
</button>
diff --git a/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.ts b/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.ts
index 38da8aa6f4e..7f8a7e55417 100644
--- a/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.ts
+++ b/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.ts
@@ -42,7 +42,7 @@ export interface ConfirmDialogOptions {
closeByEscape?:boolean;
showClose?:boolean;
closeByDocument?:boolean;
- passedData?:any;
+ passedData?:string[];
classes?:{form?:string; button?:string};
}
@@ -56,7 +56,7 @@ export class ConfirmDialogModal extends OpModalComponent {
public confirmed = false;
- public options:ConfirmDialogOptions;
+ private options:ConfirmDialogOptions;
public text:any = {
title: this.I18n.t('js.modals.form_submit.title'),
@@ -66,6 +66,10 @@ export class ConfirmDialogModal extends OpModalComponent {
close_popup: this.I18n.t('js.close_popup_title')
};
+ public passedData?:string[];
+
+ public classes:{form?:string; button?:string} = {};
+
constructor(readonly elementRef:ElementRef,
@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
readonly cdRef:ChangeDetectorRef,
@@ -73,6 +77,10 @@ export class ConfirmDialogModal extends OpModalComponent {
super(locals, cdRef, elementRef);
this.options = locals.options || {};
+ this.classes = this.options.classes || {};
+ this.classes.button = this.options.classes?.button || '-highlight';
+ //this.classes = this.options.classes;
+ this.passedData = this.options?.passedData || [];
this.closeOnEscape = _.defaultTo(this.options.closeByEscape, true);
this.closeOnOutsideClick = _.defaultTo(this.options.closeByDocument, true);
this.showClose = _.defaultTo(this.options.showClose, true);
diff --git a/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts b/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts
index dee99b93600..7178ea0bea0 100644
--- a/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts
+++ b/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts
@@ -120,7 +120,10 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
closeByEscape: true,
showClose: true,
closeByDocument: true,
- passedData:entry.activity?.name + '-' + entry.project?.name + '-' + entry.workPackage?.name + ': ' + this.timezone.toHours(entry.hours) + this.text.hour,
+ passedData:[
+ '#' + entry.workPackage?.idFromLink + ' ' + entry.workPackage?.name,
+ this.timezone.toHours(entry.hours) + ' ' + this.text.hour + ' (' + entry.activity?.name + ')'
+ ],
classes: {form:'danger-zone' , button:'-danger'}
}).then(() => {
entry.delete().then(() => {