transfer panel: fix cancel button

This commit is contained in:
rlx 2016-01-17 16:04:38 +05:30
parent 36be2bb3b2
commit 881956b4f4

View file

@ -47,13 +47,26 @@ oml.ui.transfersPanel = function() {
scrollbarVisible: true, scrollbarVisible: true,
sort: [{key: 'transferadded', operator: '-'}], sort: [{key: 'transferadded', operator: '-'}],
unique: 'id' unique: 'id'
})
.bindEvent({
select: function(data) {
$cancelButton.options({
disabled: data.ids.length == 0,
title: Ox._(
data.ids.length < 2
? 'Cancel Transfer...'
: 'Cancel Transfers...'
)
});
}
}), }),
$item = Ox.Element(), $item = Ox.Element(),
$cancelButton = Ox.Button({ $cancelButton = Ox.Button({
disabled: true,
style: 'squared', style: 'squared',
title: 'Cancel Transfer...', title: Ox._('Cancel Transfer...'),
width: 128 width: 128
}) })
.css({ .css({
@ -61,9 +74,8 @@ oml.ui.transfersPanel = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
var ids = $list.options('selected'); oml.api.cancelDownloads({
ids && ids.length && oml.api.cancelDownloads({ ids: $list.options('selected')
ids: ids
}, function() { }, function() {
$list.reloadList(true); $list.reloadList(true);
}); });