fix folder lists

This commit is contained in:
rolux 2013-03-03 11:35:25 +05:30
parent 90a0fc6309
commit 541de3b558
4 changed files with 60 additions and 27 deletions

View file

@ -37,12 +37,13 @@ pandora.ui.allItems = function() {
overflow: 'hidden', overflow: 'hidden',
whiteSpace: 'nowrap' whiteSpace: 'nowrap'
}) })
.html(pandora.user.ui.section == 'items' ? 'All ' + pandora.site.itemName.plural .html(
: pandora.site.site.name + ' ' + Ox.toTitleCase(pandora.user.ui.section)) pandora.user.ui.section == 'items'
? 'All ' + pandora.site.itemName.plural
: pandora.site.site.name + ' ' + Ox.toTitleCase(pandora.user.ui.section)
)
.appendTo(that), .appendTo(that),
$items, $items;
$clickButton,
$uploadButton;
if (pandora.user.ui.section == 'items') { if (pandora.user.ui.section == 'items') {
$items = $('<div>') $items = $('<div>')
@ -53,14 +54,14 @@ pandora.ui.allItems = function() {
textAlign: 'right' textAlign: 'right'
}) })
.appendTo(that); .appendTo(that);
$clickButton = Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',
title: 'click', title: 'click',
type: 'image' type: 'image'
}) })
.css({opacity: 0.25}) .css({opacity: 0.25})
.appendTo(that); .appendTo(that);
$uploadButton = Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',
title: 'upload', title: 'upload',
type: 'image' type: 'image'
@ -71,6 +72,21 @@ pandora.ui.allItems = function() {
}, function(result) { }, function(result) {
that.update(result.data.items); 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) { that.update = function(items) {

View file

@ -75,24 +75,31 @@ pandora.ui.folderBrowserList = function(id) {
format: function(value, data) { format: function(value, data) {
return $('<img>') return $('<img>')
.attr({ .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({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px', 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', id: 'type',
operator: '+', operator: '+',
titleImage: 'edit', titleImage: 'edit',
tooltip: function(data) { 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 Query' : 'Show Query')
: (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...'); : data.type.toUpperCase();
}, },
visible: ui.section == 'items', visible: true,
width: 16 width: 16
}, },
{ {

View file

@ -45,7 +45,7 @@ pandora.ui.folderList = function(id) {
visible: id == 'favorite', visible: id == 'favorite',
// fixme: user and name are set to the same width here, // fixme: user and name are set to the same width here,
// but resizeFolders will set them to different widths // but resizeFolders will set them to different widths
width: ui.sidebarWidth - 96 width: ui.sidebarWidth - (ui.section == 'items' ? 96 : 48)
}, },
{ {
editable: function(data) { editable: function(data) {
@ -64,14 +64,14 @@ pandora.ui.folderList = function(id) {
return Ox.decodeHTMLEntities(value); return Ox.decodeHTMLEntities(value);
}, },
visible: id != 'favorite', visible: id != 'favorite',
width: ui.sidebarWidth - 96 width: ui.sidebarWidth - (ui.section == 'items' ? 96 : 48)
}, },
{ {
align: 'right', align: 'right',
id: 'items', id: 'items',
format: {type: 'number'}, format: {type: 'number'},
operator: '-', operator: '-',
visible: true, visible: ui.section == 'items',
width: 48 width: 48
}, },
{ {
@ -81,21 +81,28 @@ pandora.ui.folderList = function(id) {
format: function(value, data) { format: function(value, data) {
return $('<img>') return $('<img>')
.attr({ .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({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px', 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', id: 'type',
operator: '+', operator: '+',
tooltip: function(data) { 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 Query' : 'Show Query')
: (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...'); : data.type.toUpperCase();
}, },
visible: true, visible: true,
width: 16 width: 16

View file

@ -1232,13 +1232,13 @@ pandora.resizeFilters = function(width) {
}; };
pandora.resizeFolders = function() { pandora.resizeFolders = function() {
var width = pandora.getFoldersWidth(), var width = pandora.getFoldersWidth() - (
columnWidth = {}, pandora.user.ui.section == 'items' ? 96 : 32
sectionWidth = pandora.user.ui.section == 'items'? 96 : 32; ),
columnWidth = {user: parseInt((width - (sectionWidth)) * 0.4)}; columnWidth = {};
columnWidth.name = (width - sectionWidth) - columnWidth.user; columnWidth.user = Math.round(width * 0.4);
Ox.Log('', 'RESIZE FOLDERS', width); columnWidth.name = width - columnWidth.user;
pandora.$ui.allItems.resizeElement(width - 104); pandora.$ui.allItems.resizeElement(width - 8);
Ox.forEach(pandora.$ui.folderList, function($list, id) { Ox.forEach(pandora.$ui.folderList, function($list, id) {
var pos = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id); var pos = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id);
pandora.$ui.folder[pos].css({width: width + 'px'}); pandora.$ui.folder[pos].css({width: width + 'px'});
@ -1250,7 +1250,10 @@ pandora.resizeFolders = function() {
$list.resizeColumn('user', columnWidth.user) $list.resizeColumn('user', columnWidth.user)
.resizeColumn('name', columnWidth.name); .resizeColumn('name', columnWidth.name);
} else { } 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]) { if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) {
pandora.$ui.folder[pos].updatePanel(); pandora.$ui.folder[pos].updatePanel();