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.7.8 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.7 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-2.0.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-2.0.0.rc2 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.6 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.5 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.4 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.3 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.2 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-2.0.0.rc1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.7.0.beta1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.6.3 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.6.2 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.6.1 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.6.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.5.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.4.0 app/helpers/curation_concerns/catalog_helper.rb
curation_concerns-1.3.3 app/helpers/curation_concerns/catalog_helper.rb