diff --git a/src/admin/components/edition/term-edition-form.vue b/src/admin/components/edition/term-edition-form.vue index 73e8c09a6..767337ad7 100644 --- a/src/admin/components/edition/term-edition-form.vue +++ b/src/admin/components/edition/term-edition-form.vue @@ -130,7 +130,7 @@ }, methods: { ...mapActions('taxonomy', [ - 'sendTerm', + 'sendChildTerm', 'updateChildTerm', ]), ...mapGetters('taxonomy', [ @@ -139,7 +139,7 @@ saveEdition(term) { if (term.id === 'new') { - this.sendTerm({ + this.sendChildTerm({ taxonomyId: this.taxonomyId, name: this.editForm.name, description: this.editForm.description, @@ -170,7 +170,6 @@ headerImageId: this.editForm.header_image_id, }) .then(() => { - this.editForm.saved = true; this.formErrors = {}; this.$emit('onEditionFinished', this.editForm); }) diff --git a/src/admin/components/lists/recursive-terms-list.vue b/src/admin/components/lists/recursive-terms-list.vue index 846aca36f..5e309bb38 100644 --- a/src/admin/components/lists/recursive-terms-list.vue +++ b/src/admin/components/lists/recursive-terms-list.vue @@ -20,14 +20,14 @@ class="label-details"> + v-if="term.id == 'new'"> {{ $i18n.get('info_not_saved') }} { - // this.$console.log(error); - // }); - // } - // } + // Updates parent IDs for orphans + if (this.term.children != undefined && this.term.children.length > 0) { + for (let orphanTerm of this.term.children) { + this.updateChildTerm({ + taxonomyId: this.taxonomyId, + termId: orphanTerm.id, + name: orphanTerm.name, + description: orphanTerm.description, + parent: this.term.parent, + oldParent: this.term.id + }) + .catch((error) => { + this.$console.log(error); + }); + } + } } }, } diff --git a/src/admin/components/lists/terms-list.vue b/src/admin/components/lists/terms-list.vue index fa5d15a69..01ba3bf5f 100644 --- a/src/admin/components/lists/terms-list.vue +++ b/src/admin/components/lists/terms-list.vue @@ -12,7 +12,7 @@