folderList: update handlers (add, duplicate, edit)

This commit is contained in:
rolux 2014-02-06 07:49:31 +00:00
parent afde04460d
commit ee6f442b5b

View file

@ -81,7 +81,7 @@ pandora.ui.folderList = function(id, section) {
}, },
{ {
clickable: function(data) { clickable: function(data) {
return section == 'items' && ( return section != 'texts' && (
data.type == 'smart' || data.user == pandora.user.username data.type == 'smart' || data.user == pandora.user.username
); );
}, },
@ -264,7 +264,7 @@ pandora.ui.folderList = function(id, section) {
columns: columns, columns: columns,
droppable: id != 'volumes', droppable: id != 'volumes',
items: items, items: items,
keys: ['modified'].concat(section == 'items' ? ['query'] : ['rightslevel']), keys: ['modified'].concat(section != 'texts' ? ['query'] : ['rightslevel']),
max: 1, max: 1,
min: 0, min: 0,
pageLength: 1000, pageLength: 1000,
@ -284,31 +284,13 @@ pandora.ui.folderList = function(id, section) {
}) })
.bindEvent({ .bindEvent({
add: function(event) { add: function(event) {
// fixme: this is duplicated,
// see folder collapse panel menu handler
if (id == 'personal') { if (id == 'personal') {
if (event.keys == '' || event.keys == 'alt') { if (event.keys == '' || event.keys == 'alt') {
pandora.api.addList({ if (section != 'texts') {
name: Ox._('Untitled'), pandora.addFolderItem(section, event.keys == 'alt', false);
status: 'private', } else {
type: event.keys == '' ? 'static' : 'smart' pandora.addText({type: event.keys == '' ? 'html' : 'pdf'});
}, function(result) { }
var id = result.data.id;
pandora.UI.set({
find: {
conditions: [{key: 'list', value: id, operator: '=='}],
operator: '&'
}
});
Ox.Request.clearCache(); // fixme: remove
that.reloadList().bindEventOnce({
load: function(data) {
that.gainFocus()
.options({selected: [id]})
.editCell(id, 'name');
}
});
});
} }
} else if (id == 'favorite' || (id == 'featured' && canEditFeatured)) { } else if (id == 'favorite' || (id == 'featured' && canEditFeatured)) {
// this makes the button trigger a change event, // this makes the button trigger a change event,
@ -372,11 +354,6 @@ pandora.ui.folderList = function(id, section) {
}); });
} }
}, },
/*
edit: function() {
pandora.ui.listDialog().open();
},
*/
init: function(data) { init: function(data) {
if (pandora.site.sectionFolders[section][i]) { if (pandora.site.sectionFolders[section][i]) {
pandora.site.sectionFolders[section][i].items = data.items; pandora.site.sectionFolders[section][i].items = data.items;
@ -390,6 +367,19 @@ pandora.ui.folderList = function(id, section) {
} }
pandora.resizeFolders(); pandora.resizeFolders();
}, },
key_control_d: function() {
if (that.options('selected').length) {
pandora.addFolderItem(ui.section, ui._list);
}
},
key_control_e: function() {
if (
that.options('selected').length
&& (id == 'personal' || (id == 'featured' && canEditFeatured))
) {
pandora.ui.listDialog().open();
}
},
move: function(data) { move: function(data) {
pandora.api['sort' + folderItems]({ pandora.api['sort' + folderItems]({
section: id, section: id,