实现了主页,用户页就十分好实现了,因为它们的界面是差不多的。修改 user/*name.js 如下:
var Models = require('../../lib/core');
var $Topic = Models.$Topic;
exports.get = function* (name) {
yield this.render('user', {
topics: $Topic.getTopicsByName(name),
name: name
});
};
修改 user.ejs,添加如下代码:
<% include header %>
<div class="container">
<div class="ui two column centered grid">
<div class="right floated left aligned four wide column">
<% include partials/userCard %>
<% if ($this.session.user) { %>
<% include partials/createCard %>
<% } %>
<% include partials/noReplyCard %>
<% include partials/linkCard %>
</div>
<div class="left floated twelve wide column">
<% include partials/list %>
</div>
</div>
</div>
<% include footer %>
至此,我们就完成了用户页。