forked from 0x2620/pandora
fix collection dubplication
This commit is contained in:
parent
7fa2a8a338
commit
addce75323
3 changed files with 37 additions and 11 deletions
|
@ -391,7 +391,7 @@ pandora.ui.folderList = function(id, section) {
|
||||||
},
|
},
|
||||||
key_control_d: function() {
|
key_control_d: function() {
|
||||||
if (that.options('selected').length) {
|
if (that.options('selected').length) {
|
||||||
pandora.addFolderItem(ui.section, ui._list);
|
pandora.addFolderItem(ui.section, ui.section == 'documents' ? ui._collection : ui._list);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key_control_e: function() {
|
key_control_e: function() {
|
||||||
|
|
|
@ -52,13 +52,13 @@ pandora.ui.folders = function(section) {
|
||||||
[Ox._(folderItem)]),
|
[Ox._(folderItem)]),
|
||||||
keyboard: 'shift control n',
|
keyboard: 'shift control n',
|
||||||
disabled: ui.section == 'documents'
|
disabled: ui.section == 'documents'
|
||||||
? ui.collectionSelection == 0
|
? ui.collectionSelection.length == 0
|
||||||
: ui.listSelection.length == 0
|
: ui.listSelection.length == 0
|
||||||
},
|
},
|
||||||
{ id: 'newsmartlist', title: Ox._('New Smart {0}', [Ox._(folderItem)]), keyboard: 'alt control n' },
|
{ id: 'newsmartlist', title: Ox._('New Smart {0}', [Ox._(folderItem)]), keyboard: 'alt control n' },
|
||||||
{ id: 'newsmartlistfromresults', title: Ox._('New Smart {0} from Results', [Ox._(folderItem)]), keyboard: 'shift alt control n' },
|
{ id: 'newsmartlistfromresults', title: Ox._('New Smart {0} from Results', [Ox._(folderItem)]), keyboard: 'shift alt control n' },
|
||||||
{},
|
{},
|
||||||
{ id: 'duplicatelist', title: Ox._('Duplicate Selected {0}', [Ox._(folderItem)]), keyboard: 'control d', disabled: !ui._list },
|
{ id: 'duplicatelist', title: Ox._('Duplicate Selected {0}', [Ox._(folderItem)]), keyboard: 'control d', disabled: ui.section == 'documents' ? !ui._collection : !ui._list },
|
||||||
{ id: 'editlist', title: Ox._('Edit Selected {0}...', [Ox._(folderItem)]), keyboard: 'control e', disabled: !editable },
|
{ id: 'editlist', title: Ox._('Edit Selected {0}...', [Ox._(folderItem)]), keyboard: 'control e', disabled: !editable },
|
||||||
{ id: 'deletelist', title: Ox._('Delete Selected {0}...', [Ox._(folderItem)]), keyboard: 'delete', disabled: !editable }
|
{ id: 'deletelist', title: Ox._('Delete Selected {0}...', [Ox._(folderItem)]), keyboard: 'delete', disabled: !editable }
|
||||||
],
|
],
|
||||||
|
@ -75,13 +75,18 @@ pandora.ui.folders = function(section) {
|
||||||
], data.id)) {
|
], data.id)) {
|
||||||
pandora.addList(data.id.indexOf('smart') > -1, data.id.indexOf('from') > -1);
|
pandora.addList(data.id.indexOf('smart') > -1, data.id.indexOf('from') > -1);
|
||||||
} else if (data.id == 'duplicatelist') {
|
} else if (data.id == 'duplicatelist') {
|
||||||
pandora.addList(ui._list);
|
pandora.addList(ui.section == 'documents' ? ui._collection : ui._list);
|
||||||
} else if (data.id == 'editlist') {
|
} else if (data.id == 'editlist') {
|
||||||
pandora.ui.listDialog().open();
|
pandora.ui.listDialog().open();
|
||||||
} else if (data.id == 'deletelist') {
|
} else if (data.id == 'deletelist') {
|
||||||
pandora.ui.deleteListDialog().open();
|
pandora.ui.deleteListDialog().open();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
pandora_collectionselection: function(data) {
|
||||||
|
pandora.$ui.personalListsMenu[
|
||||||
|
data.value.length ? 'enableItem' : 'disableItem'
|
||||||
|
]('newlistfromselection');
|
||||||
|
},
|
||||||
pandora_find: function() {
|
pandora_find: function() {
|
||||||
// fixme: duplicated
|
// fixme: duplicated
|
||||||
var action = ui._list
|
var action = ui._list
|
||||||
|
@ -96,6 +101,20 @@ pandora.ui.folders = function(section) {
|
||||||
ui.listSelection.length ? 'enableItem' : 'disableItem'
|
ui.listSelection.length ? 'enableItem' : 'disableItem'
|
||||||
]('newlistfromselection');
|
]('newlistfromselection');
|
||||||
},
|
},
|
||||||
|
pandora_finddocuments: function() {
|
||||||
|
// fixme: duplicated
|
||||||
|
var action = ui._collection
|
||||||
|
&& pandora.getListData(ui._collection).user == pandora.user.username
|
||||||
|
? 'enableItem' : 'disableItem'
|
||||||
|
pandora.$ui.personalListsMenu[
|
||||||
|
ui._collection ? 'enableItem' : 'disableItem'
|
||||||
|
]('duplicatelist');
|
||||||
|
pandora.$ui.personalListsMenu[action]('editlist');
|
||||||
|
pandora.$ui.personalListsMenu[action]('deletelist');
|
||||||
|
pandora.$ui.personalListsMenu[
|
||||||
|
ui.collectionSelection.length ? 'enableItem' : 'disableItem'
|
||||||
|
]('newlistfromselection');
|
||||||
|
},
|
||||||
pandora_listselection: function(data) {
|
pandora_listselection: function(data) {
|
||||||
pandora.$ui.personalListsMenu[
|
pandora.$ui.personalListsMenu[
|
||||||
data.value.length ? 'enableItem' : 'disableItem'
|
data.value.length ? 'enableItem' : 'disableItem'
|
||||||
|
|
|
@ -81,18 +81,28 @@ pandora.addFolderItem = function(section) {
|
||||||
data.description = result.data.items[0].description;
|
data.description = result.data.items[0].description;
|
||||||
if (data.type == 'static') {
|
if (data.type == 'static') {
|
||||||
var query;
|
var query;
|
||||||
if (isItems) {
|
if (Ox.contains(['items', 'documents'], section)) {
|
||||||
query = {
|
query = {
|
||||||
conditions: [{
|
conditions: [{
|
||||||
key: 'list',
|
key: {
|
||||||
|
items: 'list',
|
||||||
|
documents: 'collection'
|
||||||
|
}[section],
|
||||||
operator: '==',
|
operator: '==',
|
||||||
value: list
|
value: list
|
||||||
}],
|
}],
|
||||||
operator: '&'
|
operator: '&'
|
||||||
};
|
};
|
||||||
pandora.api.find({query: query}, function(result) {
|
|
||||||
|
pandora.api[{
|
||||||
|
items: 'find',
|
||||||
|
documents: 'findDocuments'
|
||||||
|
}[section]]({query: query}, function(result) {
|
||||||
if (result.data.items) {
|
if (result.data.items) {
|
||||||
pandora.api.find({
|
pandora.api[{
|
||||||
|
items: 'find',
|
||||||
|
documents: 'findDocuments'
|
||||||
|
}[section]]({
|
||||||
query: query,
|
query: query,
|
||||||
keys: ['id'],
|
keys: ['id'],
|
||||||
sort: [{key: 'id', operator: ''}],
|
sort: [{key: 'id', operator: ''}],
|
||||||
|
@ -107,9 +117,6 @@ pandora.addFolderItem = function(section) {
|
||||||
addList();
|
addList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if(section == 'documents') {
|
|
||||||
//fixme
|
|
||||||
addList();
|
|
||||||
} else {
|
} else {
|
||||||
pandora.api.getEdit({
|
pandora.api.getEdit({
|
||||||
id: list,
|
id: list,
|
||||||
|
|
Loading…
Reference in a new issue