some improvements to list folders

This commit is contained in:
rolux 2011-09-01 09:17:49 +00:00
parent d24f4bc05e
commit 545d5c4dc8
4 changed files with 34 additions and 27 deletions

View file

@ -15,6 +15,9 @@ pandora.ui.folderBrowserBar = function(id) {
})
.bindEvent({
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({
placeholder: data.selected[0].title
});
@ -31,21 +34,7 @@ pandora.ui.folderBrowserBar = function(id) {
Ox.print('ID::', id)
var key = pandora.$ui.findListSelect[id].value() == 'user' ? 'user' : 'name',
value = data.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);
}
});
updateItems(key, value);
}
})
],
@ -56,7 +45,23 @@ pandora.ui.folderBrowserBar = function(id) {
align: 'right'
})
.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;
};

View file

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

View file

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

View file

@ -39,6 +39,7 @@ pandora.ui.list = function() { // fixme: remove view argument
columnsRemovable: true,
columnsResizable: true,
columnsVisible: true,
draggable: true,
id: 'list',
items: function(data, callback) {
//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({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
draggable: true,
id: 'list',
item: function(data, sort, size) {
var icons = pandora.user.ui.icons,