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',
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 = $('<div>')
@ -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) {

View File

@ -75,24 +75,31 @@ pandora.ui.folderBrowserList = function(id) {
format: function(value, data) {
return $('<img>')
.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
},
{

View File

@ -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 $('<img>')
.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

View File

@ -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();