small fixes to search

v1.18.x
Baris Usakli 12 years ago
parent aa6eff4c54
commit bae9f46d8b

@ -14,7 +14,7 @@
</form> </form>
<div class="category search"> <div class="category search">
<div class=""> <div class="{show_results}">
<ul id="topics-container" data-search-query="{search_query}"> <ul id="topics-container" data-search-query="{search_query}">
<h3>Topics</h3> <h3>Topics</h3>
<div class="alert alert-info {show_no_topics}">No topics found!</div> <div class="alert alert-info {show_no_topics}">No topics found!</div>

@ -70,7 +70,7 @@ var RDB = require('./redis.js'),
Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) { Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
if (postData.deleted === '1') return callback(null); if (postData.deleted === '1') return callback(null);
else { else {
postData.relativeTime = new Date(parseInt(postData.timestamp, 10)).toISOString(); postData.relativeTime = new Date(parseInt(postData.timestamp || 0, 10)).toISOString();
next(null, postData); next(null, postData);
} }
}); });

@ -186,6 +186,7 @@ var user = require('./../user.js'),
return res.json({ return res.json({
show_no_topics: 'hide', show_no_topics: 'hide',
show_no_posts: 'hide', show_no_posts: 'hide',
show_results: 'hide',
search_query: '', search_query: '',
posts: [], posts: [],
topics: [] topics: []
@ -235,6 +236,7 @@ var user = require('./../user.js'),
return res.json({ return res.json({
show_no_topics: results[1].length ? 'hide' : '', show_no_topics: results[1].length ? 'hide' : '',
show_no_posts: results[0].length ? 'hide' : '', show_no_posts: results[0].length ? 'hide' : '',
show_results: '',
search_query: req.params.term, search_query: req.params.term,
posts: results[0], posts: results[0],
topics: results[1] topics: results[1]

Loading…
Cancel
Save