FIX: When using `{{avatar}}` within autocomplete

This commit is contained in:
Robin Ward 2014-12-17 10:05:38 -05:00
parent f42a5c1ba3
commit 2ca0a307de
1 changed files with 13 additions and 9 deletions

View File

@ -3,7 +3,7 @@ var get = Discourse.EmberCompatHandlebars.get;
export default function registerUnbound(name, fn) { export default function registerUnbound(name, fn) {
Handlebars.registerHelper(name, function(property, options) { Handlebars.registerHelper(name, function(property, options) {
if (options.types[0] === "ID") { if (options.types && options.types[0] === "ID") {
property = get(this, property, options); property = get(this, property, options);
} }
@ -12,7 +12,8 @@ export default function registerUnbound(name, fn) {
if (hash) { if (hash) {
var self = this; var self = this;
Ember.keys(options.hash).forEach(function(k) { if (options.hashTypes) {
Ember.keys(hash).forEach(function(k) {
var type = options.hashTypes[k]; var type = options.hashTypes[k];
if (type === "STRING") { if (type === "STRING") {
params[k] = hash[k]; params[k] = hash[k];
@ -20,6 +21,9 @@ export default function registerUnbound(name, fn) {
params[k] = get(self, hash[k], options); params[k] = get(self, hash[k], options);
} }
}); });
} else {
params = hash;
}
} }
return fn(property, params); return fn(property, params);