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



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/institutions_controller.rb', line 21

def index
  @nav_li_active = 'explore'
  params[:per_page] = params[:per_page].presence || '50'
  (@response, @document_list) = search_results(params)
  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

#search_action_url(options = {}) ⇒ Object

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



16
17
18
# File 'app/controllers/institutions_controller.rb', line 16

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

#showObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/institutions_controller.rb', line 33

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'})

  # 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]})

  # get an image for the institution
  if @document[:exemplary_image_ssi]
    @institution_image_pid = @document[:exemplary_image_ssi]
  end

  respond_to do |format|
    format.html
  end

end