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

Views directories not being traversed for templates in multiple subdirectories #95

Open
aitor opened this issue Mar 26, 2013 · 2 comments

Comments

@aitor
Copy link

aitor commented Mar 26, 2013

According the documentation:

Serve searches for a layout file in the same directory as the view. If it fails to find one there, it traverses up the directory tree searching each parent directory until it finds the "nearest" layout.
http://get-serve.com/documentation/layouts

Borrowing the example from gem's site:

views/
  |
  _layout.erb
  |
  +-- index.erb (A)
  |
  `-- about/
        |
        `-- index.erb (B)
  `-- team/
        `-- sales/
            |
            `-- index.erb (C)
        `-- dev/
            |
            `-- index.erb (D)

It's my understanding that all cases, A,B,C and D should use the same layout (_layout.erb), but currently only A and B are correctly working.

The current pipeline implementation is using File#split (see pipeline.rb) for generating an array with the possible locations for layouts and therefore expecting layout to be in one of the following locations:

   => "app/views/team/sales/_layout.erb"
   => "app/views/team/_layout.erb"

This implementation will, as consequence, check always just two levels for each template (its current dir and its parent). Before doing the pull request with a fix I'd like to confirm with @jlong or any other familiar with the codebase if this is a real bug and not a feature :).

@jlong
Copy link
Owner

jlong commented Mar 26, 2013

Ah yes. This is actually a regression. It should function as it says in the docs. Pull-request away!

@bluesaunders
Copy link

Would just like to chime in that I'm running into this as well. (Though I'm a front-end guy and thus can't fix it and submit a pull-request.)

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

3 participants