Bulk Operations (#596)
* Implemented the ability to perform multi-selections on cards. Basic selection code is done, CSS needed and exposing actions. * Implemented a bulk selection bar. Added logic to the card on when to force show checkboxes. * Fixed some bad parsing groups and cases for Comic Chapters. * Hooked up some bulk actions on series detail page. Not hooked up to backend yet. * Fixes #593. URI Enocde library names as sometimes they can have & in them. * Implemented the ability to mark volume/chapters as read/unread. * Hooked up mark as unread with specials as well. * Add to reading list hooked up for Series Detail * Implemented ability to add multiple series to a reading list. * Implemented bulk selection for series cards * Added comments to the new code in ReaderService.cs * Implemented proper styling on bulk operation bar and integrated for collections. * Fixed an issue with shift clicking * Cleaned up css of bulk operations bar * Code cleanup
This commit is contained in:
parent
52c4285168
commit
f5229fd0e6
38 changed files with 1129 additions and 172 deletions
|
@ -1,13 +1,17 @@
|
|||
import { noUndefined } from '@angular/compiler/src/util';
|
||||
import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { ReadingList } from 'src/app/_models/reading-list';
|
||||
import { ReadingListService } from 'src/app/_services/reading-list.service';
|
||||
|
||||
export enum ADD_FLOW {
|
||||
Series = 0,
|
||||
Volume = 1,
|
||||
Chapter = 2
|
||||
Chapter = 2,
|
||||
Multiple = 3,
|
||||
Multiple_Series
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -18,9 +22,31 @@ export enum ADD_FLOW {
|
|||
export class AddToListModalComponent implements OnInit, AfterViewInit {
|
||||
|
||||
@Input() title!: string;
|
||||
/**
|
||||
* Only used in Series flow
|
||||
*/
|
||||
@Input() seriesId?: number;
|
||||
/**
|
||||
* Only used in Volume flow
|
||||
*/
|
||||
@Input() volumeId?: number;
|
||||
/**
|
||||
* Only used in Chapter flow
|
||||
*/
|
||||
@Input() chapterId?: number;
|
||||
/**
|
||||
* Only used in Multiple flow
|
||||
*/
|
||||
@Input() volumeIds?: Array<number>;
|
||||
/**
|
||||
* Only used in Multiple flow
|
||||
*/
|
||||
@Input() chapterIds?: Array<number>;
|
||||
/**
|
||||
* Only used in Multiple_Series flow
|
||||
*/
|
||||
@Input() seriesIds?: Array<number>;
|
||||
|
||||
/**
|
||||
* Determines which Input is required and which API is used to associate to the Reading List
|
||||
*/
|
||||
|
@ -36,7 +62,7 @@ export class AddToListModalComponent implements OnInit, AfterViewInit {
|
|||
@ViewChild('title') inputElem!: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
constructor(private modal: NgbActiveModal, private readingListService: ReadingListService) { }
|
||||
constructor(private modal: NgbActiveModal, private readingListService: ReadingListService, private toastr: ToastrService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
|
@ -70,18 +96,34 @@ export class AddToListModalComponent implements OnInit, AfterViewInit {
|
|||
}
|
||||
|
||||
addToList(readingList: ReadingList) {
|
||||
|
||||
if (this.type === ADD_FLOW.Multiple_Series && this.seriesIds !== undefined) {
|
||||
this.readingListService.updateByMultipleSeries(readingList.id, this.seriesIds).subscribe(() => {
|
||||
this.toastr.success('Series added to reading list');
|
||||
this.modal.close();
|
||||
});
|
||||
}
|
||||
|
||||
if (this.seriesId === undefined) return;
|
||||
|
||||
if (this.type === ADD_FLOW.Series) {
|
||||
if (this.type === ADD_FLOW.Series && this.seriesId !== undefined) {
|
||||
this.readingListService.updateBySeries(readingList.id, this.seriesId).subscribe(() => {
|
||||
this.toastr.success('Series added to reading list');
|
||||
this.modal.close();
|
||||
});
|
||||
} else if (this.type === ADD_FLOW.Volume && this.volumeId !== undefined) {
|
||||
this.readingListService.updateByVolume(readingList.id, this.seriesId, this.volumeId).subscribe(() => {
|
||||
this.toastr.success('Volumes added to reading list');
|
||||
this.modal.close();
|
||||
});
|
||||
} else if (this.type === ADD_FLOW.Chapter && this.chapterId !== undefined) {
|
||||
this.readingListService.updateByChapter(readingList.id, this.seriesId, this.chapterId).subscribe(() => {
|
||||
this.toastr.success('Chapter added to reading list');
|
||||
this.modal.close();
|
||||
});
|
||||
} else if (this.type === ADD_FLOW.Multiple && this.volumeIds !== undefined && this.chapterIds !== undefined) {
|
||||
this.readingListService.updateByMultiple(readingList.id, this.seriesId, this.volumeIds, this.chapterIds).subscribe(() => {
|
||||
this.toastr.success('Chapters and Volumes added to reading list');
|
||||
this.modal.close();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue