diff options
| author | Zog | 2018-01-09 16:39:44 +0100 |
|---|---|---|
| committer | Zog | 2018-01-09 16:39:44 +0100 |
| commit | 2b72125bd3f3393c92b4e3d8680eb0ea9aa40e6e (patch) | |
| tree | b2b50919a882539046fd629322c8a91de6b3b2dd /app/controllers | |
| parent | a0e05d7b2d9be6f52d88f365739ca2eab406a2f2 (diff) | |
| download | chouette-core-2b72125bd3f3393c92b4e3d8680eb0ea9aa40e6e.tar.bz2 | |
Refs #5502 @4h; Don't use Ajax in JP selector in VJs editor5502-remove-search-from-selects
When the number of possible values is low (<10), display the values
right away, don't use an Ajax query
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/vehicle_journeys_controller.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index c03db0c7f..431d15f57 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -48,6 +48,7 @@ class VehicleJourneysController < ChouetteController @vehicle_journeys = @vehicle_journeys.includes({stop_points: :stop_area}) end format.html do + load_missions @stop_points_list = [] @stop_points_list = route.stop_points.includes(:stop_area).map do |sp| { @@ -173,6 +174,30 @@ class VehicleJourneysController < ChouetteController end private + def load_missions + @all_missions = route.journey_patterns.count > 10 ? [] : route.journey_patterns.map do |item| + { + id: item.id, + "data-item": { + id: item.id, + name: item.name, + published_name: item.published_name, + object_id: item.objectid, + short_id: item.get_objectid.short_id, + stop_area_short_descriptions: item.stop_areas.map do |stop| + { + stop_area_short_description: { + id: stop.id, + name: stop.name, + object_id: item.objectid + } + } + end + }.to_json, + text: "<strong>" + item.published_name + " - " + item.get_objectid.short_id + "</strong><br/><small>" + item.registration_number + "</small>" + } + end + end def vehicle_journey_params params.require(:vehicle_journey).permit( { footnote_ids: [] }, |
