aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-video-miniature
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.html2
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.scss12
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.ts32
3 files changed, 38 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.html b/client/src/app/shared/shared-video-miniature/abstract-video-list.html
index 08962dff8..b1ac757db 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.html
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.html
@@ -21,7 +21,7 @@
21 <div class="dropdown-item"> 21 <div class="dropdown-item">
22 <my-peertube-checkbox 22 <my-peertube-checkbox
23 (change)="toggleModerationDisplay()" 23 (change)="toggleModerationDisplay()"
24 inputName="display-unlisted-private" i18n-labelText labelText="Display unlisted and private videos" 24 inputName="display-unlisted-private" i18n-labelText labelText="Display all videos (private, unlisted or not yet published)"
25 ></my-peertube-checkbox> 25 ></my-peertube-checkbox>
26 </div> 26 </div>
27 </div> 27 </div>
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
index 7841b60f7..9077e2f75 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
@@ -31,13 +31,21 @@ $iconSize: 16px;
31 31
32 .moderation-block { 32 .moderation-block {
33 div { 33 div {
34 @include button-with-icon($iconSize, 3px, -1px); 34 @include button-with-icon($iconSize, 3px, -2px);
35 } 35 }
36 36
37 margin-left: .2rem; 37 margin-left: .4rem;
38 display: flex; 38 display: flex;
39 justify-content: flex-end; 39 justify-content: flex-end;
40 align-items: center; 40 align-items: center;
41
42 .dropdown-item {
43 padding: 0;
44
45 ::ng-deep my-peertube-checkbox label {
46 padding: 3px 15px;
47 }
48 }
41 } 49 }
42} 50}
43 51
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
index da05e15fb..2219ced30 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
@@ -15,7 +15,7 @@ import {
15import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' 15import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
16import { GlobalIconName } from '@app/shared/shared-icons' 16import { GlobalIconName } from '@app/shared/shared-icons'
17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date' 17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date'
18import { ServerConfig, VideoSortField } from '@shared/models' 18import { ServerConfig, UserRight, VideoFilter, VideoSortField } from '@shared/models'
19import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' 19import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
20import { Syndication, Video } from '../shared-main' 20import { Syndication, Video } from '../shared-main'
21import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component' 21import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component'
@@ -205,10 +205,6 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
205 this.loadMoreVideos(true) 205 this.loadMoreVideos(true)
206 } 206 }
207 207
208 toggleModerationDisplay () {
209 throw new Error('toggleModerationDisplay is not implemented')
210 }
211
212 removeVideoFromArray (video: Video) { 208 removeVideoFromArray (video: Video) {
213 this.videos = this.videos.filter(v => v.id !== video.id) 209 this.videos = this.videos.filter(v => v.id !== video.id)
214 } 210 }
@@ -268,6 +264,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
268 return this.groupedDateLabels[this.groupedDates[video.id]] 264 return this.groupedDateLabels[this.groupedDates[video.id]]
269 } 265 }
270 266
267 toggleModerationDisplay () {
268 throw new Error('toggleModerationDisplay is not implemented')
269 }
270
271 // On videos hook for children that want to do something 271 // On videos hook for children that want to do something
272 protected onMoreVideos () { /* empty */ } 272 protected onMoreVideos () { /* empty */ }
273 273
@@ -277,6 +277,28 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
277 this.angularState = routeParams[ 'a-state' ] 277 this.angularState = routeParams[ 'a-state' ]
278 } 278 }
279 279
280 protected buildLocalFilter (existing: VideoFilter, base: VideoFilter) {
281 if (base === 'local') {
282 return existing === 'local'
283 ? 'all-local' as 'all-local'
284 : 'local' as 'local'
285 }
286
287 return existing === 'all'
288 ? null
289 : 'all'
290 }
291
292 protected enableAllFilterIfPossible () {
293 if (!this.authService.isLoggedIn()) return
294
295 this.authService.userInformationLoaded
296 .subscribe(() => {
297 const user = this.authService.getUser()
298 this.displayModerationBlock = user.hasRight(UserRight.SEE_ALL_VIDEOS)
299 })
300 }
301
280 private calcPageSizes () { 302 private calcPageSizes () {
281 if (this.screenService.isInMobileView()) { 303 if (this.screenService.isInMobileView()) {
282 this.pagination.itemsPerPage = 5 304 this.pagination.itemsPerPage = 5