diff options
Diffstat (limited to 'app/javascript/routes/components/BSelect2.js')
| -rw-r--r-- | app/javascript/routes/components/BSelect2.js | 23 | 
1 files changed, 16 insertions, 7 deletions
| diff --git a/app/javascript/routes/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js index 340d9df95..0d8d7787f 100644 --- a/app/javascript/routes/components/BSelect2.js +++ b/app/javascript/routes/components/BSelect2.js @@ -96,17 +96,26 @@ class BSelect2 extends Component{              data: function(params) {                return {                  q: params.term, -                target_type: 'zdep' +                scope: 'route_editor'                };              },              processResults: function(data, params) {                return { -                results: data.map( -                  item => _.assign( -                    {}, -                    item, -                    { text: item.name + ", " + item.zip_code + " " + item.short_city_name + " <small><em>(" + item.user_objectid + ")</em></small>" } -                  ) +                 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 += ` <small><em>(${item.area_type.toUpperCase()}, ${item.user_objectid})</em></small>`; +                      return _.assign({}, item, { text: text }); +                  }                  )                };              }, | 
