diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/referential_vehicle_journeys_controller.rb | 10 | ||||
| -rw-r--r-- | app/views/referential_vehicle_journeys/_filters.html.slim | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/referential_vehicle_journeys_controller.rb b/app/controllers/referential_vehicle_journeys_controller.rb index b07d6c600..c35a06087 100644 --- a/app/controllers/referential_vehicle_journeys_controller.rb +++ b/app/controllers/referential_vehicle_journeys_controller.rb @@ -12,6 +12,16 @@ class ReferentialVehicleJourneysController < ChouetteController requires_feature :referential_vehicle_journeys + def index + if params[:q] && params[:q][:route_line_id_eq].present? + @filtered_line = Chouette::Line + .select(:id, :name) + .find(params[:q][:route_line_id_eq]) + end + + index! + end + private def collection diff --git a/app/views/referential_vehicle_journeys/_filters.html.slim b/app/views/referential_vehicle_journeys/_filters.html.slim index f9fa4fcf7..8cd17ca0a 100644 --- a/app/views/referential_vehicle_journeys/_filters.html.slim +++ b/app/views/referential_vehicle_journeys/_filters.html.slim @@ -29,7 +29,11 @@ 'select2-ajax': 'true', 'select2ed-placeholder': t('referentials.filters.line'), url: autocomplete_referential_lines_path(@referential, format: :json), - 'select2ed-allow-clear': true \ + 'select2ed-allow-clear': true, \ + initvalue: { \ + id: @filtered_line&.id, + text: @filtered_line&.name \ + } \ } \ }, label: false, |
