aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/time_tables_controller.rb
diff options
context:
space:
mode:
authorcedricnjanga2017-10-03 15:32:26 +0200
committercedricnjanga2017-10-03 16:33:49 +0200
commit9ea95b98c52f99494a13befa54cfd8cd298ab0c4 (patch)
tree11a795187148a63551b702fb2aecf502975eb9ef /app/controllers/time_tables_controller.rb
parent983f5953d6df7166e91f52ba5eccaf27b8841f76 (diff)
downloadchouette-core-9ea95b98c52f99494a13befa54cfd8cd298ab0c4.tar.bz2
Refs #4665
Adapt date filters helpers according to this new concern Try to correct build error : "ransack period range undefined" All tests pass on my machine Refs #4661 Remove string column from ComplianceCheckSet
Diffstat (limited to 'app/controllers/time_tables_controller.rb')
-rw-r--r--app/controllers/time_tables_controller.rb27
1 files changed, 2 insertions, 25 deletions
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 12dc26367..2d24d5aa6 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -1,8 +1,7 @@
class TimeTablesController < ChouetteController
include TimeTablesHelper
include RansackDateFilter
- set_date_param "bounding_dates", Date
- before_action :set_date_time_params, only: [:index]
+ before_action only: [:index] { set_date_time_params("bounding_dates", Date) }
defaults :resource_class => Chouette::TimeTable
respond_to :html
respond_to :xml
@@ -134,7 +133,7 @@ class TimeTablesController < ChouetteController
params[:q].delete("tag_search")
scope = select_time_tables.tagged_with(tags, :any => true) if tags.any?
end
- scope = ransack_period_range(scope: scope, error_message: t('referentials.errors.validity_period'), query: :overlapping)
+ scope = self.ransack_period_range(scope: scope, error_message: t('referentials.errors.validity_period'), query: :overlapping)
@q = scope.search(params[:q])
if sort_column && sort_direction
@@ -162,28 +161,6 @@ class TimeTablesController < ChouetteController
end
private
- # def ransack_periode scope
- # return scope unless params[:q]
- # return scope unless params[:q]['end_date_lteq(1i)'].present?
-
- # begin_range = flatten_date('start_date_gteq')
- # end_range = flatten_date('end_date_lteq')
-
- # if begin_range > end_range
- # flash.now[:error] = t('referentials.errors.validity_period')
- # else
- # scope = scope.overlapping(begin_range, end_range)
- # params[:q] = params[:q].slice('comment_cont', 'color_cont_any')
- # @begin_range = begin_range
- # @end_range = end_range
- # end
- # scope
- # end
-
- # def flatten_date key
- # date_int = %w(1 2 3).map {|e| params[:q]["#{key}(#{e}i)"].to_i }
- # Date.new(*date_int)
- # end
def sort_column
referential.time_tables.column_names.include?(params[:sort]) ? params[:sort] : 'comment'