add find-as-you-type to list browsers

This commit is contained in:
rlx 2011-09-01 07:43:32 +00:00
parent 4ebdec39cb
commit 5f4eecb8d0
3 changed files with 9 additions and 7 deletions

View File

@ -3,7 +3,6 @@ pandora.ui.folderBrowserBar = function(id) {
var that = Ox.Bar({ var that = Ox.Bar({
size: 24 size: 24
}); });
Ox.print('ID', id)
pandora.$ui.findListElement[id] = Ox.FormElementGroup({ pandora.$ui.findListElement[id] = Ox.FormElementGroup({
elements: [ elements: [
pandora.$ui.findListSelect[id] = Ox.Select({ pandora.$ui.findListSelect[id] = Ox.Select({
@ -22,12 +21,14 @@ pandora.ui.folderBrowserBar = function(id) {
} }
}), }),
pandora.$ui.findListInput[id] = Ox.Input({ pandora.$ui.findListInput[id] = Ox.Input({
changeOnKeypress: true,
clear: true, clear: true,
placeholder: 'Find: User', placeholder: 'Find: User',
width: pandora.getFoldersWidth() - 24 width: pandora.getFoldersWidth() - 24
}) })
.bindEvent({ .bindEvent({
submit: function(data) { change: function(data) {
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({ pandora.$ui.folderList[id].options({
@ -55,6 +56,7 @@ pandora.ui.folderBrowserBar = function(id) {
align: 'right' align: 'right'
}) })
.appendTo(that); .appendTo(that);
return that; return that;
}; };

View File

@ -55,7 +55,7 @@ pandora.ui.folderBrowserList = function(id) {
}, },
{ {
clickable: function(data) { clickable: function(data) {
return data.type == 'smart'; return data.type == 'smart' || data.user == pandora.user.username;
}, },
format: function(value, data) { format: function(value, data) {
return $('<img>') return $('<img>')
@ -83,7 +83,7 @@ pandora.ui.folderBrowserList = function(id) {
tooltip: function(data) { tooltip: function(data) {
return data.type == 'smart' return data.type == 'smart'
? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query') ? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query')
: ''; : (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...');
}, },
visible: true, visible: true,
width: 16 width: 16

View File

@ -42,7 +42,7 @@ pandora.ui.folderList = function(id) {
autovalidate: pandora.ui.autovalidateListname autovalidate: pandora.ui.autovalidateListname
}, },
operator: '+', operator: '+',
tooltip: id == 'personal' ? 'Edit Title' : null, tooltip: id == 'personal' ? 'Edit Title' : '',
visible: id != 'favorite', visible: id != 'favorite',
width: pandora.user.ui.sidebarWidth - 96 width: pandora.user.ui.sidebarWidth - 96
}, },
@ -56,7 +56,7 @@ pandora.ui.folderList = function(id) {
}, },
{ {
clickable: function(data) { clickable: function(data) {
return data.type == 'smart'; return data.type == 'smart' || data.user == pandora.user.username;
}, },
format: function(value, data) { format: function(value, data) {
return $('<img>') return $('<img>')
@ -75,7 +75,7 @@ pandora.ui.folderList = function(id) {
tooltip: function(data) { tooltip: function(data) {
return data.type == 'smart' return data.type == 'smart'
? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query') ? (data.user == pandora.user.username ? 'Edit Query' : 'Show Query')
: ''; : (data.user == pandora.user.username ? 'Edit Default View' : 'Default View: ...');
}, },
visible: true, visible: true,
width: 16 width: 16