diff --git a/app/assets/javascripts/discourse/helpers/raw.js.es6 b/app/assets/javascripts/discourse/helpers/raw.js.es6
index 4d944dfcd64..ea1687ce669 100644
--- a/app/assets/javascripts/discourse/helpers/raw.js.es6
+++ b/app/assets/javascripts/discourse/helpers/raw.js.es6
@@ -1,6 +1,17 @@
import registerUnbound from 'discourse/helpers/register-unbound';
-var viewCache = {};
+export function renderRaw(template, templateName, params) {
+ params.parent = params.parent || this;
+
+ if (!params.view) {
+ var viewClass = Discourse.__container__.lookupFactory('view:' + templateName);
+ if (viewClass) {
+ params.view = viewClass.create(params);
+ }
+ }
+
+ return new Handlebars.SafeString(template(params));
+}
registerUnbound('raw', function(templateName, params) {
var template = Discourse.__container__.lookup('template:' + templateName + '.raw');
@@ -8,27 +19,6 @@ registerUnbound('raw', function(templateName, params) {
Ember.warn('Could not find raw template: ' + templateName);
return;
}
- if(!params.parent) {
- params.parent = this;
- }
- if(!params.view) {
- var cached = viewCache[templateName];
- if(cached){
- params.view = cached === "X" ? undefined : cached.create(params);
- } else {
- var split = templateName.split("/");
- var last = split[split.length-1];
- var name = "discourse/views/" + last;
-
- if(hasModule(name)){
- viewCache[templateName] = require(name).default;
- params.view = viewCache[templateName].create(params);
- } else {
- viewCache[templateName] = "X";
- }
- }
- }
-
- return new Handlebars.SafeString(template(params));
+ return renderRaw.call(this, template, templateName, params);
});
diff --git a/app/assets/javascripts/discourse/helpers/register-unbound.js.es6 b/app/assets/javascripts/discourse/helpers/register-unbound.js.es6
index cb5f751bf05..790f77d241a 100644
--- a/app/assets/javascripts/discourse/helpers/register-unbound.js.es6
+++ b/app/assets/javascripts/discourse/helpers/register-unbound.js.es6
@@ -1,30 +1,34 @@
var get = Discourse.EmberCompatHandlebars.get;
+export function resolveParams(options) {
+ var params = {},
+ hash = options.hash;
+
+ if (hash) {
+ var self = this;
+ if (options.hashTypes) {
+ Ember.keys(hash).forEach(function(k) {
+ var type = options.hashTypes[k];
+ if (type === "STRING") {
+ params[k] = hash[k];
+ } else if (type === "ID") {
+ params[k] = get(self, hash[k], options);
+ }
+ });
+ } else {
+ params = hash;
+ }
+ }
+ return params;
+}
+
export default function registerUnbound(name, fn) {
Handlebars.registerHelper(name, function(property, options) {
if (options.types && options.types[0] === "ID") {
property = get(this, property, options);
}
-
- var params = {},
- hash = options.hash;
-
- if (hash) {
- var self = this;
- if (options.hashTypes) {
- Ember.keys(hash).forEach(function(k) {
- var type = options.hashTypes[k];
- if (type === "STRING") {
- params[k] = hash[k];
- } else if (type === "ID") {
- params[k] = get(self, hash[k], options);
- }
- });
- } else {
- params = hash;
- }
- }
+ var params = resolveParams.call(this, options);
return fn.apply(this,[property, params]);
});
diff --git a/app/assets/javascripts/discourse/templates/components/topic-list-header.raw.hbs b/app/assets/javascripts/discourse/templates/components/topic-list-header.raw.hbs
deleted file mode 100644
index b26ae030557..00000000000
--- a/app/assets/javascripts/discourse/templates/components/topic-list-header.raw.hbs
+++ /dev/null
@@ -1,24 +0,0 @@
-{{#if bulkSelectEnabled}}
-
-
- |
-{{/if}}
-{{raw "components/topic-list-header-column" order='default' name='topic.title' showBulkToggle=toggleInTitle}}
-{{#unless hideCategory}}
- {{raw "components/topic-list-header-column" sortable=sortable order='category' name='category_title'}}
-{{/unless}}
-{{#if showPosters}}
- {{raw "components/topic-list-header-column" order='posters' name='users'}}
-{{/if}}
-{{raw "components/topic-list-header-column" sortable=sortable number='true' order='posts' name='posts'}}
-{{#if showParticipants}}
- {{raw "components/topic-list-header-column" order='participants' name='users'}}
-{{/if}}
-{{#if showLikes}}
- {{raw "components/topic-list-header-column" sortable=sortable number='true' order='likes' name='likes'}}
-{{/if}}
-{{#if showOpLikes}}
- {{raw "components/topic-list-header-column" sortable=sortable number='true' order='op_likes' name='likes'}}
-{{/if}}
-{{raw "components/topic-list-header-column" sortable=sortable number='true' order='views' name='views'}}
-{{raw "components/topic-list-header-column" sortable=sortable number='true' order='activity' name='activity'}}
diff --git a/app/assets/javascripts/discourse/templates/components/topic-list.hbs b/app/assets/javascripts/discourse/templates/components/topic-list.hbs
index 357b14c0792..410d531de70 100644
--- a/app/assets/javascripts/discourse/templates/components/topic-list.hbs
+++ b/app/assets/javascripts/discourse/templates/components/topic-list.hbs
@@ -1,6 +1,6 @@
{{#unless skipHeader}}
- {{raw "components/topic-list-header"
+ {{raw "topic-list-header"
currentUser=currentUser
canBulkSelect=canBulkSelect
toggleInTitle=toggleInTitle
diff --git a/app/assets/javascripts/discourse/templates/components/topic-list-header-column.raw.hbs b/app/assets/javascripts/discourse/templates/topic-list-header-column.raw.hbs
similarity index 100%
rename from app/assets/javascripts/discourse/templates/components/topic-list-header-column.raw.hbs
rename to app/assets/javascripts/discourse/templates/topic-list-header-column.raw.hbs
diff --git a/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs b/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs
new file mode 100644
index 00000000000..762822cf709
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs
@@ -0,0 +1,24 @@
+{{#if bulkSelectEnabled}}
+
+
+ |
+{{/if}}
+{{raw "topic-list-header-column" order='default' name='topic.title' showBulkToggle=toggleInTitle}}
+{{#unless hideCategory}}
+ {{raw "topic-list-header-column" sortable=sortable order='category' name='category_title'}}
+{{/unless}}
+{{#if showPosters}}
+ {{raw "topic-list-header-column" order='posters' name='users'}}
+{{/if}}
+{{raw "topic-list-header-column" sortable=sortable number='true' order='posts' name='posts'}}
+{{#if showParticipants}}
+ {{raw "topic-list-header-column" order='participants' name='users'}}
+{{/if}}
+{{#if showLikes}}
+ {{raw "topic-list-header-column" sortable=sortable number='true' order='likes' name='likes'}}
+{{/if}}
+{{#if showOpLikes}}
+ {{raw "topic-list-header-column" sortable=sortable number='true' order='op_likes' name='likes'}}
+{{/if}}
+{{raw "topic-list-header-column" sortable=sortable number='true' order='views' name='views'}}
+{{raw "topic-list-header-column" sortable=sortable number='true' order='activity' name='activity'}}
diff --git a/app/assets/javascripts/discourse/views/posts-count-column.js.es6 b/app/assets/javascripts/discourse/views/list/posts-count-column.js.es6
similarity index 100%
rename from app/assets/javascripts/discourse/views/posts-count-column.js.es6
rename to app/assets/javascripts/discourse/views/list/posts-count-column.js.es6