views:

37

answers:

1

Hi guys,

I have been evaluating couchdb for a project and am using couchapp to develop the prototype. So far all I can only say it that it is an awesome tool. I have however run across a problem (which is surely caused by ignorance of the tool) that I cannot seem to get mustache partials to work and the reason for that I believe is that evently can't find the definitions of the partials I am using.

example out of a message queue evently template (evently/queues/_change/mustache.html)

<div class="queue">{{>queue_info}}</div>
...

and I have a queue_info.html with something like

<h2>{{name}}</h2>

where do I place the "queue_info.html" so that evently would find it and insert it properly? If I put it in the same directory as mustache.html it doesn't work.

Best regards, Vukasin

+1  A: 

ok i have figured this out so I am writing to help anyone who might run into the same issue in the future:

if you have data:

{  "queue_info": { "name": "queuename", "owner": "user1" }, "messages": [...] }

and you want to render the "queue_info" part using a partial you will need to create the partial called "queue_info" (it is important that the partial is called the same as the field) and place it in a file "queue_info.html" located in the subdirectory "partials" of the evently directory you are working in).

so we have evently/queues/_change/mustache.html

<div class="queue">
{{>queue_info}}
{{#messages}}
   <div class="message">
       author: {{author}}
       message: {{text}}
   </div>
{{/messages}}
</div>

and evently/queues/_change/partials/queue_info.html

Queue: {{name}}
Owner: {{owner}}

when we push this couchapp to the server we get a result which cascades as expected.

Hope this helps someone :-)

Vukasin Toroman