add tooltip to lists; bugfixes for drag and drop

This commit is contained in:
rlx 2011-08-28 19:50:38 +00:00
parent e83f89df63
commit e501717300
6 changed files with 45 additions and 14 deletions

View File

@ -61,10 +61,15 @@ pandora.getGroupsSizes = function() {
};
pandora.getListData = function() {
var data = {};
Ox.print('getListData ............')
var data = {}, folder;
if (pandora.user.ui.list) {
var folder = pandora.$ui.folderList['personal'].options('selected')[0] ==
pandora.user.ui.list ? 'personal' : 'featured';
Ox.forEach(pandora.$ui.folderList, function(list, key) {
if (list.options('selected').length) {
folder = key;
return false;
}
});
data = pandora.$ui.folderList[folder].value(pandora.user.ui.list);
}
data.editable = data.user == pandora.user.username && data.type == 'static';
@ -218,7 +223,7 @@ pandora.resizeFolders = function() {
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
pandora.$ui.folder[i].css({width: width + 'px'});
$list.css({width: width + 'px'});
Ox.print('...', id, $list.options())
Ox.print('...', width, id, $list.options())
if (pandora.user.ui.section == 'site') {
$list.resizeColumn('title', columnWidth.title);
} else if (pandora.user.ui.section == 'items') {

View File

@ -52,16 +52,16 @@ pandora.ui.folderBrowserList = function(id) {
clickable: function(data) {
return data.type == 'smart';
},
format: function(value) {
format: function(value, data) {
return $('<img>')
.attr({
src: Ox.UI.getImageURL('symbolFind')
src: Ox.UI.getImageURL(value == 'static' ? 'symbolClick' : 'symbolFind')
})
.css({
width: '10px',
height: '10px',
padding: '3px 2px 1px 2px', // fixme: strange
opacity: value == 'static' ? 0.1 : 1
opacity: data.user == pandora.user.username ? 1 : 0.25
});
},
id: 'type',
@ -75,6 +75,11 @@ pandora.ui.folderBrowserList = function(id) {
height: '10px',
padding: '3px 2px 1px 2px',
}),
tooltip: function(data) {
return data.type == 'smart'
? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query')
: '';
},
visible: true,
width: 16
},
@ -91,8 +96,9 @@ pandora.ui.folderBrowserList = function(id) {
width: '10px',
height: '10px',
padding: '3px 2px 1px 2px',
opacity: id == 'favorite' ? (value ? 1 : 0.1) :
(value == 'featured' ? 1 : 0.1)
opacity: id == 'favorite'
? (value ? 1 : 0.1)
: (value == 'featured' ? 1 : 0.1)
});
},
id: id == 'favorite' ? 'subscribed' : 'status',
@ -108,6 +114,11 @@ pandora.ui.folderBrowserList = function(id) {
height: '10px',
padding: '3px 2px 1px 2px'
}),
tooltip: function(data) {
var checked = id == 'favorite' ? data.subscribed : data.status == 'featured';
return (checked ? 'Remove from' : 'Add to')
+ ' ' + Ox.toTitleCase(id) + ' Lists';
},
visible: true,
width: 16
},

View File

@ -13,7 +13,7 @@ pandora.ui.folders = function() {
pandora.$ui.folderBrowser = {};
pandora.$ui.folderList = {};
if (pandora.user.ui.section == 'site') {
$.each(pandora.site.sectionFolders.site, function(i, folder) {
pandora.site.sectionFolders.site.forEach(function(folder, i) {
var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16);
pandora.$ui.folder[i] = Ox.CollapsePanel({
id: folder.id,
@ -42,7 +42,7 @@ pandora.ui.folders = function() {
});
//pandora.resizeFolders();
} else if (pandora.user.ui.section == 'items') {
$.each(pandora.site.sectionFolders.items, function(i, folder) {
pandora.site.sectionFolders.items.forEach(function(folder, i) {
var extras = [];
if (folder.id == 'personal' && pandora.user.level != 'guest') {
extras = [Ox.Select({

View File

@ -80,6 +80,7 @@ pandora.ui.folderList = function(id) {
autovalidate: pandora.ui.autovalidateListname
},
operator: '+',
tooltip: id == 'personal' ? 'Edit Title' : null,
visible: id != 'favorite',
width: pandora.user.ui.sidebarWidth - 88
},
@ -94,20 +95,25 @@ pandora.ui.folderList = function(id) {
clickable: function(data) {
return data.type == 'smart';
},
format: function(value) {
format: function(value, data) {
return $('<img>')
.attr({
src: Ox.UI.getImageURL('symbolFind')
src: Ox.UI.getImageURL(value == 'static' ? 'symbolClick' : 'symbolFind')
})
.css({
width: '10px',
height: '10px',
padding: '3px 2px 1px 2px',
opacity: value == 'static' ? 0.1 : 1
opacity: data.user == pandora.user.username ? 1 : 0.25
});
},
id: 'type',
operator: '+',
tooltip: function(data) {
return data.type == 'smart'
? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query')
: '';
},
visible: true,
width: 16
},
@ -130,6 +136,9 @@ pandora.ui.folderList = function(id) {
},
id: 'status',
operator: '+',
tooltip: id == 'personal' ? function(data) {
return data.status == 'private' ? 'Make Public' : 'Make Private';
} : null,
visible: true,
width: 16
}

View File

@ -464,10 +464,12 @@ pandora.ui.list = function() { // fixme: remove view argument
['list', 'icons'].indexOf(view) > -1 && that.bind({
dragstart: function(e) {
Ox.print('DRAGSTART');
var editable = pandora.getListData().editable,
ids = that.options('selected'),
item = ids.length == 1 ? that.value(ids[0], 'title') : ids.length;
Ox.forEach(pandora.$ui.folderList, function($list, i) {
Ox.print('FOLDERLIST', i)
$list.find('.OxItem').each(function() {
var $item = $(this),
data = $list.value($item.data('id'));
@ -539,6 +541,7 @@ pandora.ui.list = function() { // fixme: remove view argument
setTimeout(function() {
$this.removeClass('OxDragover');
}, 250);
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
return false;
}

View File

@ -139,6 +139,9 @@ pandora.ui.mainMenu = function() {
{},
{ id: 'users', title: 'Manage Users...' },
{ id: 'lists', title: 'Manage Lists...' },
{},
{ id: 'news', title: 'Manage News...' },
{ id: 'tour', title: 'Manage Tour...' }
] },
{ id: 'helpMenu', title: 'Help', items: [
{ id: 'help', title: pandora.site.site.name + ' Help', keyboard: 'shift ?' }