关于在 couchapp 和 evently 中使用小胡子部分的问题

发布于 2024-09-16 14:08:37 字数 471 浏览 3 评论 0原文

我一直在评估一个项目的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡紫姑娘! 2024-09-23 14:08:37

好的,我已经弄清楚了,所以我写信是为了帮助将来可能遇到同样问题的任何人:

如果您有数据:

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

并且您想使用部分渲染“queue_info”部分,您将需要创建名为的部分“queue_info”(重要的是,部分的名称与字段相同)并将其放置在文件“queue_info.html”中,该文件位于您正在使用的 evently 目录的子目录“partials”中)。

我们有 evently/queues/_change/mustache.html

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

和 evently/queues/_change/partials/queue_info.html ,

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

因此,当我们将此 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:

{  "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 :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文