我创建了一个应用程序如下本教程 http://geddyjs.org/tutorial(无脚手架)。
创建项目后,我可以单击它,它会显示一个大参数列表。像这儿:http://s15.postimage.org/j6at9koiz/parameters.png http://s15.postimage.org/j6at9koiz/parameters.png .
执行此操作的代码是:
<% if (todos && todos.length) { %>
<% for (var i in todos) { %>
<div class="row todo-item">
<div class="span8">
<h3><%- linkTo(todos[i].title, todoPath(todos[i].id)) %></h3>
</div>
<div class="span4"><h3><i class="icon-list-alt"></i><%= todos[i].status; %></h3></div>
</div>
<% } %>
<% } %>
更具体地说,以下行显示带有标题的链接,这些链接将我带到每个项目的参数列表:
<%- linkTo(todos[i].title, todoPath(todos[i].id)) %>
我可以做一些事情来仅显示部分参数而不是现在显示的整个列表吗?
谢谢你!
您需要添加待办事项资源的视图文件。如果您正在搭建脚手架,那么 geddy 会默认创建它们。但否则,您必须添加待办事项的视图文件app/views/todos
.
查看文件
- _form.html.ejs
- add.html.ejs
- edit.html.ejs
- index.html.ejs
- show.html.ejs
您可以手动编辑它们。用于更改单个待办事项的显示方式/todos/:id
路线、编辑show.html.ejs
<div class="hero-unit">
<%- linkTo('Edit this todo', editTodoPath(params.id), {class: 'btn pull-right'}); %>
<h3>Params</h3>
<ul>
<li>todo.title</li>
<li>todo.property1</li>
<li>todo.property2</li>
</ul>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)