]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
add: save with press enter
authorBastian Dehn <hhaalo@arcor.de>
Sat, 11 Jun 2022 08:55:31 +0000 (10:55 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 11 Jun 2022 08:55:31 +0000 (10:55 +0200)
src/app/food/food.component.html
src/app/food/food.component.ts
src/app/subtitle/subtitle.component.html
src/app/subtitle/subtitle.component.ts
src/app/title/title.component.html
src/app/title/title.component.ts

index eeac428e131037b06977ab7907f2aeb8429fe313..fd2e218c7d62035b065ccfed022ee4c8938af1f9 100644 (file)
@@ -7,7 +7,10 @@
                [disabled]="formFoodVisible"
                (click)="editFood()">Bearbeiten</button>
 
-       <form #formFood="ngForm" *ngIf="formFoodVisible" class="grid form">
+       <form #formFood="ngForm"
+               *ngIf="formFoodVisible"
+               (keypress)="onKeypressEnter($event)"
+               class="grid form">
                <label>Speise</label>
                <input [(ngModel)]="food.Food" name="food" type="text" />
                <label>Beilage</label>
index 420109fb8647668ba95dc4d5dd2988cbadab31b5..a675c9a147d90b04efc4e0bf1b28b238750c00d1 100644 (file)
@@ -30,4 +30,10 @@ export class FoodComponent implements OnInit
        {
                this.formFoodVisible = false;
        }
+
+       public onKeypressEnter(e: any): void
+       {
+               if (e.keyCode === 13)
+                       this.saveFood();
+       }
 }
index 28665868fecf224d4653d0b6410c340296407c6b..9a380359c544af5a9493b43350fd48cf91a6c3f9 100644 (file)
@@ -8,9 +8,13 @@
                id="buttonFood"
                (click)="addNewFood()">Speise hinzufügen</button>
 
-       <form #formSubtitle="ngForm" *ngIf="formSubtitleVisible" class="form">
+       <form #formSubtitle="ngForm" *ngIf="formSubtitleVisible"
+               (keypress)="onKeypressEnter($event)"
+               class="form">
                <label>Untertitel</label>
-               <input [(ngModel)]="subtitle.Subtitle" name="subtitle" type="text" />
+               <input [(ngModel)]="subtitle.Subtitle"
+               name="subtitle"
+               type="text" />
                <button class="button"
                        type="button"
                        id="saveSubtitle"
index 2f20645c7ab8daef97c0498a7658d74e9ab09793..2384943b75bf589da8f7ddba63613df711381c7e 100644 (file)
@@ -25,6 +25,12 @@ export class SubtitleComponent implements OnInit
                this.formSubtitleVisible = true;
        }
 
+       public onKeypressEnter(e: any): void
+       {
+               if (e.keyCode === 13)
+                       this.saveSubtitle();
+       }
+
        public saveSubtitle(): void
        {
                this.formSubtitleVisible = false;
index 4d25ee846821305fbfa6e07207eb58df48f9a007..746961bb861fecc9c411eb2aa9b159268a040223 100644 (file)
@@ -3,7 +3,9 @@
        <button class="button"
                type="button"
                (click)="editTitle()">Bearbeiten</button>
-       <form #formTitle="ngForm" *ngIf="formTitleVisible" class="form">
+       <form #formTitle="ngForm" *ngIf="formTitleVisible"
+               (keypress)="onKeypressEnter($event)"
+               class="form">
                <label>Titel</label>
                <input [(ngModel)]="title.Title" name="title" type="text" />
                <button class="button"
index 1b1b20ba9d9553f0bec6192f65df59feacf631b7..0b841d7eeae410d0ff7d5dd41c33c30218596f00 100644 (file)
@@ -25,6 +25,12 @@ export class TitleComponent implements OnInit
                this.formTitleVisible = true;
        }
 
+       public onKeypressEnter(e: any): void
+       {
+               if (e.keyCode === 13)
+                       this.saveTitle();
+       }
+
        public saveTitle(): void
        {
                this.formTitleVisible = false;