From 11c009ee70761571d13ae9cb77b3d5cb38e81c82 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 27 Jul 2015 16:17:43 -0400 Subject: [PATCH] Add bicycle=dismount access option (closes #2726) --- data/presets.yaml | 5 +++++ data/presets/fields.json | 4 ++++ data/presets/fields/access.json | 6 +++++- dist/locales/en.json | 4 ++++ js/id/ui/preset/access.js | 4 ++++ test/spec/ui/preset/access.js | 9 ++++++++- 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index 6390bf482..641a383cf 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -36,6 +36,11 @@ en: description: Access permitted only to reach a destination # access=destination title: Destination + dismount: + # access=dismount + description: Access permitted but rider must dismount + # access=dismount + title: Dismount 'no': # access=no description: Access not permitted to the general public diff --git a/data/presets/fields.json b/data/presets/fields.json index 2df83232f..ab2dae6f8 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -45,6 +45,10 @@ "destination": { "title": "Destination", "description": "Access permitted only to reach a destination" + }, + "dismount": { + "title": "Dismount", + "description": "Access permitted but rider must dismount" } } } diff --git a/data/presets/fields/access.json b/data/presets/fields/access.json index 2c2eb60a5..f852d71d6 100644 --- a/data/presets/fields/access.json +++ b/data/presets/fields/access.json @@ -36,7 +36,11 @@ "destination": { "title": "Destination", "description": "Access permitted only to reach a destination" + }, + "dismount": { + "title": "Dismount", + "description": "Access permitted but rider must dismount" } } } -} \ No newline at end of file +} diff --git a/dist/locales/en.json b/dist/locales/en.json index a83c59573..fdeb5bc6b 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -624,6 +624,10 @@ "destination": { "title": "Destination", "description": "Access permitted only to reach a destination" + }, + "dismount": { + "title": "Dismount", + "description": "Access permitted but rider must dismount" } } }, diff --git a/js/id/ui/preset/access.js b/js/id/ui/preset/access.js index e6384f080..13dde11d0 100644 --- a/js/id/ui/preset/access.js +++ b/js/id/ui/preset/access.js @@ -56,6 +56,10 @@ iD.ui.preset.access = function(field) { options.push('designated'); } + if (type === 'bicycle') { + options.push('dismount'); + } + return options.map(function(option) { return { title: field.t('options.' + option + '.description'), diff --git a/test/spec/ui/preset/access.js b/test/spec/ui/preset/access.js index 702677063..3533ce017 100644 --- a/test/spec/ui/preset/access.js +++ b/test/spec/ui/preset/access.js @@ -16,10 +16,17 @@ describe('iD.ui.preset.access', function() { expect(selection.selectAll('.preset-access-horse')[0].length).to.equal(1); }); - it('does not include a "yes" or "designated" option for general access (#934), (#2213)', function() { + it('does not include "yes", "designated", "dismount" options for general access (#934), (#2213)', function() { var access = iD.ui.preset.access(field); expect(_.pluck(access.options('access'), 'value')).not.to.include('yes'); expect(_.pluck(access.options('access'), 'value')).not.to.include('designated'); + expect(_.pluck(access.options('access'), 'value')).not.to.include('dismount'); + }); + + it('does include a "dismount" option for bicycles (#2726)', function() { + var access = iD.ui.preset.access(field); + expect(_.pluck(access.options('bicycle'), 'value')).to.include('dismount'); + expect(_.pluck(access.options('foot'), 'value')).not.to.include('dismount'); }); it('sets foot placeholder to "yes" for steps and pedestrian', function() {