Adds terms not saved warning on page leave for terms list. Closes #144.

This commit is contained in:
Mateus Machado Luna 2018-10-26 11:08:47 -03:00
parent d001d23878
commit 43fd085308
3 changed files with 24 additions and 2 deletions

View File

@ -146,7 +146,9 @@
<b-tab-item :label="$i18n.get('terms')">
<!-- Terms List -->
<terms-list :taxonomy-id="taxonomyId"/>
<terms-list
@isEditingTermUpdate="isEditingTermUpdate"
:taxonomy-id="taxonomyId"/>
</b-tab-item>
<b-loading
@ -173,6 +175,7 @@
taxonomy: null,
isLoadingTaxonomy: false,
isUpdatingSlug: false,
isEditinTerm: false,
form: {
name: String,
status: String,
@ -228,6 +231,19 @@
}
}
});
} else if (this.isEditinTerm) {
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_terms_not_saved'),
onConfirm: () => {
next();
}
}
});
} else {
next();
}
@ -358,6 +374,9 @@
},
labelNewTerms(){
return ( this.form.allowInsert === 'yes' ) ? this.$i18n.get('label_yes') : this.$i18n.get('label_no');
},
isEditingTermUpdate (value) {
this.isEditinTerm = value;
}
},
mounted(){

View File

@ -175,6 +175,9 @@ export default {
},
taxonomyId() {
this.loadTerms(0);
},
isEditingTerm(value) {
this.$emit('isEditingTermUpdate', value);
}
},
components: {

View File

@ -409,7 +409,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_warning_metadata_not_saved' => __( 'Are you sure? There are metadata not saved, changes will be lost.', 'tainacan' ),
'info_warning_filters_not_saved' => __( 'Are you sure? There are filters not saved, changes will be lost.', 'tainacan' ),
'info_no_description_provided' => __( 'No description provided.', 'tainacan' ),
'info_warning_taxonomy_not_saved' => __( 'Are you sure? The metadata is not saved, changes will be lost.', 'tainacan' ),
'info_warning_taxonomy_not_saved' => __( 'Are you sure? The taxonomy is not saved, changes will be lost.', 'tainacan' ),
'info_warning_terms_not_saved' => __( 'Are you sure? There are terms not saved, changes will be lost.', 'tainacan' ),
'info_warning_orphan_terms' => __( 'Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan' ),
'info_no_events' => __( 'No events', 'tainacan' ),