This commit is contained in:
rlx 2016-01-17 13:13:33 +05:30
parent 6b25845660
commit 6b5eb8bf39

View file

@ -2,14 +2,16 @@
oml.ui.peersButton = function() { oml.ui.peersButton = function() {
var that = Ox.Element({ var requests = 0,
tooltip: Ox._('No peering requests')
}) that = Ox.Element({
.css({ tooltip: Ox._('No peering requests')
marginRight: '6px' })
}), .css({
count, marginRight: '6px'
requests = 0; }),
$count;
Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',
@ -27,7 +29,7 @@ oml.ui.peersButton = function() {
}) })
.appendTo(that); .appendTo(that);
count = Ox.Element() $count = Ox.Element()
.addClass('OxLight') .addClass('OxLight')
.css({ .css({
float: 'left', float: 'left',
@ -47,21 +49,18 @@ oml.ui.peersButton = function() {
}); });
update(); update();
function open() {
}
function update() { function update() {
// wait for clearCache in folder.js // wait for clearCache in folder.js
setTimeout(function() { setTimeout(function() {
oml.api.getUsers(function(result) { oml.api.getUsers(function(result) {
requests = result.data.users.filter(function(user) { requests = result.data.users.filter(function(user) {
return user.pending=="received"; return user.pending == 'received';
}).length; }).length;
count.html(requests); $count.html(requests);
that.options({ that.options({
tooltip: Ox._(requests tooltip: requests
? Ox.formatCount(requests, 'peering request') ? Ox.formatCount(requests, '{0} peering request')
: 'No peering requests') : Ox._('No peering requests')
}); });
}); });
}); });