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_url, #resource_masthead?, #search_action_url, #search_facet_url, #set_exhibit_locale_scope, #set_locale
Methods included from Config
#exhibit_specific_blacklight_config
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 |
# File 'app/controllers/spotlight/resources/csv_upload_controller.rb', line 15 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_back(fallback_location: spotlight.exhibit_resources_path(current_exhibit)) end |
#template ⇒ Object
22 23 24 |
# File 'app/controllers/spotlight/resources/csv_upload_controller.rb', line 22 def template render plain: CSV.generate { |csv| csv << data_param_keys.unshift(:url) }, content_type: 'text/csv' end |