From: Stephanie Leary Date: Thu, 22 Sep 2022 18:40:45 +0000 (-0500) Subject: LP#1951307: Contextual confirm dialog button text X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=10be99717f4900616700ab3c420eec528cebc1a5;p=working%2FEvergreen.git LP#1951307: Contextual confirm dialog button text This patch 1) changes the confirm dialog buttons to "Yes" and "No" for event cloning as requested, but more generally 2) allows the confirm dialog to accept input strings specifying the text for these buttons, with "Confirm" and "Cancel" as the defaults. You can now choose the wording that makes the most sense in the context of the dialog. See in triggers.component.html for usage. To test: ------- [1] Apply the patch and open the Local Admin Notifications/Action Triggers screen: eg2/en-US/staff/admin/local/action_trigger/event_definition [2] Right-click a row and choose "Clone Selected." [3] Verify that the choices are "Yes" and "No" instead of "Confirm" and "Cancel." [4] Navigate to another screen that includes a confirm dialog, e.g. eg2/en-US/staff/reporter/simple, right click a report and select "Clone Report," to verify that "Confirm" and "Cancel" have not changed in other instances. --- diff --git a/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html b/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html index 05cf562123..4a17040a0d 100644 --- a/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html +++ b/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.html @@ -16,8 +16,11 @@ + + + \ No newline at end of file diff --git a/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.ts b/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.ts index f195f32094..1e834403d3 100644 --- a/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.ts +++ b/Open-ILS/src/eg2/src/app/share/dialog/confirm.component.ts @@ -1,5 +1,6 @@ -import {Component, Input, ViewChild, TemplateRef} from '@angular/core'; +import {Component, Input, ViewChild, TemplateRef, AfterViewInit} from '@angular/core'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; +import {StringComponent} from '@eg/share/string/string.component'; @Component({ selector: 'eg-confirm-dialog', @@ -9,10 +10,35 @@ import {DialogComponent} from '@eg/share/dialog/dialog.component'; /** * Confirmation dialog that asks a yes/no question. */ -export class ConfirmDialogComponent extends DialogComponent { +export class ConfirmDialogComponent extends DialogComponent implements AfterViewInit { // What question are we asking? @Input() public dialogBody: string; + @Input() public dialogConfirmTrue: string; + @Input() public dialogConfirmFalse: string; @Input() public dialogBodyTemplate: TemplateRef; -} + _confirmTrue = ''; + _confirmFalse = ''; + @ViewChild('defaultDialogConfirmTrue', {static: false}) defaultDialogConfirmTrue: StringComponent; + @ViewChild('defaultDialogConfirmFalse', {static: false}) defaultDialogConfirmFalse: StringComponent; + + // Get confirm/cancel strings from the component HTML + ngAfterViewInit() { + if ( this.dialogConfirmTrue && this.dialogConfirmTrue.length ) { + this._confirmTrue = this.dialogConfirmTrue; + } + else { + this.defaultDialogConfirmTrue.current().then(str => this._confirmTrue = str); + } + + if ( this.dialogConfirmFalse && this.dialogConfirmFalse.length ) { + this._confirmFalse = this.dialogConfirmFalse; + } + else { + this.defaultDialogConfirmFalse.current().then(str => this._confirmFalse = str); + } + + + } + } \ No newline at end of file diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/triggers/triggers.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/triggers/triggers.component.html index 07e7901819..35a430dda0 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/triggers/triggers.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/triggers/triggers.component.html @@ -112,9 +112,11 @@
+ dialogBody="Clone event definition environment as well?" + dialogConfirmTrue = "Yes" + dialogConfirmFalse = "No">