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
1 changed files with 18 additions and 7 deletions

View File

@ -80,8 +80,9 @@ oml.ui.browser = function() {
})
.bindEvent({
key_control_delete: function() {
var listData = oml.getListData();
if (listData.own) {
if (that.value(
that.options('selected')[0], 'mediastate'
) == 'available') {
oml.ui.deleteItemsDialog().open();
}
},
@ -100,12 +101,22 @@ oml.ui.browser = function() {
});
} else {
// no longer in context after edit
oml.stayInItemView = true;
oml.UI.set({
find: {conditions: [], operator: '&'},
listSelection: [ui.item]
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.UI.set({
find: {conditions: [], operator: '&'},
listSelection: [ui.item]
});
oml.stayInItemView = false;
}
});
oml.stayInItemView = false;
}
}
},