Module: Curate::CatalogHelper

Defined in:
app/helpers/curate/catalog_helper.rb

Instance Method Summary collapse

Instance Method Details

#all_type_tab(label = "All") ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/curate/catalog_helper.rb', line 13

def all_type_tab(label = "All")
  if params[:f] && params[:f][type_field]
    local_params = params.dup
    local_params[:f] = local_params[:f].select{|k,_| k != type_field }
    local_params.delete(:f) if local_params[:f].empty?
    (:li, link_to(label, local_params))
  else
    (:li, link_to(label, '#'), class: "active")
  end
end

#catalog_typeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/curate/catalog_helper.rb', line 24

def catalog_type
  if params[:f] && params[:f][type_field]
    if params[:f][type_field].first == "All"
      "Content"
    elsif params[:f][type_field].first == "Person"
      "Profile"
    else
      params[:f][type_field].first.pluralize
    end
  else
    "Content"
  end
end

#type_tab(label, key = label) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'app/helpers/curate/catalog_helper.rb', line 2

def type_tab(label, key=label)
  if params[:f] && params[:f][type_field] == [key]
    (:li, link_to(label, "#"), class: "active")
  else
    local_params = params.dup
    local_facet_params = local_params[:f] || {}.with_indifferent_access
    local_params[:f] = local_facet_params.select{|k,_| k != type_field }
    (:li, link_to(label, add_facet_params(type_field, key, local_params)))
  end
end