Small optimization: remove a template with an {{if}}

This commit is contained in:
Robin Ward 2015-01-02 16:29:08 -05:00
parent 5beac44731
commit 030bab92a2
2 changed files with 13 additions and 8 deletions

View file

@ -1,8 +1,18 @@
export default Ember.Component.extend({
import StringBuffer from 'discourse/mixins/string-buffer';
export default Ember.Component.extend(StringBuffer, {
classNameBindings: ['containerClass'],
layoutName: 'components/conditional-loading-spinner',
rerenderTriggers: ['condition'],
containerClass: function() {
return (this.get('size') === 'small') ? 'inline-spinner' : undefined;
}.property('size')
}.property('size'),
renderString: function(buffer) {
if (this.get('condition')) {
buffer.push('<div class="spinner ' + this.get('size') + '"}}></div>');
} else {
return this._super();
}
}
});

View file

@ -1,5 +0,0 @@
{{#if condition}}
<div {{bind-attr class=":spinner size"}}></div>
{{else}}
{{yield}}
{{/if}}