diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-block-list')
-rw-r--r-- | client/src/app/+admin/moderation/video-block-list/video-block-list.component.html | 20 | ||||
-rw-r--r-- | client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | 31 |
2 files changed, 13 insertions, 38 deletions
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html index c7275de1b..cf2466bdb 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html | |||
@@ -13,25 +13,7 @@ | |||
13 | <ng-template pTemplate="caption"> | 13 | <ng-template pTemplate="caption"> |
14 | <div class="caption"> | 14 | <div class="caption"> |
15 | <div class="ml-auto"> | 15 | <div class="ml-auto"> |
16 | <div class="input-group has-feedback has-clear"> | 16 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)" (resetTableFilter)="resetTableFilter()"></my-advanced-input-filter> |
17 | <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body"> | ||
18 | <div class="input-group-text" ngbDropdownToggle> | ||
19 | <span class="caret" aria-haspopup="menu" role="button"></span> | ||
20 | </div> | ||
21 | |||
22 | <div role="menu" ngbDropdownMenu> | ||
23 | <h6 class="dropdown-header" i18n>Advanced block filters</h6> | ||
24 | <a [routerLink]="[ '/admin/moderation/video-blocks/list' ]" [queryParams]="{ 'search': 'type:auto' }" class="dropdown-item" i18n>Automatic blocks</a> | ||
25 | <a [routerLink]="[ '/admin/moderation/video-blocks/list' ]" [queryParams]="{ 'search': 'type:manual' }" class="dropdown-item" i18n>Manual blocks</a> | ||
26 | </div> | ||
27 | </div> | ||
28 | <input | ||
29 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | ||
30 | (keyup)="onSearch($event)" | ||
31 | > | ||
32 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> | ||
33 | <span class="sr-only" i18n>Clear filters</span> | ||
34 | </div> | ||
35 | </div> | 17 | </div> |
36 | </div> | 18 | </div> |
37 | </ng-template> | 19 | </ng-template> |
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index d6aca10e7..dfd8dc745 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -6,6 +6,7 @@ import { AfterViewInit, Component, OnInit } from '@angular/core' | |||
6 | import { DomSanitizer } from '@angular/platform-browser' | 6 | import { DomSanitizer } from '@angular/platform-browser' |
7 | import { ActivatedRoute, Params, Router } from '@angular/router' | 7 | import { ActivatedRoute, Params, Router } from '@angular/router' |
8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
9 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | ||
9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 10 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
10 | import { VideoBlockService } from '@app/shared/shared-moderation' | 11 | import { VideoBlockService } from '@app/shared/shared-moderation' |
11 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' | 12 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' |
@@ -24,6 +25,17 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
24 | 25 | ||
25 | videoBlocklistActions: DropdownAction<VideoBlacklist>[][] = [] | 26 | videoBlocklistActions: DropdownAction<VideoBlacklist>[][] = [] |
26 | 27 | ||
28 | inputFilters: AdvancedInputFilter[] = [ | ||
29 | { | ||
30 | queryParams: { 'search': 'type:auto' }, | ||
31 | label: $localize`Automatic blocks` | ||
32 | }, | ||
33 | { | ||
34 | queryParams: { 'search': 'type:manual' }, | ||
35 | label: $localize`Manual blocks` | ||
36 | } | ||
37 | ] | ||
38 | |||
27 | constructor ( | 39 | constructor ( |
28 | protected route: ActivatedRoute, | 40 | protected route: ActivatedRoute, |
29 | protected router: Router, | 41 | protected router: Router, |
@@ -111,25 +123,6 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
111 | if (this.search) this.setTableFilter(this.search, false) | 123 | if (this.search) this.setTableFilter(this.search, false) |
112 | } | 124 | } |
113 | 125 | ||
114 | /* Table filter functions */ | ||
115 | onBlockSearch (event: Event) { | ||
116 | this.onSearch(event) | ||
117 | this.setQueryParams((event.target as HTMLInputElement).value) | ||
118 | } | ||
119 | |||
120 | setQueryParams (search: string) { | ||
121 | const queryParams: Params = {} | ||
122 | if (search) Object.assign(queryParams, { search }) | ||
123 | this.router.navigate([ '/admin/moderation/video-blocks/list' ], { queryParams }) | ||
124 | } | ||
125 | |||
126 | resetTableFilter () { | ||
127 | this.setTableFilter('') | ||
128 | this.setQueryParams('') | ||
129 | this.resetSearch() | ||
130 | } | ||
131 | /* END Table filter functions */ | ||
132 | |||
133 | getIdentifier () { | 126 | getIdentifier () { |
134 | return 'VideoBlockListComponent' | 127 | return 'VideoBlockListComponent' |
135 | } | 128 | } |