Update ember-cloaking for latest fixes/tweaks

This commit is contained in:
Robin Ward 2014-03-17 12:00:59 -04:00
parent f390c92578
commit 38f2c778fb
1 changed files with 20 additions and 4 deletions

View File

@ -25,7 +25,7 @@
cloaks: cloakView, cloaks: cloakView,
preservesContext: this.get('preservesContext') === "true", preservesContext: this.get('preservesContext') === "true",
cloaksController: this.get('itemController'), cloaksController: this.get('itemController'),
defaultHeight: this.get('defaultHeight') || 100, defaultHeight: this.get('defaultHeight'),
init: function() { init: function() {
this._super(); this._super();
@ -191,6 +191,7 @@
$(window).bind('scroll.ember-cloak', onScrollMethod); $(window).bind('scroll.ember-cloak', onScrollMethod);
this.addObserver('wrapperTop', self, onScrollMethod); this.addObserver('wrapperTop', self, onScrollMethod);
this.addObserver('wrapperHeight', self, onScrollMethod); this.addObserver('wrapperHeight', self, onScrollMethod);
this.scrollTriggered();
this.set('scrollingEnabled', true); this.set('scrollingEnabled', true);
}.on('didInsertElement'), }.on('didInsertElement'),
@ -219,7 +220,7 @@
init: function() { init: function() {
this._super(); this._super();
this.uncloak(); this.cloak();
}, },
/** /**
@ -246,8 +247,8 @@
factory = Ember.generateControllerFactory(container, controllerName, model); factory = Ember.generateControllerFactory(container, controllerName, model);
// inform developer about typo // inform developer about typo
Ember.Logger.warn('ember-cloacking: can\'t lookup controller by name "' + controllerFullName + '".'); Ember.Logger.warn('ember-cloaking: can\'t lookup controller by name "' + controllerFullName + '".');
Ember.Logger.warn('ember-cloacking: using ' + factory.toString() + '.'); Ember.Logger.warn('ember-cloaking: using ' + factory.toString() + '.');
} }
controller = factory.create({ controller = factory.create({
@ -301,6 +302,21 @@
}, },
didInsertElement: function(){
if (!this.get('containedView')) {
// setting default height
// but do not touch if height already defined
if(!this.$().height()){
var defaultHeight = 100;
if(this.get('defaultHeight')) {
defaultHeight = this.get('defaultHeight');
}
this.$().css('height', defaultHeight);
}
}
},
/** /**
Render the cloaked view if applicable. Render the cloaked view if applicable.