mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
fixed pagination, and loading of template blocks on cold load (temp solution)
This commit is contained in:
@@ -59,22 +59,24 @@ define(function() {
|
||||
return;
|
||||
}
|
||||
|
||||
var html = templates.prepare(templates['users'].blocks['users']).parse({
|
||||
users: data.users
|
||||
}),
|
||||
userListEl = $('#users-container');
|
||||
templates.preload_template('users', function() {
|
||||
templates['users'].parse({users:[]});
|
||||
var html = templates.prepare(templates['users'].blocks['users']).parse({
|
||||
users: data.users
|
||||
}),
|
||||
userListEl = $('#users-container');
|
||||
|
||||
userListEl.html(html);
|
||||
userListEl.html(html);
|
||||
|
||||
|
||||
if (data && data.users.length === 0) {
|
||||
$('#user-notfound-notify').html('User not found!');
|
||||
$('#user-notfound-notify').parent().addClass('btn-warning label-warning');
|
||||
} else {
|
||||
$('#user-notfound-notify').html(data.users.length + ' user' + (data.users.length > 1 ? 's' : '') + ' found! Search took ' + data.timing + ' ms.');
|
||||
$('#user-notfound-notify').parent().addClass('btn-success label-success');
|
||||
}
|
||||
|
||||
if (data && data.users.length === 0) {
|
||||
$('#user-notfound-notify').html('User not found!');
|
||||
$('#user-notfound-notify').parent().addClass('btn-warning label-warning');
|
||||
} else {
|
||||
$('#user-notfound-notify').html(data.users.length + ' user' + (data.users.length > 1 ? 's' : '') + ' found! Search took ' + data.timing + ' ms.');
|
||||
$('#user-notfound-notify').parent().addClass('btn-success label-success');
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 500); //replace this with global throttling function/constant
|
||||
|
||||
@@ -108,17 +110,20 @@ define(function() {
|
||||
}
|
||||
|
||||
function onUsersLoaded(users, emptyContainer) {
|
||||
var html = templates.prepare(templates['users'].blocks['users']).parse({
|
||||
users: users
|
||||
});
|
||||
templates.preload_template('users', function() {
|
||||
templates['useres'].parse({users:[]});
|
||||
var html = templates.prepare(templates['users'].blocks['users']).parse({
|
||||
users: users
|
||||
});
|
||||
|
||||
translator.translate(html, function(translated) {
|
||||
if(emptyContainer) {
|
||||
$('#users-container .registered-user').remove();
|
||||
}
|
||||
translator.translate(html, function(translated) {
|
||||
if(emptyContainer) {
|
||||
$('#users-container .registered-user').remove();
|
||||
}
|
||||
|
||||
$('#users-container').append(translated);
|
||||
$('#users-container .anon-user').appendTo($('#users-container'));
|
||||
$('#users-container').append(translated);
|
||||
$('#users-container .anon-user').appendTo($('#users-container'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user