Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better documentation of the folder conventions and nested template structure #230

Open
eccegordo opened this issue Jul 31, 2013 · 4 comments

Comments

@eccegordo
Copy link
Contributor

This may just be me not understanding the conventions of ember-rails. But can someone explain the idiomatic way to nest handlebars templates in an ember-rails based project?

For example assuming the following route structure:

App.Router.map(function() {
    this.resource('solutions', function() {
        this.route('new');
        this.resource('solution', { path: ':solution_id' }, function() {           
            this.route('overview', { path: 'overview' });
            this.route('edit', { path: 'edit' });
        });
    });
}); // map

It would seem idiomatic to recursively nest folders to match the router nesting

/app
   |-assets/
   |---javascripts/
   |-----myapp/
   |-------templates/
   |---------solutions.handlebars
   |---------solutions/
   |-----------index.handlebars
   |-----------new.handlebars
   |-----------solution/
   |-------------index.handlebars
   |-------------overview.handlebars
   |-------------edit.handlebars   

But ember rails seems to require the following directory structure. e.g the "solution" directory is outside the "solutions" directory:

/app
   |-assets/
   |---javascripts/
   |-----myapp/
   |-------templates/
   |---------solutions.handlebars
   |---------solutions/
   |-----------index.handlebars
   |-----------new.handlebars
   |---------solution/
   |-----------index.handlebars
   |-----------overview.handlebars
   |-----------edit.handlebars

Is this a bug? Perhaps some more documentation of implied folder conventions would be helpful. Especially around deeply nested application structures (i.e. more than two levels deep).

@stefanpenner
Copy link
Member

I prefer your first example. And yes as apps grow more deeply nested app structure is needed.

Someone should take a shot at addressing this.

@rwjblue
Copy link
Member

rwjblue commented Oct 31, 2013

@eccegordo - If you could create a sample repo that I could use to test, I'd like to look into addressing this...

@eccegordo
Copy link
Contributor Author

@rjackson thanks, good timing, I was just struggling with this yesterday. I think I keep expecting certain nested folders to behave in a specific way and they don't. I started to look at the ember rails source to figure out what was going on. I think there are at least three folder layout variants I can think of. One is more edge case than the others

I will put together a repo to display the expectations.

This is ultimately about compilation of source folders and how they map to conventions and expectations. A learning exercise for me but would love to be able to document and show what happens in the explicit and implicit case (e.g. generated controllers, etc)

I started to look at the dummy app to understand how your tests work.

https://github.com/emberjs/ember-rails/tree/master/test/dummy

Hopefully we can get a few varied test cases together. And from that some explicit documentation.

Will get something shortly.

@kprentiss
Copy link

Really excited about this - happy to help test against our project, which would greatly benefit from folder nesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants