misc preset

This commit is contained in:
Ansis Brammanis
2013-03-01 18:43:47 -05:00
parent 900c37a652
commit d1d90ab691
5 changed files with 57 additions and 7 deletions

View File

@@ -785,6 +785,7 @@ div.combobox {
}
.grid-entry .preset-help {
display:none;
position: absolute;
bottom: 0px;
right: 0px;

View File

@@ -16,7 +16,7 @@ iD.presets.Preset = function(preset, forms) {
var tags = preset.match.tags;
for (var t in tags) {
if (entity.tags[t] !== tags[t] &&
(tags[t] !== '*' || t in entity.tags)) return -1;
!(tags[t] === '*' && t in entity.tags)) return -1;
}
return Object.keys(preset.match.tags).length;
};

View File

@@ -28,15 +28,15 @@ iD.ui.PresetGrid = function(context) {
.attr('type', 'search')
.on('keyup', function() {
// enter
if (d3.event.keyCode === 13) {
var value = search.property('value');
if (d3.event.keyCode === 13 && value.length) {
choose(grid.selectAll('.grid-entry:first-child').datum());
} else {
var value = search.property('value');
grid.classed('filtered', value.length);
if (value.length) {
var results = presets.search(value);
message.text(t('inspector.results', {n: results.length, search: value}));
message.text(t('inspector.results', {n: results.collection.length, search: value}));
grid.call(drawGrid, results);
grid.classed('filtered', value.length);
} else {
grid.call(drawGrid, context.presets().defaults(entity));
}

View File

@@ -37,6 +37,11 @@
"key": "building",
"type": "combo"
},
"building_yes": {
"key": "building",
"type": "combo",
"default": { "area": "yes" }
},
"fee": {
"key": "fee",
"type": "select",

View File

@@ -300,7 +300,15 @@
"form": ["oneway", "access", "maxspeed"]
},
{
"title": "Basketball court",
"name": "sport pitch",
"match": {
"type": ["point", "area"],
"tags": { "leisure": "pitch" }
},
"icon": "pitch",
"form": ["surface"]
},
{
"name": "basketball court",
"match": {
"type": ["point", "area"],
@@ -312,6 +320,42 @@
"icon": "basketball",
"form": ["surface"]
},
{
"name": "baseball diamond",
"match": {
"type": ["point", "area"],
"tags": {
"leisure": "pitch",
"sport": "baseball"
}
},
"icon": "baseball",
"form": ["surface"]
},
{
"name": "soccer field",
"match": {
"type": ["point", "area"],
"tags": {
"leisure": "pitch",
"sport": "soccer"
}
},
"icon": "soccer",
"form": ["surface"]
},
{
"name": "tennis court",
"match": {
"type": ["point", "area"],
"tags": {
"leisure": "pitch",
"sport": "tennis"
}
},
"icon": "tennis",
"form": ["surface"]
},
{
"title": "Building",
"name": "building",
@@ -322,6 +366,6 @@
}
},
"icon": "warehouse",
"form": ["building", "address"]
"form": ["building_yes", "address"]
}
]