From 5eabd1e4d50811ce70079caaca6af65be6f87132 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 27 Feb 2013 17:51:51 -0500 Subject: [PATCH 1/2] Add validation warning for many deletions. Fixes #862 --- js/id/ui/commit.js | 4 +++- js/id/validate.js | 6 ++++++ locale/en.js | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index f47575c58..efdc1c190 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -108,7 +108,9 @@ iD.ui.Commit = function(context) { .enter() .append('li'); - warningLi.append('button') + // only show the fix icon when an entity is given + warningLi.filter(function(d) { return d.entity; }) + .append('button') .attr('class', 'minor') .on('click', event.fix) .append('span') diff --git a/js/id/validate.js b/js/id/validate.js index dacff7889..ff2e42fb3 100644 --- a/js/id/validate.js +++ b/js/id/validate.js @@ -15,6 +15,12 @@ iD.validate = function(changes, graph) { if (tags.building && tags.building === 'yes') return 'building=yes'; } + if (changes.deleted.length > 100) { + warnings.push({ + message: t('validations.many_deletions') + }); + } + for (var i = 0; i < changes.created.length; i++) { change = changes.created[i]; diff --git a/locale/en.js b/locale/en.js index 2890187e2..7d82a4944 100644 --- a/locale/en.js +++ b/locale/en.js @@ -221,6 +221,7 @@ locale.en = { untagged_point: "Untagged point which is not part of a line or area", untagged_line: "Untagged line", untagged_area: "Untagged area", + many_deletions: "You're deleting more than 200 objects. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org.", tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area", deprecated_tags: "Deprecated tags: {tags}" }, From a35154b19bf6ff27fb251057bc35d1dae9b7d5f1 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 27 Feb 2013 18:12:40 -0500 Subject: [PATCH 2/2] Fix localization number --- js/id/validate.js | 2 +- locale/en.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id/validate.js b/js/id/validate.js index ff2e42fb3..30568f652 100644 --- a/js/id/validate.js +++ b/js/id/validate.js @@ -17,7 +17,7 @@ iD.validate = function(changes, graph) { if (changes.deleted.length > 100) { warnings.push({ - message: t('validations.many_deletions') + message: t('validations.many_deletions', { n: changes.deleted.length }) }); } diff --git a/locale/en.js b/locale/en.js index 7d82a4944..0ba305dc0 100644 --- a/locale/en.js +++ b/locale/en.js @@ -221,7 +221,7 @@ locale.en = { untagged_point: "Untagged point which is not part of a line or area", untagged_line: "Untagged line", untagged_area: "Untagged area", - many_deletions: "You're deleting more than 200 objects. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org.", + many_deletions: "You're deleting {n} objects. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org.", tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area", deprecated_tags: "Deprecated tags: {tags}" },