Class: Tasks::DwcaImport::DwcaImportController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tasks::DwcaImport::DwcaImportController
- Includes:
- TaskControllerConfiguration
- Defined in:
- app/controllers/tasks/dwca_import/dwca_import_controller.rb
Instance Method Summary collapse
- #dwc_import_params ⇒ Object private
-
#index ⇒ Object
GET.
-
#set_import_settings ⇒ Object
POST.
-
#update_catalog_number_collection_code_namespace ⇒ Object
POST.
-
#update_catalog_number_namespace ⇒ Object
POST.
-
#upload ⇒ Object
POST.
Methods included from TaskControllerConfiguration
Instance Method Details
#dwc_import_params ⇒ Object (private)
52 53 54 55 56 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 52 def dwc_import_params params.require(:dwc_import).permit( :file, :name ) end |
#index ⇒ Object
GET
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 7 def index respond_to do |format| format.html format.json { @datasets = ImportDataset::DarwinCore .where(project_id: sessions_current_project_id) .order(:updated_at, :description) .page(params[:page]).per(params[:per] || 25) } end end |
#set_import_settings ⇒ Object
POST
24 25 26 27 28 29 30 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 24 def set_import_settings import_dataset = ImportDataset::DarwinCore.find(params[:import_dataset_id]) settings = import_dataset.set_import_settings(params[:import_settings]) import_dataset.save! render json: settings end |
#update_catalog_number_collection_code_namespace ⇒ Object
POST
42 43 44 45 46 47 48 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 42 def update_catalog_number_collection_code_namespace ImportDataset::DarwinCore::Occurrences .find(params[:import_dataset_id]) .update_catalog_number_collection_code_namespace(params[:collectionCode], params[:namespace_id]) render json: {success: true} end |
#update_catalog_number_namespace ⇒ Object
POST
33 34 35 36 37 38 39 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 33 def update_catalog_number_namespace ImportDataset::DarwinCore::Occurrences .find(params[:import_dataset_id]) .update_catalog_number_namespace(params[:institutionCode], params[:collectionCode], params[:namespace_id]) render json: {success: true} end |
#upload ⇒ Object
POST
20 21 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 20 def upload end |