fix save as collection in documents section

This commit is contained in:
j 2020-01-17 23:34:07 +01:00
parent d3f2cf770f
commit 7fa2a8a338
2 changed files with 19 additions and 7 deletions

View file

@ -37,6 +37,7 @@ pandora.ui.documentFilterForm = function(options) {
return item.id; return item.id;
}) })
}]), }]),
listName: Ox._('Collection'),
list: mode == 'find' ? { list: mode == 'find' ? {
sort: pandora.user.ui.collectionSort, sort: pandora.user.ui.collectionSort,
view: pandora.user.ui.collectionView view: pandora.user.ui.collectionView

View file

@ -12,7 +12,9 @@ pandora.ui.filterDialog = function() {
click: function() { click: function() {
var list = pandora.$ui.filterForm.getList(); var list = pandora.$ui.filterForm.getList();
if (list.save) { if (list.save) {
pandora.api.addList({ pandora.api[
pandora.user.ui.section == 'documents' ? 'addCollection' : 'addList'
]({
name: list.name, name: list.name,
query: list.query, query: list.query,
status: 'private', status: 'private',
@ -20,12 +22,21 @@ pandora.ui.filterDialog = function() {
}, function(result) { }, function(result) {
var $list = pandora.$ui.folderList.personal, var $list = pandora.$ui.folderList.personal,
id = result.data.id; id = result.data.id;
pandora.UI.set({ if (pandora.user.ui.section) {
find: { pandora.UI.set({
conditions: [{key: 'list', value: id, operator: '=='}], findDocuments: {
operator: '&' conditions: [{key: 'collection', value: id, operator: '=='}],
} operator: '&'
}); }
});
} else {
pandora.UI.set({
find: {
conditions: [{key: 'list', value: id, operator: '=='}],
operator: '&'
}
});
}
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.bindEventOnce({ $list.bindEventOnce({
load: function(data) { load: function(data) {