documents panel: update menu

This commit is contained in:
rolux 2014-01-16 02:44:39 +00:00
parent b626bbf360
commit dfce5b4d88

View file

@ -113,8 +113,7 @@ pandora.ui.documentsPanel = function(options) {
image: 'upload', image: 'upload',
tooltip: Ox._('Upload Documents...'), tooltip: Ox._('Upload Documents...'),
type: 'image' type: 'image'
}) }))
)
.css({float: 'left', margin: '4px 2px 4px 4px'}) .css({float: 'left', margin: '4px 2px 4px 4px'})
.bindEvent({ .bindEvent({
click: function(data) { click: function(data) {
@ -256,11 +255,12 @@ pandora.ui.documentsPanel = function(options) {
items: isItemView ? [ items: isItemView ? [
{id: 'open', title: '', keyboard: 'return'}, {id: 'open', title: '', keyboard: 'return'},
{id: 'edit', title: ''}, {id: 'edit', title: ''},
{},
{id: 'remove', title: '', keyboard: 'delete'} {id: 'remove', title: '', keyboard: 'delete'}
] : [ ] : [
{id: 'open', title: '', keyboard: 'return'}, {id: 'open', title: '', keyboard: 'return'},
{id: 'addtoitem', title: ''}, {id: 'add', title: ''},
{id: 'addtolist', title: ''}, {},
{id: 'replace', title: Ox._('Replace Document...')}, {id: 'replace', title: Ox._('Replace Document...')},
{id: 'delete', title: '', keyboard: 'delete'} {id: 'delete', title: '', keyboard: 'delete'}
], ],
@ -271,16 +271,13 @@ pandora.ui.documentsPanel = function(options) {
.css({float: 'left', margin: '4px'}) .css({float: 'left', margin: '4px'})
.bindEvent({ .bindEvent({
click: function(data) { click: function(data) {
if (data.id == 'addtoitem') { if (data.id == 'add') {
addToItem(); addDocuments();
} else if (data.id == 'addtolist') {
addToList();
} else if (data.id == 'open') { } else if (data.id == 'open') {
openDocuments(); openDocuments();
} else if (data.id == 'edit') { } else if (data.id == 'edit') {
editDocuments(); editDocuments();
} else if (data.id == 'replace') { } else if (data.id == 'replace') {
console.log('replace', data);
replaceDocument(data.files); replaceDocument(data.files);
} else if (data.id == 'remove') { } else if (data.id == 'remove') {
removeDocuments(); removeDocuments();
@ -400,10 +397,6 @@ pandora.ui.documentsPanel = function(options) {
); );
function addDocuments() { function addDocuments() {
pandora.$ui.documentsDialog = pandora.ui.documentsDialog().open();
}
function addToItem() {
pandora.api.addDocument({ pandora.api.addDocument({
item: ui.item, item: ui.item,
ids: ui.documentsSelection[''] ids: ui.documentsSelection['']
@ -418,21 +411,6 @@ pandora.ui.documentsPanel = function(options) {
}); });
} }
function addToList() {
pandora.api.addDocument({
list: ui._list,
ids: ui.documentsSelection['']
}, function() {
Ox.Request.clearCache();
if (ui.item && ui.itemView == 'documents') {
//fixme just upload list here
//self.$documentsList.reloadList();
pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.item = pandora.ui.item());
}
});
}
function closeDocuments() { function closeDocuments() {
if (pandora.$ui.documentDialog) { if (pandora.$ui.documentDialog) {
pandora.$ui.documentDialog.close(); pandora.$ui.documentDialog.close();
@ -733,13 +711,10 @@ pandora.ui.documentsPanel = function(options) {
$itemMenu.setItemTitle('edit', Ox._('Edit ' + string + '...')) $itemMenu.setItemTitle('edit', Ox._('Edit ' + string + '...'))
.setItemTitle('remove', Ox._('Remove ' + string)); .setItemTitle('remove', Ox._('Remove ' + string));
} else { } else {
$itemMenu.setItemTitle('addtoitem', Ox._( $itemMenu.setItemTitle('add', Ox._(
'Add ' + string + ' to Current ' 'Add ' + string + ' to Current '
+ pandora.site.itemName.singular + pandora.site.itemName.singular
)) ))
.setItemTitle('addtolist', Ox._(
'Add ' + string + ' to All Items in Current List'
))
.setItemTitle('delete', Ox._('Delete ' + string + '...')); .setItemTitle('delete', Ox._('Delete ' + string + '...'));
} }
$itemMenu[selected.length ? 'show' : 'hide'](); $itemMenu[selected.length ? 'show' : 'hide']();