1
0
Fork 0

Update field id handling

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-16 13:33:07 +10:00
Ursprung 4576aff5b5
Commit ca7af31562
2 geänderte Dateien mit 18 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -68,16 +68,25 @@ export default Component.extend({
actions: { actions: {
add() { add() {
const items = this.items; const items = this.get('items');
const itemType = this.itemType; const itemType = this.itemType;
let next = 1; let next = 1;
if (items.length) { if (items.length) {
next = Math.max.apply(Math, items.map((i) => (i.id.split('_')[1]))) + 1; next = Math.max.apply(Math, items.map((i) => {
let parts = i.id.split('_');
return parts[parts.length - 1];
})) + 1;
}
let id = `${itemType}_${next}`;
if (itemType === 'field') {
id = `${this.parentId}_${id}`;
} }
let params = { let params = {
id: `${itemType}_${next}`, id,
isNew: true isNew: true
}; };

Datei anzeigen

@ -97,7 +97,11 @@
</div> </div>
{{/if}} {{/if}}
{{wizard-links itemType="field" current=currentField items=step.fields}} {{wizard-links
itemType="field"
current=currentField
items=step.fields
parentId=step.id}}
{{#if currentField}} {{#if currentField}}
{{wizard-custom-field {{wizard-custom-field