compatibility fixes

This commit is contained in:
Sam 2014-12-11 11:50:43 +11:00 committed by Robin Ward
parent a0787103c1
commit f8f1611035
3 changed files with 15 additions and 5 deletions

View File

@ -7,7 +7,7 @@ export function daysSinceEpoch(dt) {
Converts a date to a coldmap class
**/
function coldAgeClass(property, options) {
var dt = Em.Handlebars.get(this, property, options);
var dt = Discourse.EmberCompatHandlebars.get(this, property, options);
var className = (options && options.hash && options.hash.class !== undefined) ? options.hash.class : 'age';
if (!dt) { return className; }
@ -15,7 +15,7 @@ function coldAgeClass(property, options) {
var startDate = (options && options.hash && options.hash.startDate) || new Date();
if (typeof startDate === "string") {
startDate = Em.Handlebars.get(this, startDate, options);
startDate = Discourse.EmberCompatHandlebars.get(this, startDate, options);
}
// Show heat on age

View File

@ -1,9 +1,7 @@
function registerUnbound(name, fn) {
Handlebars.registerHelper(name, function(property, options) {
if (options.types[0] === "ID") {
property = options.data.view.getStream(property).value();
}
property = Discourse.EmberCompatHandlebars.get(this, property, options);
var params = {},
hash = options.hash;

View File

@ -96,6 +96,18 @@
return template;
};
RawHandlebars.get = function(_this, property, options){
var val;
if (options.types && options.data.view && options.types[0] === "ID") {
val = options.data.view.getStream(property).value();
} else {
val = Em.get(_this, property);
}
return val;
};
Discourse.EmberCompatHandlebars = RawHandlebars;
})();