upload error
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
<button type="button" class="produkt {{if @isSelected "selected"}}" {{on "click" (fn this.toggleSelection @titel)}}>
|
||||
<img src={{@bild}} alt="Ein Bild von {{@titel}}"/>
|
||||
<h3>{{@titel}}</h3>
|
||||
<button type="button" class="produkt {{if @produkt.isSelected "selected"}}" {{on "click" (fn this.toggleSelection @produkt.titel)}}>
|
||||
<img src={{@produkt.bild}} alt="Ein Bild von {{@produkt.titel}}"/>
|
||||
<h3>{{@produkt.titel}}</h3>
|
||||
<ul class="details">
|
||||
<li class="detail"><h4>Menge:</h4> {{@menge}}{{@einheit}}</li>
|
||||
<li class="detail"><h4>Menge:</h4> {{@produkt.menge}}{{@produkt.einheit}}</li>
|
||||
</ul>
|
||||
</button>
|
||||
|
||||
|
||||
|
||||
<!--<li class="detail"><h4>this.ex:</h4> {{this.ex}}</li>
|
||||
<li class="detail"><h4>this.prodn:</h4> {{this.prodn}}</li>
|
||||
<li class="detail"><h4>produkt count:</h4> {{this.count}}</li>-->
|
||||
</button>
|
||||
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import ApplicationAdapter from '../adapters/application';
|
||||
|
||||
export default class ProduktController extends Component {
|
||||
@tracked isLarge = false;
|
||||
@@ -42,6 +43,14 @@ export default class ProduktController extends Component {
|
||||
|
||||
setStatus(produktname, selection)
|
||||
{
|
||||
function failure(reason) {
|
||||
// handle the error
|
||||
if(reason != null)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
//schreibt den aktuellen Zustand in den Store
|
||||
this.store.findAll('produkt')
|
||||
.then(function(suchergebnis)
|
||||
@@ -50,8 +59,7 @@ export default class ProduktController extends Component {
|
||||
if(element.titel==produktname)
|
||||
{
|
||||
element.isSelected = selection;
|
||||
element.save();
|
||||
this.store.updateRelationships();
|
||||
element.save().catch(failure);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,30 +1,12 @@
|
||||
{{#if @isSelected}}
|
||||
<button type="button" class="rezept selected" {{on "click" (fn this.toggleSelection @titel)}}>
|
||||
<span><img src={{@bild}} alt="Ein Bild von {{@titel}}"/></span>
|
||||
<button type="button" class="rezept {{if @rezept.isSelected "selected"}}" {{on "click" (fn this.toggleSelection @rezept.titel)}}>
|
||||
<span><img src={{@rezept.bild}} alt="Ein Bild von {{@rezept.titel}}"/></span>
|
||||
<span>
|
||||
<h3>{{@titel}}</h3>
|
||||
<h3>{{@rezept.titel}}</h3>
|
||||
<ul class="details">
|
||||
<li class="detail"><h4>Zutaten:</h4>{{#each @produkte as |produkt|}}
|
||||
{{produkt.attributes.titel}},
|
||||
{{/each}}Gewürze</li>
|
||||
<li class="detail"><h4>Personen:</h4>{{@personen}}</li>
|
||||
<li class="detail"><h4>Dauer:</h4>{{@dauer}} Minuten</li>
|
||||
</ul>
|
||||
</span>
|
||||
<li class="detail"><h4>Zutaten:</h4>{{#each @rezept.produkte as |produkt|}}
|
||||
{{produkt.attributes.titel}}, {{/each}}Gewürze</li>
|
||||
<li class="detail"><h4>Personen:</h4>{{@rezept.personen}}</li>
|
||||
<li class="detail"><h4>Dauer:</h4>{{@rezept.dauer}} Minuten</li>
|
||||
</ul>
|
||||
</span>
|
||||
</button>
|
||||
{{else}}
|
||||
<button type="button" class="rezept" {{on "click" (fn this.toggleSelection @titel)}}>
|
||||
<span><img src={{@bild}} alt="Ein Bild von {{@titel}}"/></span>
|
||||
<span>
|
||||
<h3>{{@titel}}</h3>
|
||||
<ul class="details">
|
||||
<li class="detail"><h4>Zutaten:</h4>{{#each @produkte as |produkt|}}
|
||||
{{produkt.attributes.titel}},
|
||||
{{/each}}Gewürze</li>
|
||||
<li class="detail"><h4>Personen:</h4>{{@personen}} </li>
|
||||
<li class="detail"><h4>Dauer:</h4>{{@dauer}} Minuten</li>
|
||||
</ul>
|
||||
</span>
|
||||
</button>
|
||||
{{/if}}
|
||||
|
||||
|
||||
@@ -30,7 +30,16 @@ export default class RezeptController extends Component {
|
||||
if(element.titel==rezeptname)
|
||||
{
|
||||
element.isSelected = selection;
|
||||
element.save();
|
||||
element.save().catch(failure);
|
||||
|
||||
function failure(reason)
|
||||
{
|
||||
// handle the error
|
||||
if(reason != null)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user