mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-30 15:55:54 +02:00
Fixed problems with non-unique prototype names when using nested collection type, which prevented to create nested entries with mulitple new sub entries.
We now use a unique prototype name for every collection field. This fixes issue #219
This commit is contained in:
parent
1e998fccbb
commit
9d1cd0477a
3 changed files with 25 additions and 2 deletions
|
@ -27,6 +27,7 @@ export default class extends Controller {
|
|||
deleteMessage: String,
|
||||
prototype: String,
|
||||
rowsToDelete: Number, //How many rows (including the current one) shall be deleted after the current row
|
||||
fieldPlaceholder: String
|
||||
}
|
||||
|
||||
static targets = ["target"];
|
||||
|
@ -65,8 +66,11 @@ export default class extends Controller {
|
|||
}
|
||||
|
||||
|
||||
const regexString = this.fieldPlaceholderValue || "__name__";
|
||||
const regex = new RegExp(regexString, "g");
|
||||
|
||||
//Apply the index to prototype to create our element to insert
|
||||
const newElementStr = this.htmlDecode(prototype.replace(/__name__/g, this.generateUID()));
|
||||
const newElementStr = this.htmlDecode(prototype.replace(regex, this.generateUID()));
|
||||
|
||||
|
||||
//Insert new html after the last child element
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue