From 43fd085308802317976d4e914727241213cb2b36 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Fri, 26 Oct 2018 11:08:47 -0300 Subject: [PATCH] Adds terms not saved warning on page leave for terms list. Closes #144. --- .../edition/taxonomy-edition-form.vue | 21 ++++++++++++++++++- src/admin/components/lists/terms-list.vue | 3 +++ src/admin/tainacan-admin-i18n.php | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/admin/components/edition/taxonomy-edition-form.vue b/src/admin/components/edition/taxonomy-edition-form.vue index 8e558ccd9..f5eeb7369 100644 --- a/src/admin/components/edition/taxonomy-edition-form.vue +++ b/src/admin/components/edition/taxonomy-edition-form.vue @@ -146,7 +146,9 @@ - + { + 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(){ diff --git a/src/admin/components/lists/terms-list.vue b/src/admin/components/lists/terms-list.vue index 9788af21d..00e2ce5fa 100644 --- a/src/admin/components/lists/terms-list.vue +++ b/src/admin/components/lists/terms-list.vue @@ -175,6 +175,9 @@ export default { }, taxonomyId() { this.loadTerms(0); + }, + isEditingTerm(value) { + this.$emit('isEditingTermUpdate', value); } }, components: { diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index 381678d56..079f0f60a 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -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' ),