for andrew

v1.18.x
Baris Usakli 12 years ago
parent 7a478637e3
commit a59fdcbf6a

@ -1,34 +1,7 @@
(function() {
jQuery('document').ready(function() {
var yourid = templates.get('yourid');
var timeoutId = 0;
var url = window.location.href, function initUsers() {
parts = url.split('/'),
active = parts[parts.length-1];
jQuery('.nav-pills li').removeClass('active');
jQuery('.nav-pills li a').each(function() {
if (this.getAttribute('href').match(active)) {
jQuery(this.parentNode).addClass('active');
return false;
}
});
jQuery('#search-user').on('keyup', function () {
if(timeoutId !== 0) {
clearTimeout(timeoutId);
timeoutId = 0;
}
timeoutId = setTimeout(function() {
jQuery('.icon-spinner').removeClass('none');
socket.emit('api:admin.user.search', $('#search-user').val());
}, 250);
});
function isUserAdmin(element) { function isUserAdmin(element) {
@ -102,6 +75,41 @@
return false; return false;
}); });
}
(function() {
jQuery('document').ready(function() {
var yourid = templates.get('yourid');
var timeoutId = 0;
var url = window.location.href,
parts = url.split('/'),
active = parts[parts.length-1];
jQuery('.nav-pills li').removeClass('active');
jQuery('.nav-pills li a').each(function() {
if (this.getAttribute('href').match(active)) {
jQuery(this.parentNode).addClass('active');
return false;
}
});
jQuery('#search-user').on('keyup', function () {
if(timeoutId !== 0) {
clearTimeout(timeoutId);
timeoutId = 0;
}
timeoutId = setTimeout(function() {
jQuery('.icon-spinner').removeClass('none');
socket.emit('api:admin.user.search', $('#search-user').val());
}, 250);
});
initUsers();
}); });

@ -43,6 +43,7 @@
socket.emit('api:get_all_rooms'); socket.emit('api:get_all_rooms');
socket.on('api:admin.user.search', function(data) { socket.on('api:admin.user.search', function(data) {
console.log('move this into user.js but it should execute only once');
var html = templates.prepare(templates['admin/users'].blocks['users']).parse({ var html = templates.prepare(templates['admin/users'].blocks['users']).parse({
users: data users: data
}), }),
@ -57,12 +58,14 @@
.addClass('label-important') .addClass('label-important')
.removeClass('label-success'); .removeClass('label-success');
} }
else else {
$('#user-notfound-notify').html(data.length + ' user'+(data.length>1?'s':'') + ' found!') $('#user-notfound-notify').html(data.length + ' user'+(data.length>1?'s':'') + ' found!')
.show() .show()
.addClass('label-success') .addClass('label-success')
.removeClass('label-important'); .removeClass('label-important');
}
user.initUsers();
}); });
</script> </script>
Loading…
Cancel
Save