1

I've followed the user manual to apply a default template, e.g. in the projects src/main/webapp/WEB-INF/scalate/layouts/default.scaml I have a template that's supposed to get applied to all scaml files, but when I hit my test page (in src/main/webapp/WEB-INF/views/x/view.scaml) it only renders the content in that one page. Even if I put an explicit layout attribute at the top it still doesn't render, i.e.

- attributes ("layout") = "/WEB-INF/scalate/layouts/default.scaml"

Any idea on what I could be doing wrong?

Kevin
  • 24,871
  • 19
  • 102
  • 158
  • This seems to imply that the default layout strategy has been changed to the Null strategy: http://fusesource.com/issues/browse/SCALATE-34. Any idea on how to set a layout strategy? I don't think that's in the docs, or I haven't seen it... – Kevin May 09 '11 at 15:07
  • I'm using the scalate's spring view resolver, ScalateViewResolver. It seems like the layout strategy should be set against that class, but I don't see any way to do that. – Kevin May 09 '11 at 15:17

1 Answers1

1

Digging into the scalate source code (1.4.1) it appears that the viewName is expected to be prefixed with "layout:" if layouts should be applied, see https://github.com/scalate/scalate/blob/master/scalate-spring-mvc/src/main/scala/org/fusesource/scalate/spring/view/ScalateViewResolver.scala.

This seems like a very odd decision, since the docs indicate that layouts can be disabled on a per view basis by doing:

- attributes("layout") = ""

Given this I'm not sure why layouts are disabled by default and each view must explicitly ask for the layout feature to be enabled.

Kevin
  • 24,871
  • 19
  • 102
  • 158
  • This looks to be a feature of the spring-mvc plugin for scalate; not scalate itself. For the rest of scalate templates get applied to a layout using the mechanism you mention. Unfortunately I don't know enough about spring-mvc to know if this layout: prefix idea is a good thing or not – James Strachan May 10 '11 at 18:15