A collection of bug fixes (#3820)
Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
This commit is contained in:
parent
6288d89651
commit
193e9b1da9
36 changed files with 268 additions and 89 deletions
|
|
@ -83,7 +83,7 @@
|
|||
}
|
||||
|
||||
|
||||
<div class="col-auto ms-2 d-none d-md-block">
|
||||
<div class="col-auto ms-2">
|
||||
<div class="card-actions btn-actions" [ngbTooltip]="t('more-alt')">
|
||||
<app-card-actionables [entity]="readingList" [inputActions]="actions" [labelBy]="readingList.title" iconClass="fa-ellipsis-h" btnClass="btn"></app-card-actionables>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ import {DefaultValuePipe} from "../../../_pipes/default-value.pipe";
|
|||
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
||||
import {DetailsTabComponent} from "../../../_single-module/details-tab/details-tab.component";
|
||||
import {IHasCast} from "../../../_models/common/i-has-cast";
|
||||
import {User} from "../../../_models/user";
|
||||
|
||||
enum TabID {
|
||||
Storyline = 'storyline-tab',
|
||||
|
|
@ -251,7 +252,8 @@ export class ReadingListDetailComponent implements OnInit {
|
|||
if (user) {
|
||||
this.isAdmin = this.accountService.hasAdminRole(user);
|
||||
|
||||
this.actions = this.actionFactoryService.getReadingListActions(this.handleReadingListActionCallback.bind(this))
|
||||
this.actions = this.actionFactoryService
|
||||
.getReadingListActions(this.handleReadingListActionCallback.bind(this), this.shouldRenderReadingListAction.bind(this))
|
||||
.filter(action => this.readingListService.actionListFilter(action, readingList, this.isAdmin));
|
||||
this.isOwnedReadingList = this.actions.filter(a => a.action === Action.Edit).length > 0;
|
||||
this.cdRef.markForCheck();
|
||||
|
|
@ -307,6 +309,17 @@ export class ReadingListDetailComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
shouldRenderReadingListAction(action: ActionItem<ReadingList>, entity: ReadingList, user: User) {
|
||||
switch (action.action) {
|
||||
case Action.Promote:
|
||||
return !entity.promoted;
|
||||
case Action.UnPromote:
|
||||
return entity.promoted;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
editReadingList(readingList: ReadingList) {
|
||||
this.actionService.editReadingList(readingList, (readingList: ReadingList) => {
|
||||
// Reload information around list
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
[trackByIdentity]="trackByIdentity"
|
||||
>
|
||||
<ng-template #cardItem let-item let-position="idx" >
|
||||
<app-card-item [title]="item.title" [entity]="item" [actions]="actions[item.id]"
|
||||
<app-card-item [title]="item.title" [entity]="item" [actions]="actions[item.id]" [actionEntity]="item"
|
||||
[suppressLibraryLink]="true" [imageUrl]="imageService.getReadingListCoverImage(item.id)"
|
||||
[linkUrl]="'/lists/' + item.id"
|
||||
[count]="item.itemCount"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {Title} from "@angular/platform-browser";
|
|||
import {WikiLink} from "../../../_models/wiki";
|
||||
import {BulkSelectionService} from "../../../cards/bulk-selection.service";
|
||||
import {BulkOperationsComponent} from "../../../cards/bulk-operations/bulk-operations.component";
|
||||
import {User} from "../../../_models/user";
|
||||
|
||||
@Component({
|
||||
selector: 'app-reading-lists',
|
||||
|
|
@ -37,7 +38,7 @@ export class ReadingListsComponent implements OnInit {
|
|||
|
||||
protected readonly bulkSelectionService = inject(BulkSelectionService);
|
||||
protected readonly actionService = inject(ActionService);
|
||||
|
||||
|
||||
|
||||
lists: ReadingList[] = [];
|
||||
loadingLists = false;
|
||||
|
|
@ -69,10 +70,8 @@ export class ReadingListsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getActions(readingList: ReadingList) {
|
||||
const d = this.actionFactoryService.getReadingListActions(this.handleReadingListActionCallback.bind(this))
|
||||
.filter(action => this.readingListService.actionListFilter(action, readingList, this.isAdmin || this.hasPromote));
|
||||
|
||||
return this.actionFactoryService.getReadingListActions(this.handleReadingListActionCallback.bind(this))
|
||||
return this.actionFactoryService
|
||||
.getReadingListActions(this.handleReadingListActionCallback.bind(this), this.shouldRenderReadingListAction.bind(this))
|
||||
.filter(action => this.readingListService.actionListFilter(action, readingList, this.isAdmin || this.hasPromote));
|
||||
}
|
||||
|
||||
|
|
@ -172,4 +171,15 @@ export class ReadingListsComponent implements OnInit {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
shouldRenderReadingListAction(action: ActionItem<ReadingList>, entity: ReadingList, user: User) {
|
||||
switch (action.action) {
|
||||
case Action.Promote:
|
||||
return !entity.promoted;
|
||||
case Action.UnPromote:
|
||||
return entity.promoted;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue