diff options
| author | cedricnjanga | 2017-07-27 16:44:12 +0200 |
|---|---|---|
| committer | cedricnjanga | 2017-07-27 17:10:26 +0200 |
| commit | a47492bddaa3caf56f21ca129ce20f3ea8f7e181 (patch) | |
| tree | 440433c9a73b14473f3e340019a6e162989df1e7 | |
| parent | 045ea93e036b71689a19018c3a4a89724f437200 (diff) | |
| download | chouette-core-a47492bddaa3caf56f21ca129ce20f3ea8f7e181.tar.bz2 | |
Add short id in Ransack query for MissionSelect2
| -rw-r--r-- | app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js | 5 | ||||
| -rw-r--r-- | app/views/api/v1/journey_patterns/show.rabl | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js index c04a1d642..2c4dfe7fc 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js @@ -15,6 +15,7 @@ class BSelect4 extends React.Component{ render() { + console.log(this.props) return ( <Select2 data={(this.props.isFilter) ? [this.props.filters.query.journeyPattern.published_name] : ((this.props.selection.selectedJPModal) ? [this.props.selection.selectedJPModal.published_name] : undefined)} @@ -34,7 +35,7 @@ class BSelect4 extends React.Component{ delay: '500', data: function(params) { return { - q: {published_name_or_objectid_or_registration_number_cont: params.term}, + q: {published_name_cont_or_short_id_or_registration_number_cont: params.term}, }; }, processResults: function(data, params) { @@ -43,7 +44,7 @@ class BSelect4 extends React.Component{ item => _.assign( {}, item, - { text: "<strong>" + item.published_name + _.last(_.split(item.object_id, ':')) + "</strong><br/><small>" + item.registration_number + "</small>" } + { text: "<strong>" + item.published_name + " - " + item.short_id + "</strong><br/><small>" + item.registration_number + "</small>" } ) ) }; diff --git a/app/views/api/v1/journey_patterns/show.rabl b/app/views/api/v1/journey_patterns/show.rabl index 21f25e480..7c3af52fc 100644 --- a/app/views/api/v1/journey_patterns/show.rabl +++ b/app/views/api/v1/journey_patterns/show.rabl @@ -5,6 +5,13 @@ extends "api/v1/trident_objects/show" attributes attr, :unless => lambda { |m| m.send( attr).nil?} end +node do |jp| + { + short_id: jp.objectid.parts.try(:third) + } + +end + node(:route_short_description) do |journey_pattern| partial("api/v1/routes/short_description", :object => journey_pattern.route) end @@ -18,4 +25,3 @@ child :stop_points => :stop_area_short_descriptions do |stop_points| partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area) end end - |
