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

make confirmation modal consistent for deleting time entry

bsatarnejad7cc3b1cd3e1f
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 09703554f36..7c15bc6c318 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -946,6 +946,9 @@ en:
has_children: "The work package has %{childUnits}:"
confirm_deletion_children: "I acknowledge that ALL descendants of the listed work packages will be recursively removed."
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 ?"
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 78e63684a1e..ed094f6b3aa 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,33 +1,46 @@
-<div class="op-modal--portal confirm-form-submit--modal ngdialog-theme-openproject">
+<div class="op-modal--portal ">
<div class="op-modal--modal-container confirm-dialog--modal loading-indicator--location"
- data-indicator-name="modal"
- tabindex="0">
+ 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>
- <h3 class="icon-context icon-attention" [textContent]="text.title"></h3>
</div>
- <div class="ngdialog-body op-modal--modal-body">
- <p [textContent]="text.text"></p>
- </div>
- <div class="op-modal--modal-footer">
- <button class="confirm-form-submit--continue button -highlight"
- (click)="confirmAndClose($event)"
- [textContent]="text.button_continue"
- [attr.title]="text.button_continue">
- </button>
- <button class="confirm-form-submit--cancel button"
- (click)="closeMe($event)"
- [textContent]="text.button_cancel"
- [attr.title]="text.button_cancel">
- </button>
-
- </div>
+ <form class="form"
+ [ngClass]="options.classes?.form">
+ <section class="form--section -inner-scrolling">
+ <h3 class="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>
+ </p>
+ </ng-container>
+ </div>
+ </section>
+
+ <div class="form--space -left-spacing">
+ <button class="button"
+ [ngClass]="options.classes?.button ? options.classes?.button : '-highlight'"
+ (click)="confirmAndClose($event)" [textContent]="text.button_continue"
+ [attr.title]="text.button_continue">
+ </button>
+ <button class="button"
+ (click)="closeMe($event)"
+ [textContent]="text.button_cancel"
+ [attr.title]="text.button_cancel">
+ </button>
+ </div>
+
+ </form>
</div>
-</div>
+</div>
\ No newline at end of file
diff --git a/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.sass b/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.sass
index 9b6d312d213..b8e11390709 100644
--- a/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.sass
+++ b/frontend/src/app/components/modals/confirm-dialog/confirm-dialog.modal.sass
@@ -1,8 +1,5 @@
-.op-modal--modal-close-button
- right: 1.75rem
- top: 1.6rem
-.op-modal--modal-container
- padding-bottom: 0
-
\ No newline at end of file
+.confirm-dialog--modal
+ p
+ margin-right: 15px
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 4fb69ab33e3..38da8aa6f4e 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,6 +42,8 @@ export interface ConfirmDialogOptions {
closeByEscape?:boolean;
showClose?:boolean;
closeByDocument?:boolean;
+ passedData?:any;
+ classes?:{form?:string; button?:string};
}
@Component({
@@ -54,7 +56,7 @@ export class ConfirmDialogModal extends OpModalComponent {
public confirmed = false;
- private options:ConfirmDialogOptions;
+ public options:ConfirmDialogOptions;
public text:any = {
title: this.I18n.t('js.modals.form_submit.title'),
@@ -70,12 +72,10 @@ export class ConfirmDialogModal extends OpModalComponent {
readonly I18n:I18nService) {
super(locals, cdRef, elementRef);
-
this.options = locals.options || {};
this.closeOnEscape = _.defaultTo(this.options.closeByEscape, true);
this.closeOnOutsideClick = _.defaultTo(this.options.closeByDocument, true);
this.showClose = _.defaultTo(this.options.showClose, true);
-
// override default texts if any
this.text = _.defaults(this.options.text, this.text);
}
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 6f36b25764e..dee99b93600 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
@@ -20,8 +20,8 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
edit: this.i18n.t('js.button_edit'),
delete: this.i18n.t('js.button_delete'),
confirmDelete: {
- text: this.i18n.t('js.text_are_you_sure'),
- title: this.i18n.t('js.modals.form_submit.title')
+ text: this.i18n.t('js.modals.destroy_time_entry.text'),
+ title: this.i18n.t('js.modals.destroy_time_entry.title')
},
noResults: this.i18n.t('js.grid.widgets.time_entries_list.no_results'),
};
@@ -115,12 +115,13 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
public deleteIfConfirmed(event:Event, entry:TimeEntryResource) {
event.preventDefault();
-
this.confirmDialog.confirm({
text: this.text.confirmDelete,
closeByEscape: true,
showClose: true,
- closeByDocument: true
+ closeByDocument: true,
+ passedData:entry.activity?.name + '-' + entry.project?.name + '-' + entry.workPackage?.name + ': ' + this.timezone.toHours(entry.hours) + this.text.hour,
+ classes: {form:'danger-zone' , button:'-danger'}
}).then(() => {
entry.delete().then(() => {
let newEntries = this.entries.filter((anEntry) => {