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



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

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



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

def formats_facet
  @nav_li_active = 'explore'
  @page_title = t('blacklight.formats.page_title', :application_name => t('blacklight.application_name'))

  @facet = blacklight_config.facet_fields['genre_basic_ssim']

  @response = get_facet_field_response(@facet.key, params, {"f.genre_basic_ssim.facet.limit" => -1})
  @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.



205
206
207
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 205

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)


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

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



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

def mlt_search
  if params[:mlt_id]
    blacklight_config.search_builder_class = CommonwealthMltSearchBuilder
  end
end

#set_nav_contextObject



209
210
211
# File 'lib/commonwealth-vlr-engine/controller_override.rb', line 209

def set_nav_context
  @nav_li_active = 'search'
end