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)
50 51 52 53 54 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 50 def dwc_import_params params.require(:dwc_import).permit( :file, :name ) end |
#index ⇒ Object
GET
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 5 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
22 23 24 25 26 27 28 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 22 def set_import_settings import_dataset = ImportDataset::DarwinCore::Occurrences.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
40 41 42 43 44 45 46 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 40 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
31 32 33 34 35 36 37 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 31 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
18 19 |
# File 'app/controllers/tasks/dwca_import/dwca_import_controller.rb', line 18 def upload end |