Module: FacetsHelper

Defined in:
app/helpers/facets_helper.rb

Instance Method Summary collapse

Instance Method Details

#facet_sort_url(sort_type, facet_field) ⇒ Object



16
17
18
# File 'app/helpers/facets_helper.rb', line 16

def facet_sort_url(sort_type, facet_field)
  url_for(request.query_parameters.merge(:controller => "catalog", :action => "facet", "facet_field" => facet_field, "facet.sort" => sort_type))
end

#local_facet_sort_buttons(facet_field) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/facets_helper.rb', line 4

def local_facet_sort_buttons(facet_field)
  (:div, class: "sort-options btn-group") do
    if params["facet.sort"] == "index"
      (:span, "A-Z Sort", class: "active az btn btn-outline-secondary", data: {blacklight_modal: "preserve"}) +
        link_to("Numerical Sort", facet_sort_url("count", facet_field), class: "sort_change numeric btn btn-outline-secondary", data: {blacklight_modal: "preserve"})
    else
      link_to("A-Z Sort", facet_sort_url("index", facet_field), class: "sort_change az btn btn-outline-secondary", data: {blacklight_modal: "preserve"}) +
        (:span, "Numerical Sort", class: "active numeric btn btn-outline-secondary")
    end
  end
end