mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
Final set of backwards compatible fixes for Ember 1.13
This commit is contained in:
@ -1,14 +1,11 @@
|
||||
import { get } from 'discourse-common/lib/raw-handlebars';
|
||||
|
||||
function fixArgs(args) {
|
||||
return (args.length > 1) ? args[0].concat(args[args.length-1]) : args;
|
||||
}
|
||||
|
||||
// `Ember.Helper` is only available in versions after 1.12
|
||||
export function htmlHelper(fn) {
|
||||
if (Ember.Helper) {
|
||||
return Ember.Helper.helper(function(...args) {
|
||||
return new Handlebars.SafeString(fn.apply(this, fixArgs(args)) || '');
|
||||
args = (args.length > 1) ? args[0].concat({ hash: args[args.length-1] }) : args;
|
||||
return new Handlebars.SafeString(fn.apply(this, args) || '');
|
||||
});
|
||||
} else {
|
||||
return Ember.Handlebars.makeBoundHelper(function() {
|
||||
|
Reference in New Issue
Block a user