Class: InstitutionsController

Inherits:
CatalogController
  • Object
show all
Includes:
Blacklight::Configurable, Blacklight::SearchHelper
Defined in:
app/controllers/institutions_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/institutions_controller.rb', line 17

def index
  @nav_li_active = 'explore'
  self.search_params_logic += [:institutions_filter]
  params[:per_page] = params[:per_page].presence || '50'
  (@response, @document_list) = search_results(params, search_params_logic)
  params[:view] ||= 'list' # still need this or grid view is invoked
  params[:sort] = 'title_info_primary_ssort asc'

  respond_to do |format|
    format.html
  end
end

#remove_unwanted_viewsObject

remove grid view from blacklight_config for index view



51
52
53
54
55
# File 'app/controllers/institutions_controller.rb', line 51

def remove_unwanted_views
  blacklight_config.view.delete(:gallery)
  blacklight_config.view.delete(:masonry)
  blacklight_config.view.delete(:slideshow)
end

#search_action_url(options = {}) ⇒ Object

Blacklight uses #search_action_url to figure out the right URL for the global search box



12
13
14
# File 'app/controllers/institutions_controller.rb', line 12

def search_action_url options = {}
  catalog_index_url(options.except(:controller, :action))
end

#showObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/institutions_controller.rb', line 30

def show
  @nav_li_active = 'explore'
  @show_response, @document = fetch(params[:id])
  @institution_title = @document[blacklight_config.index.title_field.to_sym]

  # get the response for collection objects
  @collex_response, @collex_documents = search_results({:f => {'active_fedora_model_suffix_ssi' => 'Collection','institution_pid_ssi' => params[:id]},:rows => 100, :sort => 'title_info_primary_ssort asc'}, search_params_logic)

  # add params[:f] for proper facet links
  params[:f] = {blacklight_config.institution_field => [@institution_title]}

  # get the response for the facets representing items in collection
  (@response, @document_list) = search_results({:f => params[:f]}, search_params_logic)

  respond_to do |format|
    format.html
  end

end