<commit_before>Spree::FrontendHelper.module_eval do

  def taxon_popup_children(root_taxon, always)
    #return '' if root_taxon.leaf?
    taxons = root_taxon.children.map do |taxon|
      desc = taxon.description.nil? || taxon.description.empty? ? '' : "<span class=\"taxonomies-subtaxon-description\">#{taxon.description}</span>"
      link = link_to("<span class=\"taxonomies-subtaxon-name\">#{taxon.name}</span>#{desc}".html_safe, seo_url(taxon), class: 'taxonomies-subtaxon-link')
      "<div class=\"taxonomies-subtaxon\">#{link}</div>"
    end
    return '' if taxons.empty? && !always
    img = image_tag(root_taxon.background.url(:large), class: 'taxonomies-taxon-background')
    "<div class=\"popover\">
    #{img}
    <h3 class=\"popover-title\"><a href=\"#{seo_url(root_taxon)}\">#{root_taxon.name}</a></h3><div class=\"taxonomies-subtaxon-list\">#{taxons.join("\n")}</div>
    </div>".html_safe
  end

  def taxons_tree(root_taxon, current_taxon, max_level = 1, offset = '')

    return '' if root_taxon.leaf?

    tax = current_taxon || root_taxon

    taxons = tax.children.map do |taxon|
      css_class = (current_taxon == taxon) ? 'list-group-item active' : 'list-group-item'

      popup_children = taxon_popup_children(taxon, current_taxon.nil? || root_taxon == current_taxon);
      if !popup_children.empty?
        chevron = '<span class="taxon-chevron glyphicon glyphicon-chevron-right pull-right"></span>'
      else
        chevron = ''
      end

      link = link_to("#{offset}#{taxon.name}#{chevron}".html_safe, seo_url(taxon), class: 'taxonomies-taxon-link')
      "<li class=\"#{css_class} taxonomies-taxon\">#{link}#{popup_children}</li>"

    end

    html = taxons.join("\n").html_safe

    if offset == ''
      content_tag :ul, html, class: 'list-group', id: 'taxonomies_taxons_tree'
    else
      html
    end

  end

end
<commit_msg>taxons research)<commit_after>Spree::FrontendHelper.module_eval do

  def taxon_popup_children(root_taxon, always)
    return '' if root_taxon.leaf?
    taxons = root_taxon.children.map do |taxon|
      desc = taxon.description.nil? || taxon.description.empty? ? '' : "<span class=\"taxonomies-subtaxon-description\">#{taxon.description}</span>"
      link = link_to("<span class=\"taxonomies-subtaxon-name\">#{taxon.name}</span>#{desc}".html_safe, seo_url(taxon), class: 'taxonomies-subtaxon-link')
      "<div class=\"taxonomies-subtaxon\">#{link}</div>"
    end
    return '' if taxons.empty? && !always
    img = image_tag(root_taxon.background.url(:large), class: 'taxonomies-taxon-background')
    "<div class=\"popover\">
    #{img}
    <h3 class=\"popover-title\"><a href=\"#{seo_url(root_taxon)}\">#{root_taxon.name}</a></h3><div class=\"taxonomies-subtaxon-list\">#{taxons.join("\n")}</div>
    </div>".html_safe
  end

  def taxons_tree(root_taxon, current_taxon, max_level = 1, offset = '')

    return '' if root_taxon.leaf?

    tax = current_taxon || root_taxon

    taxons = tax.children.map do |taxon|
      css_class = (current_taxon == taxon) ? 'list-group-item active' : 'list-group-item'

      popup_children = taxon_popup_children(taxon, false);
      if !popup_children.empty?
        chevron = '<span class="taxon-chevron glyphicon glyphicon-chevron-right pull-right"></span>'
      else
        chevron = ''
      end

      link = link_to("#{offset}#{taxon.name}#{chevron}".html_safe, seo_url(taxon), class: 'taxonomies-taxon-link')
      "<li class=\"#{css_class} taxonomies-taxon\">#{link}#{popup_children}</li>"

    end

    html = taxons.join("\n").html_safe

    if offset == ''
      content_tag :ul, html, class: 'list-group', id: 'taxonomies_taxons_tree'
    else
      html
    end

  end

end

{'fraction_non_alphanumeric': 0.1744060475161987, 'fraction_numerical': 0.0016198704103671706, 'mean_word_length': 3.7560975609756095, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5208389', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1333, 'n_words': 211}