mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:10:17 +08:00
compatibility fixes
This commit is contained in:
parent
a0787103c1
commit
f8f1611035
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue
Block a user