diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-13 16:57:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-14 09:27:18 +0200 |
commit | 26b7305a232e547709f433a6edf700bf495935d8 (patch) | |
tree | b5676090c61df72f864735bcc881d5ee256cffbd /client/src/app/+admin | |
parent | efc9e8450a8bbeeef9cd18e3ad6037abc0f815c3 (diff) | |
download | PeerTube-26b7305a232e547709f433a6edf700bf495935d8.tar.gz PeerTube-26b7305a232e547709f433a6edf700bf495935d8.tar.zst PeerTube-26b7305a232e547709f433a6edf700bf495935d8.zip |
Add blacklist reason field
Diffstat (limited to 'client/src/app/+admin')
4 files changed, 47 insertions, 18 deletions
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html index 08501d872..aa0e18c70 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html | |||
@@ -9,7 +9,7 @@ | |||
9 | <ng-template pTemplate="header"> | 9 | <ng-template pTemplate="header"> |
10 | <tr> | 10 | <tr> |
11 | <th style="width: 40px"></th> | 11 | <th style="width: 40px"></th> |
12 | <th i18n style="width: 80px;">State</th> | 12 | <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th> |
13 | <th i18n>Reason</th> | 13 | <th i18n>Reason</th> |
14 | <th i18n>Reporter</th> | 14 | <th i18n>Reporter</th> |
15 | <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> | 15 | <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> |
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html index 04f0e3b5c..78989dc58 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html | |||
@@ -4,30 +4,43 @@ | |||
4 | 4 | ||
5 | <p-table | 5 | <p-table |
6 | [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" | 6 | [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" |
7 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" | 7 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" |
8 | > | 8 | > |
9 | <ng-template pTemplate="header"> | 9 | <ng-template pTemplate="header"> |
10 | <tr> | 10 | <tr> |
11 | <th i18n pSortableColumn="name">Name <p-sortIcon field="name"></p-sortIcon></th> | 11 | <th style="width: 40px"></th> |
12 | <th i18n>Description</th> | 12 | <th i18n pSortableColumn="name">Video name <p-sortIcon field="name"></p-sortIcon></th> |
13 | <th i18n pSortableColumn="views">Views <p-sortIcon field="views"></p-sortIcon></th> | ||
14 | <th i18n>NSFW</th> | 13 | <th i18n>NSFW</th> |
15 | <th i18n>UUID</th> | 14 | <th i18n>UUID</th> |
16 | <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> | 15 | <th i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th> |
17 | <th></th> | 16 | <th style="width: 50px;"></th> |
18 | </tr> | 17 | </tr> |
19 | </ng-template> | 18 | </ng-template> |
20 | 19 | ||
21 | <ng-template pTemplate="body" let-videoBlacklist> | 20 | <ng-template pTemplate="body" let-videoBlacklist let-expanded="expanded"> |
22 | <tr> | 21 | <tr> |
23 | <td>{{ videoBlacklist.name }}</td> | 22 | <td> |
24 | <td>{{ videoBlacklist.description }}</td> | 23 | <span *ngIf="videoBlacklist.reason" class="expander" [pRowToggler]="videoBlacklist"> |
25 | <td>{{ videoBlacklist.views }}</td> | 24 | <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> |
26 | <td>{{ videoBlacklist.nsfw }}</td> | 25 | </span> |
27 | <td>{{ videoBlacklist.uuid }}</td> | 26 | </td> |
27 | |||
28 | <td>{{ videoBlacklist.video.name }}</td> | ||
29 | <td>{{ videoBlacklist.video.nsfw }}</td> | ||
30 | <td>{{ videoBlacklist.video.uuid }}</td> | ||
28 | <td>{{ videoBlacklist.createdAt }}</td> | 31 | <td>{{ videoBlacklist.createdAt }}</td> |
32 | |||
29 | <td class="action-cell"> | 33 | <td class="action-cell"> |
30 | <my-delete-button i18n-label label="Unblacklist" (click)="removeVideoFromBlacklist(videoBlacklist)"></my-delete-button> | 34 | <my-action-dropdown i18n-label label="Actions" [actions]="videoBlacklistActions" [entry]="videoBlacklist"></my-action-dropdown> |
35 | </td> | ||
36 | </tr> | ||
37 | </ng-template> | ||
38 | |||
39 | <ng-template pTemplate="rowexpansion" let-videoBlacklist> | ||
40 | <tr class="blacklist-reason"> | ||
41 | <td colspan="6"> | ||
42 | <span i18n class="blacklist-reason-label">Blacklist reason:</span> | ||
43 | {{ videoBlacklist.reason }} | ||
31 | </td> | 44 | </td> |
32 | </tr> | 45 | </tr> |
33 | </ng-template> | 46 | </ng-template> |
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss new file mode 100644 index 000000000..5265536ca --- /dev/null +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss | |||
@@ -0,0 +1,6 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | .blacklist-reason-label { | ||
5 | font-weight: $font-semibold; | ||
6 | } \ No newline at end of file | ||
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts index 143ec8406..00b0ac57e 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts | |||
@@ -5,11 +5,12 @@ import { ConfirmService } from '../../../core' | |||
5 | import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' | 5 | import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' |
6 | import { BlacklistedVideo } from '../../../../../../shared' | 6 | import { BlacklistedVideo } from '../../../../../../shared' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-video-blacklist-list', | 11 | selector: 'my-video-blacklist-list', |
11 | templateUrl: './video-blacklist-list.component.html', | 12 | templateUrl: './video-blacklist-list.component.html', |
12 | styleUrls: [] | 13 | styleUrls: [ './video-blacklist-list.component.scss' ] |
13 | }) | 14 | }) |
14 | export class VideoBlacklistListComponent extends RestTable implements OnInit { | 15 | export class VideoBlacklistListComponent extends RestTable implements OnInit { |
15 | blacklist: BlacklistedVideo[] = [] | 16 | blacklist: BlacklistedVideo[] = [] |
@@ -18,6 +19,8 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
18 | sort: SortMeta = { field: 'createdAt', order: 1 } | 19 | sort: SortMeta = { field: 'createdAt', order: 1 } |
19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
20 | 21 | ||
22 | videoBlacklistActions: DropdownAction<BlacklistedVideo>[] = [] | ||
23 | |||
21 | constructor ( | 24 | constructor ( |
22 | private notificationsService: NotificationsService, | 25 | private notificationsService: NotificationsService, |
23 | private confirmService: ConfirmService, | 26 | private confirmService: ConfirmService, |
@@ -25,6 +28,13 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
25 | private i18n: I18n | 28 | private i18n: I18n |
26 | ) { | 29 | ) { |
27 | super() | 30 | super() |
31 | |||
32 | this.videoBlacklistActions = [ | ||
33 | { | ||
34 | label: this.i18n('Unblacklist'), | ||
35 | handler: videoBlacklist => this.removeVideoFromBlacklist(videoBlacklist) | ||
36 | } | ||
37 | ] | ||
28 | } | 38 | } |
29 | 39 | ||
30 | ngOnInit () { | 40 | ngOnInit () { |
@@ -33,17 +43,17 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
33 | 43 | ||
34 | async removeVideoFromBlacklist (entry: BlacklistedVideo) { | 44 | async removeVideoFromBlacklist (entry: BlacklistedVideo) { |
35 | const confirmMessage = this.i18n( | 45 | const confirmMessage = this.i18n( |
36 | 'Do you really want to remove this video from the blacklist ? It will be available again in the videos list.' | 46 | 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.' |
37 | ) | 47 | ) |
38 | 48 | ||
39 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist')) | 49 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist')) |
40 | if (res === false) return | 50 | if (res === false) return |
41 | 51 | ||
42 | this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( | 52 | this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe( |
43 | () => { | 53 | () => { |
44 | this.notificationsService.success( | 54 | this.notificationsService.success( |
45 | this.i18n('Success'), | 55 | this.i18n('Success'), |
46 | this.i18n('Video {{name}} removed from the blacklist.', { name: entry.name }) | 56 | this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name }) |
47 | ) | 57 | ) |
48 | this.loadData() | 58 | this.loadData() |
49 | }, | 59 | }, |