aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/imports_controller.rb
blob: 9b21015846a148230a34e998903838f10e1c1848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class ImportsController < BreadcrumbController
  defaults :resource_class => Import
  respond_to :html
  belongs_to :workbench

  def show
    show! do
      build_breadcrumb :show
    end
  end

  def index
    index! do
      build_breadcrumb :index
    end
  end

  def new
    new! do
      build_breadcrumb :new
    end
  end

  def download
    if params[:token] == resource.token_download
      send_file resource.file.path
    else
      user_not_authorized
    end
  end

  private

  def import_params
    params.require(:import).permit(:name, :file, :referential_id)
  end
end