From d3445d085b607544dc6355956cd228835258d612 Mon Sep 17 00:00:00 2001 From: Zog Date: Tue, 26 Dec 2017 11:23:53 +0100 Subject: Refs #5382 @1h; Enable all area types for Stopareas in Routes Given that the organisation has the matching feature. --- app/javascript/routes/components/BSelect2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/javascript') diff --git a/app/javascript/routes/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js index 340d9df95..29983dd58 100644 --- a/app/javascript/routes/components/BSelect2.js +++ b/app/javascript/routes/components/BSelect2.js @@ -96,7 +96,7 @@ class BSelect2 extends Component{ data: function(params) { return { q: params.term, - target_type: 'zdep' + scope: 'route_editor' }; }, processResults: function(data, params) { -- cgit v1.2.3 From 0b7805f0d7d9a8fba394fd81a861044a821595bd Mon Sep 17 00:00:00 2001 From: Alban Peignier Date: Tue, 26 Dec 2017 23:04:21 +0100 Subject: Include StopArea type in select2 text for routes#edit. Refs #5382 --- app/javascript/routes/components/BSelect2.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/routes/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js index 29983dd58..0d8d7787f 100644 --- a/app/javascript/routes/components/BSelect2.js +++ b/app/javascript/routes/components/BSelect2.js @@ -101,12 +101,21 @@ class BSelect2 extends Component{ }, processResults: function(data, params) { return { - results: data.map( - item => _.assign( - {}, - item, - { text: item.name + ", " + item.zip_code + " " + item.short_city_name + " (" + item.user_objectid + ")" } - ) + results: data.map( + function(item) { + var text = item.name; + if (item.zip_code || item.short_city_name) { + text += "," + } + if (item.zip_code) { + text += ` ${item.zip_code}` + } + if (item.short_city_name) { + text += ` ${item.short_city_name}` + } + text += ` (${item.area_type.toUpperCase()}, ${item.user_objectid})`; + return _.assign({}, item, { text: text }); + } ) }; }, -- cgit v1.2.3