Adds warning of how many terms were created. #786.

This commit is contained in:
mateuswetah 2023-05-22 11:53:21 -03:00
parent 8472d5804a
commit 106fbc54c1
3 changed files with 18 additions and 7 deletions

View File

@ -561,7 +561,7 @@ export default {
amountOfTerms: this.amountOfTermsSelected,
excludeTree: this.selectedColumnIndex >= 0 ? this.termColumns[this.selectedColumnIndex].id : this.selected.map((aTerm) => aTerm.id),
taxonomyId: this.taxonomyId,
// onConfirm: (selectedParentTerm) => { }
onConfirm: () => {}
},
trapFocus: true,
customClass: 'tainacan-modal',
@ -600,7 +600,10 @@ export default {
this.termColumns[removedTermParentColumn - 1].children[parentTermIndex].total_children = Number(this.termColumns[removedTermParentColumn].total_children);
}
this.removeLevelsAfterIndex(removedTermParentColumn - 1);
if (removedTermParentColumn > 1)
this.removeLevelsAfterIndex(removedTermParentColumn - 1);
else
this.resetTermsListUI();
}
}
},
@ -687,8 +690,7 @@ export default {
parent: this,
component: TermMultipleInsertionDialog,
props: {
amountOfTerms: this.amountOfTermsSelected,
excludeTree: this.selectedColumnIndex >= 0 ? this.termColumns[this.selectedColumnIndex].id : this.selected.map((aTerm) => aTerm.id),
excludeTree: this.selectedColumnIndex >= 0 ? this.termColumns[this.selectedColumnIndex].id : false,
taxonomyId: this.taxonomyId,
isHierarchical: this.isHierarchical,
initialTermParent: parentId,
@ -699,8 +701,16 @@ export default {
parent: parent,
termNames: termNames
})
.then(() => {
.then((createdTerms) => {
this.resetTermsListUI();
this.$buefy.snackbar.open({
message: this.$i18n.getWithVariables('info_%1$s_of_%2$s_terms_created', [ createdTerms.length, termNames.length ]),
type: 'is-warning',
position: 'is-bottom-right',
pauseOnHover: true,
queue: false
});
})
.catch((error) => {
this.$console.log(error);

View File

@ -251,9 +251,9 @@ export const changeTermsParent = ({}, { taxonomyId, newParentTerm, terms, parent
// Used only on Term Edit form, for autocomplete search for parents
export const fetchPossibleParentTerms = ({ commit }, { taxonomyId, termId, search, offset } ) => {
const excludeTree = qs.stringify({ exclude_tree: termId });
const excludeTree = termId ? qs.stringify({ exclude_tree: termId }) : '';
let endpoint = '/taxonomy/' + taxonomyId + '/terms?searchterm=' + search + '&hierarchical=1&' + excludeTree + "&hideempty=0&offset=0&number=20&order=asc";
let endpoint = '/taxonomy/' + taxonomyId + '/terms?searchterm=' + search + '&hierarchical=1&hideempty=0&offset=0&number=20&order=asc&' + excludeTree;
if (offset)
endpoint += '&offset=' + offset;

View File

@ -1041,6 +1041,7 @@ return apply_filters( 'tainacan-i18n', [
'info_warning_term_with_child' => __( 'This term has child terms. Per default, if you remove a parent term, its child terms will be moved one level up in the hierarchy.', 'tainacan' ),
'info_warning_selected_term_delete' => __( 'Do you really want to permanently delete the selected term?', 'tainacan' ),
'info_warning_some_terms_with_child' => __( 'When removing multiple terms at once, it is possible that some of the terms contain child terms. Per default, if you remove a parent term, its child terms will be moved one level up in the hierarchy.', 'tainacan' ),
'info_%1$s_of_%2$s_terms_created' => __( '%1$s of %2$s terms created with success.', 'tainacan' ),
/* Activity actions */
'action_update-metadata-value' => __( 'Item Metadata Value Updates', 'tainacan'),