aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorLuc Donnet2017-09-06 10:10:16 +0200
committerLuc Donnet2017-09-06 10:10:16 +0200
commite9360b375f27d43d91d833d301224b0b04daf2f1 (patch)
tree3cfc97b2d70d4ccf33385ea7adc565ed5ed9682b /app/controllers
parent9785f6afbc943724d5260176be4b550e3c64e2a0 (diff)
parent53804667d4ba62e29ff687995dfa6d2566139075 (diff)
downloadchouette-core-e9360b375f27d43d91d833d301224b0b04daf2f1.tar.bz2
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/imports_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index b1b34731b..97a8f91aa 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -1,6 +1,7 @@
class ImportsController < BreadcrumbController
skip_before_action :authenticate_user!, only: [:download]
defaults resource_class: Import, collection_name: 'imports', instance_name: 'import'
+ before_action :ransack_started_on_date, only: [:index]
respond_to :html
belongs_to :workbench
@@ -55,6 +56,17 @@ class ImportsController < BreadcrumbController
private
+ def ransack_started_on_date
+ date =[]
+ if params[:q] && !params[:q]['started_on_date(1i)'].empty?
+ ['started_on_date(1i)', 'started_on_date(2i)', 'started_on_date(3i)'].each do |key|
+ date << params[:q][key].to_i
+ params[:q].delete(key)
+ end
+ params[:q]['started_on_date'] = DateTime.new(*date) rescue nil
+ end
+ end
+
def build_resource
@import ||= WorkbenchImport.new(*resource_params) do |import|
import.workbench = parent