Module: Sufia::FacetsHelperBehavior

Includes:
Hydra::FacetsHelperBehavior
Included in:
FacetsHelper
Defined in:
app/helpers/sufia/facets_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#render_facet_value(facet_solr_field, item, options = {}) ⇒ Object

Override to remove the label class (easier integration with bootstrap) and handles arrays



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/sufia/facets_helper_behavior.rb', line 7

def render_facet_value(facet_solr_field, item, options ={})
  logger.warn "display value #{ facet_display_value(facet_solr_field, item)}"
  if item.is_a? Array
    render_array_facet_value(facet_solr_field, item, options)
  end
  if params[:controller] == "dashboard"
    path = sufia.url_for(add_facet_params_and_redirect(facet_solr_field,item.value ).merge(:only_path=>true))
    (link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item), path, :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
  else
    # This is for controllers that use this helper method that are defined outside Sufia
    path = url_for(add_facet_params_and_redirect(facet_solr_field, item.value).merge(:only_path=>true))
    (link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item), path, :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
  end
end