parent
6288d89651
commit
db77e08264
11 changed files with 43 additions and 15 deletions
|
|
@ -128,6 +128,7 @@ public class UsersController : BaseApiController
|
|||
existingPreferences.PromptForDownloadSize = preferencesDto.PromptForDownloadSize;
|
||||
existingPreferences.NoTransitions = preferencesDto.NoTransitions;
|
||||
existingPreferences.SwipeToPaginate = preferencesDto.SwipeToPaginate;
|
||||
existingPreferences.AllowAutomaticWebtoonReaderDetection = preferencesDto.AllowAutomaticWebtoonReaderDetection;
|
||||
existingPreferences.CollapseSeriesRelationships = preferencesDto.CollapseSeriesRelationships;
|
||||
existingPreferences.ShareReviews = preferencesDto.ShareReviews;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class="d-grid gap-2">
|
||||
@for (action of currentItems; track action.title) {
|
||||
@if (willRenderAction(action)) {
|
||||
@if (willRenderAction(action, user!)) {
|
||||
<button class="btn btn-outline-primary text-start d-flex justify-content-between align-items-center w-100"
|
||||
(click)="handleItemClick(action)">
|
||||
{{action.title}}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export class ActionableModalComponent implements OnInit {
|
|||
|
||||
@Input() entity: ActionableEntity = null;
|
||||
@Input() actions: ActionItem<any>[] = [];
|
||||
@Input() willRenderAction!: (action: ActionItem<any>) => boolean;
|
||||
@Input() willRenderAction!: (action: ActionItem<any>, user: User) => boolean;
|
||||
@Input() shouldRenderSubMenu!: (action: ActionItem<any>, dynamicList: null | Array<any>) => boolean;
|
||||
@Output() actionPerformed = new EventEmitter<ActionItem<any>>();
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
<span class="card-actions">
|
||||
@if (actions && actions.length > 0) {
|
||||
<app-card-actionables (actionHandler)="performAction($event)" [inputActions]="actions" [labelBy]="title"></app-card-actionables>
|
||||
<app-card-actionables [entity]="actionEntity" (actionHandler)="performAction($event)" [inputActions]="actions" [labelBy]="title"></app-card-actionables>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import {Series} from 'src/app/_models/series';
|
|||
import {User} from 'src/app/_models/user';
|
||||
import {Volume} from 'src/app/_models/volume';
|
||||
import {AccountService} from 'src/app/_services/account.service';
|
||||
import {Action, ActionFactoryService, ActionItem} from 'src/app/_services/action-factory.service';
|
||||
import {Action, ActionableEntity, ActionFactoryService, ActionItem} from 'src/app/_services/action-factory.service';
|
||||
import {ImageService} from 'src/app/_services/image.service';
|
||||
import {LibraryService} from 'src/app/_services/library.service';
|
||||
import {EVENTS, MessageHubService} from 'src/app/_services/message-hub.service';
|
||||
|
|
@ -118,6 +118,10 @@ export class CardItemComponent implements OnInit {
|
|||
* This is the entity we are representing. It will be returned if an action is executed.
|
||||
*/
|
||||
@Input({required: true}) entity!: CardEntity;
|
||||
/**
|
||||
* An optional entity to be used in the action callback
|
||||
*/
|
||||
@Input() actionEntity: ActionableEntity | null = null;
|
||||
/**
|
||||
* If the entity is selected or not.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<button type="button" class="btn-close" [attr.aria-label]="t('close')" (click)="resetField()"></button>
|
||||
}
|
||||
} @else {
|
||||
<div class="input-hint">
|
||||
<div class="input-hint d-none d-lg-block">
|
||||
Ctrl+K
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2229,8 +2229,8 @@
|
|||
"tasks-tab": "{{tabs.tasks-tab}}",
|
||||
"info-tab": "{{tabs.info-tab}}",
|
||||
|
||||
"pages-label": "{{edit-chapter-modal.pages-count}}",
|
||||
"words-label": "{{edit-chapter-modal.length-title}}",
|
||||
"pages-label": "{{edit-chapter-modal.pages-label}}",
|
||||
"words-label": "{{edit-chapter-modal.words-label}}",
|
||||
"pages-count": "{{edit-chapter-modal.pages-count}}",
|
||||
"words-count": "{{edit-chapter-modal.words-count}}",
|
||||
"reading-time-label": "{{edit-chapter-modal.reading-time-label}}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue