2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00
discourse/app/assets/javascripts/discourse/helpers/raw.js.es6
2015-02-06 13:26:33 -05:00

26 lines
734 B
JavaScript

import registerUnbound from 'discourse/helpers/register-unbound';
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');
if (!template) {
Ember.warn('Could not find raw template: ' + templateName);
return;
}
return renderRaw.call(this, template, templateName, params);
});
export { renderRaw };