add 'find in list' functionality to 'manage places' dialog
This commit is contained in:
parent
c624cc5082
commit
f4c1f826bf
2 changed files with 50 additions and 13 deletions
|
@ -6,19 +6,19 @@ Ox.TextList <f:Ox.Element> TextList Object
|
||||||
(options) -> <f> TextList Object
|
(options) -> <f> TextList Object
|
||||||
(options, self) -> <f> TextList Object
|
(options, self) -> <f> TextList Object
|
||||||
options <o> Options object
|
options <o> Options object
|
||||||
columns <[o]|[]>
|
columns <[o]|[]> Columns
|
||||||
# Fixme: There's probably more...
|
# Fixme: There's probably more...
|
||||||
addable <b>
|
addable <b> ...
|
||||||
editable <b>
|
editable <b> ...
|
||||||
format <f>
|
format <f> ...
|
||||||
id <s>
|
id <s> ...
|
||||||
removable <b>
|
removable <b> ...
|
||||||
map <f> function that maps values to sort values
|
map <f> function that maps values to sort values
|
||||||
operator <s> default sort operator
|
operator <s> default sort operator
|
||||||
title <s>
|
title <s> ...
|
||||||
unique <b> If true, this column acts as unique id
|
unique <b> If true, this column acts as unique id
|
||||||
visible <b>
|
visible <b> ...
|
||||||
width <n>
|
width <n> ...
|
||||||
columnsMovable <b|false> If true, columns can be re-ordered
|
columnsMovable <b|false> If true, columns can be re-ordered
|
||||||
columnsRemovable <b|false> If true, columns are removable
|
columnsRemovable <b|false> If true, columns are removable
|
||||||
columnsResizable <b|false> If true, columns are resizable
|
columnsResizable <b|false> If true, columns are resizable
|
||||||
|
|
|
@ -64,8 +64,10 @@ Ox.ListMap = function(options, self) {
|
||||||
},
|
},
|
||||||
id: 'countryCode',
|
id: 'countryCode',
|
||||||
resizable: false, // fixme: implement
|
resizable: false, // fixme: implement
|
||||||
title: '<img src="' + Ox.UI.getImageURL('symbolFlag') +
|
title: $('<img>').attr({
|
||||||
'" style="width: 10px; height: 10px; padding: 3px 1px 1px 3px"/>',
|
src: Ox.UI.getImageURL('symbolFlag')
|
||||||
|
// fixme: why does this not work? it does in folderBrowserList
|
||||||
|
}),
|
||||||
visible: true,
|
visible: true,
|
||||||
width: 16
|
width: 16
|
||||||
},
|
},
|
||||||
|
@ -228,12 +230,26 @@ Ox.ListMap = function(options, self) {
|
||||||
],
|
],
|
||||||
overlap: 'right',
|
overlap: 'right',
|
||||||
type: 'image'
|
type: 'image'
|
||||||
|
})
|
||||||
|
.bindEvent({
|
||||||
|
change: function(data) {
|
||||||
|
var key = data.selected[0].id,
|
||||||
|
value = self.$findInput.value();
|
||||||
|
value && updateList(key, value);
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
self.$findInput = Ox.Input({
|
self.$findInput = Ox.Input({
|
||||||
clear: true,
|
clear: true,
|
||||||
placeholder: 'Find in List',
|
placeholder: 'Find in List',
|
||||||
width: 234
|
width: 234
|
||||||
})
|
})
|
||||||
|
.bindEvent({
|
||||||
|
submit: function(data) {
|
||||||
|
var key = self.$findSelect.value(),
|
||||||
|
value = data.value;
|
||||||
|
updateList(key, value);
|
||||||
|
}
|
||||||
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.css({float: 'right', margin: '4px'})
|
.css({float: 'right', margin: '4px'})
|
||||||
|
@ -432,11 +448,11 @@ Ox.ListMap = function(options, self) {
|
||||||
id: 'type',
|
id: 'type',
|
||||||
items: [
|
items: [
|
||||||
{id: 'country', title: 'Country'},
|
{id: 'country', title: 'Country'},
|
||||||
{id: 'region', title: 'Region'},
|
{id: 'region', title: 'Region'}, // administative (Kansas) or colloquial (Midwest)
|
||||||
{id: 'city', title: 'City'},
|
{id: 'city', title: 'City'},
|
||||||
{id: 'borough', title: 'Borough'},
|
{id: 'borough', title: 'Borough'},
|
||||||
{id: 'street', title: 'Street'}, // streets, squares, bridges, tunnels, ...
|
{id: 'street', title: 'Street'}, // streets, squares, bridges, tunnels, ...
|
||||||
{id: 'building', title: 'Building'},
|
{id: 'building', title: 'Building'}, // airports, stations, stadiums, military installations, ...
|
||||||
{id: 'feature', title: 'Feature'} // continents, islands, rivers, lakes, seas, oceans, ...
|
{id: 'feature', title: 'Feature'} // continents, islands, rivers, lakes, seas, oceans, ...
|
||||||
],
|
],
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
|
@ -756,6 +772,27 @@ Ox.ListMap = function(options, self) {
|
||||||
return Ox.isNumber(val) ? val.toFixed(8) : val; // fixme: why can a string be passed ??
|
return Ox.isNumber(val) ? val.toFixed(8) : val; // fixme: why can a string be passed ??
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateList(key, value) {
|
||||||
|
var query = {
|
||||||
|
conditions: Ox.merge(
|
||||||
|
['all', 'name'].indexOf(key) > -1
|
||||||
|
? [{key: 'name', value: value, operator: '='}] : [],
|
||||||
|
['all', 'alternativeNames'].indexOf(key) > -1
|
||||||
|
? [{key: 'alternativeNames', value: value, operator: '='}] : [],
|
||||||
|
['all', 'geoname'].indexOf(key) > -1
|
||||||
|
? [{key: 'geoname', value: value, operator: '='}] : []
|
||||||
|
),
|
||||||
|
operator: key == 'all' ? '|' : '&'
|
||||||
|
};
|
||||||
|
self.$list.options({
|
||||||
|
items: function(data, callback) {
|
||||||
|
return pandora.api.findPlaces(Ox.extend(data, {
|
||||||
|
query: query
|
||||||
|
}), callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
setOption <f> setOption
|
setOption <f> setOption
|
||||||
@*/
|
@*/
|
||||||
|
|
Loading…
Reference in a new issue