aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/imports_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/imports_controller.rb')
-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