Class: Spotlight::HomePagesController
- Inherits:
-
PagesController
- Object
- ApplicationController
- ApplicationController
- PagesController
- Spotlight::HomePagesController
- Includes:
- Catalog
- Defined in:
- app/controllers/spotlight/home_pages_controller.rb
Overview
CRUD actions for the exhibit home page
Constant Summary collapse
- DEFAULT_FACET_LIMIT =
Copied from blacklight to avoid bringing in all of Blacklight::Catalog
10
Instance Method Summary collapse
-
#clone ⇒ Object
We’re oddly getting an unknown action error w/o explicitly defining this here.
- #edit ⇒ Object
-
#facet_limit_for(facet_field) ⇒ Object
Look up facet limit for given facet_field.
- #index ⇒ Object
- #show ⇒ Object
Methods included from Catalog
#add_facet_visibility_field, #render_curator_actions?
Methods included from SearchHelper
#search_service, #search_service_context
Methods included from Base
#autocomplete_json_response, #autocomplete_json_response_for_document, #blacklight_config, #controller_tracking_method
Methods included from Config
#exhibit_specific_blacklight_config
Methods inherited from PagesController
#create, #destroy, #new, #preview, #update, #update_all
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_state, #set_exhibit_locale_scope, #set_locale
Instance Method Details
#clone ⇒ Object
We’re oddly getting an unknown action error w/o explicitly defining this here
37 38 39 |
# File 'app/controllers/spotlight/home_pages_controller.rb', line 37 def clone super end |
#edit ⇒ Object
29 30 31 32 33 |
# File 'app/controllers/spotlight/home_pages_controller.rb', line 29 def edit (t(:'spotlight.curation.sidebar.feature_pages'), exhibit_feature_pages_path(@exhibit)) (@page.title, [:edit, @exhibit, @page]) super end |
#facet_limit_for(facet_field) ⇒ Object
Look up facet limit for given facet_field. Will look at config, and if config is ‘true’ will look up from Solr @response if available. If no limit is available, returns nil. Used from #add_facetting_to_solr to supply f.fieldname.facet.limit values in solr request (no @response available), and used in display (with @response available) to create a facet paginator with the right limit.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/spotlight/home_pages_controller.rb', line 50 def facet_limit_for(facet_field) facet = blacklight_config.facet_fields[facet_field] return if facet.blank? if facet.limit && @response && @response.aggregations[facet.field] limit = @response.aggregations[facet.field].limit if limit.nil? # we didn't get or a set a limit, so infer one. facet.limit if facet.limit != true elsif limit == -1 # limit -1 is solr-speak for unlimited nil else limit.to_i - 1 # we added 1 to find out if we needed to paginate end elsif facet.limit facet.limit == true ? DEFAULT_FACET_LIMIT : facet.limit end end |
#index ⇒ Object
15 16 17 |
# File 'app/controllers/spotlight/home_pages_controller.rb', line 15 def index redirect_to exhibit_feature_pages_path(@exhibit) end |
#show ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/spotlight/home_pages_controller.rb', line 19 def show @response, @document_list = search_service.search_results if @page. if @page.nil? || !@page.published? render '/catalog/index' else render 'show' end end |