Sha256: 3a5e86a0de2c3ea0b252b90d4a9523dc8f94b00616bbf6e9acf1e258084e8c2f

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module Hydra
  module FacetsHelperBehavior
    include Blacklight::FacetsHelperBehavior

    # Removing the [remove] link and label class from the default selected facet display
    def render_selected_facet_value(facet_solr_field, item)
      content_tag(:span, render_facet_value(facet_solr_field, item, :suppress_link => true), :class => "selected")
    end

    # @override to remove the label class (easier integration with bootstrap)
    # and handles arrays
    def render_facet_value(facet_solr_field, item, options ={})    
      if item.is_a? Array
        render_array_facet_value(facet_solr_field, item, options)
      end

      (link_to_unless(options[:suppress_link], item.value, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
    end

    def render_array_facet_value(facet_solr_field, item, options)
      ActiveSupport::Deprecation.warn("render_array_facet_value is deprecated and will be removed in the next release")

      (link_to_unless(options[:suppress_link], item[0], add_facet_params_and_redirect(facet_solr_field, item[0]), :class=>"facet_select") + " (" + format_num(item[1]) + ")").html_safe 
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydra-head-4.0.0 app/helpers/hydra/facets_helper_behavior.rb