From 7a9fb7304e9cd956988d5e624ed26fed1d77ca09 Mon Sep 17 00:00:00 2001 From: vlatka pavisic Date: Thu, 17 Nov 2016 14:30:40 +0100 Subject: Refs #1937 : Lines filtering by transport mode --- app/controllers/referential_lines_controller.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'app/controllers/referential_lines_controller.rb') diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb index 6a07e5093..165b4c262 100644 --- a/app/controllers/referential_lines_controller.rb +++ b/app/controllers/referential_lines_controller.rb @@ -67,19 +67,11 @@ class ReferentialLinesController < ChouetteController end def collection - if params[:q] && params[:q]["network_id_eq"] == "-1" - params[:q]["network_id_eq"] = "" - params[:q]["network_id_blank"] = "1" - end - - if params[:q] && params[:q]["company_id_eq"] == "-1" - params[:q]["company_id_eq"] = "" - params[:q]["company_id_blank"] = "1" - end - - if params[:q] && params[:q]["group_of_lines_id_eq"] == "-1" - params[:q]["group_of_lines_id_eq"] = "" - params[:q]["group_of_lines_id_blank"] = "1" + %w(network_id company_id group_of_lines_id comment_id transport_mode_name).each do |filter| + if params[:q] && params[:q]["#{filter}_eq"] == '-1' + params[:q]["#{filter}_eq"] = '' + params[:q]["#{filter}_blank"] = '1' + end end @q = referential.lines.search(params[:q]) -- cgit v1.2.3