diff options
| author | Luc Donnet | 2016-11-18 15:11:29 +0100 |
|---|---|---|
| committer | Luc Donnet | 2016-11-18 15:11:29 +0100 |
| commit | 6827025a73a35788bbfb40d0ef20903cb62d27e3 (patch) | |
| tree | 51d3aa6ce87496beb242377163aab6c41ca78bbe /app/controllers/lines_controller.rb | |
| parent | d20a0e06b5df1645d311f8fbf7a7fb66cad3a869 (diff) | |
| parent | 37e2519ca0e0131a5b7ea7c3c7bf16833b15703f (diff) | |
| download | chouette-core-6827025a73a35788bbfb40d0ef20903cb62d27e3.tar.bz2 | |
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'app/controllers/lines_controller.rb')
| -rw-r--r-- | app/controllers/lines_controller.rb | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index a93084012..1a5c30787 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -69,25 +69,16 @@ class LinesController < BreadcrumbController end def filtered_lines - line_referential.lines.select{ |t| [t.name, t.published_name].find { |e| /#{params[:q]}/i =~ e } } + line_referential.lines.by_text(params[:q]) end def collection - if params[:q] && params[:q]["network_id_eq"] == "-1" - params[:q]["network_id_eq"] = "" - params[:q]["network_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 - - 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 - @q = line_referential.lines.search(params[:q]) @lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company]) end |
