MCPcopy Create free account
hub / github.com/cnodejs/nodeclub / render

Function render

controllers/site.js:27–53  ·  view source on GitHub ↗
(tags, topics, hot_topics, stars, tops, no_reply_topics, pages)

Source from the content-addressed store, hash-verified

25 var limit = config.list_topic_count;
26
27 var render = function (tags, topics, hot_topics, stars, tops, no_reply_topics, pages) {
28 var all_tags = tags.slice(0);
29
30 // 计算最热标签
31 tags.sort(function (tag_a, tag_b) {
32 return tag_b.topic_count - tag_a.topic_count;
33 });
34
35 // 计算最新标签
36 tags.sort(function (tag_a, tag_b) {
37 return tag_b.create_at - tag_a.create_at;
38 });
39 var recent_tags = tags.slice(0, 5);
40 res.render('index', {
41 tags: all_tags,
42 topics: topics,
43 current_page: page,
44 list_topic_count: limit,
45 recent_tags: recent_tags,
46 hot_topics: hot_topics,
47 stars: stars,
48 tops: tops,
49 no_reply_topics: no_reply_topics,
50 pages: pages,
51 keyword: keyword
52 });
53 };
54
55 var proxy = EventProxy.create('tags', 'topics', 'hot_topics', 'stars', 'tops', 'no_reply_topics', 'pages', render);
56 proxy.fail(next);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected