Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-14 13:52:54 +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: {
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Laden …
In neuem Issue referenzieren