diff options
| author | vlatka pavisic | 2016-11-17 17:51:27 +0100 |
|---|---|---|
| committer | vlatka pavisic | 2016-11-17 17:51:34 +0100 |
| commit | 46076bf6127efea667cc764dd2fc4a9d66451c9f (patch) | |
| tree | 1df56c14c8202623d41e0043bbd48abced43a9f1 /app/controllers | |
| parent | 3fb20fcc5ca5c39fae2c793e822eac1a2b2f6cb7 (diff) | |
| download | chouette-core-46076bf6127efea667cc764dd2fc4a9d66451c9f.tar.bz2 | |
Refs #1939 : Refactor
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/lines_controller.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index bd1550a00..925ac54bf 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -73,20 +73,11 @@ class LinesController < BreadcrumbController 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" - end + %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 @q = line_referential.lines.search(params[:q]) @lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company]) |
