<commit_before>package EnsEMBL::Web::Document::HTML::LocalTools;

# Generates the local context tools - configuration, data export, etc.

use strict;
use base qw(EnsEMBL::Web::Document::HTML);
use EnsEMBL::Web::RegObj;

sub add_entry {
  my $self = shift;
  push @{$self->{'_entries'}}, {@_};
}

sub entries {
  my $self = shift;
  return $self->{'_entries'}||[];
}

sub render {
  my $self = shift;
  $self->print($self->_content);
}

sub _content {
  my $self = shift;
  
  return unless @{$self->entries};
  
  my %icons = (
    'Configure this page'     => 'config',
    'Manage your data'        => 'data',
    'Export data'             => 'export',
    'Bookmark this page'      => 'bookmark'
  );
  
  my $html = '<div id="local-tools">';

  foreach( @{$self->entries} ) {
    my $icon = qq{<img src="/i/$icons{$_->{'caption'}}.png" alt="" />};

    if ($_->{'class'} eq 'disabled') {
      $html .= qq{<p class="disabled" title="$_->{'title'}">$icon$_->{'caption'}</p>};
    } else {
      my $attrs = $_->{'class'};
      my $rel = lc $_->{'rel'};
      $attrs .= ($attrs ? ' ' : '') . 'external' if $rel eq 'external';
      $attrs = qq{class="$attrs"} if $attrs;
      $attrs .= ' style="display:none"' if $attrs =~ /modal_link/;
      $attrs .= qq{ rel="$rel"} if $rel;

      $html .= qq{
        <p><a href="$_->{'url'}" $attrs>$icon$_->{'caption'}</a></p>};
    }

  }
  $html .= '</div>';

  return $html; 

}
<commit_msg>moved images to background images based on classes<commit_after>package EnsEMBL::Web::Document::HTML::LocalTools;

# Generates the local context tools - configuration, data export, etc.

use strict;
use base qw(EnsEMBL::Web::Document::HTML);
use EnsEMBL::Web::RegObj;

sub add_entry {
  my $self = shift;
  push @{$self->{'_entries'}}, {@_};
}

sub entries {
  my $self = shift;
  return $self->{'_entries'}||[];
}

sub render {
  my $self = shift;
  $self->print($self->_content);
}

sub _content {
  my $self = shift;
  
  return unless @{$self->entries};
  
  my %classes = (
    'Configure this page' => 'config',
    'Manage your data'    => 'data',
    'Export data'         => 'export',
    'Bookmark this page'  => 'bookmark'
  );
  
  my $html = '<div id="local-tools">';

  foreach( @{$self->entries} ) {
    if ($_->{'class'} eq 'disabled') {
      $html .= qq{<p class="disabled $classes{$_->{'caption'}}" title="$_->{'title'}">$_->{'caption'}</p>};
    } else {
      my $attrs = $_->{'class'};
      my $rel = lc $_->{'rel'};
      $attrs .= ($attrs ? ' ' : '') . 'external' if $rel eq 'external';
      $attrs .= ($attrs ? ' ' : '') . $classes{$_->{'caption'}} if $classes{$_->{'caption'}};
      $attrs = qq{class="$attrs"} if $attrs;
      $attrs .= ' style="display:none"' if $attrs =~ /modal_link/;
      $attrs .= qq{ rel="$rel"} if $rel;

      $html .= qq{
        <p><a href="$_->{'url'}" $attrs>$_->{'caption'}</a></p>};
    }

  }
  $html .= '</div>';

  return $html; 

}

{'fraction_non_alphanumeric': 0.2387602179836512, 'fraction_numerical': 0.0, 'mean_word_length': 2.9635627530364372, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 58, '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': '4221821', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1061, 'n_words': 248}