diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/application_controller.rb | 5 | ||||
| -rw-r--r-- | app/controllers/calendars_controller.rb | 7 | ||||
| -rw-r--r-- | app/controllers/routes_controller.rb | 6 | ||||
| -rw-r--r-- | app/controllers/vehicle_journeys_controller.rb | 4 |
4 files changed, 9 insertions, 13 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f2c9b4c6f..42b7c2a25 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,7 +12,10 @@ class ApplicationController < ActionController::Base helper LanguageEngine::Engine.helpers def set_locale - I18n.locale = session[:language] || I18n.default_locale + # I18n.locale = session[:language] || I18n.default_locale + # For testing different locales w/o restarting the server + I18n.locale = (params['lang'] || session[:language] || I18n.default_locale).to_sym + logger.info "locale set to #{I18n.locale.inspect}" end def pundit_user diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index d18e165d2..5370d9cbb 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -45,14 +45,13 @@ class CalendarsController < BreadcrumbController end def ransack_contains_date - # 3 parts to date object, in order to use in ransackable_scopes + date =[] if params[:q] && !params[:q]['contains_date(1i)'].empty? - date =[] ['contains_date(1i)', 'contains_date(2i)', 'contains_date(3i)'].each do |key| - date << params[:q][key] + date << params[:q][key].to_i params[:q].delete(key) end - params[:q]['contains_date'] = Date.parse(date.join('-')) + params[:q]['contains_date'] = Date.new(*date) end end diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index a1aadf883..73febc4b9 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -46,12 +46,6 @@ class RoutesController < ChouetteController end end - # overwrite inherited resources to use delete instead of destroy - # foreign keys will propagate deletion) - def destroy_resource(object) - object.delete - end - def destroy destroy! do |success, failure| success.html { redirect_to referential_line_path(@referential,@line) } diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index c084b592a..316652ca2 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -77,14 +77,14 @@ class VehicleJourneysController < ChouetteController protected def collection - scope = route.vehicle_journeys.joins(:journey_pattern).joins('LEFT JOIN "vehicle_journey_at_stops" ON "vehicle_journey_at_stops"."vehicle_journey_id" = "vehicle_journeys"."id"') + scope = route.vehicle_journeys.with_stops @q = scope.search filtered_ransack_params grouping = ransack_periode_filter @q.build_grouping(grouping) if grouping @ppage = 20 - @vehicle_journeys = @q.result(distinct: true).paginate(:page => params[:page], :per_page => @ppage) + @vehicle_journeys = @q.result.paginate(:page => params[:page], :per_page => @ppage) @footnotes = route.line.footnotes.to_json @matrix = resource_class.matrix(@vehicle_journeys) @vehicle_journeys |
