Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 17:30:29 +01:00
Update field id handling
Dieser Commit ist enthalten in:
Ursprung
4576aff5b5
Commit
ca7af31562
2 geänderte Dateien mit 18 neuen und 5 gelöschten Zeilen
|
@ -68,16 +68,25 @@ export default Component.extend({
|
|||
|
||||
actions: {
|
||||
add() {
|
||||
const items = this.items;
|
||||
const items = this.get('items');
|
||||
const itemType = this.itemType;
|
||||
let next = 1;
|
||||
|
||||
|
||||
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 = {
|
||||
id: `${itemType}_${next}`,
|
||||
id,
|
||||
isNew: true
|
||||
};
|
||||
|
||||
|
|
|
@ -97,7 +97,11 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{wizard-links itemType="field" current=currentField items=step.fields}}
|
||||
{{wizard-links
|
||||
itemType="field"
|
||||
current=currentField
|
||||
items=step.fields
|
||||
parentId=step.id}}
|
||||
|
||||
{{#if currentField}}
|
||||
{{wizard-custom-field
|
||||
|
|
Laden …
In neuem Issue referenzieren