v1.18.x
Baris Soner Usakli 12 years ago
parent 902e60fab2
commit 0db599a478

@ -5,14 +5,11 @@
</ul>
</div>
<div class="alert alert-warning {show_no_results}" id="no-search-results">
<strong>No search results for {search_query}.</strong>
</div>
<div class="category row">
<div class="span12">
<ul id="topics-container" data-search-query="{search_query}">
<h3>Topics</h3>
<div class="alert alert-info {show_no_topics}">No topics found!</div>
<!-- BEGIN topics -->
<a href="../../topic/{topics.slug}" id="tid-{topics.tid}">
<li class="category-item">
@ -28,6 +25,8 @@
</li>
</a>
<!-- END topics -->
<h3>Posts</h3>
<div class="alert alert-info {show_no_posts}">No posts found!</div>
<!-- BEGIN posts -->
<a href="../../topic/{posts.topicSlug}#{posts.pid}" id="tid-{posts.tid}">
<li class="category-item">

@ -183,9 +183,11 @@ var user = require('./../user.js'),
app.get('/api/search', function(req, res) {
return res.json({
show_no_results:'hide',
show_no_topics:'hide',
show_no_posts:'hide',
search_query:'',
posts:[]
posts:[],
topics:[]
});
});
@ -228,9 +230,10 @@ var user = require('./../user.js'),
async.parallel([searchPosts, searchTopics], function(err, results) {
if (err)
return next();
var noresults = !results[0].length && !results[1].length;
return res.json({
show_no_results: noresults?'show':'hide',
show_no_topics: results[1].length? 'hide':'',
show_no_posts: results[0].length? 'hide':'',
search_query:req.params.term,
posts:results[0],
topics:results[1]

Loading…
Cancel
Save