Closed paynerc closed 12 years ago
I have checked in more code which is now included in my outstanding pull request.
The template keys now take into account any subfolders. The only outstanding issue at this point is that when generating the template name, it needs to know the value of ember_runner_config.apps.templates. I am not sure how to get access to that value in the guts of the handlers. At the present time I have just hardcoded the default template value of "templates" into the method call and have placed big TEMPORARY comments around that so we revisit it later and Do The Right Thing™. Let me know if you have any questions/comments/concerns.
Hi, the Package manager already have a 'templates' path from ember_runner_config, so I have added templatePath to the context for the handler, and I have published to npm, now we are in 0.1.24.
Thanks!!
Closed :D
From issue #17:
RCP: One other question (I feel like maybe this isn't the totally correct forum for these questions, but they really aren't "issues" requiring opening new issues...) Say we have a templates folder. And in that templates folder we have subfolders for different views. And in those subfolders we have templates for the various things such as show, edit, new (sort of the railsy approach). Is there a way for ember-runner to handle that when generating the templates?
So say you had:
does ember-runner have the ability to create templates such as contacts/show and contacts/edit?
I was looking into the way ember-rails appears to be working and it seems like they operate in this fashion. We are not looking to serve our ember app up from rails however, so the whole ember-rails gem really doesn't help me out much. We are most likely going to be serving up the ember app from our express API server.
Envone: The problem of your approach is that you can't save in the Em.Templates array's a template with the same key, for example contact's edit and user's edit. should have Em.Templates['edit'] for contact and Em.Templates['edit'] for users, and so on... maybe contacts-edit / contacts-new.. and should be intelligently managed by ember-runner, maybe you can fill a ticket for future... of course you can do right now, a bit redundant but works (if i'm not wrong):
RCP: Right. What ember-rails is doing is creating the key to include the folder. So the show.handlebars template in the contacts folder would actually be 'contacts/show'. And in your view you specify the template as 'contacts/show'.
So when iterating over the collection of handlebars templates, it looks like we could probably take into account the folder hierarchy when inserting the template into EM.Templates.