return time and matchcount on page switch

v1.18.x
barisusakli 10 years ago
parent addd6ecde7
commit fbdae8fe1d

@ -109,11 +109,6 @@ define('forum/users', ['translator'], function(translator) {
}
function doSearch(page) {
function reset() {
notify.html('<i class="fa fa-search"></i>');
notify.parent().removeClass('btn-warning label-warning btn-success label-success');
}
var username = $('#search-user').val();
var notify = $('#user-notfound-notify');
page = page || 1;
@ -132,21 +127,28 @@ define('forum/users', ['translator'], function(translator) {
onlineOnly: $('.search .online-only').is(':checked')
}, function(err, data) {
if (err) {
reset();
resetSearchNotify();
return app.alertError(err.message);
}
if (!data) {
return reset();
return resetSearchNotify();
}
renderSearchResults(data);
});
}
function resetSearchNotify() {
var notify = $('#user-notfound-notify');
notify.html('<i class="fa fa-search"></i>');
notify.parent().removeClass('btn-warning label-warning btn-success label-success');
}
function loadPage(page) {
socket.emit('user.loadPage', {page: page, sortBy: $('.search select').val(), onlineOnly: $('.search .online-only').is(':checked')}, function(err, data) {
resetSearchNotify();
if (err) {
return app.alertError(err.message);
}

@ -438,6 +438,8 @@ SocketUser.loadPage = function(socket, data, callback) {
}
var pageCount = Math.ceil(result.count / resultsPerPage);
var userData = {
matchCount: result.users.length,
timing: (process.elapsedTimeSince(startTime) / 1000).toFixed(2),
users: result.users,
pagination: pagination.create(data.page, pageCount)
};
@ -448,7 +450,7 @@ SocketUser.loadPage = function(socket, data, callback) {
if (!data || !data.page) {
return callback(new Error('[[error:invalid-data]]'));
}
var startTime = process.hrtime();
var controllers = require('../controllers/users');
var pagination = require('../pagination');
var set = '';

Loading…
Cancel
Save