some improvements to list folders

This commit is contained in:
rlx 2011-09-01 09:17:49 +00:00
parent 5f4eecb8d0
commit 12bcb0d4b1
4 changed files with 34 additions and 27 deletions

View file

@ -15,6 +15,9 @@ pandora.ui.folderBrowserBar = function(id) {
}) })
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
var key = data.selected[0].id == 'user' ? 'user' : 'name',
value = pandora.$ui.findListInput[id].value();
value && updateItems(key, value);
pandora.$ui.findListInput[id].options({ pandora.$ui.findListInput[id].options({
placeholder: data.selected[0].title placeholder: data.selected[0].title
}); });
@ -31,21 +34,7 @@ pandora.ui.folderBrowserBar = function(id) {
Ox.print('ID::', id) Ox.print('ID::', id)
var key = pandora.$ui.findListSelect[id].value() == 'user' ? 'user' : 'name', var key = pandora.$ui.findListSelect[id].value() == 'user' ? 'user' : 'name',
value = data.value; value = data.value;
pandora.$ui.folderList[id].options({ updateItems(key, value);
items: function(data, callback) {
var query = id == 'favorite' ? {conditions: [
{key: 'status', value: 'public', operator: '='},
{key: 'user', value: pandora.user.username, operator: '!'},
{key: key, value: value, operator: ''}
], operator: '&'} : {conditions: [
{key: 'status', value: 'private', operator: '!'},
{key: key, value: value, operator: ''}
], operator: '&'};
return pandora.api.findLists(Ox.extend(data, {
query: query
}), callback);
}
});
} }
}) })
], ],
@ -56,7 +45,23 @@ pandora.ui.folderBrowserBar = function(id) {
align: 'right' align: 'right'
}) })
.appendTo(that); .appendTo(that);
function updateItems(key, value) {
pandora.$ui.folderList[id].options({
items: function(data, callback) {
var query = id == 'favorite' ? {conditions: [
{key: 'status', value: 'public', operator: '='},
{key: 'user', value: pandora.user.username, operator: '!'},
{key: key, value: value, operator: ''}
], operator: '&'} : {conditions: [
{key: 'status', value: 'private', operator: '!'},
{key: key, value: value, operator: ''}
], operator: '&'};
return pandora.api.findLists(Ox.extend(data, {
query: query
}), callback);
}
});
}
return that; return that;
}; };

View file

@ -13,7 +13,7 @@ pandora.ui.folderBrowserList = function(id) {
}).css({ }).css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px' padding: '3px'
}); });
}, },
id: 'id', id: 'id',
@ -24,7 +24,7 @@ pandora.ui.folderBrowserList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px', padding: '3px',
}), }),
unique: true, unique: true,
visible: true, visible: true,
@ -65,7 +65,7 @@ pandora.ui.folderBrowserList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px', // fixme: strange padding: '3px',
opacity: data.user == pandora.user.username ? 1 : 0.25 opacity: data.user == pandora.user.username ? 1 : 0.25
}); });
}, },
@ -78,7 +78,7 @@ pandora.ui.folderBrowserList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px', padding: '3px',
}), }),
tooltip: function(data) { tooltip: function(data) {
return data.type == 'smart' return data.type == 'smart'
@ -100,7 +100,7 @@ pandora.ui.folderBrowserList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px', padding: '3px',
opacity: id == 'favorite' opacity: id == 'favorite'
? (value ? 1 : 0.25) ? (value ? 1 : 0.25)
: (value == 'featured' ? 1 : 0.25) : (value == 'featured' ? 1 : 0.25)
@ -117,7 +117,7 @@ pandora.ui.folderBrowserList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px' padding: '3px'
}), }),
tooltip: function(data) { tooltip: function(data) {
var checked = id == 'favorite' ? data.subscribed : data.status == 'featured'; var checked = id == 'favorite' ? data.subscribed : data.status == 'featured';

View file

@ -13,7 +13,7 @@ pandora.ui.folderList = function(id) {
}).css({ }).css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px' padding: '3px'
}); });
}, },
id: 'user', id: 'user',
@ -66,7 +66,7 @@ pandora.ui.folderList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px', padding: '3px',
opacity: data.user == pandora.user.username ? 1 : 0.25 opacity: data.user == pandora.user.username ? 1 : 0.25
}); });
}, },
@ -93,7 +93,7 @@ pandora.ui.folderList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px', padding: '3px',
opacity: value == 'private' ? 0.25 : 1 opacity: value == 'private' ? 0.25 : 1
}) })
}, },
@ -134,7 +134,7 @@ pandora.ui.folderList = function(id) {
}).css({ }).css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px' padding: '3px'
}); });
}, },
id: 'user', id: 'user',
@ -171,7 +171,7 @@ pandora.ui.folderList = function(id) {
.css({ .css({
width: '10px', width: '10px',
height: '10px', height: '10px',
padding: '3px 2px 1px 2px' padding: '3px'
}); });
}, },
id: 'path', id: 'path',

View file

@ -39,6 +39,7 @@ pandora.ui.list = function() { // fixme: remove view argument
columnsRemovable: true, columnsRemovable: true,
columnsResizable: true, columnsResizable: true,
columnsVisible: true, columnsVisible: true,
draggable: true,
id: 'list', id: 'list',
items: function(data, callback) { items: function(data, callback) {
//Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject()) //Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject())
@ -83,6 +84,7 @@ pandora.ui.list = function() { // fixme: remove view argument
that = Ox.IconList({ that = Ox.IconList({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16, borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
draggable: true,
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
var icons = pandora.user.ui.icons, var icons = pandora.user.ui.icons,