diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-comment-list')
-rw-r--r-- | client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts | 34 |
2 files changed, 6 insertions, 30 deletions
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html index 5c932739b..330ee2478 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html | |||
@@ -31,7 +31,7 @@ | |||
31 | </div> | 31 | </div> |
32 | <input | 32 | <input |
33 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | 33 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." |
34 | (keyup)="onInputSearch($event)" | 34 | (keyup)="onSearch($event)" |
35 | > | 35 | > |
36 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> | 36 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> |
37 | <span class="sr-only" i18n>Clear filters</span> | 37 | <span class="sr-only" i18n>Clear filters</span> |
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts index d26047125..284ec541d 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts | |||
@@ -14,6 +14,8 @@ import { FeedFormat, UserRight } from '@shared/models' | |||
14 | styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-comment-list.component.scss' ] | 14 | styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-comment-list.component.scss' ] |
15 | }) | 15 | }) |
16 | export class VideoCommentListComponent extends RestTable implements OnInit, AfterViewInit { | 16 | export class VideoCommentListComponent extends RestTable implements OnInit, AfterViewInit { |
17 | baseRoute = '/admin/moderation/video-comments/list' | ||
18 | |||
17 | comments: VideoCommentAdmin[] | 19 | comments: VideoCommentAdmin[] |
18 | totalRecords = 0 | 20 | totalRecords = 0 |
19 | sort: SortMeta = { field: 'createdAt', order: -1 } | 21 | sort: SortMeta = { field: 'createdAt', order: -1 } |
@@ -44,13 +46,13 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte | |||
44 | } | 46 | } |
45 | 47 | ||
46 | constructor ( | 48 | constructor ( |
49 | protected router: Router, | ||
50 | protected route: ActivatedRoute, | ||
47 | private auth: AuthService, | 51 | private auth: AuthService, |
48 | private notifier: Notifier, | 52 | private notifier: Notifier, |
49 | private confirmService: ConfirmService, | 53 | private confirmService: ConfirmService, |
50 | private videoCommentService: VideoCommentService, | 54 | private videoCommentService: VideoCommentService, |
51 | private markdownRenderer: MarkdownService, | 55 | private markdownRenderer: MarkdownService, |
52 | private route: ActivatedRoute, | ||
53 | private router: Router, | ||
54 | private bulkService: BulkService | 56 | private bulkService: BulkService |
55 | ) { | 57 | ) { |
56 | super() | 58 | super() |
@@ -75,39 +77,13 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte | |||
75 | 77 | ||
76 | ngOnInit () { | 78 | ngOnInit () { |
77 | this.initialize() | 79 | this.initialize() |
78 | 80 | this.listenToSearchChange() | |
79 | this.route.queryParams | ||
80 | .pipe(filter(params => params.search !== undefined && params.search !== null)) | ||
81 | .subscribe(params => { | ||
82 | this.search = params.search | ||
83 | this.setTableFilter(params.search) | ||
84 | this.loadData() | ||
85 | }) | ||
86 | } | 81 | } |
87 | 82 | ||
88 | ngAfterViewInit () { | 83 | ngAfterViewInit () { |
89 | if (this.search) this.setTableFilter(this.search) | 84 | if (this.search) this.setTableFilter(this.search) |
90 | } | 85 | } |
91 | 86 | ||
92 | onInputSearch (event: Event) { | ||
93 | this.onSearch(event) | ||
94 | this.setQueryParams((event.target as HTMLInputElement).value) | ||
95 | } | ||
96 | |||
97 | setQueryParams (search: string) { | ||
98 | const queryParams: Params = {} | ||
99 | |||
100 | if (search) Object.assign(queryParams, { search }) | ||
101 | this.router.navigate([ '/admin/moderation/video-comments/list' ], { queryParams }) | ||
102 | } | ||
103 | |||
104 | resetTableFilter () { | ||
105 | this.setTableFilter('') | ||
106 | this.setQueryParams('') | ||
107 | this.resetSearch() | ||
108 | } | ||
109 | /* END Table filter functions */ | ||
110 | |||
111 | getIdentifier () { | 87 | getIdentifier () { |
112 | return 'VideoCommentListComponent' | 88 | return 'VideoCommentListComponent' |
113 | } | 89 | } |