Sha256: d207e0908d88dbefdd0cf1e3c7562f5cafcb9b3f1611cf2064c1c4de1457ec6c
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
module Spree::BaseHelper def breadcrumb_pairs(taxon) crumbs = [] if taxon crumbs << [Spree.t(:products), products_url] crumbs += taxon.ancestors.collect { |a| [a.name, spree.nested_taxons_url(a.permalink)] } unless taxon.ancestors.empty? crumbs << [taxon.name, spree.nested_taxons_url(taxon.permalink)] else crumbs << [Spree.t(:products), products_url] end crumbs end def taxon_breadcrumbs_with_jsonld(taxon, separator = ' » ', list_class = 'list-inline', list_item_class = 'list-inline-item') return '' if current_page?('/') || taxon.nil? separator = tag.span(separator.html_safe, class: 'breadcrumb-separator') original_output = Nokogiri::HTML::DocumentFragment.parse(taxon_breadcrumbs_without_jsonld(taxon, separator, list_class).to_s) original_output.xpath('@itemscope|@itemtype|@itemprop|.//@itemscope|.//@itemtype|.//@itemprop').remove original_output.search('.columns').first['class'] = '' original_output.search('li').attr('class', list_item_class) jsonld_breadcrumbs(breadcrumb_pairs(taxon)) + original_output.to_s.html_safe end alias_method :taxon_breadcrumbs_without_jsonld, :taxon_breadcrumbs alias_method :taxon_breadcrumbs, :taxon_breadcrumbs_with_jsonld end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
solidus_seo-1.0.2 | app/helpers/spree/base_helper_decorator.rb |
solidus_seo-1.0.1 | app/helpers/spree/base_helper_decorator.rb |
solidus_seo-1.0.0 | app/helpers/spree/base_helper_decorator.rb |