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

View file

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

View file

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

View file

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

View file

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

View file

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