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,
sort: [{key: 'transferadded', operator: '-'}],
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(),
$cancelButton = Ox.Button({
disabled: true,
style: 'squared',
title: 'Cancel Transfer...',
title: Ox._('Cancel Transfer...'),
width: 128
})
.css({
@ -61,9 +74,8 @@ oml.ui.transfersPanel = function() {
})
.bindEvent({
click: function() {
var ids = $list.options('selected');
ids && ids.length && oml.api.cancelDownloads({
ids: ids
oml.api.cancelDownloads({
ids: $list.options('selected')
}, function() {
$list.reloadList(true);
});