Class: Spotlight::BulkUpdatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Spotlight::BulkUpdatesController
- Defined in:
- app/controllers/spotlight/bulk_updates_controller.rb
Overview
Controller enabling bulk functionality for items defined in a spreadsheet.
Instance Method Summary collapse
Methods included from Concerns::ApplicationController
#enabled_in_spotlight_view_type_configuration?, #field_enabled?
Methods included from Controller
#add_breadcrumb, #blacklight_config, #breadcrumbs, #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
#download_template ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/spotlight/bulk_updates_controller.rb', line 19 def download_template # Set Last-Modified as a work-around for https://github.com/rack/rack/issues/1619 headers['Last-Modified'] = '' headers['Cache-Control'] = 'no-cache' headers['Content-Type'] = 'text/csv' headers['Content-Disposition'] = "attachment; filename=\"#{current_exhibit.slug}-bulk-update-template.csv\"" headers.delete('Content-Length') self.response_body = csv_template end |
#edit ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/spotlight/bulk_updates_controller.rb', line 13 def edit (t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit) (t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)) (t(:'spotlight.pages.index.bulk_updates.header'), edit_exhibit_bulk_updates_path(@exhibit)) end |
#monitor ⇒ Object
40 41 42 |
# File 'app/controllers/spotlight/bulk_updates_controller.rb', line 40 def monitor render json: BackgroundJobProgress.new(current_exhibit, job_class: Spotlight::ProcessBulkUpdatesCsvJob) end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/spotlight/bulk_updates_controller.rb', line 30 def update bulk_update = Spotlight::BulkUpdate.new(exhibit: current_exhibit, file: file_params) if bulk_update.save ProcessBulkUpdatesCsvJob.perform_later(current_exhibit, bulk_update) redirect_back fallback_location: spotlight.edit_exhibit_bulk_updates_path(current_exhibit), notice: t(:'spotlight.bulk_updates.update.submitted') else redirect_back fallback_location: spotlight.edit_exhibit_bulk_updates_path(current_exhibit), alert: t(:'spotlight.bulk_updates.update.error') end end |