aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorvlatka pavisic2016-11-17 14:30:40 +0100
committervlatka pavisic2016-11-17 14:32:21 +0100
commit7a9fb7304e9cd956988d5e624ed26fed1d77ca09 (patch)
tree3b952a7b712f41f9677e34a3ce3113842a26d400 /app/controllers
parentc68bb71ce5f3741788c65bb92904cf999c2fa654 (diff)
downloadchouette-core-7a9fb7304e9cd956988d5e624ed26fed1d77ca09.tar.bz2
Refs #1937 : Lines filtering by transport mode
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/referential_lines_controller.rb18
1 files changed, 5 insertions, 13 deletions
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])