Class: Spotlight::Resources::CsvUploadController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Spotlight::Resources::CsvUploadController
- Defined in:
- app/controllers/spotlight/resources/csv_upload_controller.rb
Overview
Creating new exhibit items from single-item entry forms or batch CSV upload
Instance Method Summary collapse
Methods included from Concerns::ApplicationController
#enabled_in_spotlight_view_type_configuration?, #field_enabled?
Methods included from Controller
#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #default_url_options, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_path, #resource_masthead?, #search_action_url, #search_facet_path, #search_state, #set_exhibit_locale_scope, #set_locale
Methods included from Config
#exhibit_specific_blacklight_config
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 |
# File 'app/controllers/spotlight/resources/csv_upload_controller.rb', line 17 def create csv = CSV.parse(csv_io_param, headers: true, return_headers: false).map(&:to_hash) Spotlight::AddUploadsFromCsv.perform_later(csv, current_exhibit, current_user) flash[:notice] = t('spotlight.resources.upload.csv.success', file_name: csv_io_name) redirect_to spotlight.admin_exhibit_catalog_path(current_exhibit) end |
#template ⇒ Object
24 25 26 |
# File 'app/controllers/spotlight/resources/csv_upload_controller.rb', line 24 def template render plain: CSV.generate { |csv| csv << data_param_keys.unshift(:url) }, content_type: 'text/csv' end |