Sha256: 280fd19760ab5629a78969814359abbabd2a0d2583d068036847deb158d2d7f6

Contents?: true

Size: 944 Bytes

Versions: 12

Compression:

Stored size: 944 Bytes

Contents

module Curate::CatalogHelper 
  def type_tab(label, key=label)
    if params[:f] && params[:f][type_field] == [key]
      content_tag(: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 }
      content_tag(:li, link_to(label, add_facet_params(type_field, key, local_params)))
    end
  end

  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?
      content_tag(:li, link_to(label, local_params))
    else
      content_tag(:li, link_to(label, '#'), class: "active")
    end
  end

  private

    def type_field
      Solrizer.solr_name("generic_type", :facetable)
    end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
curate-0.6.5 app/helpers/curate/catalog_helper.rb
curate-0.6.4 app/helpers/curate/catalog_helper.rb
curate-0.6.3 app/helpers/curate/catalog_helper.rb
curate-0.6.1 app/helpers/curate/catalog_helper.rb
curate-0.6.0 app/helpers/curate/catalog_helper.rb
curate-0.5.6 app/helpers/curate/catalog_helper.rb
curate-0.5.5 app/helpers/curate/catalog_helper.rb
curate-0.5.4 app/helpers/curate/catalog_helper.rb
curate-0.5.2 app/helpers/curate/catalog_helper.rb
curate-0.5.1 app/helpers/curate/catalog_helper.rb
curate-0.5.0 app/helpers/curate/catalog_helper.rb
curate-0.4.2 app/helpers/curate/catalog_helper.rb