Add cover lock in metadata edit

This commit is contained in:
aditya.chandel
2025-01-26 13:58:42 -07:00
parent 1e6195f88e
commit cbc51993ba
2 changed files with 18 additions and 14 deletions
@@ -3,9 +3,11 @@
<div class="overflow-y-scroll flex-1"> <div class="overflow-y-scroll flex-1">
<div class="flex flex-row w-full gap-4"> <div class="flex flex-row w-full gap-4">
<div class="flex flex-col items-center gap-4">
<img [src]="urlHelper.getCoverUrl(metadata.bookId, metadata?.coverUpdatedOn)" alt="Image" width="225"/> <img [src]="urlHelper.getCoverUrl(metadata.bookId, metadata?.coverUpdatedOn)" alt="Image" width="225"/>
<p-button *ngIf="!metadata['coverLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('thumbnailUrl')" severity="success"></p-button>
<p-button *ngIf="metadata['coverLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('thumbnailUrl')" severity="warn"></p-button>
</div>
<div class="flex flex-col flex-grow pl-2"> <div class="flex flex-col flex-grow pl-2">
<!-- Title and Subtitle --> <!-- Title and Subtitle -->
@@ -152,17 +154,17 @@
</div> </div>
</div> </div>
<div class="flex flex-row w-full gap-4 mt-2 pb-1"> </div>
<div class="flex flex-col gap-1 w-full"> </div>
<label for="description">Description</label>
<div class="flex justify-between items-center gap-2">
<textarea rows="9" pTextarea id="description" formControlName="description" class="w-full"></textarea>
<p-button *ngIf="!metadata['descriptionLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('description')" severity="success"></p-button>
<p-button *ngIf="metadata['descriptionLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('description')" severity="warn"></p-button>
</div>
</div>
</div>
<div class="flex flex-row w-full pb-1">
<div class="flex flex-col gap-1 w-full">
<label for="description">Description</label>
<div class="flex justify-between items-center gap-2">
<textarea rows="12" pTextarea id="description" formControlName="description" class="w-full"></textarea>
<p-button *ngIf="!metadata['descriptionLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('description')" severity="success"></p-button>
<p-button *ngIf="metadata['descriptionLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('description')" severity="warn"></p-button>
</div>
</div> </div>
</div> </div>
@@ -74,6 +74,7 @@ export class MetadataEditorComponent implements OnInit {
seriesNameLocked: new FormControl(false), seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false), seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false), seriesTotalLocked: new FormControl(false),
thumbnailUrlLocked: new FormControl(false),
}); });
} }
@@ -116,6 +117,7 @@ export class MetadataEditorComponent implements OnInit {
seriesNameLocked: metadata.seriesNameLocked || false, seriesNameLocked: metadata.seriesNameLocked || false,
seriesNumberLocked: metadata.seriesNumberLocked || false, seriesNumberLocked: metadata.seriesNumberLocked || false,
seriesTotalLocked: metadata.seriesTotalLocked || false, seriesTotalLocked: metadata.seriesTotalLocked || false,
thumbnailUrlLocked: metadata.coverLocked || false,
}); });
if (metadata.titleLocked) this.metadataForm.get('title')?.disable(); if (metadata.titleLocked) this.metadataForm.get('title')?.disable();
@@ -220,7 +222,7 @@ export class MetadataEditorComponent implements OnInit {
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value, seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value, seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value, seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value,
coverLocked: this.metadataForm.get('thumbnailUrlLocked')?.value,
}; };
return updatedBookMetadata; return updatedBookMetadata;
} }