app/controllers/spotlight/exhibits_controller.rb in blacklight-spotlight-3.0.0.alpha.9 vs app/controllers/spotlight/exhibits_controller.rb in blacklight-spotlight-3.0.0.alpha.10
- old
+ new
@@ -25,12 +25,11 @@
add_breadcrumb t(:'spotlight.sites.home'), root_url
add_breadcrumb t(:'spotlight.exhibits.new.page_title')
end
def process_import
- @exhibit.import(JSON.parse(import_exhibit_params.read))
- if @exhibit.save && @exhibit.reindex_later
+ if @exhibit.import(JSON.parse(import_exhibit_params.read)) && @exhibit.reindex_later
redirect_to spotlight.exhibit_dashboard_path(@exhibit), notice: t(:'helpers.submit.exhibit.updated', model: @exhibit.class.model_name.human.downcase)
else
render action: :import
end
end
@@ -48,10 +47,10 @@
def show
respond_to do |format|
format.json do
authorize! :export, @exhibit
- send_data JSON.pretty_generate(Spotlight::ExhibitExportSerializer.new(@exhibit).as_json),
+ send_data JSON.pretty_generate(Spotlight::ExhibitImportExportService.new(@exhibit).as_json),
type: 'application/json',
disposition: 'attachment',
filename: "#{@exhibit.friendly_id}-export.json"
end
end