Finishing the basic metadata edit for shows

This commit is contained in:
Zoe Roux 2020-04-19 15:03:05 +02:00
parent 6801bb620c
commit aad61bfb43
2 changed files with 30 additions and 5 deletions

View File

@ -5,6 +5,17 @@
<mat-label>Title</mat-label>
<input matInput [(ngModel)]="this.show.title" name="title">
</mat-form-field>
<mat-form-field class="w-100">
<mat-label>Aliases</mat-label>
<mat-chip-list #aliasList>
<mat-chip *ngFor="let alias of this.show.aliases" (removed)="removeAlias(alias)" removable="true">
{{alias}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
<input #aliasInput placeholder="New alias..." [matChipInputFor]="aliasList" (matChipInputTokenEnd)="addAlias($event)" />
</mat-chip-list>
</mat-form-field>
<mat-form-field class="w-100">
<mat-label>Overview</mat-label>
@ -52,10 +63,10 @@
<mat-form-field class="w-100">
<mat-label>Studio</mat-label>
<input matInput [value]="this.show.studio?.name" (input)="this.show.studio = {slug: null, name: $event.target.value}"
<input matInput [value]="this.show.studio?.name" (input)="this.show.studio = {slug: null, name: $event.target.value}; console.log(this.show.studio)"
[matAutocomplete]="studioAuto" name="studio">
<mat-autocomplete #studioAuto="matAutocomplete">
<mat-option *ngFor="let studio of this.allStudios" [value]="studio.name">
<mat-autocomplete #studioAuto="matAutocomplete" (optionSelected)="this.show.studio = $event.option.value">
<mat-option *ngFor="let studio of this.allStudios" [value]="studio">
{{studio.name}}
</mat-option>
</mat-autocomplete>

View File

@ -43,6 +43,22 @@ export class MetadataEditComponent implements OnInit
this.dialogRef.close(this.show);
});
}
addAlias(event: MatChipInputEvent)
{
const input = event.input;
const value = event.value;
this.show.aliases.push(value);
if (input)
input.value = "";
}
removeAlias(alias: string)
{
const i = this.show.aliases.indexOf(alias);
this.show.aliases.splice(i, 1);
}
addGenre(event: MatChipInputEvent)
{
@ -57,8 +73,6 @@ export class MetadataEditComponent implements OnInit
removeGenre(genre: Genre): void
{
console.log("Removing a genre");
console.log(genre);
const i = this.show.genres.indexOf(genre);
this.show.genres.splice(i, 1);
}