list.js: only editable _and static_ list allow for remove; on paste, select pasted items; remove main menu update on select (belongs in main menu)

This commit is contained in:
rolux 2013-08-02 15:10:47 +00:00
parent b16ee88a68
commit 8850153909

View file

@ -398,13 +398,16 @@ pandora.ui.list = function() {
Ox.Clipboard.add(data.ids, 'item'); Ox.Clipboard.add(data.ids, 'item');
}, },
'delete': function(data) { 'delete': function(data) {
pandora.getListData().editable && pandora.api.removeListItems({ var listData = pandora.getListData();
list: pandora.user.ui._list, if (listData.editable && listData.type == 'static') {
items: data.ids pandora.api.removeListItems({
}, function() { list: pandora.user.ui._list,
pandora.UI.set({listSelection: []}); items: data.ids
pandora.reloadList(); }, function() {
}); pandora.UI.set({listSelection: []});
pandora.reloadList();
});
}
}, },
init: function(data) { init: function(data) {
var folder, list; var folder, list;
@ -461,19 +464,15 @@ pandora.ui.list = function() {
items.length && pandora.getListData().editable && pandora.api.addListItems({ items.length && pandora.getListData().editable && pandora.api.addListItems({
list: pandora.user.ui._list, list: pandora.user.ui._list,
items: items items: items
}, pandora.reloadList); }, function() {
pandora.UI.set({listSelection: items});
pandora.reloadList();
});
} }
}, },
select: function(data) { select: function(data) {
var query; var query;
pandora.UI.set('listSelection', data.ids); pandora.UI.set('listSelection', data.ids);
if (data.ids.length) {
pandora.$ui.mainMenu.enableItem('copy');
pandora.$ui.mainMenu.enableItem('openmovie');
} else {
pandora.$ui.mainMenu.disableItem('copy');
pandora.$ui.mainMenu.disableItem('openmovie');
}
if (data.ids.length == 0) { if (data.ids.length == 0) {
pandora.$ui.statusbar.set('selected', {items: 0}); pandora.$ui.statusbar.set('selected', {items: 0});
} else { } else {