Class: Spotlight::ResourcesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/spotlight/resources_controller.rb

Overview

CRUD actions for exhibit resources

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object Also known as: update



26
27
28
29
30
31
32
33
# File 'app/controllers/spotlight/resources_controller.rb', line 26

def create
  if @resource.save_and_index
    redirect_to spotlight.admin_exhibit_catalog_path(@resource.exhibit, sort: :timestamp)
  else
    flash[:error] = @resource.errors.full_messages.to_sentence if @resource.errors.present?
    render action: 'new'
  end
end

#monitor ⇒ Object



36
37
38
# File 'app/controllers/spotlight/resources_controller.rb', line 36

def monitor
  render json: current_exhibit.reindex_progress
end

#new ⇒ Object



17
18
19
20
21
22
23
24
# File 'app/controllers/spotlight/resources_controller.rb', line 17

def new
  add_breadcrumb(t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), exhibit_root_path(@exhibit))
  add_breadcrumb(t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit))
  add_breadcrumb(t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_path(@exhibit))
  add_breadcrumb(t(:'spotlight.resources.new.header'), new_exhibit_resource_path(@exhibit))

  render
end

#reindex_all ⇒ Object



40
41
42
43
44
# File 'app/controllers/spotlight/resources_controller.rb', line 40

def reindex_all
  @exhibit.reindex_later current_user

  redirect_to admin_exhibit_catalog_path(@exhibit), notice: t(:'spotlight.resources.reindexing_in_progress')
end