Fix 'this' scoping bug in base-creator.

This commit is contained in:
Dannon Baker
2017-10-06 08:07:48 -04:00
parent 9385a37c4c
commit 08f9700f26
6 changed files with 7 additions and 7 deletions
@@ -99,10 +99,10 @@ var CollectionCreatorMixin = {
/** render the footer, completion controls, and cancel controls */
_renderFooter : function( speed, callback ){
var instance = this;
var self = this;
var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );
_.each( this.footerSettings, function( property, selector ) {
this.$( selector ).prop( 'checked', instance[ property ] );
self.$( selector ).prop( 'checked', self[ property ] );
});
if( typeof this.oncancel === 'function' ){
this.$( '.cancel-create.btn' ).show();
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
"use strict";define([],function(){return{CollectionCreatorMixin:{_validationWarning:function(e,i){"name"===e&&(e=this.$(".collection-name").add(this.$(".collection-name-prompt")),this.$(".collection-name").focus().select()),i?(e=e||this.$(".validation-warning")).removeClass("validation-warning"):e.addClass("validation-warning")},_changeHideOriginals:function(e){this.hideOriginals=this.$(".hide-originals").prop("checked")},_changeName:function(e){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,i){i=i||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(i).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},_cancelCreate:function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},_clickCreate:function(e){var i=this._getName();i?this.blocking||this.createList(i):this._validationWarning("name")},_setUpCommonSettings:function(e){this.hideOriginals=e.defaultHideSourceItems||!1},_renderFooter:function(e,i){var t=this,n=this.$(".footer").empty().html(this.templates.footer());return _.each(this.footerSettings,function(e,i){this.$(i).prop("checked",t[e])}),"function"==typeof this.oncancel&&this.$(".cancel-create.btn").show(),n},_creatorTemplates:{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex"></div>'].join(""))}}}});
"use strict";define([],function(){return{CollectionCreatorMixin:{_validationWarning:function(e,i){"name"===e&&(e=this.$(".collection-name").add(this.$(".collection-name-prompt")),this.$(".collection-name").focus().select()),i?(e=e||this.$(".validation-warning")).removeClass("validation-warning"):e.addClass("validation-warning")},_changeHideOriginals:function(e){this.hideOriginals=this.$(".hide-originals").prop("checked")},_changeName:function(e){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,i){i=i||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(i).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},_cancelCreate:function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},_clickCreate:function(e){var i=this._getName();i?this.blocking||this.createList(i):this._validationWarning("name")},_setUpCommonSettings:function(e){this.hideOriginals=e.defaultHideSourceItems||!1},_renderFooter:function(e,i){var t=this,n=this.$(".footer").empty().html(this.templates.footer());return _.each(this.footerSettings,function(e,i){t.$(i).prop("checked",t[e])}),"function"==typeof this.oncancel&&this.$(".cancel-create.btn").show(),n},_creatorTemplates:{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex"></div>'].join(""))}}}});
//# sourceMappingURL=../../../maps/mvc/collection/base-creator.js.map