diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/modal')
3 files changed, 17 insertions, 11 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.html b/client/src/app/videos/+video-watch/modal/video-share.component.html index 9f3c37fe8..955b2b80c 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.html +++ b/client/src/app/videos/+video-watch/modal/video-share.component.html | |||
@@ -6,11 +6,19 @@ | |||
6 | 6 | ||
7 | <div class="modal-body"> | 7 | <div class="modal-body"> |
8 | 8 | ||
9 | <div *ngIf="currentVideoTimestampString" class="start-at"> | 9 | <div class="start-at"> |
10 | <my-peertube-checkbox | 10 | <my-peertube-checkbox |
11 | inputName="startAt" [(ngModel)]="startAtCheckbox" | 11 | inputName="startAt" [(ngModel)]="startAtCheckbox" |
12 | i18n-labelText [labelText]="getStartCheckboxLabel()" | 12 | i18n-labelText labelText="Start at" |
13 | ></my-peertube-checkbox> | 13 | ></my-peertube-checkbox> |
14 | |||
15 | <my-timestamp-input | ||
16 | [timestamp]="currentVideoTimestamp" | ||
17 | [maxTimestamp]="video.duration" | ||
18 | [disabled]="!startAtCheckbox" | ||
19 | [(ngModel)]="currentVideoTimestamp" | ||
20 | > | ||
21 | </my-timestamp-input> | ||
14 | </div> | 22 | </div> |
15 | 23 | ||
16 | <div class="form-group"> | 24 | <div class="form-group"> |
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.scss b/client/src/app/videos/+video-watch/modal/video-share.component.scss index 4937506b9..472a45920 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.scss +++ b/client/src/app/videos/+video-watch/modal/video-share.component.scss | |||
@@ -13,4 +13,9 @@ | |||
13 | display: flex; | 13 | display: flex; |
14 | justify-content: center; | 14 | justify-content: center; |
15 | margin-top: 10px; | 15 | margin-top: 10px; |
16 | align-items: center; | ||
17 | |||
18 | my-timestamp-input { | ||
19 | margin-left: 10px; | ||
20 | } | ||
16 | } | 21 | } |
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.ts b/client/src/app/videos/+video-watch/modal/video-share.component.ts index c6205e355..6565d7f88 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-share.component.ts | |||
@@ -16,10 +16,8 @@ export class VideoShareComponent { | |||
16 | 16 | ||
17 | @Input() video: VideoDetails = null | 17 | @Input() video: VideoDetails = null |
18 | 18 | ||
19 | currentVideoTimestamp: number | ||
19 | startAtCheckbox = false | 20 | startAtCheckbox = false |
20 | currentVideoTimestampString: string | ||
21 | |||
22 | private currentVideoTimestamp: number | ||
23 | 21 | ||
24 | constructor ( | 22 | constructor ( |
25 | private modalService: NgbModal, | 23 | private modalService: NgbModal, |
@@ -28,8 +26,7 @@ export class VideoShareComponent { | |||
28 | ) { } | 26 | ) { } |
29 | 27 | ||
30 | show (currentVideoTimestamp?: number) { | 28 | show (currentVideoTimestamp?: number) { |
31 | this.currentVideoTimestamp = Math.floor(currentVideoTimestamp) | 29 | this.currentVideoTimestamp = currentVideoTimestamp ? Math.floor(currentVideoTimestamp) : 0 |
32 | this.currentVideoTimestampString = durationToString(this.currentVideoTimestamp) | ||
33 | 30 | ||
34 | this.modalService.open(this.modal) | 31 | this.modalService.open(this.modal) |
35 | } | 32 | } |
@@ -52,10 +49,6 @@ export class VideoShareComponent { | |||
52 | this.notifier.success(this.i18n('Copied')) | 49 | this.notifier.success(this.i18n('Copied')) |
53 | } | 50 | } |
54 | 51 | ||
55 | getStartCheckboxLabel () { | ||
56 | return this.i18n('Start at {{timestamp}}', { timestamp: this.currentVideoTimestampString }) | ||
57 | } | ||
58 | |||
59 | private getVideoTimestampIfEnabled () { | 52 | private getVideoTimestampIfEnabled () { |
60 | if (this.startAtCheckbox === true) return this.currentVideoTimestamp | 53 | if (this.startAtCheckbox === true) return this.currentVideoTimestamp |
61 | 54 | ||