From 56218b082411770476b8ff769c7f05a9e4d5aa72 Mon Sep 17 00:00:00 2001 From: George Stephanis Date: Mon, 10 Aug 2015 18:49:06 -0400 Subject: [PATCH] Add in a notification for unsaved changes. --- assets/js/admin/settings-views-html-settings-tax.js | 3 +++ includes/admin/settings/views/html-settings-tax.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js index b00c873e8fd..7e72129661b 100644 --- a/assets/js/admin/settings-views-html-settings-tax.js +++ b/assets/js/admin/settings-views-html-settings-tax.js @@ -16,6 +16,7 @@ paginationTemplate = wp.template( 'wc-tax-table-pagination' ), $table = $( '.wc_tax_rates' ), $tbody = $( '#rates' ), + $p_unsaved_msg = $( '#unsaved-changes' ), $pagination = $( '#rates-pagination' ), WCTaxTableModelConstructor = Backbone.Model.extend({ setRateAttribute : function( rateID, attribute, value ) { @@ -85,9 +86,11 @@ }, setUnloadConfirmation : function() { this.needsUnloadConfirm = true; + $p_unsaved_msg.show(); }, clearUnloadConfirmation : function() { this.needsUnloadConfirm = false; + $p_unsaved_msg.hide(); }, unloadConfirmation : function(event) { if ( event.data.view.needsUnloadConfirm ) { diff --git a/includes/admin/settings/views/html-settings-tax.php b/includes/admin/settings/views/html-settings-tax.php index cbfac9f3a04..b48d954318c 100644 --- a/includes/admin/settings/views/html-settings-tax.php +++ b/includes/admin/settings/views/html-settings-tax.php @@ -45,6 +45,8 @@ if ( ! defined( 'ABSPATH' ) ) { + +