documents panel: remove add button, update menu

This commit is contained in:
rolux 2014-01-16 05:37:06 +00:00
parent 49057ac14a
commit 634b8f799b

View file

@ -105,30 +105,6 @@ pandora.ui.documentsPanel = function(options) {
$listBar = Ox.Bar({size: 24}), $listBar = Ox.Bar({size: 24}),
$addButton = (isItemView ? Ox.Button({
title: 'add',
tooltip: Ox._(
'Add Documents... {0}',
['<span class="OxBright">' + Ox.UI.symbols.control + 'N</span>']
),
type: 'image'
}) : Ox.FileButton({
image: 'upload',
tooltip: Ox._('Upload Documents...'),
type: 'image'
}))
.css({float: 'left', margin: '4px 2px 4px 4px'})
.bindEvent({
click: function(data) {
if (isItemView) {
openDocumentsDialog();
} else {
uploadDocuments(data);
}
}
})
.appendTo($listBar),
$viewSelect = Ox.Select({ $viewSelect = Ox.Select({
items: [ items: [
{id: 'list', title: Ox._('View as List')}, {id: 'list', title: Ox._('View as List')},
@ -137,7 +113,7 @@ pandora.ui.documentsPanel = function(options) {
value: ui.documentsView, value: ui.documentsView,
width: 128 width: 128
}) })
.css({float: 'left', margin: '4px 2px'}) .css({float: 'left', margin: '4px 2px 4px 4px'})
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
pandora.UI.set({documentsView: data.value}); pandora.UI.set({documentsView: data.value});
@ -265,7 +241,7 @@ pandora.ui.documentsPanel = function(options) {
{}, {},
{id: 'remove', title: '', keyboard: 'delete'} {id: 'remove', title: '', keyboard: 'delete'}
] : [ ] : [
{id: 'upload', title: Ox._('Upload Documents...')}, {id: 'upload', title: Ox._('Upload Documents...'), file: {width: 192}},
{}, {},
{id: 'open', title: '', keyboard: 'return'}, {id: 'open', title: '', keyboard: 'return'},
{id: 'add', title: ''}, {id: 'add', title: ''},
@ -282,6 +258,8 @@ pandora.ui.documentsPanel = function(options) {
click: function(data) { click: function(data) {
if (data.id == 'add') { if (data.id == 'add') {
isItemView ? openDocumentsDialog() : addDocuments(); isItemView ? openDocumentsDialog() : addDocuments();
} else if (data.id == 'upload') {
uploadDocuments(data);
} else if (data.id == 'open') { } else if (data.id == 'open') {
openDocuments(); openDocuments();
} else if (data.id == 'edit') { } else if (data.id == 'edit') {
@ -746,6 +724,7 @@ pandora.ui.documentsPanel = function(options) {
)) ))
.setItemTitle('replace', Ox._('Replace ' + string + '...')) .setItemTitle('replace', Ox._('Replace ' + string + '...'))
.setItemTitle('delete', Ox._('Delete ' + string + '...')) .setItemTitle('delete', Ox._('Delete ' + string + '...'))
[selected.length > 0 ? 'enableItem' : 'disableItem']('add');
[selected.length == 1 ? 'enableItem' : 'disableItem']('replace') [selected.length == 1 ? 'enableItem' : 'disableItem']('replace')
[selected.length > 0 ? 'enableItem' : 'disableItem']('delete'); [selected.length > 0 ? 'enableItem' : 'disableItem']('delete');
} }