diff options
Diffstat (limited to 'client/src/app/core/confirm')
-rw-r--r-- | client/src/app/core/confirm/confirm.component.html | 2 | ||||
-rw-r--r-- | client/src/app/core/confirm/confirm.component.ts | 5 | ||||
-rw-r--r-- | client/src/app/core/confirm/confirm.service.ts | 18 |
3 files changed, 18 insertions, 7 deletions
diff --git a/client/src/app/core/confirm/confirm.component.html b/client/src/app/core/confirm/confirm.component.html index 90274b248..01a4e0ac4 100644 --- a/client/src/app/core/confirm/confirm.component.html +++ b/client/src/app/core/confirm/confirm.component.html | |||
@@ -21,7 +21,7 @@ | |||
21 | </span> | 21 | </span> |
22 | 22 | ||
23 | <input | 23 | <input |
24 | type="submit" value="Confirm" class="action-button-submit" [disabled]="isConfirmationDisabled()" | 24 | type="submit" [value]="confirmButtonText" class="action-button-submit" [disabled]="isConfirmationDisabled()" |
25 | (click)="confirm()" | 25 | (click)="confirm()" |
26 | > | 26 | > |
27 | </div> | 27 | </div> |
diff --git a/client/src/app/core/confirm/confirm.component.ts b/client/src/app/core/confirm/confirm.component.ts index 8f81b7a98..147bc9d65 100644 --- a/client/src/app/core/confirm/confirm.component.ts +++ b/client/src/app/core/confirm/confirm.component.ts | |||
@@ -18,6 +18,7 @@ export class ConfirmComponent implements OnInit { | |||
18 | inputLabel = '' | 18 | inputLabel = '' |
19 | 19 | ||
20 | inputValue = '' | 20 | inputValue = '' |
21 | confirmButtonText = '' | ||
21 | 22 | ||
22 | constructor (private confirmService: ConfirmService) { | 23 | constructor (private confirmService: ConfirmService) { |
23 | // Empty | 24 | // Empty |
@@ -30,13 +31,15 @@ export class ConfirmComponent implements OnInit { | |||
30 | } | 31 | } |
31 | 32 | ||
32 | this.confirmService.showConfirm.subscribe( | 33 | this.confirmService.showConfirm.subscribe( |
33 | ({ title, message, expectedInputValue, inputLabel }) => { | 34 | ({ title, message, expectedInputValue, inputLabel, confirmButtonText }) => { |
34 | this.title = title | 35 | this.title = title |
35 | this.message = message | 36 | this.message = message |
36 | 37 | ||
37 | this.inputLabel = inputLabel | 38 | this.inputLabel = inputLabel |
38 | this.expectedInputValue = expectedInputValue | 39 | this.expectedInputValue = expectedInputValue |
39 | 40 | ||
41 | this.confirmButtonText = confirmButtonText || 'Confirm' | ||
42 | |||
40 | this.showModal() | 43 | this.showModal() |
41 | } | 44 | } |
42 | ) | 45 | ) |
diff --git a/client/src/app/core/confirm/confirm.service.ts b/client/src/app/core/confirm/confirm.service.ts index f30feb9d0..d99226f05 100644 --- a/client/src/app/core/confirm/confirm.service.ts +++ b/client/src/app/core/confirm/confirm.service.ts | |||
@@ -3,19 +3,27 @@ import { Subject } from 'rxjs/Subject' | |||
3 | import 'rxjs/add/operator/first' | 3 | import 'rxjs/add/operator/first' |
4 | import 'rxjs/add/operator/toPromise' | 4 | import 'rxjs/add/operator/toPromise' |
5 | 5 | ||
6 | type ConfirmOptions = { | ||
7 | title: string | ||
8 | message: string | ||
9 | inputLabel?: string | ||
10 | expectedInputValue?: string | ||
11 | confirmButtonText?: string | ||
12 | } | ||
13 | |||
6 | @Injectable() | 14 | @Injectable() |
7 | export class ConfirmService { | 15 | export class ConfirmService { |
8 | showConfirm = new Subject<{ title: string, message: string, inputLabel?: string, expectedInputValue?: string }>() | 16 | showConfirm = new Subject<ConfirmOptions>() |
9 | confirmResponse = new Subject<boolean>() | 17 | confirmResponse = new Subject<boolean>() |
10 | 18 | ||
11 | confirm (message: string, title = '') { | 19 | confirm (message: string, title = '', confirmButtonText?: string) { |
12 | this.showConfirm.next({ title, message }) | 20 | this.showConfirm.next({ title, message, confirmButtonText }) |
13 | 21 | ||
14 | return this.confirmResponse.asObservable().first().toPromise() | 22 | return this.confirmResponse.asObservable().first().toPromise() |
15 | } | 23 | } |
16 | 24 | ||
17 | confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '') { | 25 | confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '', confirmButtonText?: string) { |
18 | this.showConfirm.next({ title, message, inputLabel, expectedInputValue }) | 26 | this.showConfirm.next({ title, message, inputLabel, expectedInputValue, confirmButtonText }) |
19 | 27 | ||
20 | return this.confirmResponse.asObservable().first().toPromise() | 28 | return this.confirmResponse.asObservable().first().toPromise() |
21 | } | 29 | } |