ES6: Migrate a few components over
This commit is contained in:
parent
ec5580c075
commit
f9ca13b33b
|
@ -1,5 +1,4 @@
|
||||||
Discourse.AutoCloseFormComponent = Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
|
||||||
autoCloseValid: false,
|
autoCloseValid: false,
|
||||||
|
|
||||||
label: function() {
|
label: function() {
|
|
@ -6,7 +6,7 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.BasicTopicListComponent = Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
|
||||||
loaded: function() {
|
loaded: function() {
|
||||||
var topicList = this.get('topicList');
|
var topicList = this.get('topicList');
|
|
@ -6,7 +6,7 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.BreadCrumbsComponent = Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
classNames: ['category-breadcrumb'],
|
classNames: ['category-breadcrumb'],
|
||||||
tagName: 'ol',
|
tagName: 'ol',
|
||||||
parentCategory: Em.computed.alias('category.parentCategory'),
|
parentCategory: Em.computed.alias('category.parentCategory'),
|
|
@ -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(){
|
didInsertElement: function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -22,26 +37,10 @@ Discourse.CategoryGroupComponent = Ember.Component.extend({
|
||||||
});
|
});
|
||||||
self.set("categories", categories);
|
self.set("categories", categories);
|
||||||
},
|
},
|
||||||
template: Discourse.CategoryGroupComponent.templateFunction(),
|
template: templateFunction(),
|
||||||
transformComplete: function(category) {
|
transformComplete: function(category) {
|
||||||
return Discourse.HTML.categoryBadge(category, {allowUncategorized: true});
|
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;
|
|
||||||
}
|
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
Discourse.HomeLogoComponent = Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
classNames: ["title"],
|
classNames: ["title"],
|
||||||
|
|
||||||
linkUrl: function() {
|
linkUrl: function() {
|
||||||
|
@ -12,5 +12,4 @@ Discourse.HomeLogoComponent = Ember.Component.extend({
|
||||||
smallLogoUrl: Discourse.computed.setting('logo_small_url'),
|
smallLogoUrl: Discourse.computed.setting('logo_small_url'),
|
||||||
bigLogoUrl: Discourse.computed.setting('logo_url'),
|
bigLogoUrl: Discourse.computed.setting('logo_url'),
|
||||||
title: Discourse.computed.setting('title'),
|
title: Discourse.computed.setting('title'),
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue