diff options
| author | Luc Donnet | 2017-09-06 10:10:16 +0200 |
|---|---|---|
| committer | Luc Donnet | 2017-09-06 10:10:16 +0200 |
| commit | e9360b375f27d43d91d833d301224b0b04daf2f1 (patch) | |
| tree | 3cfc97b2d70d4ccf33385ea7adc565ed5ed9682b /app/controllers | |
| parent | 9785f6afbc943724d5260176be4b550e3c64e2a0 (diff) | |
| parent | 53804667d4ba62e29ff687995dfa6d2566139075 (diff) | |
| download | chouette-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.rb | 12 |
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 |
