diff --git a/css/app.css b/css/app.css index fb41626e3..c3ab06fda 100644 --- a/css/app.css +++ b/css/app.css @@ -530,21 +530,39 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;} } .inspector-inner.type { + border: 1px solid #eee; z-index:1; position:relative; } .inspector-inner.type .preset-icon { - width: 50px; + width: 24px; + height: 24px; + padding: 13px; + background: #eee; +} + +.inspector-inner.type .preset-label-wrap { height: 50px; + display: inline-block; + padding: 10px; } .inspector-inner.type .preset-name { - display: inline-block; - margin-left: 20px; + margin: 0; +} + +.inspector-inner .info { + color: white; + border-radius: 3px; + text-align: center; + width: 20px; + height: 20px; + float: right; } .inspector-inner.head { + border: 1px solid #eee; z-index:1; position:relative; } @@ -654,9 +672,17 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;} float: left; width: 100px; height: 100px; - background: red; + //background: red; color: black; margin: 10px; + text-align: center; +} +.preset-grid .grid-entry img { + width: 24px; + margin-left: 20px; + padding: 18px; + background: #eee; + display: block; } .preset-grid-search-wrap { @@ -1459,6 +1485,7 @@ a.success-action { .inspector-preset.cf, .preset-section-input.cf { width: 100%; + margin: 5px 0; } .preset-search-input { diff --git a/index.html b/index.html index 126b17f6b..fc34dc60e 100644 --- a/index.html +++ b/index.html @@ -180,7 +180,7 @@ var id = iD(); d3.json('keys.json', function(err, keys) { - d3.json('presets/presets_josm.json', function(err, presets_data) { + d3.json('presets/presets.json', function(err, presets_data) { id.connection() .keys(keys) diff --git a/js/id/presetdata.js b/js/id/presetdata.js index 70834b248..aa3752283 100644 --- a/js/id/presetdata.js +++ b/js/id/presetdata.js @@ -17,7 +17,7 @@ iD.presetData = function() { presets.match = function(entity) { var type = entity.type == 'node' ? 'node' : entity.geometry(); return data.filter(function(d) { - return _.contains(d.type, type); + return _.contains(d.match.type, type); }); }; @@ -28,8 +28,8 @@ iD.presetData = function() { for (var i = 0; i < data.length; i++) { count = 0; - tags = data[i].tags; - if (!_.contains(data[i].type, type)) continue; + tags = data[i].match.tags; + if (!_.contains(data[i].match.type, type)) continue; for (var k in tags) { if (entity.tags[k] == tags[k]) count++; } diff --git a/js/id/ui/preset.js b/js/id/ui/preset.js index 059a2ef61..481564a76 100644 --- a/js/id/ui/preset.js +++ b/js/id/ui/preset.js @@ -6,7 +6,7 @@ iD.ui.preset = function() { preset; function getTags() { - var tags = _.clone(preset.tags); + var tags = _.clone(preset.match.tags); sections.selectAll('input,select') .each(function(d) { tags[d.key] = this.value; @@ -79,7 +79,7 @@ iD.ui.preset = function() { var w = this.append('span').attr('class', 'input-wrap-position'); i = w.append('input'); w.call(d3.combobox() - .data([''].concat(d.values.slice()).map(function(o) { + .data([''].concat(d.option.slice()).map(function(o) { return { value: o, title: o }; }))); break; @@ -92,7 +92,7 @@ iD.ui.preset = function() { function presets(selection) { selection.html(''); sections = selection.selectAll('div.preset-section') - .data(preset.main) + .data(preset.form) .enter() .append('div') .attr('class', 'preset-section cf'); @@ -104,7 +104,7 @@ iD.ui.preset = function() { .attr('class', 'col4 preset-label') .append('label') .attr('for', 'input-' + d.key) - .text(d.text); + .text(d.key); input.call(wrap.append('div') .attr('class', 'col8 preset-input'), d); }); diff --git a/js/id/ui/presetgrid.js b/js/id/ui/presetgrid.js index 48307b73a..2d71ffbed 100644 --- a/js/id/ui/presetgrid.js +++ b/js/id/ui/presetgrid.js @@ -47,14 +47,17 @@ iD.ui.PresetGrid = function() { .selectAll('div.grid-entry') .data(presets.slice(0, 12), name); - entries.enter() + var entered = entries.enter() .append('div') .attr('class', 'grid-entry') - .text(name) .on('click', function(d) { event.choose(d); }); + entered.append('img') + .attr('src', function(d) { return '/presets/maki/' + d.icon; }); + entered.append('span').text(name); + entries.exit().remove(); } diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js index 33e70557d..81b5a9234 100644 --- a/js/id/ui/tageditor.js +++ b/js/id/ui/tageditor.js @@ -30,19 +30,31 @@ iD.ui.TagEditor = function() { .text('Type'); typewrap.append('img') - .attr('class', 'preset-icon'); + .attr('class', 'preset-icon') + .attr('src', presetMatch ? '/presets/maki/' + presetMatch.icon : ''); - typewrap.append('h3') + var typelabel = typewrap.append('div') + .attr('class', 'preset-label-wrap'); + + typelabel.append('h3') .attr('class', 'preset-name') .text(presetMatch ? presetMatch.name : ''); + typelabel.append('span') + .attr('class', 'preset-geometry') + .text(entity.geometry(context.graph())); + + typewrap.append('div') + .attr('class', 'info fillD'); var namewrap = editorwrap.append('div') .attr('class', 'head inspector-inner fillL'), + namelabel = namewrap.append('h4') + .text('Name'), h2 = namewrap.append('h2'); - h2.append('span') - .attr('class', 'icon big icon-pre-text big-' + entity.geometry(context.graph())); + h2.append('div') + .attr('class', 'info fillD'); var name = h2.append('input') .attr('placeholder', 'name') diff --git a/presets/maki/airfield-24.png b/presets/maki/airfield-24.png new file mode 100644 index 000000000..85ed41889 Binary files /dev/null and b/presets/maki/airfield-24.png differ diff --git a/presets/maki/airport-24.png b/presets/maki/airport-24.png new file mode 100644 index 000000000..b77598138 Binary files /dev/null and b/presets/maki/airport-24.png differ diff --git a/presets/maki/america-football-24.png b/presets/maki/america-football-24.png new file mode 100644 index 000000000..fbe890786 Binary files /dev/null and b/presets/maki/america-football-24.png differ diff --git a/presets/maki/art-gallery-24.png b/presets/maki/art-gallery-24.png new file mode 100644 index 000000000..ebdf24f85 Binary files /dev/null and b/presets/maki/art-gallery-24.png differ diff --git a/presets/maki/bank-24.png b/presets/maki/bank-24.png new file mode 100644 index 000000000..3a6af91fb Binary files /dev/null and b/presets/maki/bank-24.png differ diff --git a/presets/maki/bar-24.png b/presets/maki/bar-24.png new file mode 100644 index 000000000..2c69023d8 Binary files /dev/null and b/presets/maki/bar-24.png differ diff --git a/presets/maki/baseball-24.png b/presets/maki/baseball-24.png new file mode 100644 index 000000000..3e70ea9b4 Binary files /dev/null and b/presets/maki/baseball-24.png differ diff --git a/presets/maki/basketball-24.png b/presets/maki/basketball-24.png new file mode 100644 index 000000000..60538e23b Binary files /dev/null and b/presets/maki/basketball-24.png differ diff --git a/presets/maki/beer-24.png b/presets/maki/beer-24.png new file mode 100644 index 000000000..2b09f2b8f Binary files /dev/null and b/presets/maki/beer-24.png differ diff --git a/presets/maki/bicycle-24.png b/presets/maki/bicycle-24.png new file mode 100644 index 000000000..3c1063885 Binary files /dev/null and b/presets/maki/bicycle-24.png differ diff --git a/presets/maki/bus-24.png b/presets/maki/bus-24.png new file mode 100644 index 000000000..0aec12ee1 Binary files /dev/null and b/presets/maki/bus-24.png differ diff --git a/presets/maki/cafe-24.png b/presets/maki/cafe-24.png new file mode 100644 index 000000000..6e766bdb7 Binary files /dev/null and b/presets/maki/cafe-24.png differ diff --git a/presets/maki/campsite-24.png b/presets/maki/campsite-24.png new file mode 100644 index 000000000..f43939bec Binary files /dev/null and b/presets/maki/campsite-24.png differ diff --git a/presets/maki/cemetery-24.png b/presets/maki/cemetery-24.png new file mode 100644 index 000000000..6d42f61be Binary files /dev/null and b/presets/maki/cemetery-24.png differ diff --git a/presets/maki/cinema-24.png b/presets/maki/cinema-24.png new file mode 100644 index 000000000..730d2851d Binary files /dev/null and b/presets/maki/cinema-24.png differ diff --git a/presets/maki/circle-24.png b/presets/maki/circle-24.png new file mode 100644 index 000000000..e490ba4e5 Binary files /dev/null and b/presets/maki/circle-24.png differ diff --git a/presets/maki/circle-stroked-24.png b/presets/maki/circle-stroked-24.png new file mode 100644 index 000000000..100a716be Binary files /dev/null and b/presets/maki/circle-stroked-24.png differ diff --git a/presets/maki/college-24.png b/presets/maki/college-24.png new file mode 100644 index 000000000..63330b862 Binary files /dev/null and b/presets/maki/college-24.png differ diff --git a/presets/maki/commercial-24.png b/presets/maki/commercial-24.png new file mode 100644 index 000000000..e978c3e80 Binary files /dev/null and b/presets/maki/commercial-24.png differ diff --git a/presets/maki/cricket-24.png b/presets/maki/cricket-24.png new file mode 100644 index 000000000..c4004438d Binary files /dev/null and b/presets/maki/cricket-24.png differ diff --git a/presets/maki/embassy-24.png b/presets/maki/embassy-24.png new file mode 100644 index 000000000..973f7019a Binary files /dev/null and b/presets/maki/embassy-24.png differ diff --git a/presets/maki/fast-food-24.png b/presets/maki/fast-food-24.png new file mode 100644 index 000000000..c688fab98 Binary files /dev/null and b/presets/maki/fast-food-24.png differ diff --git a/presets/maki/ferry-24.png b/presets/maki/ferry-24.png new file mode 100644 index 000000000..4e8913460 Binary files /dev/null and b/presets/maki/ferry-24.png differ diff --git a/presets/maki/fire-station-24.png b/presets/maki/fire-station-24.png new file mode 100644 index 000000000..bf667b781 Binary files /dev/null and b/presets/maki/fire-station-24.png differ diff --git a/presets/maki/fuel-24.png b/presets/maki/fuel-24.png new file mode 100644 index 000000000..99e4e2b54 Binary files /dev/null and b/presets/maki/fuel-24.png differ diff --git a/presets/maki/garden-24.png b/presets/maki/garden-24.png new file mode 100644 index 000000000..662d69619 Binary files /dev/null and b/presets/maki/garden-24.png differ diff --git a/presets/maki/golf-24.png b/presets/maki/golf-24.png new file mode 100644 index 000000000..5391df936 Binary files /dev/null and b/presets/maki/golf-24.png differ diff --git a/presets/maki/grocery-24.png b/presets/maki/grocery-24.png new file mode 100644 index 000000000..3b8692cfd Binary files /dev/null and b/presets/maki/grocery-24.png differ diff --git a/presets/maki/harbor-24.png b/presets/maki/harbor-24.png new file mode 100644 index 000000000..7086414ad Binary files /dev/null and b/presets/maki/harbor-24.png differ diff --git a/presets/maki/heliport-24.png b/presets/maki/heliport-24.png new file mode 100644 index 000000000..33b7f1b55 Binary files /dev/null and b/presets/maki/heliport-24.png differ diff --git a/presets/maki/hospital-24.png b/presets/maki/hospital-24.png new file mode 100644 index 000000000..e0e686d5a Binary files /dev/null and b/presets/maki/hospital-24.png differ diff --git a/presets/maki/industrial-24.png b/presets/maki/industrial-24.png new file mode 100644 index 000000000..a577262ab Binary files /dev/null and b/presets/maki/industrial-24.png differ diff --git a/presets/maki/library-24.png b/presets/maki/library-24.png new file mode 100644 index 000000000..5d82c34bb Binary files /dev/null and b/presets/maki/library-24.png differ diff --git a/presets/maki/lodging-24.png b/presets/maki/lodging-24.png new file mode 100644 index 000000000..a4fe1533f Binary files /dev/null and b/presets/maki/lodging-24.png differ diff --git a/presets/maki/london-underground-24.png b/presets/maki/london-underground-24.png new file mode 100644 index 000000000..f01f77c69 Binary files /dev/null and b/presets/maki/london-underground-24.png differ diff --git a/presets/maki/marker-24.png b/presets/maki/marker-24.png new file mode 100644 index 000000000..9113f11f4 Binary files /dev/null and b/presets/maki/marker-24.png differ diff --git a/presets/maki/marker-stroked-24.png b/presets/maki/marker-stroked-24.png new file mode 100644 index 000000000..dd4943729 Binary files /dev/null and b/presets/maki/marker-stroked-24.png differ diff --git a/presets/maki/minefield-24.png b/presets/maki/minefield-24.png new file mode 100644 index 000000000..41dc553c2 Binary files /dev/null and b/presets/maki/minefield-24.png differ diff --git a/presets/maki/monument-24.png b/presets/maki/monument-24.png new file mode 100644 index 000000000..6caa4e112 Binary files /dev/null and b/presets/maki/monument-24.png differ diff --git a/presets/maki/museum-24.png b/presets/maki/museum-24.png new file mode 100644 index 000000000..d3ad8069c Binary files /dev/null and b/presets/maki/museum-24.png differ diff --git a/presets/maki/park-24.png b/presets/maki/park-24.png new file mode 100644 index 000000000..af32485d4 Binary files /dev/null and b/presets/maki/park-24.png differ diff --git a/presets/maki/park2-24.png b/presets/maki/park2-24.png new file mode 100644 index 000000000..5abe94a1d Binary files /dev/null and b/presets/maki/park2-24.png differ diff --git a/presets/maki/parking-24.png b/presets/maki/parking-24.png new file mode 100644 index 000000000..75f4defea Binary files /dev/null and b/presets/maki/parking-24.png differ diff --git a/presets/maki/parking-garage-24.png b/presets/maki/parking-garage-24.png new file mode 100644 index 000000000..b3747e4dc Binary files /dev/null and b/presets/maki/parking-garage-24.png differ diff --git a/presets/maki/pharmacy-24.png b/presets/maki/pharmacy-24.png new file mode 100644 index 000000000..8a510577e Binary files /dev/null and b/presets/maki/pharmacy-24.png differ diff --git a/presets/maki/pitch-24.png b/presets/maki/pitch-24.png new file mode 100644 index 000000000..43fe98809 Binary files /dev/null and b/presets/maki/pitch-24.png differ diff --git a/presets/maki/police-24.png b/presets/maki/police-24.png new file mode 100644 index 000000000..692f9cb53 Binary files /dev/null and b/presets/maki/police-24.png differ diff --git a/presets/maki/post-24.png b/presets/maki/post-24.png new file mode 100644 index 000000000..1f3eea541 Binary files /dev/null and b/presets/maki/post-24.png differ diff --git a/presets/maki/prison-24.png b/presets/maki/prison-24.png new file mode 100644 index 000000000..1e7ec3b42 Binary files /dev/null and b/presets/maki/prison-24.png differ diff --git a/presets/maki/rail-24.png b/presets/maki/rail-24.png new file mode 100644 index 000000000..7810e36cd Binary files /dev/null and b/presets/maki/rail-24.png differ diff --git a/presets/maki/rail-above-24.png b/presets/maki/rail-above-24.png new file mode 100644 index 000000000..2dcd457ab Binary files /dev/null and b/presets/maki/rail-above-24.png differ diff --git a/presets/maki/rail-underground-24.png b/presets/maki/rail-underground-24.png new file mode 100644 index 000000000..6127113a3 Binary files /dev/null and b/presets/maki/rail-underground-24.png differ diff --git a/presets/maki/religious-christian-24.png b/presets/maki/religious-christian-24.png new file mode 100644 index 000000000..63068c002 Binary files /dev/null and b/presets/maki/religious-christian-24.png differ diff --git a/presets/maki/religious-jewish-24.png b/presets/maki/religious-jewish-24.png new file mode 100644 index 000000000..78d522d6e Binary files /dev/null and b/presets/maki/religious-jewish-24.png differ diff --git a/presets/maki/religious-muslim-24.png b/presets/maki/religious-muslim-24.png new file mode 100644 index 000000000..d95a9de1a Binary files /dev/null and b/presets/maki/religious-muslim-24.png differ diff --git a/presets/maki/restaurant-24.png b/presets/maki/restaurant-24.png new file mode 100644 index 000000000..e26ada792 Binary files /dev/null and b/presets/maki/restaurant-24.png differ diff --git a/presets/maki/roadblock-24.png b/presets/maki/roadblock-24.png new file mode 100644 index 000000000..1c39f23ca Binary files /dev/null and b/presets/maki/roadblock-24.png differ diff --git a/presets/maki/school-24.png b/presets/maki/school-24.png new file mode 100644 index 000000000..49674430d Binary files /dev/null and b/presets/maki/school-24.png differ diff --git a/presets/maki/shop-24.png b/presets/maki/shop-24.png new file mode 100644 index 000000000..f2077e2a5 Binary files /dev/null and b/presets/maki/shop-24.png differ diff --git a/presets/maki/skiing-24.png b/presets/maki/skiing-24.png new file mode 100644 index 000000000..4345d502a Binary files /dev/null and b/presets/maki/skiing-24.png differ diff --git a/presets/maki/soccer-24.png b/presets/maki/soccer-24.png new file mode 100644 index 000000000..7e69e8c11 Binary files /dev/null and b/presets/maki/soccer-24.png differ diff --git a/presets/maki/square-24.png b/presets/maki/square-24.png new file mode 100644 index 000000000..8d97e90ca Binary files /dev/null and b/presets/maki/square-24.png differ diff --git a/presets/maki/square-stroked-24.png b/presets/maki/square-stroked-24.png new file mode 100644 index 000000000..a020270bf Binary files /dev/null and b/presets/maki/square-stroked-24.png differ diff --git a/presets/maki/star-24.png b/presets/maki/star-24.png new file mode 100644 index 000000000..efd0d178d Binary files /dev/null and b/presets/maki/star-24.png differ diff --git a/presets/maki/star-stroked-24.png b/presets/maki/star-stroked-24.png new file mode 100644 index 000000000..fe91ec40f Binary files /dev/null and b/presets/maki/star-stroked-24.png differ diff --git a/presets/maki/swimming-24.png b/presets/maki/swimming-24.png new file mode 100644 index 000000000..5941e505a Binary files /dev/null and b/presets/maki/swimming-24.png differ diff --git a/presets/maki/tennis-24.png b/presets/maki/tennis-24.png new file mode 100644 index 000000000..09c8c3f18 Binary files /dev/null and b/presets/maki/tennis-24.png differ diff --git a/presets/maki/theatre-24.png b/presets/maki/theatre-24.png new file mode 100644 index 000000000..e8c45720e Binary files /dev/null and b/presets/maki/theatre-24.png differ diff --git a/presets/maki/toilets-24.png b/presets/maki/toilets-24.png new file mode 100644 index 000000000..a8f5bfcd8 Binary files /dev/null and b/presets/maki/toilets-24.png differ diff --git a/presets/maki/town-hall-24.png b/presets/maki/town-hall-24.png new file mode 100644 index 000000000..0da5bce20 Binary files /dev/null and b/presets/maki/town-hall-24.png differ diff --git a/presets/maki/triangle-24.png b/presets/maki/triangle-24.png new file mode 100644 index 000000000..066487737 Binary files /dev/null and b/presets/maki/triangle-24.png differ diff --git a/presets/maki/triangle-stroked-24.png b/presets/maki/triangle-stroked-24.png new file mode 100644 index 000000000..059a97307 Binary files /dev/null and b/presets/maki/triangle-stroked-24.png differ diff --git a/presets/maki/warehouse-24.png b/presets/maki/warehouse-24.png new file mode 100644 index 000000000..323beb5fb Binary files /dev/null and b/presets/maki/warehouse-24.png differ diff --git a/presets/maki/waste-basket-24.png b/presets/maki/waste-basket-24.png new file mode 100644 index 000000000..338ff6720 Binary files /dev/null and b/presets/maki/waste-basket-24.png differ diff --git a/presets/maki/x-24.png b/presets/maki/x-24.png new file mode 100644 index 000000000..367ab8342 Binary files /dev/null and b/presets/maki/x-24.png differ diff --git a/presets/maki/zoo-24.png b/presets/maki/zoo-24.png new file mode 100644 index 000000000..32fed6b24 Binary files /dev/null and b/presets/maki/zoo-24.png differ diff --git a/presets/presets.json b/presets/presets.json index a4f25bd42..e8644179a 100644 --- a/presets/presets.json +++ b/presets/presets.json @@ -1,22 +1,4 @@ [ - { - "title": "Highway", - "name": "highway", - "match": { - "type": ["line"], - "tags": { - "highway": "*" - } - }, - "form": [ - { - "tag": "highway", - "title": "Highway Type", - "type": "select", - "option": ["primary", "secondary", "tertiary"] - } - ] - }, { "title": "Cafe", "name": "cafe", @@ -26,31 +8,16 @@ "amenity": "cafe" } }, + "icon": "cafe-24.png", "form": [ { - "tag": "phone", - "type": "tel" - }, - { - "tag": "fax", - "type": "tel" - }, - { - "tag": "website", - "type": "url" - }, - { - "tag": "email", - "type": "email" - }, - { - "tag": "internet_access", + "key": "internet_access", "title": "Internet Access", "type": "select", "option": ["yes", "wlan","wired","terminal","no"] }, { - "tag": "internet_access:fee", + "key": "internet_access:fee", "title": "Internet Access Fee", "type": "select", "option": ["yes", "no"]