I have a Rails app that is namespaced into three sections (almost 3 apps that share models). I would like for each namespaced section to have it's own Ember app. These apps are never loaded in the same layout so don't have to know anything about each other. In fact I would like to keep the code as separate as possible for when the app can eventually be really split up.
I am trying to do this using the ember-rails gem.
Basically it is like this question: How can I specify an alternative directory for my HandlebarsJS templates with the ember-rails gem?
And the answer there works, but I'm pretty sure using templates_root limits me to just one namespace. So I couldn't also have an admin.js and admin/templates namespace as well as a customer.js and customer/templates namespace.
So does anyone know if ember-rails will support multiple namespaced Ember apps and render multiple template roots as a result?
Thanks!
As posted here you can have namespace templates by adding a custom resolver to each app.
App1 = Ember.Application.create({
Resolver: Ember.DefaultResolver.extend({
resolveTemplate: function(parsedName) {
parsedName.fullNameWithoutType = "app1/" + parsedName.fullNameWithoutType;
return this._super(parsedName);
}
})
});
App2 = Ember.Application.create({
Resolver: Ember.DefaultResolver.extend({
resolveTemplate: function(parsedName) {
parsedName.fullNameWithoutType = "app2/" + parsedName.fullNameWithoutType;
return this._super(parsedName);
}
})
});
App3 = Ember.Application.create({
Resolver: Ember.DefaultResolver.extend({
resolveTemplate: function(parsedName) {
parsedName.fullNameWithoutType = "app3/" + parsedName.fullNameWithoutType;
return this._super(parsedName);
}
})
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With