From 8ea2c7ff9a1ee0d53bf72764e12697abf1875162 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 7 Apr 2018 14:51:04 -0400 Subject: [PATCH] Add community icons, add icons and descriptions to post-save screen --- css/80_app.css | 3 +++ modules/svg/defs.js | 3 ++- modules/ui/success.js | 47 ++++++++++++++++++++++++++++++++++++------- package.json | 3 ++- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/css/80_app.css b/css/80_app.css index 585459070..ed1fa33a3 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -3611,6 +3611,9 @@ img.tile-debug { vertical-align: top; padding: 0 10px 5px 10px; } +.save-success td.cell-icon { + width: 50px; +} .save-success .details { margin: 0px 5px; white-space: nowrap; diff --git a/modules/svg/defs.js b/modules/svg/defs.js index d3e533ca4..7d5df37bd 100644 --- a/modules/svg/defs.js +++ b/modules/svg/defs.js @@ -134,6 +134,7 @@ export function svgDefs(context) { // symbol spritesheets defs .call(SVGSpriteDefinition('iD-sprite', context.imagePath('iD-sprite.svg'))) - .call(SVGSpriteDefinition('maki-sprite', context.imagePath('maki-sprite.svg'))); + .call(SVGSpriteDefinition('maki-sprite', context.imagePath('maki-sprite.svg'))) + .call(SVGSpriteDefinition('community-sprite', context.imagePath('community-sprite.svg'))); }; } diff --git a/modules/ui/success.js b/modules/ui/success.js index ae29802bc..02b68debd 100644 --- a/modules/ui/success.js +++ b/modules/ui/success.js @@ -72,7 +72,7 @@ export function uiSuccess(context) { row .append('td') - .attr('class', 'summary-icon') + .attr('class', 'cell-icon summary-icon') .append('a') .attr('target', '_blank') .attr('href', changesetURL) @@ -83,7 +83,7 @@ export function uiSuccess(context) { var summaryDetail = row .append('td') - .attr('class', 'summary-detail'); + .attr('class', 'cell-detail summary-detail'); summaryDetail .append('a') @@ -168,13 +168,46 @@ export function uiSuccess(context) { rowEnter .append('td') - .attr('class', 'community-icon') - .text(function(d) { return d.type; }); + .attr('class', 'cell-icon community-icon') + .append('a') + .attr('target', '_blank') + .attr('href', function(d) { return d.url; }) + .append('svg') + .attr('class', 'logo-small') + .append('use') + .attr('xlink:href', function(d) { return '#community-' + d.type; }); - rowEnter + var communityDetail = rowEnter .append('td') - .attr('class', 'community-detail') - .text(function(d) { return d.name; }); + .attr('class', 'cell-detail community-detail'); + + communityDetail.each(function(d) { + var selection = d3_select(this); + var replacements = { + url: d.url, + signupUrl: d.signupUrl || d.url + }; + + selection + .append('div') + .attr('class', 'community-detail-name') + .append('a') + .attr('target', '_blank') + .attr('href', d.url) + .text(t('community.' + d.id + '.name')); + + selection + .append('div') + .attr('class', 'community-detail-description') + .text(t('community.' + d.id + '.description', replacements)); + + if (d.extendedDescription) { + selection + .append('div') + .attr('class', 'community-detail-extendedDescription') + .text(t('community.' + d.id + '.extendedDescription', replacements)); + } + }); } diff --git a/package.json b/package.json index 79ec8deb0..6ee3b383e 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,9 @@ "dist": "npm-run-all -p dist:**", "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/", "dist:min": "uglifyjs dist/iD.js -c warnings=false -m -o dist/iD.min.js", - "dist:svg:maki": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg", "dist:svg:id": "node svg/spriteify.js --svg svg/iD-sprite.src.svg --json svg/iD-sprite.json > dist/img/iD-sprite.svg", + "dist:svg:community": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"community-%s\" --symbol-sprite dist/img/community-sprite.svg node_modules/osm-community-index/dist/img/*.svg", + "dist:svg:maki": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg", "imagery": "node data/update_imagery", "lint": "eslint *.js js/id test/spec modules", "start": "node development_server.js develop",