<button class="button"
type="button"
id="addTitle"
- [disabled]="edit"
+ [disabled]="edit || disableByInsertMode()"
(click)="addTitle()">Hinzufügen</button>
+ <button class="button"
+ type="button"
+ [disabled]="edit || !disableByInsertMode()"
+ (click)="insertMainSectionAfter()">Einfügen</button>
<button class="button"
type="button"
id="saveTitle"
- [disabled]="!edit"
+ [disabled]="!edit || disableByInsertMode()"
(click)="saveTitle()">Speichern</button>
</form>
(click)="saveFood()">Speichern</button>
</form>
-<div *ngFor="let title of foodcard.Titles">
+<div *ngFor="let title of foodcard.Titles; let i = index">
<h1>{{title.Title}}</h1>
<button class="button"
type="button"
(click)="editTitle(title)">Bearbeiten</button>
+ <button class="button"
+ type="button"
+ (click)="insertMainSection(i)">Einfügen Hauptteil</button>
<div *ngFor="let subtitle of title.Subtitles; let i = index">
<h2>{{subtitle.Subtitle}}</h2>
<button class="button"
this.edit = true;
}
+ public insertMainSectionAfter(): void
+ {
+ this.foodcard.Titles.splice(this.insertIndicies[0] + 1, 0,
+ this.title);
+ this.title = { Title: "", Subtitles: [] };
+ this.insertIndicies = [ -1, -1, -1 ];
+ this.formTitleVisible = false;
+ }
+
+ public insertMainSection(index: number): void
+ {
+ this.insertIndicies = [ index, -1, -1 ];
+ this.formTitleVisible = true;
+ }
+
public addSubtitle(): void
{
let lastTitle = this.getLastTitle()