Module: Georgia::FacetsHelper

Defined in:
app/helpers/georgia/facets_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_facet_list(*facets) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/georgia/facets_helper.rb', line 22

def active_facet_list(*facets)
  return unless facets and !facets.empty?
  output = ActiveSupport::SafeBuffer.new
  facets.each do |param|
    if params[param] and params[param].is_a?(Array)
      params[param].each{|v| output << Georgia::ActiveFacetPresenter.new(self, v, param) } if params[param] and !params[param].empty?
    else
      output << Georgia::SingleActiveFacetPresenter.new(self, params[param], param) if params[param].present?
    end
  end
  (:div, ("Your selection: " + output).html_safe, class: 'active-facets') if output and !output.blank?
end

#facet_list_tag(list, param, options = {}) ⇒ Object



18
19
20
# File 'app/helpers/georgia/facets_helper.rb', line 18

def facet_list_tag list, param, options={}
  Georgia::ListFacetPresenter.new(self, list, :tg, options)
end

#facet_tag(text, param, options = {}) ⇒ Object



14
15
16
# File 'app/helpers/georgia/facets_helper.rb', line 14

def facet_tag text, param, options={}
  Georgia::FacetPresenter.new(self, text, param, options)
end

#facets_inputs(facets = []) ⇒ Object



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

def facets_inputs facets=[]
  facets.map do |f|
    if params[f] and !params[f].empty?
      params[f].map do |v|
        hidden_field_tag(f, v, name: "#{f}[]")
      end
    end
  end.flatten.join().html_safe
end