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 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], disabled: !pandora.site.capabilities.canRemoveItems[pandora.user.level],
title: 'Delete ' + pandora.site.itemName.singular + '...', id: 'delete',
width: 128 title: 'Delete ' + pandora.site.itemName.singular + '...'
}
],
title: 'set',
type: 'image'
}) })
.css({ .css({
float: 'left', float: 'left',
margin: '4px' margin: '4px'
}) })
.bindEvent({ .bindEvent({
click: deleteItem click: function(data) {
if (data.id == 'ignore') {
ignoreFiles();
} else if (data.id == 'delete') {
deleteItem();
}
}
}) })
.appendTo(self.$toolbar); .appendTo(self.$toolbar);
@ -54,20 +72,6 @@ pandora.ui.filesView = function(options, self) {
}) })
.appendTo(self.$toolbar); .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({ self.$filesList = Ox.TableList({
columns: [ columns: [
{ {
@ -559,9 +563,9 @@ pandora.ui.filesView = function(options, self) {
self.$moveButton.options({ self.$moveButton.options({
disabled: self.selected.length == 0 disabled: self.selected.length == 0
}); });
self.$ignoreButton.options({ self.$menu[
disabled: self.selected.length == 0 self.selected.length == 0 ? 'disableItem' : 'enableItem'
}); ]('ignore');
} }
return that; return that;