]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
change: insert subtitle button into title
authorBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jun 2022 17:07:24 +0000 (19:07 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jun 2022 17:13:30 +0000 (19:13 +0200)
src/app/app.component.html
src/app/app.component.ts

index 3dd455b08fbb3e4e13f7ca36c4f8a5f6b560483c..6b39e5f91b6762cf043ba43932c30977d2ca158f 100644 (file)
        type="button"
        id="buttonTitle"
        (click)="changeFormTitleVisible()">Titel hinzufügen</button>
-<button class="button main"
-       type="button"
-       id="buttonSubtitle"
-       [disabled]="disableSubtitleButton()"
-       (click)="changeFormSubtitleVisible()">Untertitel hinzufügen</button>
 <button class="button main"
        type="button"
        id="buttonFood"
 <form #formSubtitle="ngForm" *ngIf="formSubtitleVisible" class="form">
        <label>Untertitel</label>
        <input [(ngModel)]="subtitle.Subtitle" name="subtitle" type="text" />
-       <button class="button"
-               type="button"
-               id="addSubtitle"
-               [disabled]="edit || disableByInsertMode()"
-               (click)="addSubtitle()">Hinzufügen</button>
        <button class="button"
                type="button"
                [disabled]="edit || !disableByInsertMode()"
        <button class="button"
                type="button"
                (click)="removeMainSection(i)">Lösche Hauptteil</button>
+       <button class="button"
+               type="button"
+               id="buttonSubtitle"
+               [disabled]="disableSubtitleButton()"
+               (click)="addNewSubtitle(i)">Untertitel hinzufügen</button>
        <div *ngFor="let subtitle of title.Subtitles; let i = index">
                <h2>{{subtitle.Subtitle}}</h2>
                <button class="button"
index 4d3a11a6856eb2cab2daf359df31fcd10d893b44..1da9ab523b30dbe1c9e215cf0f51b59621b2f0d4 100644 (file)
@@ -32,8 +32,10 @@ export class AppComponent
                this.formTitleVisible = !this.formTitleVisible;
        }
 
-       public changeFormSubtitleVisible(): void
+       public addNewSubtitle(index: number): void
        {
+               let title = this.foodcard.Titles[index];
+               this.insertIndicies = [ index, title.Subtitles.length - 1, -1 ];
                this.formSubtitleVisible = !this.formSubtitleVisible;
        }