improved handling of delete when in item view

This commit is contained in:
rlx 2016-01-16 13:18:37 +05:30
parent 5882e97608
commit 09687f0cd7

View file

@ -80,8 +80,9 @@ oml.ui.browser = function() {
}) })
.bindEvent({ .bindEvent({
key_control_delete: function() { key_control_delete: function() {
var listData = oml.getListData(); if (that.value(
if (listData.own) { that.options('selected')[0], 'mediastate'
) == 'available') {
oml.ui.deleteItemsDialog().open(); oml.ui.deleteItemsDialog().open();
} }
}, },
@ -100,6 +101,14 @@ oml.ui.browser = function() {
}); });
} else { } else {
// no longer in context after edit // no longer in context after edit
oml.api.find({
query: {conditions: [], operator: '&'},
positions: [ui.item]
}, function(result) {
if (result.data.positions[ui.item] === void 0) {
// no longer in libraries after delete
oml.UI.set({item: ''});
} else {
oml.stayInItemView = true; oml.stayInItemView = true;
oml.UI.set({ oml.UI.set({
find: {conditions: [], operator: '&'}, find: {conditions: [], operator: '&'},
@ -107,6 +116,8 @@ oml.ui.browser = function() {
}); });
oml.stayInItemView = false; oml.stayInItemView = false;
} }
});
}
} }
}, },
toggle: function(data) { toggle: function(data) {