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

Function done

controllers/tag.js:24–51  ·  view source on GitHub ↗
(topic_ids, collection, hot_topics, no_reply_topics, pages)

Source from the content-addressed store, hash-verified

22 return res.render('notify/notify', {error: '没有这个标签。'});
23 }
24 var done = function (topic_ids, collection, hot_topics, no_reply_topics, pages) {
25 var query = {'_id': {'$in': topic_ids}};
26 var opt = {skip: (page - 1) * limit, limit: limit, sort: [['create_at', 'desc']]};
27
28 Topic.getTopicsByQuery(query, opt, function (err, topics) {
29 for (var i = 0; i < topics.length; i++) {
30 for (var j = 0; j < topics[i].tags.length; j++) {
31 if (topics[i].tags[j].id === tag.id) {
32 topics[i].tags[j].highlight = true;
33 }
34 }
35 }
36
37 var style = tag.background === '' ? null : '#wrapper {background-image: url("' + tag.background + '")}';
38
39 res.render('tag/list_topic', {
40 tag: tag,
41 topics: topics,
42 current_page: page,
43 list_topic_count: limit,
44 in_collection: collection,
45 hot_topics: hot_topics,
46 no_reply_topics: no_reply_topics,
47 pages: pages,
48 extra_style: style
49 });
50 });
51 };
52
53 var proxy = new EventProxy();
54 proxy.assign('topic_ids', 'collection', 'hot_topics', 'no_reply_topics', 'pages', done);

Callers

nothing calls this directly

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected