aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/time_tables_controller.rb
diff options
context:
space:
mode:
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'