Re: [nesta] Project not using custom layout view
- From:
- Graham Ashton
- Date:
- 2011-02-27 @ 07:55
On 27 Feb 2011, at 05:08, Michael Hanson wrote:
> So I've set up a 'views/layout.haml' file but I cannot get the project
to recognize it. According to
http://nestacms.com/docs/design/editing-default-templates Nesta will first
look in the project's views directory, *then* the gem's views directory,
but I'm not finding this to be the case? User error?
I wonder if you've been bitten by the "gotcha" that's mentioned on here?
http://nestacms.com/docs/design/editing-default-templates
"If the template you’re redefining is rendered with a layout (i.e. it’s a
top level template such as page.haml) then Sinatra will expect to find the
layout in the same directory as the template itself. In these cases you’ll
also need to copy layout.haml into views."
There's then a bit of blather about how to identify these templates, and
I've just added a new paragraph beneath that. Here's the new bit:
https://github.com/gma/nestacms.com/commit/1d5d9c384971973668c522a89a7a23a2e4e7500e
This is all down to the way Sinatra's rendering methods work. They assume
that all templates that are needed when you call the `haml` method are
in the same folder, and I didn't fancy monkey patching Sinatra to get
around it (I suspect any clever patch like that would be brittle).
This may not be the cause of your problem (I'm just guessing), in which
case it needs investigating. If you can't get it working feel free to send
a link to a git repo and I'll take a look at it.
Cheers,
Graham
Re: [nesta] Project not using custom layout view
- From:
- Michael Hanson
- Date:
- 2011-02-27 @ 17:42
On Sat, Feb 26, 2011 at 11:55 PM, Graham Ashton <graham@effectif.com> wrote:
> This is all down to the way Sinatra's rendering methods work. They assume
> that all templates that are needed when you call the `haml` method are in
> the same folder, and I didn't fancy monkey patching Sinatra to get around it
> (I suspect any clever patch like that would be brittle).
>
> This may not be the cause of your problem (I'm just guessing), in which
> case it needs investigating. If you can't get it working feel free to send a
> link to a git repo and I'll take a look at it.
>
Yep, that was it. As a test, I just copied all the default views from the
gem directory into my project's views directory and that did the trick. So
I'll just go from there. Thanks a bunch for the help.
Michael