Revision 60315
Added by Konstantinos Triantafyllou about 3 years ago
pages.component.ts | ||
---|---|---|
78 | 78 |
type: ['all', Validators.required] |
79 | 79 |
}); |
80 | 80 |
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => { |
81 |
this.filterBySearch(value); |
|
81 |
this.searchText = new RegExp(value, 'i'); |
|
82 |
this.applyFilters(); |
|
82 | 83 |
})); |
83 | 84 |
this.subscriptions.push(this.filterForm.get('type').valueChanges.subscribe(value => { |
84 |
this.applyTypeFilter();
|
|
85 |
this.applyFilters();
|
|
85 | 86 |
})); |
86 | 87 |
this.subscriptions.push(this.route.queryParams.subscribe(params => { |
87 | 88 |
this.pagesType = ''; |
... | ... | |
228 | 229 |
let i = this.pages.findIndex(_ => _._id == id); |
229 | 230 |
this.pages.splice(i, 1); |
230 | 231 |
} |
231 |
this.applyTypeFilter(); |
|
232 |
this.applyFilter(); |
|
232 |
this.applyFilters(); |
|
233 | 233 |
} |
234 | 234 |
|
235 | 235 |
public confirmDeletePage(id: string) { |
... | ... | |
387 | 387 |
} else { |
388 | 388 |
this.pages[this.index] = page; |
389 | 389 |
} |
390 |
this.applyTypeFilter(); |
|
391 |
this.applyFilter(); |
|
390 |
this.applyFilters(); |
|
392 | 391 |
this.applyCheck(false); |
393 | 392 |
} |
394 | 393 |
|
395 |
|
|
396 |
public filterBySearch(text: string) { |
|
397 |
this.searchText = new RegExp(text, 'i'); |
|
398 |
this.applyFilter(); |
|
399 |
} |
|
400 |
|
|
401 |
public applyFilter() { |
|
394 |
public applyFilters() { |
|
402 | 395 |
this.checkboxes = []; |
403 |
this.pages.filter(item => this.filterPages(item)).forEach( |
|
404 |
_ => this.checkboxes.push(<CheckPage>{page: _, checked: false}) |
|
405 |
); |
|
406 |
} |
|
407 |
|
|
408 |
public applyTypeFilter() { |
|
409 |
this.checkboxes = []; |
|
410 | 396 |
this.pages.filter(item => this.filterByType(item)).forEach( |
411 | 397 |
_ => this.checkboxes.push(<CheckPage>{page: _, checked: false}) |
412 | 398 |
); |
399 |
this.checkboxes = this.checkboxes.filter(item => this.filterPages(item.page)); |
|
413 | 400 |
} |
414 | 401 |
|
415 | 402 |
public filterByType(page: Page): boolean { |
Also available in: Unified diff
[Libraryr | Trunk]: Fix filters on admin tools pages