Module: CommonwealthVlrEngine::BlacklightUrlHelper
- Includes:
- Blacklight::UrlHelperBehavior
- Defined in:
- app/helpers/commonwealth_vlr_engine/blacklight_url_helper.rb
Instance Method Summary collapse
-
#show_solr_document_url(doc, options) ⇒ Object
need this method for rss and atom polymorphic_url(url_for_document(document)) because polymorphic_url appends any action passed in arg hash to route so we need to re-route to the correct url.
-
#url_for_document(doc, options = {}) ⇒ Object
override to route to collections#show and institutions#show where appropriate this uses the older BL 5.14 def as the basis, but don’t really need to update to BL6.* model.
Instance Method Details
#show_solr_document_url(doc, options) ⇒ Object
need this method for rss and atom polymorphic_url(url_for_document(document)) because polymorphic_url appends any action passed in arg hash to route so we need to re-route to the correct url
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/commonwealth_vlr_engine/blacklight_url_helper.rb', line 8 def show_solr_document_url doc, if [:controller] case [:controller] when 'collections' collection_url doc when 'institutions' institution_url doc end else solr_document_url doc, end end |
#url_for_document(doc, options = {}) ⇒ Object
override to route to collections#show and institutions#show where appropriate this uses the older BL 5.14 def as the basis, but don’t really need to update to BL6.* model
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/commonwealth_vlr_engine/blacklight_url_helper.rb', line 24 def url_for_document doc, = {} if respond_to?(:blacklight_config) && doc.respond_to?(:[]) display_type = doc[blacklight_config.show.display_type_field].presence if display_type == 'Collection' || display_type == 'Institution' {controller: display_type.downcase.pluralize, action: :show, id: doc} else doc end else doc end end |