From 634b8f799b1a5c98062486c1aed50538ee4a3ba3 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 16 Jan 2014 05:37:06 +0000 Subject: [PATCH] documents panel: remove add button, update menu --- static/js/documentsPanel.js | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index 92798b91..fe2c8017 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -105,30 +105,6 @@ pandora.ui.documentsPanel = function(options) { $listBar = Ox.Bar({size: 24}), - $addButton = (isItemView ? Ox.Button({ - title: 'add', - tooltip: Ox._( - 'Add Documents... {0}', - ['' + Ox.UI.symbols.control + 'N'] - ), - 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({ items: [ {id: 'list', title: Ox._('View as List')}, @@ -137,7 +113,7 @@ pandora.ui.documentsPanel = function(options) { value: ui.documentsView, width: 128 }) - .css({float: 'left', margin: '4px 2px'}) + .css({float: 'left', margin: '4px 2px 4px 4px'}) .bindEvent({ change: function(data) { pandora.UI.set({documentsView: data.value}); @@ -265,7 +241,7 @@ pandora.ui.documentsPanel = function(options) { {}, {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: 'add', title: ''}, @@ -282,6 +258,8 @@ pandora.ui.documentsPanel = function(options) { click: function(data) { if (data.id == 'add') { isItemView ? openDocumentsDialog() : addDocuments(); + } else if (data.id == 'upload') { + uploadDocuments(data); } else if (data.id == 'open') { openDocuments(); } else if (data.id == 'edit') { @@ -746,6 +724,7 @@ pandora.ui.documentsPanel = function(options) { )) .setItemTitle('replace', Ox._('Replace ' + string + '...')) .setItemTitle('delete', Ox._('Delete ' + string + '...')) + [selected.length > 0 ? 'enableItem' : 'disableItem']('add'); [selected.length == 1 ? 'enableItem' : 'disableItem']('replace') [selected.length > 0 ? 'enableItem' : 'disableItem']('delete'); }