ES6: Migrate a few components over

This commit is contained in:
Robin Ward 2014-05-28 14:59:41 -04:00
parent ec5580c075
commit f9ca13b33b
5 changed files with 21 additions and 24 deletions

View File

@ -1,5 +1,4 @@
Discourse.AutoCloseFormComponent = Ember.Component.extend({
export default Ember.Component.extend({
autoCloseValid: false,
label: function() {

View File

@ -6,7 +6,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.BasicTopicListComponent = Ember.Component.extend({
export default Ember.Component.extend({
loaded: function() {
var topicList = this.get('topicList');

View File

@ -6,7 +6,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.BreadCrumbsComponent = Ember.Component.extend({
export default Ember.Component.extend({
classNames: ['category-breadcrumb'],
tagName: 'ol',
parentCategory: Em.computed.alias('category.parentCategory'),

View File

@ -1,4 +1,19 @@
Discourse.CategoryGroupComponent = Ember.Component.extend({
// Compile and memoize a template
var compiled;
function templateFunction() {
compiled = compiled || Handlebars.compile("<div class='autocomplete'>" +
"<ul>" +
"{{#each options}}" +
"<li>" +
"{{categoryLinkRaw this allowUncategorized=true}}" +
"</li>" +
"{{/each}}" +
"</ul>" +
"</div>");
return compiled;
}
export default Ember.Component.extend({
didInsertElement: function(){
var self = this;
@ -22,26 +37,10 @@ Discourse.CategoryGroupComponent = Ember.Component.extend({
});
self.set("categories", categories);
},
template: Discourse.CategoryGroupComponent.templateFunction(),
template: templateFunction(),
transformComplete: function(category) {
return Discourse.HTML.categoryBadge(category, {allowUncategorized: true});
}
});
}
});
Discourse.CategoryGroupComponent.reopenClass({
templateFunction: function(){
this.compiled = this.compiled || Handlebars.compile("<div class='autocomplete'>" +
"<ul>" +
"{{#each options}}" +
"<li>" +
"{{categoryLinkRaw this allowUncategorized=true}}" +
"</li>" +
"{{/each}}" +
"</ul>" +
"</div>");
return this.compiled;
}
});

View File

@ -1,4 +1,4 @@
Discourse.HomeLogoComponent = Ember.Component.extend({
export default Ember.Component.extend({
classNames: ["title"],
linkUrl: function() {
@ -12,5 +12,4 @@ Discourse.HomeLogoComponent = Ember.Component.extend({
smallLogoUrl: Discourse.computed.setting('logo_small_url'),
bigLogoUrl: Discourse.computed.setting('logo_url'),
title: Discourse.computed.setting('title'),
});