files view: move buttons into menu (fixes #1323)

This commit is contained in:
rolux 2013-03-01 08:00:59 +05:30
parent 8d5f8d5156
commit cdeb38b7e8

View file

@ -26,17 +26,35 @@ pandora.ui.filesView = function(options, self) {
size: 24
});
self.$deleteButton = Ox.Button({
self.$menu = Ox.MenuButton({
items: [
{
disabled: true,
id: 'ignore',
title: 'Ignore Selected Files'
},
{},
{
disabled: !pandora.site.capabilities.canRemoveItems[pandora.user.level],
title: 'Delete ' + pandora.site.itemName.singular + '...',
width: 128
id: 'delete',
title: 'Delete ' + pandora.site.itemName.singular + '...'
}
],
title: 'set',
type: 'image'
})
.css({
float: 'left',
margin: '4px'
})
.bindEvent({
click: deleteItem
click: function(data) {
if (data.id == 'ignore') {
ignoreFiles();
} else if (data.id == 'delete') {
deleteItem();
}
}
})
.appendTo(self.$toolbar);
@ -54,20 +72,6 @@ pandora.ui.filesView = function(options, self) {
})
.appendTo(self.$toolbar);
self.$ignoreButton = Ox.Button({
disabled: 'true',
title: 'Ignore Selected Files',
width: 128
})
.css({
float: 'right',
margin: '4px'
})
.bindEvent({
click: ignoreFiles
})
.appendTo(self.$toolbar);
self.$filesList = Ox.TableList({
columns: [
{
@ -559,9 +563,9 @@ pandora.ui.filesView = function(options, self) {
self.$moveButton.options({
disabled: self.selected.length == 0
});
self.$ignoreButton.options({
disabled: self.selected.length == 0
});
self.$menu[
self.selected.length == 0 ? 'disableItem' : 'enableItem'
]('ignore');
}
return that;