Fixed bulk action not being wired up anymore
This commit is contained in:
parent
a2f6dfa7bf
commit
c7d8c78c10
4 changed files with 7 additions and 11 deletions
|
|
@ -237,6 +237,7 @@ export class ActionFactoryService {
|
||||||
dummyCallback(action: ActionItem<any>, entity: any) {}
|
dummyCallback(action: ActionItem<any>, entity: any) {}
|
||||||
dummyShouldRender(action: ActionItem<any>, entity: any, user: User) {return true;}
|
dummyShouldRender(action: ActionItem<any>, entity: any, user: User) {return true;}
|
||||||
basicReadRender(action: ActionItem<any>, entity: any, user: User) {
|
basicReadRender(action: ActionItem<any>, entity: any, user: User) {
|
||||||
|
if (entity === null || entity === undefined) return true;
|
||||||
if (!entity.hasOwnProperty('pagesRead') && !entity.hasOwnProperty('pages')) return true;
|
if (!entity.hasOwnProperty('pagesRead') && !entity.hasOwnProperty('pages')) return true;
|
||||||
|
|
||||||
switch (action.action) {
|
switch (action.action) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<span class="visually-hidden">{{t('mark-as-read')}}</span>
|
<span class="visually-hidden">{{t('mark-as-read')}}</span>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
<app-card-actionables [inputActions]="actions" labelBy="bulk-actions-header" iconClass="fa-ellipsis-h" />
|
<app-card-actionables (actionHandler)="performAction($event)" [inputActions]="actions" labelBy="bulk-actions-header" iconClass="fa-ellipsis-h" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span id="bulk-actions-header" class="visually-hidden">Bulk Actions</span>
|
<span id="bulk-actions-header" class="visually-hidden">Bulk Actions</span>
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,6 @@ export class BulkOperationsComponent implements OnInit {
|
||||||
this.actionCallback(action, null);
|
this.actionCallback(action, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
executeAction(action: Action) {
|
executeAction(action: Action) {
|
||||||
const foundActions = this.actions.filter(act => act.action === action);
|
const foundActions = this.actions.filter(act => act.action === action);
|
||||||
if (foundActions.length > 0) {
|
if (foundActions.length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
||||||
import {map} from "rxjs/operators";
|
import {map} from "rxjs/operators";
|
||||||
import {AccountService} from "../../_services/account.service";
|
import {AccountService} from "../../_services/account.service";
|
||||||
import {BulkSelectionService} from "../bulk-selection.service";
|
import {BulkSelectionService} from "../bulk-selection.service";
|
||||||
import {User} from "../../_models/user";
|
|
||||||
import {ScrollService} from "../../_services/scroll.service";
|
import {ScrollService} from "../../_services/scroll.service";
|
||||||
import {ReaderService} from "../../_services/reader.service";
|
import {ReaderService} from "../../_services/reader.service";
|
||||||
import {SeriesFormatComponent} from "../../shared/series-format/series-format.component";
|
import {SeriesFormatComponent} from "../../shared/series-format/series-format.component";
|
||||||
|
|
@ -145,8 +144,6 @@ export class SeriesCardComponent implements OnInit, OnChanges {
|
||||||
*/
|
*/
|
||||||
prevOffset: number = 0;
|
prevOffset: number = 0;
|
||||||
selectionInProgress: boolean = false;
|
selectionInProgress: boolean = false;
|
||||||
private user: User | undefined;
|
|
||||||
|
|
||||||
|
|
||||||
@HostListener('touchmove', ['$event'])
|
@HostListener('touchmove', ['$event'])
|
||||||
onTouchMove(event: TouchEvent) {
|
onTouchMove(event: TouchEvent) {
|
||||||
|
|
@ -190,15 +187,15 @@ export class SeriesCardComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
ngOnChanges(changes: any) {
|
ngOnChanges(changes: any) {
|
||||||
if (this.series) {
|
if (this.series) {
|
||||||
this.accountService.currentUser$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(user => {
|
// this.accountService.currentUser$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(user => {
|
||||||
this.user = user;
|
// this.user = user;
|
||||||
});
|
// });
|
||||||
|
|
||||||
this.download$ = this.downloadService.activeDownloads$.pipe(takeUntilDestroyed(this.destroyRef), map((events) => {
|
this.download$ = this.downloadService.activeDownloads$.pipe(takeUntilDestroyed(this.destroyRef), map((events) => {
|
||||||
return this.downloadService.mapToEntityType(events, this.series);
|
return this.downloadService.mapToEntityType(events, this.series);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.actions = [...this.actionFactoryService.getSeriesActions((action: ActionItem<Series>, series: Series) => this.handleSeriesActionCallback(action, series))];
|
this.actions = [...this.actionFactoryService.getSeriesActions(this.handleSeriesActionCallback.bind(this))];
|
||||||
if (this.isOnDeck) {
|
if (this.isOnDeck) {
|
||||||
const othersIndex = this.actions.findIndex(obj => obj.title === 'others');
|
const othersIndex = this.actions.findIndex(obj => obj.title === 'others');
|
||||||
const othersAction = deepClone(this.actions[othersIndex]) as ActionItem<Series>;
|
const othersAction = deepClone(this.actions[othersIndex]) as ActionItem<Series>;
|
||||||
|
|
@ -207,7 +204,7 @@ export class SeriesCardComponent implements OnInit, OnChanges {
|
||||||
action: Action.RemoveFromOnDeck,
|
action: Action.RemoveFromOnDeck,
|
||||||
title: 'remove-from-on-deck',
|
title: 'remove-from-on-deck',
|
||||||
description: '',
|
description: '',
|
||||||
callback: (action: ActionItem<Series>, series: Series) => this.handleSeriesActionCallback(action, series),
|
callback: this.handleSeriesActionCallback.bind(this),
|
||||||
class: 'danger',
|
class: 'danger',
|
||||||
requiresAdmin: false,
|
requiresAdmin: false,
|
||||||
requiredRoles: [],
|
requiredRoles: [],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue