update advanced find

This commit is contained in:
rolux 2011-11-10 22:48:32 +00:00
parent 72c0917d2c
commit 2d7d0414f9
3 changed files with 66 additions and 64 deletions

View file

@ -3,24 +3,13 @@
pandora.ui.filterDialog = function(list) { pandora.ui.filterDialog = function(list) {
var that = Ox.Dialog({ var that = Ox.Dialog({
buttons: [ buttons: [
/*
Ox.Button({
id: 'cancel',
title: 'Cancel'
})
.bindEvent({
click: function() {
pandora.$ui.filterDialog.close();
}
}),
*/
Ox.Button({ Ox.Button({
id: 'done', id: 'done',
title: 'Done' title: 'Done'
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
pandora.$ui.filterDialog.close(); that.close();
} }
}) })
], ],
@ -30,6 +19,7 @@ pandora.ui.filterDialog = function(list) {
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE, minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
height: 264, height: 264,
// keys: {enter: 'save', escape: 'cancel'}, // keys: {enter: 'save', escape: 'cancel'},
removeOnClose: true,
title: list ? 'Smart List - ' + list.name : 'Advanced Find', title: list ? 'Smart List - ' + list.name : 'Advanced Find',
width: 648 + Ox.UI.SCROLLBAR_SIZE width: 648 + Ox.UI.SCROLLBAR_SIZE
}); });

View file

@ -3,7 +3,18 @@
'use strict'; 'use strict';
pandora.ui.filterForm = function(list) { pandora.ui.filterForm = function(list) {
var that = Ox.Filter({ var that = Ox.Element();
pandora.api.findLists({
query: {
conditions: [{key: 'type', value: 'static', operator: '='}],
operator: '&'
},
keys: ['id'],
range: [0, 1000],
sort: [{key: 'user', operator: '+'}, {key: 'name', operator: '+'}]
}, function(result) {
that.append(
Ox.Filter({
findKeys: Ox.merge(Ox.map(pandora.site.itemKeys, function(itemKey) { findKeys: Ox.merge(Ox.map(pandora.site.itemKeys, function(itemKey) {
var key = Ox.clone(itemKey); var key = Ox.clone(itemKey);
key.type = key.type == 'layer' key.type = key.type == 'layer'
@ -13,7 +24,10 @@ pandora.ui.filterForm = function(list) {
}), { }), {
id: 'list', id: 'list',
title: 'List', title: 'List',
type: 'string' type: 'list',
values: result.data.items.map(function(item) {
return item.id;
})
}), }),
list: list ? null : { list: list ? null : {
sort: pandora.user.ui.listSort, sort: pandora.user.ui.listSort,
@ -50,6 +64,8 @@ pandora.ui.filterForm = function(list) {
pandora.UI.set({find: Ox.clone(data.query, true)}); pandora.UI.set({find: Ox.clone(data.query, true)});
} }
} }
})
);
}); });
return that; return that;
}; };

View file

@ -52,9 +52,7 @@ pandora.ui.findElement = function() {
placeholder: 'Edit Query...', placeholder: 'Edit Query...',
value: '' value: ''
}); });
(pandora.$ui.filterDialog || ( pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
pandora.$ui.filterDialog = pandora.ui.filterDialog()
)).open();
} else { } else {
Ox.Log('FIND', pandora.$ui.findInput.value()) Ox.Log('FIND', pandora.$ui.findInput.value())
pandora.$ui.findInput.options({ pandora.$ui.findInput.options({
@ -80,9 +78,7 @@ pandora.ui.findElement = function() {
focus: function(data) { focus: function(data) {
if (pandora.$ui.findSelect.value() == 'advanced') { if (pandora.$ui.findSelect.value() == 'advanced') {
pandora.$ui.findInput.blurInput(); pandora.$ui.findInput.blurInput();
(pandora.$ui.filterDialog || ( pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
pandora.$ui.filterDialog = pandora.ui.filterDialog()
)).open();
} }
}, },
submit: function(data) { submit: function(data) {