revert changes

This commit is contained in:
rlx 2016-01-16 15:18:05 +05:30
parent 591fa089ce
commit 4fc590b7ba

View file

@ -98,6 +98,30 @@ oml.ui.browser = function() {
itemView: 'info', itemView: 'info',
listSelection: data.ids listSelection: data.ids
}); });
} else if (ui.item) {
// 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({
find: {conditions: [], operator: '&'},
item: '',
listSelection: []
});
} else {
Ox.Request.clearCache('find');
oml.stayInItemView = true;
oml.UI.set({
find: {conditions: [], operator: '&'},
item: ui.item,
listSelection: [ui.item]
});
oml.stayInItemView = false;
}
});
} }
}, },
toggle: function(data) { toggle: function(data) {
@ -124,32 +148,6 @@ oml.ui.browser = function() {
if (data.value.length) { if (data.value.length) {
that.options({selected: [data.value[0]]}); that.options({selected: [data.value[0]]});
} }
else {
// no longer in context after edit
Ox.print('OUT OF CONTEXT')
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({
find: {conditions: [], operator: '&'},
item: '',
listSelection: []
});
} else {
Ox.Request.clearCache('find');
oml.stayInItemView = true;
oml.UI.set({
find: {conditions: [], operator: '&'},
item: ui.item,
listSelection: [ui.item]
});
oml.stayInItemView = false;
}
});
}
}, },
oml_listsort: function(data) { oml_listsort: function(data) {
that.options({sort: data.value}); that.options({sort: data.value});