Class: Spotlight::CatalogController
Instance Method Summary
collapse
Methods included from Base
#autocomplete_json_response, #blacklight_config
Methods included from Config
#exhibit_specific_blacklight_config
Methods included from Controller
#blacklight_config, #current_exhibit, #exhibit_search_action_url, #exhibit_search_facet_url, #search_action_url, #search_facet_url
Instance Method Details
#admin ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 51
def admin
self.blacklight_config.view.select! { |k,v| k == :admin_table }
self.blacklight_config.view.admin_table.partials = [:index_compact]
self.blacklight_config.sort_fields.reject! { |k,v| true }
add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
add_breadcrumb t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_index_path(@exhibit)
(@response, @document_list) = get_search_results
@filters = params[:f] || []
respond_to do |format|
format.html
end
end
|
#autocomplete ⇒ Object
“id_ng” and “full_title_ng” should be defined in the Solr core’s schema.xml. It’s expected that these fields will be set up to have EdgeNGram filter setup within their index analyzer. This will ensure that this method returns results when a partial match is passed in the “q” parameter.
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 41
def autocomplete
(_, @document_list) = get_search_results(params, blacklight_config.default_autocomplete_solr_params)
respond_to do |format|
format.json do
render json: { docs: autocomplete_json_response(@document_list) }
end
end
end
|
#edit ⇒ Object
73
74
75
76
77
78
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 73
def edit
@response, @document = get_solr_response_for_doc_id params[:id]
blacklight_config.view.edit.partials = blacklight_config.view_config(:show).partials.dup
blacklight_config.view.edit.partials.delete "spotlight/catalog/tags"
blacklight_config.view.edit.partials.insert(2, :edit)
end
|
#make_private ⇒ Object
80
81
82
83
84
85
86
87
88
89
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 80
def make_private
@response, @document = get_solr_response_for_doc_id params[:catalog_id]
@document.make_private!(current_exhibit)
@document.save
respond_to do |format|
format.html { redirect_to :back }
format.json { render json: true }
end
end
|
#make_public ⇒ Object
91
92
93
94
95
96
97
98
99
100
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 91
def make_public
@response, @document = get_solr_response_for_doc_id params[:catalog_id]
@document.make_public!(current_exhibit)
@document.save
respond_to do |format|
format.html { redirect_to :back }
format.json { render json: true }
end
end
|
#new ⇒ Object
13
14
15
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 13
def new
@resource = @exhibit.resources.build
end
|
#show ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 17
def show
blacklight_config.show.partials.unshift "curation_mode_toggle"
super
if @document.private? current_exhibit
authenticate_user!
authorize! :curate, current_exhibit
end
if current_browse_category
add_breadcrumb current_browse_category.exhibit.main_navigations.browse.label_or_default, exhibit_browse_index_path(current_browse_category.exhibit)
add_breadcrumb current_browse_category.title, exhibit_browse_path(current_browse_category.exhibit, current_browse_category)
elsif current_page_context
add_breadcrumb current_page_context.title, [current_page_context.exhibit, current_page_context] if current_page_context.title.present? and !current_page_context.is_a?(Spotlight::HomePage)
else
add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), search_action_url(current_search_session[:query_params]) if current_search_session
end
add_breadcrumb Array(@document[blacklight_config.view_config(:show).title_field]).join(', '), exhibit_catalog_path(@exhibit, @document)
end
|
#update ⇒ Object
66
67
68
69
70
71
|
# File 'app/controllers/spotlight/catalog_controller.rb', line 66
def update
@response, @document = get_solr_response_for_doc_id params[:id]
@document.update(current_exhibit, solr_document_params)
@document.save
redirect_to exhibit_catalog_path(current_exhibit, @document)
end
|