aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-25 10:28:43 +0200
committerChocobozzz <me@florianbigard.com>2018-07-25 10:28:43 +0200
commit772d5642ba617865519ca5e590061adf174866d4 (patch)
tree27e2f3c9a78a4de67128f005d2bd73a5eecca804 /client/src/app/videos/+video-edit/shared
parentd73c98884ec7f970ed95a01fb2d445d10c53c817 (diff)
downloadPeerTube-772d5642ba617865519ca5e590061adf174866d4.tar.gz
PeerTube-772d5642ba617865519ca5e590061adf174866d4.tar.zst
PeerTube-772d5642ba617865519ca5e590061adf174866d4.zip
Improve captions UX (at least I've tried)
Diffstat (limited to 'client/src/app/videos/+video-edit/shared')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.html29
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.scss23
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts11
3 files changed, 59 insertions, 4 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html
index 16dbf5cfc..2c40747ba 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.html
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html
@@ -142,10 +142,33 @@
142 142
143 <div class="form-group" *ngFor="let videoCaption of videoCaptions"> 143 <div class="form-group" *ngFor="let videoCaption of videoCaptions">
144 144
145 <div *ngIf="videoCaption.action !== 'REMOVE'" class="caption-entry"> 145 <div class="caption-entry">
146 <div class="caption-entry-label">{{ videoCaption.language.label }}</div> 146 <ng-container *ngIf="!videoCaption.action">
147 <a
148 i18n-title title="See the subtitle file" class="caption-entry-label" target="_blank" rel="noopener noreferrer"
149 [href]="videoCaption.captionPath"
150 >{{ videoCaption.language.label }}</a>
147 151
148 <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Delete</span> 152 <div class="caption-entry-state">Already uploaded &#10004;</div>
153
154 <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Delete</span>
155 </ng-container>
156
157 <ng-container *ngIf="videoCaption.action === 'CREATE'">
158 <span class="caption-entry-label">{{ videoCaption.language.label }}</span>
159
160 <div class="caption-entry-state caption-entry-state-create">Will be created on update</div>
161
162 <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Cancel create</span>
163 </ng-container>
164
165 <ng-container *ngIf="videoCaption.action === 'REMOVE'">
166 <span class="caption-entry-label">{{ videoCaption.language.label }}</span>
167
168 <div class="caption-entry-state caption-entry-state-delete">Will be deleted on update</div>
169
170 <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Cancel deletion</span>
171 </ng-container>
149 </div> 172 </div>
150 </div> 173 </div>
151 174
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.scss b/client/src/app/videos/+video-edit/shared/video-edit.component.scss
index 058ccba36..f3d9ee44a 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.scss
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.scss
@@ -46,11 +46,34 @@
46 height: 40px; 46 height: 40px;
47 align-items: center; 47 align-items: center;
48 48
49 a.caption-entry-label {
50 @include disable-default-a-behaviour;
51
52 color: #000;
53
54 &:hover {
55 opacity: 0.8;
56 }
57 }
58
49 .caption-entry-label { 59 .caption-entry-label {
50 font-size: 15px; 60 font-size: 15px;
51 font-weight: bold; 61 font-weight: bold;
52 62
53 margin-right: 20px; 63 margin-right: 20px;
64 width: 150px;
65 }
66
67 .caption-entry-state {
68 width: 200px;
69
70 &.caption-entry-state-create {
71 color: #39CC0B;
72 }
73
74 &.caption-entry-state-delete {
75 color: #FF0000;
76 }
54 } 77 }
55 78
56 .caption-entry-delete { 79 .caption-entry-delete {
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index 00c7bc41d..b8aef99dd 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -50,6 +50,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
50 50
51 private schedulerInterval 51 private schedulerInterval
52 private firstPatchDone = false 52 private firstPatchDone = false
53 private initialVideoCaptions: string[] = []
53 54
54 constructor ( 55 constructor (
55 private formValidatorService: FormValidatorService, 56 private formValidatorService: FormValidatorService,
@@ -127,6 +128,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {
127 this.videoLanguages = this.serverService.getVideoLanguages() 128 this.videoLanguages = this.serverService.getVideoLanguages()
128 129
129 this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute 130 this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute
131
132 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id)
130 } 133 }
131 134
132 ngOnDestroy () { 135 ngOnDestroy () {
@@ -147,7 +150,13 @@ export class VideoEditComponent implements OnInit, OnDestroy {
147 ) 150 )
148 } 151 }
149 152
150 deleteCaption (caption: VideoCaptionEdit) { 153 async deleteCaption (caption: VideoCaptionEdit) {
154 // Caption recovers his former state
155 if (caption.action && this.initialVideoCaptions.indexOf(caption.language.id) !== -1) {
156 caption.action = undefined
157 return
158 }
159
151 // This caption is not on the server, just remove it from our array 160 // This caption is not on the server, just remove it from our array
152 if (caption.action === 'CREATE') { 161 if (caption.action === 'CREATE') {
153 removeElementFromArray(this.videoCaptions, caption) 162 removeElementFromArray(this.videoCaptions, caption)