aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/referential_lines_controller.rb
diff options
context:
space:
mode:
authorLuc Donnet2016-11-18 15:11:29 +0100
committerLuc Donnet2016-11-18 15:11:29 +0100
commit6827025a73a35788bbfb40d0ef20903cb62d27e3 (patch)
tree51d3aa6ce87496beb242377163aab6c41ca78bbe /app/controllers/referential_lines_controller.rb
parentd20a0e06b5df1645d311f8fbf7a7fb66cad3a869 (diff)
parent37e2519ca0e0131a5b7ea7c3c7bf16833b15703f (diff)
downloadchouette-core-6827025a73a35788bbfb40d0ef20903cb62d27e3.tar.bz2
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'app/controllers/referential_lines_controller.rb')
-rw-r--r--app/controllers/referential_lines_controller.rb21
1 files changed, 7 insertions, 14 deletions
diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb
index 6a07e5093..c53819dd2 100644
--- a/app/controllers/referential_lines_controller.rb
+++ b/app/controllers/referential_lines_controller.rb
@@ -63,23 +63,15 @@ class ReferentialLinesController < ChouetteController
end
def filtered_lines
- referential.lines.select{ |t| [t.name, t.published_name].find { |e| /#{params[:q]}/i =~ e } }
+ 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"
- 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])
@@ -91,6 +83,7 @@ class ReferentialLinesController < ChouetteController
def line_params
params.require(:line).permit(
:transport_mode,
+ :transport_submode,
:network_id,
:company_id,
:objectid,