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
1 changed files with 8 additions and 3 deletions

View File

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