mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-13 01:01:27 -05:00
24 lines
710 B
JavaScript
24 lines
710 B
JavaScript
import registerUnbound from 'discourse/helpers/register-unbound';
|
|
|
|
function renderRaw(ctx, template, templateName, params) {
|
|
params.parent = params.parent || ctx;
|
|
|
|
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(this, template, templateName, params);
|
|
});
|