diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-05 14:16:48 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-05 14:16:48 +0200 |
commit | 8dfceec44a5eec8b0190d1d5076aab0f03a0cb52 (patch) | |
tree | 70ff676157240702a2013f2f6d705bfc342a8a81 /client/src/app/shared/forms | |
parent | 3a0fb65c61f80b510bce979a45d59d17948745e8 (diff) | |
download | PeerTube-8dfceec44a5eec8b0190d1d5076aab0f03a0cb52.tar.gz PeerTube-8dfceec44a5eec8b0190d1d5076aab0f03a0cb52.tar.zst PeerTube-8dfceec44a5eec8b0190d1d5076aab0f03a0cb52.zip |
video add to playlist component -> onpush strategy
Diffstat (limited to 'client/src/app/shared/forms')
-rw-r--r-- | client/src/app/shared/forms/peertube-checkbox.component.scss | 2 | ||||
-rw-r--r-- | client/src/app/shared/forms/peertube-checkbox.component.ts | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.scss b/client/src/app/shared/forms/peertube-checkbox.component.scss index 6e4e20775..ea321ee65 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.scss +++ b/client/src/app/shared/forms/peertube-checkbox.component.scss | |||
@@ -28,4 +28,4 @@ | |||
28 | position: relative; | 28 | position: relative; |
29 | top: -2px; | 29 | top: -2px; |
30 | } | 30 | } |
31 | } \ No newline at end of file | 31 | } |
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/forms/peertube-checkbox.component.ts index c1a6915e8..9578f5618 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/forms/peertube-checkbox.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, forwardRef, Input } from '@angular/core' | 1 | import { ChangeDetectorRef, Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core' |
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
@@ -21,10 +21,19 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor { | |||
21 | @Input() helpHtml: string | 21 | @Input() helpHtml: string |
22 | @Input() disabled = false | 22 | @Input() disabled = false |
23 | 23 | ||
24 | // FIXME: https://github.com/angular/angular/issues/10816#issuecomment-307567836 | ||
25 | @Input() onPushWorkaround = false | ||
26 | |||
27 | constructor (private cdr: ChangeDetectorRef) { } | ||
28 | |||
24 | propagateChange = (_: any) => { /* empty */ } | 29 | propagateChange = (_: any) => { /* empty */ } |
25 | 30 | ||
26 | writeValue (checked: boolean) { | 31 | writeValue (checked: boolean) { |
27 | this.checked = checked | 32 | this.checked = checked |
33 | |||
34 | if (this.onPushWorkaround) { | ||
35 | this.cdr.markForCheck() | ||
36 | } | ||
28 | } | 37 | } |
29 | 38 | ||
30 | registerOnChange (fn: (_: any) => void) { | 39 | registerOnChange (fn: (_: any) => void) { |