Module: CommonwealthVlrEngine::ControllerOverride

Extended by:
ActiveSupport::Concern
Defined in:
lib/commonwealth-vlr-engine/controller_override.rb

Instance Method Summary collapse

Instance Method Details

#add_institution_fieldsObject

add institutions if configured



216
217
218
219
220
221
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 216

def add_institution_fields
  if t('blacklight.home.browse.institutions.enabled')
    blacklight_config.add_facet_field 'physical_location_ssim', :label => 'Institution', :limit => 8, :sort => 'count', :collapse => false
    blacklight_config.add_index_field 'institution_name_ssim', :label => 'Institution', :helper_method => :index_institution_link
  end
end

#formats_facetObject

displays values and pagination links for Format field



187
188
189
190
191
192
193
194
195
196
197
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 187

def formats_facet
  @nav_li_active = 'explore'

  @facet = blacklight_config.facet_fields['genre_basic_ssim']
  @response = get_facet_field_response(@facet.key, params)
  @display_facet = @response.aggregations[@facet.key]

  @pagination = facet_paginator(@facet, @display_facet)

  render :facet
end

#get_object_filesObject

TODO: refactor how views access files/volumes/etc.



207
208
209
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 207

def get_object_files
  @object_files = get_files(params[:id])
end

#has_volumes?(document) ⇒ Boolean

TODO: refactor how views access files/volumes/etc. returns the child volumes for Book objects (if they exist) needs to be in this module because CommonwealthVlrEngine::Finder methods aren’t accessible in helpers/views

Returns:

  • (Boolean)


226
227
228
229
230
231
232
233
234
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 226

def has_volumes?(document)
  case document[blacklight_config.show.display_type_field.to_sym]
    when 'Book'
      volumes = get_volume_objects(document.id)
    else
      volumes = nil
  end
  volumes.presence
end

#mlt_searchObject

if this is ‘more like this’ search, solr id = params



200
201
202
203
204
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 200

def mlt_search
  if params[:mlt_id]
    CatalogController.search_params_logic += [:set_solr_id_for_mlt] unless CatalogController.search_params_logic.include? :set_solr_id_for_mlt
  end
end

#set_nav_contextObject



211
212
213
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 211

def set_nav_context
  @nav_li_active = 'search'
end