From 541de3b558e661de37da7dce5673e989468eca42 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 3 Mar 2013 11:35:25 +0530 Subject: [PATCH] fix folder lists --- static/js/pandora/allItems.js | 30 ++++++++++++++++++++------ static/js/pandora/folderBrowserList.js | 17 ++++++++++----- static/js/pandora/folderList.js | 21 ++++++++++++------ static/js/pandora/utils.js | 19 +++++++++------- 4 files changed, 60 insertions(+), 27 deletions(-) diff --git a/static/js/pandora/allItems.js b/static/js/pandora/allItems.js index 1f9469c9d..f794ebf94 100644 --- a/static/js/pandora/allItems.js +++ b/static/js/pandora/allItems.js @@ -37,12 +37,13 @@ pandora.ui.allItems = function() { overflow: 'hidden', whiteSpace: 'nowrap' }) - .html(pandora.user.ui.section == 'items' ? 'All ' + pandora.site.itemName.plural - : pandora.site.site.name + ' ' + Ox.toTitleCase(pandora.user.ui.section)) + .html( + pandora.user.ui.section == 'items' + ? 'All ' + pandora.site.itemName.plural + : pandora.site.site.name + ' ' + Ox.toTitleCase(pandora.user.ui.section) + ) .appendTo(that), - $items, - $clickButton, - $uploadButton; + $items; if (pandora.user.ui.section == 'items') { $items = $('
') @@ -53,14 +54,14 @@ pandora.ui.allItems = function() { textAlign: 'right' }) .appendTo(that); - $clickButton = Ox.Button({ + Ox.Button({ style: 'symbol', title: 'click', type: 'image' }) .css({opacity: 0.25}) .appendTo(that); - $uploadButton = Ox.Button({ + Ox.Button({ style: 'symbol', title: 'upload', type: 'image' @@ -71,6 +72,21 @@ pandora.ui.allItems = function() { }, function(result) { that.update(result.data.items); }); + } else if (pandora.user.ui.section == 'text') { + Ox.Button({ + style: 'symbol', + title: 'file', + tooltip: 'HTML', + type: 'image' + }) + .appendTo(that); + Ox.Button({ + style: 'symbol', + title: 'help', + tooltip: 'Help', + type: 'image' + }) + .appendTo(that); } that.update = function(items) { diff --git a/static/js/pandora/folderBrowserList.js b/static/js/pandora/folderBrowserList.js index 3580f7584..3635c25dc 100644 --- a/static/js/pandora/folderBrowserList.js +++ b/static/js/pandora/folderBrowserList.js @@ -75,24 +75,31 @@ pandora.ui.folderBrowserList = function(id) { format: function(value, data) { return $('') .attr({ - src: Ox.UI.getImageURL(value == 'smart' ? 'symbolFind' : value == 'pdf' ? 'symbolFiles' : value == 'html' ? 'symbolFile' : 'symbolClick') + src: Ox.UI.getImageURL( + value == 'static' ? 'symbolClick' + : value == 'smart' ? 'symbolFind' + : value == 'html' ? 'symbolFile' + : 'symbolBook' + ) }) .css({ width: '10px', height: '10px', padding: '3px', - opacity: data.user == pandora.user.username ? 1 : 0.25 + opacity: pandora.user.ui.section == 'items' && data.user == pandora.user.username ? 1 : 0.25 }); }, id: 'type', operator: '+', titleImage: 'edit', tooltip: function(data) { - return data.type == 'smart' + return data.type == 'static' + ? (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...') + : data.type == 'smart' ? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query') - : (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...'); + : data.type.toUpperCase(); }, - visible: ui.section == 'items', + visible: true, width: 16 }, { diff --git a/static/js/pandora/folderList.js b/static/js/pandora/folderList.js index 819611f49..a1ead529d 100644 --- a/static/js/pandora/folderList.js +++ b/static/js/pandora/folderList.js @@ -45,7 +45,7 @@ pandora.ui.folderList = function(id) { visible: id == 'favorite', // fixme: user and name are set to the same width here, // but resizeFolders will set them to different widths - width: ui.sidebarWidth - 96 + width: ui.sidebarWidth - (ui.section == 'items' ? 96 : 48) }, { editable: function(data) { @@ -64,14 +64,14 @@ pandora.ui.folderList = function(id) { return Ox.decodeHTMLEntities(value); }, visible: id != 'favorite', - width: ui.sidebarWidth - 96 + width: ui.sidebarWidth - (ui.section == 'items' ? 96 : 48) }, { align: 'right', id: 'items', format: {type: 'number'}, operator: '-', - visible: true, + visible: ui.section == 'items', width: 48 }, { @@ -81,21 +81,28 @@ pandora.ui.folderList = function(id) { format: function(value, data) { return $('') .attr({ - src: Ox.UI.getImageURL(value == 'smart' ? 'symbolFind' : value == 'pdf' ? 'symbolBook' : value == 'html' ? 'symbolFile' : 'symbolClick') + src: Ox.UI.getImageURL( + value == 'static' ? 'symbolClick' + : value == 'smart' ? 'symbolFind' + : value == 'html' ? 'symbolFile' + : 'symbolBook' + ) }) .css({ width: '10px', height: '10px', padding: '3px', - opacity: data.user == pandora.user.username ? 1 : 0.25 + opacity: pandora.user.ui.section == 'items' && data.user == pandora.user.username ? 1 : 0.25 }); }, id: 'type', operator: '+', tooltip: function(data) { - return data.type == 'smart' + return data.type == 'static' + ? (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...') + : data.type == 'smart' ? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query') - : (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...'); + : data.type.toUpperCase(); }, visible: true, width: 16 diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 867a18692..550b01d0c 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -1232,13 +1232,13 @@ pandora.resizeFilters = function(width) { }; pandora.resizeFolders = function() { - var width = pandora.getFoldersWidth(), - columnWidth = {}, - sectionWidth = pandora.user.ui.section == 'items'? 96 : 32; - columnWidth = {user: parseInt((width - (sectionWidth)) * 0.4)}; - columnWidth.name = (width - sectionWidth) - columnWidth.user; - Ox.Log('', 'RESIZE FOLDERS', width); - pandora.$ui.allItems.resizeElement(width - 104); + var width = pandora.getFoldersWidth() - ( + pandora.user.ui.section == 'items' ? 96 : 32 + ), + columnWidth = {}; + columnWidth.user = Math.round(width * 0.4); + columnWidth.name = width - columnWidth.user; + pandora.$ui.allItems.resizeElement(width - 8); Ox.forEach(pandora.$ui.folderList, function($list, id) { var pos = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id); pandora.$ui.folder[pos].css({width: width + 'px'}); @@ -1250,7 +1250,10 @@ pandora.resizeFolders = function() { $list.resizeColumn('user', columnWidth.user) .resizeColumn('name', columnWidth.name); } else { - $list.resizeColumn(id == 'favorite' ? 'id' : 'name', width - 96); + $list.resizeColumn( + id == 'favorite' ? 'id' : 'name', + width - (pandora.user.ui.section == 'items' ? 96 : 48) + ); } if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) { pandora.$ui.folder[pos].updatePanel();