关于在 couchapp 和 evently 中使用小胡子部分的问题
我一直在评估一个项目的 couchdb,并使用 couchapp 来开发原型。到目前为止我只能说它是一个很棒的工具。然而,我遇到了一个问题(这肯定是由于对工具的无知造成的),我似乎无法让小胡子部分工作,我认为原因是最终找不到我正在使用的部分的定义。
消息队列事件模板(evently/queues/_change/mustache.html)中的示例
<div class="queue">{{>queue_info}}</div>
...
,我有一个queue_info.html,其内容类似于
<h2>{{name}}</h2>
我将“queue_info.html”放置在哪里,以便事件能够找到它并正确插入它?如果我将它放在与 Mustache.html 相同的目录中,它就不起作用。
此致, 武卡辛
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我已经弄清楚了,所以我写信是为了帮助将来可能遇到同样问题的任何人:
如果您有数据:
并且您想使用部分渲染“queue_info”部分,您将需要创建名为的部分“queue_info”(重要的是,部分的名称与字段相同)并将其放置在文件“queue_info.html”中,该文件位于您正在使用的 evently 目录的子目录“partials”中)。
我们有 evently/queues/_change/mustache.html
和 evently/queues/_change/partials/queue_info.html ,
因此,当我们将此 couchapp 推送到服务器时,
我们会得到按预期级联的结果。希望这对某人有帮助:-)
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:
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
and evently/queues/_change/partials/queue_info.html
when we push this couchapp to the server we get a result which cascades as expected.
Hope this helps someone :-)