diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-22 15:29:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-22 15:29:32 +0100 |
commit | 1f30a1853e38c20a45722dbd6d38aaaec63839e8 (patch) | |
tree | cdce8cc9fcc62d9b3343c9478b1dbcefedcea972 /client/src/app/core/confirm/confirm.component.ts | |
parent | 78967fca4cacbc247fa6fb62d64b2d6825a10804 (diff) | |
download | PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.gz PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.zst PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.zip |
Add confirm when admin use custom js/css
Diffstat (limited to 'client/src/app/core/confirm/confirm.component.ts')
-rw-r--r-- | client/src/app/core/confirm/confirm.component.ts | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/client/src/app/core/confirm/confirm.component.ts b/client/src/app/core/confirm/confirm.component.ts index 0515d969a..8f81b7a98 100644 --- a/client/src/app/core/confirm/confirm.component.ts +++ b/client/src/app/core/confirm/confirm.component.ts | |||
@@ -4,21 +4,20 @@ import { ModalDirective } from 'ngx-bootstrap/modal' | |||
4 | 4 | ||
5 | import { ConfirmService } from './confirm.service' | 5 | import { ConfirmService } from './confirm.service' |
6 | 6 | ||
7 | export interface ConfigChangedEvent { | ||
8 | columns: { [id: string]: { isDisplayed: boolean } } | ||
9 | config: { resultsPerPage: number } | ||
10 | } | ||
11 | |||
12 | @Component({ | 7 | @Component({ |
13 | selector: 'my-confirm', | 8 | selector: 'my-confirm', |
14 | templateUrl: './confirm.component.html', | 9 | templateUrl: './confirm.component.html', |
15 | styles: [ '.button { padding: 0 13px; }' ] | 10 | styleUrls: [ './confirm.component.scss' ] |
16 | }) | 11 | }) |
17 | export class ConfirmComponent implements OnInit { | 12 | export class ConfirmComponent implements OnInit { |
18 | @ViewChild('confirmModal') confirmModal: ModalDirective | 13 | @ViewChild('confirmModal') confirmModal: ModalDirective |
19 | 14 | ||
20 | title = '' | 15 | title = '' |
21 | message = '' | 16 | message = '' |
17 | expectedInputValue = '' | ||
18 | inputLabel = '' | ||
19 | |||
20 | inputValue = '' | ||
22 | 21 | ||
23 | constructor (private confirmService: ConfirmService) { | 22 | constructor (private confirmService: ConfirmService) { |
24 | // Empty | 23 | // Empty |
@@ -31,10 +30,13 @@ export class ConfirmComponent implements OnInit { | |||
31 | } | 30 | } |
32 | 31 | ||
33 | this.confirmService.showConfirm.subscribe( | 32 | this.confirmService.showConfirm.subscribe( |
34 | ({ title, message }) => { | 33 | ({ title, message, expectedInputValue, inputLabel }) => { |
35 | this.title = title | 34 | this.title = title |
36 | this.message = message | 35 | this.message = message |
37 | 36 | ||
37 | this.inputLabel = inputLabel | ||
38 | this.expectedInputValue = expectedInputValue | ||
39 | |||
38 | this.showModal() | 40 | this.showModal() |
39 | } | 41 | } |
40 | ) | 42 | ) |
@@ -52,6 +54,13 @@ export class ConfirmComponent implements OnInit { | |||
52 | this.hideModal() | 54 | this.hideModal() |
53 | } | 55 | } |
54 | 56 | ||
57 | isConfirmationDisabled () { | ||
58 | // No input validation | ||
59 | if (!this.inputLabel || !this.expectedInputValue) return false | ||
60 | |||
61 | return this.expectedInputValue !== this.inputValue | ||
62 | } | ||
63 | |||
55 | showModal () { | 64 | showModal () { |
56 | this.confirmModal.show() | 65 | this.confirmModal.show() |
57 | } | 66 | } |