Figured out how to avoid hardcoding the instance.
This commit is contained in:
parent
ccd1734353
commit
59a1a313a6
|
@ -63,7 +63,7 @@
|
||||||
this.qty_pages = Math.ceil( this.model.get( 'rates' ).length / this.per_page );
|
this.qty_pages = Math.ceil( this.model.get( 'rates' ).length / this.per_page );
|
||||||
this.listenTo( this.model, 'change', this.setUnloadConfirmation );
|
this.listenTo( this.model, 'change', this.setUnloadConfirmation );
|
||||||
this.listenTo( this.model, 'saved', this.clearUnloadConfirmation );
|
this.listenTo( this.model, 'saved', this.clearUnloadConfirmation );
|
||||||
$(window).on( 'beforeunload', this.unloadConfirmation );
|
$(window).on( 'beforeunload', { view : this }, this.unloadConfirmation );
|
||||||
},
|
},
|
||||||
setUnloadConfirmation : function() {
|
setUnloadConfirmation : function() {
|
||||||
this.needsUnloadConfirm = true;
|
this.needsUnloadConfirm = true;
|
||||||
|
@ -72,8 +72,7 @@
|
||||||
this.needsUnloadConfirm = false;
|
this.needsUnloadConfirm = false;
|
||||||
},
|
},
|
||||||
unloadConfirmation : function(e) {
|
unloadConfirmation : function(e) {
|
||||||
// @todo: Find a way to stop needing to refer to the specific instance from the abstract class.
|
if ( e.data.view.needsUnloadConfirm ) {
|
||||||
if ( WCTaxTableInstance.needsUnloadConfirm ) {
|
|
||||||
e.returnValue = data.strings.unload_confirmation_msg;
|
e.returnValue = data.strings.unload_confirmation_msg;
|
||||||
window.event.returnValue = data.strings.unload_confirmation_msg;
|
window.event.returnValue = data.strings.unload_confirmation_msg;
|
||||||
return data.strings.unload_confirmation_msg;
|
return data.strings.unload_confirmation_msg;
|
||||||
|
|
Loading…
Reference in New Issue