mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
show results as WIP
This commit is contained in:
@@ -36,5 +36,6 @@
|
||||
"save-preferences": "Save preferences",
|
||||
"clear-preferences": "Clear preferences",
|
||||
"search-preferences-saved": "Search preferences saved",
|
||||
"search-preferences-cleared": "Search preferences cleared"
|
||||
"search-preferences-cleared": "Search preferences cleared",
|
||||
"show-results-as": "Show results as"
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ define('forum/search', ['search'], function(searchModule) {
|
||||
timeFilter: form.find('#post-time-filter').val(),
|
||||
timeRange: form.find('#post-time-range').val(),
|
||||
sortBy: form.find('#post-sort-by').val(),
|
||||
sortDirection: form.find('#post-sort-direction').val()
|
||||
sortDirection: form.find('#post-sort-direction').val(),
|
||||
showAs: form.find('#show-as-topics').is(':checked') ? 'topics' : 'posts'
|
||||
};
|
||||
return searchData;
|
||||
}
|
||||
@@ -97,6 +98,13 @@ define('forum/search', ['search'], function(searchModule) {
|
||||
$('#post-sort-by').val(params.sortBy);
|
||||
$('#post-sort-direction').val(params.sortDirection);
|
||||
}
|
||||
|
||||
if (params.showAs) {
|
||||
var isTopic = params.showAs === 'topics';
|
||||
var ispost = params.showAs === 'posts';
|
||||
$('#show-as-topics').prop('checked', isTopic).parent().toggleClass('active', isTopic);
|
||||
$('#show-as-posts').prop('checked', isPost).parent().toggleClass('active', isPost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,10 @@ define('search', ['navigator'], function(nav) {
|
||||
query.sortBy = data.sortBy;
|
||||
query.sortDirection = data.sortDirection;
|
||||
}
|
||||
|
||||
if (data.showAs) {
|
||||
query.showAs = data.showAs;
|
||||
}
|
||||
return decodeURIComponent($.param(query));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ searchController.search = function(req, res, next) {
|
||||
|
||||
var pageCount = Math.max(1, Math.ceil(results.matchCount / 10));
|
||||
results.pagination = pagination.create(page, pageCount, req.query);
|
||||
|
||||
results.showAsPosts = !req.query.showAs || req.query.showAs === 'posts';
|
||||
results.showAsTopics = req.query.showAs === 'topics';
|
||||
results.breadcrumbs = breadcrumbs;
|
||||
results.categories = categories;
|
||||
res.render('search', results);
|
||||
|
||||
Reference in New Issue
Block a user