special case for 'other' preset

This commit is contained in:
Ansis Brammanis
2013-02-26 15:01:59 -05:00
parent f057bfebc7
commit 763c9dad59
3 changed files with 19 additions and 25 deletions
+15 -3
View File
@@ -1,7 +1,19 @@
iD.presetData = function() {
var other = {
name: 'other',
title: 'Other',
icon: 'marker-stroked',
match: {
tags: {},
type: ['node', 'line', 'area']
},
form: []
};
var presets = {},
data = [],
categories = {},
data = [other],
categories = [],
defaults = {
node: [],
area: [],
@@ -16,7 +28,7 @@ iD.presetData = function() {
presets.data = function(_) {
if (!arguments.length) return data;
data = _.presets;
data = _.presets.concat([other]);
categories = _.categories;
defaults = _.defaults;
return presets;
+2 -1
View File
@@ -56,7 +56,8 @@ iD.ui.PresetGrid = function() {
return iD.util.editDistance(value, a.name) - iD.util.editDistance(value, b.name);
}).filter(function(d) {
return iD.util.editDistance(value, d.name) - d.name.length + value.length < 3;
return iD.util.editDistance(value, d.name) - d.name.length + value.length < 3 ||
d.name === 'other';
});
}
+2 -21
View File
@@ -13,7 +13,8 @@
"form": [
{
"key": "cuisine",
"type": "combo"
"type": "combo",
"indexed": true
},
{
"key": "internet_access",
@@ -645,26 +646,6 @@
"title": "Address"
}
]
},
{
"title": "Other",
"name": "other",
"match": {
"type": ["line", "area"],
"tags": {}
},
"icon": "square-stroked",
"form": []
},
{
"title": "Other",
"name": "other",
"match": {
"type": ["node"],
"tags": {}
},
"icon": "marker-stroked",
"form": []
}
],