Sha256: a20d329f03fefe8ed58676a6fd6dc34d11cbe810ca79152f861d2b24e8ed52b0

Contents?: true

Size: 1.41 KB

Versions: 62

Compression:

Stored size: 1.41 KB

Contents

module CurationConcerns::CatalogHelper
  def type_tab(label, key = label)
    if params[:f] && params[:f][type_field] == [key]
      content_tag(:li, link_to(label, '#'), class: 'active')
    else
      # TODO: Unused variable. Not sure why this is here.
      # facet_solr_field = facet_configuration_for_field(type_field)
      path = search_action_path(search_state.add_facet_params_and_redirect(type_field, key))
      # local_params = params.dup
      # local_facet_params = local_params[:f] || {}.with_indifferent_access
      # local_params[:f] = local_facet_params.select{|k,_| k != type_field }
      # puts "local #{local_params}"
      # path = add_facet_params(type_field, key, local_params)
      content_tag(:li, link_to(label, path))
    end
  end

  def all_type_tab(label = t('curation_concerns.catalog.index.type_tabs.all'))
    if params[:f] && params[:f][type_field]
      new_params = search_state.remove_facet_params(type_field, params[:f][type_field].first)

      # Delete any request params from facet-specific action, needed
      # to redir to index action properly.
      new_params.except!(*Blacklight::Solr::FacetPaginator.request_keys.values)
      path = search_action_path(new_params)
      content_tag(:li, link_to(label, path))
    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

62 entries across 62 versions & 1 rubygems

Version Path
curation_concerns-1.3.2 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.3.1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.3.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.2.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.1.2 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.1.1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.1.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta10 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta9 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta8 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta7 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta6 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta5 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta4 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta3 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta2 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.0.0.beta1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-0.14.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-0.14.0.pre4 app/helpers/curation_concerns/catalog_helper.rb