FIX: Resolver should try with slashes instead of periods too

This commit is contained in:
Robin Ward 2014-07-16 17:34:48 -04:00
parent f43293a7bc
commit d9c2b316b6

View File

@ -37,11 +37,16 @@ Discourse.Resolver = Ember.DefaultResolver.extend({
normalize: function(fullName) {
var split = fullName.split(':');
if (split.length > 1) {
// Try slashes
var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/')),
moduleName = 'discourse/' + split[0] + 's/' + dashed;
if (requirejs.entries[moduleName]) {
return split[0] + ":" + dashed;
}
if (requirejs.entries[moduleName]) { return split[0] + ":" + dashed; }
// Try with dashes instead of slashes
dashed = Ember.String.dasherize(split[1].replace(/\./g, '-'));
moduleName = 'discourse/' + split[0] + 's/' + dashed;
if (requirejs.entries[moduleName]) { return split[0] + ":" + dashed; }
}
return this._super(fullName);
},