i have a quick question regarding views/layouts.
I have installed & setup a working tower bot, however whenever i call: @render 'viewName'
from within a controller, (this includes the example controller generated by running tower new appName
) the clients template.js file is generated, but its contents is never inserted into the layout.
From what I can see in the layout, it would make sense for the view to replace the handlebar token {{outlet}}
However, I cannot see any reason why it should.
I have scoured the documentation, but as it is still being written it seems to be lacking any instruction that can help me.
I'm sure its something simple I am missing.
Any help is appreciated. Relevant code below. (All code from default install)
Thanks in advance.
app/controllers/server/applicationController.coffee:
class App.ApplicationController extends Tower.Controller
@layout 'application'
...
welcome: ->
@render 'welcome', locals: {@bootstrapData}
...
app/templates/shared/layout/_body.coffee_body.coffee:
...
section id: 'content', role: 'main', ->
div class: 'container', ->
text '{{outlet}}\n'
...
app/templates/shared/welcome.coffee:
h1 'Welcome to Tower.js'
After digging in the towerjs source code I have discovered that the @render
function assigns the view to the name 'body', so inserting that view is as easy as:
app/templates/shared/layout/_body.coffee_body.coffee:
...
section id: 'content', role: 'main', ->
div class: 'container', ->
yields 'body'
...
I hope this helps someone else.