show results as WIP

v1.18.x
Barış Soner Uşaklı 10 years ago
parent be92f07ab9
commit c98720ee4c

@ -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);

Loading…
Cancel
Save