From 545d5c4dc8054aa64b4a03e2fa2c602b8939be4a Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 1 Sep 2011 09:17:49 +0000 Subject: [PATCH] some improvements to list folders --- static/js/pandora/ui/folderBrowserBar.js | 37 +++++++++++++---------- static/js/pandora/ui/folderBrowserList.js | 12 ++++---- static/js/pandora/ui/foldersList.js | 10 +++--- static/js/pandora/ui/list.js | 2 ++ 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/static/js/pandora/ui/folderBrowserBar.js b/static/js/pandora/ui/folderBrowserBar.js index 9450e668..17fedc87 100644 --- a/static/js/pandora/ui/folderBrowserBar.js +++ b/static/js/pandora/ui/folderBrowserBar.js @@ -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; }; diff --git a/static/js/pandora/ui/folderBrowserList.js b/static/js/pandora/ui/folderBrowserList.js index 19e2e773..d8de5785 100644 --- a/static/js/pandora/ui/folderBrowserList.js +++ b/static/js/pandora/ui/folderBrowserList.js @@ -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'; diff --git a/static/js/pandora/ui/foldersList.js b/static/js/pandora/ui/foldersList.js index 543887c2..9b4a45c0 100644 --- a/static/js/pandora/ui/foldersList.js +++ b/static/js/pandora/ui/foldersList.js @@ -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', diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 18a7dd3a..aaa721fa 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -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,