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,12 +101,22 @@ oml.ui.browser = function() {
}); });
} else { } else {
// no longer in context after edit // no longer in context after edit
oml.stayInItemView = true; oml.api.find({
oml.UI.set({ query: {conditions: [], operator: '&'},
find: {conditions: [], operator: '&'}, positions: [ui.item]
listSelection: [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.UI.set({
find: {conditions: [], operator: '&'},
listSelection: [ui.item]
});
oml.stayInItemView = false;
}
}); });
oml.stayInItemView = false;
} }
} }
}, },