fix raw helper so its handlebars 2.0 compliant
This commit is contained in:
parent
008a19f997
commit
a0787103c1
|
@ -3,9 +3,6 @@ Handlebars.registerHelper('raw', function(property, options) {
|
||||||
template = Discourse.__container__.lookup('template:' + templateName),
|
template = Discourse.__container__.lookup('template:' + templateName),
|
||||||
params = options.hash;
|
params = options.hash;
|
||||||
|
|
||||||
// {{raw}} helper is broken!
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!template) {
|
if (!template) {
|
||||||
Ember.warn('Could not find raw template: ' + templateName);
|
Ember.warn('Could not find raw template: ' + templateName);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var RawHandlebars = objectCreate(Handlebars);
|
var RawHandlebars = Handlebars.create();
|
||||||
|
|
||||||
RawHandlebars.helper = function() {};
|
RawHandlebars.helper = function() {};
|
||||||
RawHandlebars.helpers = objectCreate(Handlebars.helpers);
|
RawHandlebars.helpers = objectCreate(Handlebars.helpers);
|
||||||
|
@ -59,7 +59,6 @@
|
||||||
if ( !(mustache.params.length || mustache.hash)) {
|
if ( !(mustache.params.length || mustache.hash)) {
|
||||||
|
|
||||||
var id = new Handlebars.AST.IdNode([{ part: 'get' }]);
|
var id = new Handlebars.AST.IdNode([{ part: 'get' }]);
|
||||||
|
|
||||||
mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, mustache.escaped);
|
mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, mustache.escaped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +91,7 @@
|
||||||
var templateSpec = new RawHandlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
|
var templateSpec = new RawHandlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
|
||||||
|
|
||||||
var template = RawHandlebars.template(templateSpec);
|
var template = RawHandlebars.template(templateSpec);
|
||||||
|
template.isMethod = false;
|
||||||
|
|
||||||
return template;
|
return template;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue