Module: SolrHelper

Included in:
ApplicationHelper, AtriumBaseController
Defined in:
lib/generators/atrium/install/templates/helpers/solr_helper.rb

Overview

TODO: Move to generator

Instance Method Summary collapse

Instance Method Details

#__initialize_collectionObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/atrium/install/templates/helpers/solr_helper.rb', line 4

def __initialize_collection
  @collection_response, @collection_document_list =
    get_search_results(params, evaluate_query_params)

  @extra_controller_params =
  get_current_filter_query_params(
    @collection,
    @exhibit,
    get_current_browse_level(@exhibit),
  )
end

#get_current_browse_level(exhibit) ⇒ Atrium::BrowseLevel

Checks if a browse level has been navigated to for a exhibit

Parameters:

Returns:

  • (Atrium::BrowseLevel)

    It will return a browse level that is selected, otherwise it will return nil



20
21
22
23
# File 'lib/generators/atrium/install/templates/helpers/solr_helper.rb', line 20

def get_current_browse_level(exhibit)
  return nil unless exhibit.respond_to?(:browse_levels)
  NavigationTree.new(exhibit.browse_levels, params[:f]).current_level
end

#get_exhibit_navigation_data(exhibit) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/generators/atrium/install/templates/helpers/solr_helper.rb', line 25

def get_exhibit_navigation_data(exhibit)
  browse_data=[]
  if exhibit.respond_to?(:browse_levels) && !exhibit.browse_levels.nil?
    updated_browse_levels = get_browse_level_data(exhibit)
    exhibit.browse_levels.each_index do |index|
      exhibit.browse_levels.fetch(index).values = updated_browse_levels.fetch(index).values
      exhibit.browse_levels.fetch(index).label = updated_browse_levels.fetch(index).label
      exhibit.browse_levels.fetch(index).selected = updated_browse_levels.fetch(index).selected
    end
    exhibit.browse_levels.flatten!
    browse_data << exhibit
  end

  browse_data=[] if check_for_scope(browse_data)
  @exhibit_navigation_data=browse_data
  browse_data
end