consolidate list reloading
This commit is contained in:
parent
16c0514809
commit
904ed06349
8 changed files with 21 additions and 33 deletions
|
@ -31,10 +31,7 @@ oml.ui.deleteItemsDialog = function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
Ox.Request.clearCache(); // too much?
|
Ox.Request.clearCache(); // too much?
|
||||||
oml.$ui.info.updateElement();
|
oml.$ui.info.updateElement();
|
||||||
oml.$ui.filters.forEach(function($filter) {
|
oml.reloadLists();
|
||||||
$filter.reloadList();
|
|
||||||
});
|
|
||||||
oml.$ui.list.updateElement();
|
|
||||||
oml.user.ui.item && oml.UI.set({
|
oml.user.ui.item && oml.UI.set({
|
||||||
item: '',
|
item: '',
|
||||||
itemView: 'info'
|
itemView: 'info'
|
||||||
|
|
|
@ -33,11 +33,7 @@ oml.ui.editDialog = function() {
|
||||||
if (!ui.updateResults && hasChanged) {
|
if (!ui.updateResults && hasChanged) {
|
||||||
Ox.Request.clearCache();
|
Ox.Request.clearCache();
|
||||||
oml.$ui.info.updateElement();
|
oml.$ui.info.updateElement();
|
||||||
oml.$ui.filters.forEach(function($filter) {
|
oml.reloadLists();
|
||||||
$filter.reloadList();
|
|
||||||
});
|
|
||||||
oml.$ui.list.reloadList(true);
|
|
||||||
oml.$ui.browser.reloadList(true);
|
|
||||||
}
|
}
|
||||||
that.close();
|
that.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,7 @@ oml.ui.findForm = function(list) {
|
||||||
|
|
||||||
function updateResults() {
|
function updateResults() {
|
||||||
if (list || ui.updateResults) {
|
if (list || ui.updateResults) {
|
||||||
Ox.Request.clearCache();
|
oml.reloadLists();
|
||||||
oml.$ui.list.reloadList();
|
|
||||||
oml.$ui.filters.forEach(function($filter) {
|
|
||||||
$filter.reloadList();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
oml.UI.set({find: Ox.clone($filter.options('value'), true)});
|
oml.UI.set({find: Ox.clone($filter.options('value'), true)});
|
||||||
oml.$ui.findElement.updateElement();
|
oml.$ui.findElement.updateElement();
|
||||||
|
|
|
@ -169,8 +169,7 @@ oml.ui.identifyDialog = function(data) {
|
||||||
)), function(result) {
|
)), function(result) {
|
||||||
Ox.Request.clearCache('find');
|
Ox.Request.clearCache('find');
|
||||||
oml.$ui.info.updateElement();
|
oml.$ui.info.updateElement();
|
||||||
oml.$ui.browser.reloadList(true);
|
oml.reloadLists();
|
||||||
oml.$ui.list.reloadList(true);
|
|
||||||
Ox.Request.clearCache(data.id);
|
Ox.Request.clearCache(data.id);
|
||||||
oml.$ui.infoView.updateElement(data.id);
|
oml.$ui.infoView.updateElement(data.id);
|
||||||
that.close();
|
that.close();
|
||||||
|
|
|
@ -23,8 +23,7 @@ oml.ui.list = function() {
|
||||||
oml.clipboard.copy(data.ids, 'book');
|
oml.clipboard.copy(data.ids, 'book');
|
||||||
oml.doHistory('cut', data.ids, ui._list, function() {
|
oml.doHistory('cut', data.ids, ui._list, function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
oml.$ui.folders.updateElement();
|
oml.reloadLists();
|
||||||
oml.$ui.list.updateElement();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -34,8 +33,7 @@ oml.ui.list = function() {
|
||||||
oml.clipboard.add(data.ids, 'book');
|
oml.clipboard.add(data.ids, 'book');
|
||||||
oml.doHistory('cut', data.ids, ui._list, function() {
|
oml.doHistory('cut', data.ids, ui._list, function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
oml.$ui.folders.updateElement();
|
oml.reloadLists();
|
||||||
oml.$ui.list.updateElement();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -44,8 +42,7 @@ oml.ui.list = function() {
|
||||||
if (listData.editable && listData.type == 'static') {
|
if (listData.editable && listData.type == 'static') {
|
||||||
oml.doHistory('delete', data.ids, ui._list, function() {
|
oml.doHistory('delete', data.ids, ui._list, function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
oml.$ui.folders.updateItems();
|
oml.reloadLists();
|
||||||
oml.$ui.list.updateElement();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -104,7 +101,7 @@ oml.ui.list = function() {
|
||||||
) {
|
) {
|
||||||
oml.doHistory('paste', items, ui._list, function() {
|
oml.doHistory('paste', items, ui._list, function() {
|
||||||
oml.UI.set({listSelection: items});
|
oml.UI.set({listSelection: items});
|
||||||
oml.reloadList();
|
oml.reloadLists();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -386,8 +386,7 @@ oml.ui.mainMenu = function() {
|
||||||
if (listData.editable && listData.type == 'static') {
|
if (listData.editable && listData.type == 'static') {
|
||||||
oml.doHistory('delete', ui.listSelection, ui._list, function() {
|
oml.doHistory('delete', ui.listSelection, ui._list, function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
oml.$ui.folders.updateItems();
|
oml.reloadLists();
|
||||||
oml.$ui.list.updateElement();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (id == 'deletefromlibrary') {
|
} else if (id == 'deletefromlibrary') {
|
||||||
|
@ -415,7 +414,7 @@ oml.ui.mainMenu = function() {
|
||||||
oml.clipboard[action](ui.listSelection, 'item');
|
oml.clipboard[action](ui.listSelection, 'item');
|
||||||
oml.doHistory('cut', ui.listSelection, ui._list, function() {
|
oml.doHistory('cut', ui.listSelection, ui._list, function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
oml.reloadList();
|
oml.reloadLists();
|
||||||
});
|
});
|
||||||
} else if (Ox.contains(['copy', 'copyadd'], id)) {
|
} else if (Ox.contains(['copy', 'copyadd'], id)) {
|
||||||
var action = data.id == 'copy' ? 'copy' : 'add';
|
var action = data.id == 'copy' ? 'copy' : 'add';
|
||||||
|
@ -425,14 +424,14 @@ oml.ui.mainMenu = function() {
|
||||||
var items = oml.clipboard.paste();
|
var items = oml.clipboard.paste();
|
||||||
oml.doHistory('paste', items, ui._list, function() {
|
oml.doHistory('paste', items, ui._list, function() {
|
||||||
oml.UI.set({listSelection: items});
|
oml.UI.set({listSelection: items});
|
||||||
oml.reloadList();
|
oml.reloadLists();
|
||||||
});
|
});
|
||||||
} else if (data.id == 'clearclipboard') {
|
} else if (data.id == 'clearclipboard') {
|
||||||
oml.clipboard.clear();
|
oml.clipboard.clear();
|
||||||
} else if (data.id == 'delete') {
|
} else if (data.id == 'delete') {
|
||||||
oml.doHistory('delete', ui.listSelection, ui._list, function() {
|
oml.doHistory('delete', ui.listSelection, ui._list, function() {
|
||||||
oml.UI.set({listSelection: []});
|
oml.UI.set({listSelection: []});
|
||||||
oml.reloadList();
|
oml.reloadLists();
|
||||||
});
|
});
|
||||||
} else if (data.id == 'editmetadata') {
|
} else if (data.id == 'editmetadata') {
|
||||||
oml.$ui.editDialog = oml.ui.editDialog().open();
|
oml.$ui.editDialog = oml.ui.editDialog().open();
|
||||||
|
|
|
@ -117,9 +117,8 @@
|
||||||
event.originalEvent.stopPropagation();
|
event.originalEvent.stopPropagation();
|
||||||
oml.upload(event.originalEvent.dataTransfer.files, function(response) {
|
oml.upload(event.originalEvent.dataTransfer.files, function(response) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
Ox.Request.clearCache();
|
oml.reloadLists();
|
||||||
oml.UI.set({listSelection: response.data.ids});
|
oml.UI.set({listSelection: response.data.ids});
|
||||||
oml.reloadList();
|
|
||||||
}, 50);
|
}, 50);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ oml.createLinks = function($element) {
|
||||||
});
|
});
|
||||||
if (Ox.contains(object.targets, ui._list)) {
|
if (Ox.contains(object.targets, ui._list)) {
|
||||||
// FIXME: Why is this timeout needed?
|
// FIXME: Why is this timeout needed?
|
||||||
setTimeout(oml.reloadList, 250);
|
setTimeout(oml.reloadLists, 250);
|
||||||
}
|
}
|
||||||
callback && callback();
|
callback && callback();
|
||||||
}
|
}
|
||||||
|
@ -882,8 +882,13 @@ oml.openLink = function(url) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
oml.reloadList = function() {
|
oml.reloadLists = function() {
|
||||||
oml.$ui.list.updateElement();
|
Ox.Request.clearCache('find');
|
||||||
|
oml.$ui.filters.forEach(function($filter) {
|
||||||
|
$filter.reloadList();
|
||||||
|
});
|
||||||
|
oml.$ui.list.reloadList(true);
|
||||||
|
oml.$ui.browser.reloadList();
|
||||||
};
|
};
|
||||||
|
|
||||||
oml.renameUser = function(data) {
|
oml.renameUser = function(data) {
|
||||||
|
|
Loading…
Reference in a new issue