Sha256: ad3f1ae20a8fc243350b17593dc5df47a27bb3f075205e7836f98f4d167d5cc1

Contents?: true

Size: 896 Bytes

Versions: 31

Compression:

Stored size: 896 Bytes

Contents

module Blacklight
  module Rendering
    class LinkToFacet < AbstractStep
      def render
        # TODO: We should rename the config variable, because it creates a link to a facet.
        return next_step(values) unless config.link_to_search
        next_step(render_link)
      end

      private

        # This allows the link to wrap an itemprop
        def render_link
          values.map { |v| link(link_field, v) }
        end

        def link_field
          return config.key if config.link_to_search == true
          config.link_to_search
        end

        def link(field, v)
          context.link_to v, search_path(field, v)
        end

        def search_path(field, v)
          context.search_action_path(facet_params(field, v))
        end

        def facet_params(field, v)
          context.search_state.reset.add_facet_params(field, v)
        end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
blacklight-6.10.1 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.10.0 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.9.0 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.8.0 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.7.3 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.7.2 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.7.1 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.7.0 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.6.2 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.6.1 app/presenters/blacklight/rendering/link_to_facet.rb
blacklight-6.6.0 app/presenters/blacklight/rendering/link_to_facet.rb