Add in a notification for unsaved changes.

This commit is contained in:
George Stephanis 2015-08-10 18:49:06 -04:00
parent 843fef6e26
commit 56218b0824
2 changed files with 5 additions and 0 deletions

View File

@ -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 ) {

View File

@ -45,6 +45,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tbody>
</table>
<p id="unsaved-changes" style="display:none;"><?php _e( 'There are unsaved changes.', 'woocommerce' ); ?></p>
<script type="text/html" id="tmpl-wc-tax-table-row">
<tr class="tips" data-tip="<?php echo esc_attr( sprintf( __( 'Tax rate ID: %s', 'woocommerce' ), '{{ data.tax_rate_id }}' ) ); ?>" data-id="{{ data.tax_rate_id }}">
<td class="sort">