Sha256: cfcd7392f46e293119f9ccdb7f3563d99b539c829f139c2e01e87ecec98a7731

Contents?: true

Size: 604 Bytes

Versions: 2

Compression:

Stored size: 604 Bytes

Contents

module Hyrax
  class SearchState < Blacklight::SearchState
    include ActionDispatch::Routing::RouteSet::MountedHelpers

    def initialize(view_context)
      super(view_context.params, view_context.blacklight_config)
      @view_context = view_context
    end

    # Required for producing full urls (has the host)
    delegate :url_options, to: :@view_context

    # Override Blacklight so we can use the per-worktype routes
    # @param doc [#collection?, #model_name]
    def url_for_document(doc, _options = {})
      return [hyrax, doc] if doc.collection?
      [main_app, doc]
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
hyrax-1.0.0.rc1 lib/hyrax/search_state.rb
test_hyrax-0.0.1.alpha lib/hyrax/search_state.rb