mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 09:21:40 +08:00
21 lines
554 B
JavaScript
21 lines
554 B
JavaScript
Handlebars.registerHelper('raw', function(property, options) {
|
|
var templateName = property + ".raw",
|
|
template = Discourse.__container__.lookup('template:' + templateName),
|
|
params = options.hash;
|
|
|
|
if (!template) {
|
|
Ember.warn('Could not find raw template: ' + templateName);
|
|
return;
|
|
}
|
|
|
|
if (params) {
|
|
for (var prop in params) {
|
|
if (options.hashTypes[prop] === "ID") {
|
|
params[prop] = Ember.Handlebars.get(this, params[prop], options);
|
|
}
|
|
}
|
|
}
|
|
|
|
return new Handlebars.SafeString(template(params));
|
|
});
|