<commit_before><% content_for :title, "Dashboard" %>

<h3>Site Analytics</h3>

<% unless Translation.find_by_key('site.show.dashboard.analytics').try(:value).eql?("true") %>
  <p>Please set your google anlytics credentials <%= link_to "here", translations_path %></p>
<% else %>
  <p><%= link_to "Click here", "?analytics=true" %> to hard reset the analytics.</p>
  <table class="table padded-sides ruled br br-grey-d8 rd-b-5px ln-h-3">
    <thead>
      <tr class="control tx-11px tx-grey-54 bg-grey-f4">
        <th>Path</th>
        <th>Pageviews</th>
        <th>Unique Pageviews</th>
        <th>Exits</th>
      </tr>
    </thead>
    <% @result.each do |r| %>
    <tr>
      <td><%= truncate r.page_path, length: 50 %></td>
      <td><%= r.pageviews %></td>
      <td><%= r.unique_pageviews %></td>
      <td><%= r.exits %></td>
    </tr>
    <% end %>
  </table>

  <div class="chart">
    <h3>Browsers</h3>
    <div id="browser-chart"></div>
    <% content_for :head do %>
      <script type="text/javascript">
        var chart;
        $(document).ready(function() {
          chart = new Highcharts.Chart({
            chart: {
              renderTo: 'browser-chart',
              plotBackgroundColor: null,
              plotBorderWidth: null,
              plotShadow: false
            },
            title: {
              text: 'Browsers used to access this website'
            },
            tooltip: {
              formatter: function() {
                return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
              }
            },
            plotOptions: {
              pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                  enabled: true,
                  color: '#000000',
                  connectorColor: '#000000',
                  formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
                  }
                }
              }
            },
            series: [{
              type: 'pie',
              name: 'Browser share',
              data: <%= raw Exits.browsers %>
            }]
          });
        });
      </script>
    <% end %>
  </div>

  <div class="chart">
    <h3>Keywords</h3>
    <div id="keywords-chart"></div>
    <% content_for :head do %>
      <script type="text/javascript">
        var chart;
        $(document).ready(function() {
          chart = new Highcharts.Chart({
            chart: {
              renderTo: 'keywords-chart',
              plotBackgroundColor: null,
              plotBorderWidth: null,
              plotShadow: false
            },
            title: {
              text: 'Keywords used to search this website'
            },
            tooltip: {
              formatter: function() {
                return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
              }
            },
            plotOptions: {
              pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                  enabled: true,
                  color: '#000000',
                  connectorColor: '#000000',
                  formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
                  }
                }
              }
            },
            series: [{
              type: 'pie',
              name: 'Keywords',
              data: <%= raw Exits.keywords %>
            }]
          });
        });
      </script>
    <% end %>
  </div>

  <div class="chart">
    <table>
      <tr>
        <td>Continent</td>
        <td>Pageviews</td>
      </tr>
      <% Exits.continents.each do |result| %>
        <tr>
          <td><%= result.continent %></td>
          <td><%= result.pageviews %></td>
        </tr>
      <% end %>
    </table>
  </div>
<% end %>

<% content_for :side do %>
  <% content_for :head do %>
    <script type="text/javascript">
      jQuery(function($){
        $("#twitter-query").tweet({
          avatar_size: 32,
          count: 5,
          query: "<%= Translation.find_by_key('site.twitter.query').value %>",
          loading_text: "searching twitter..."
        }).bind("empty", function() { $(this).append('No matching tweets found. Please<p>Please set your twitter search query <%= link_to "here", translations_path %></p>'); });
      });
  </script>
  <% end %>
  <h3>Latest Tweets</h3>
  <div id="twitter-query"></div>
<% end %><commit_msg>Changed twitter sidebar to use value<commit_after><% content_for :title, "Dashboard" %>

<h3>Site Analytics</h3>

<% unless Translation.find_by_key('site.show.dashboard.analytics').try(:value).eql?("true") %>
  <p>Please set your google anlytics credentials <%= link_to "here", translations_path %></p>
<% else %>
  <p><%= link_to "Click here", "?analytics=true" %> to hard reset the analytics.</p>
  <table class="table padded-sides ruled br br-grey-d8 rd-b-5px ln-h-3">
    <thead>
      <tr class="control tx-11px tx-grey-54 bg-grey-f4">
        <th>Path</th>
        <th>Pageviews</th>
        <th>Unique Pageviews</th>
        <th>Exits</th>
      </tr>
    </thead>
    <% @result.each do |r| %>
    <tr>
      <td><%= truncate r.page_path, length: 50 %></td>
      <td><%= r.pageviews %></td>
      <td><%= r.unique_pageviews %></td>
      <td><%= r.exits %></td>
    </tr>
    <% end %>
  </table>

  <div class="chart">
    <h3>Browsers</h3>
    <div id="browser-chart"></div>
    <% content_for :head do %>
      <script type="text/javascript">
        var chart;
        $(document).ready(function() {
          chart = new Highcharts.Chart({
            chart: {
              renderTo: 'browser-chart',
              plotBackgroundColor: null,
              plotBorderWidth: null,
              plotShadow: false
            },
            title: {
              text: 'Browsers used to access this website'
            },
            tooltip: {
              formatter: function() {
                return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
              }
            },
            plotOptions: {
              pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                  enabled: true,
                  color: '#000000',
                  connectorColor: '#000000',
                  formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
                  }
                }
              }
            },
            series: [{
              type: 'pie',
              name: 'Browser share',
              data: <%= raw Exits.browsers %>
            }]
          });
        });
      </script>
    <% end %>
  </div>

  <div class="chart">
    <h3>Keywords</h3>
    <div id="keywords-chart"></div>
    <% content_for :head do %>
      <script type="text/javascript">
        var chart;
        $(document).ready(function() {
          chart = new Highcharts.Chart({
            chart: {
              renderTo: 'keywords-chart',
              plotBackgroundColor: null,
              plotBorderWidth: null,
              plotShadow: false
            },
            title: {
              text: 'Keywords used to search this website'
            },
            tooltip: {
              formatter: function() {
                return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
              }
            },
            plotOptions: {
              pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                  enabled: true,
                  color: '#000000',
                  connectorColor: '#000000',
                  formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
                  }
                }
              }
            },
            series: [{
              type: 'pie',
              name: 'Keywords',
              data: <%= raw Exits.keywords %>
            }]
          });
        });
      </script>
    <% end %>
  </div>

  <div class="chart">
    <table>
      <tr>
        <td>Continent</td>
        <td>Pageviews</td>
      </tr>
      <% Exits.continents.each do |result| %>
        <tr>
          <td><%= result.continent %></td>
          <td><%= result.pageviews %></td>
        </tr>
      <% end %>
    </table>
  </div>
<% end %>

<% content_for :side do %>
  <% content_for :head do %>
    <script type="text/javascript">
      jQuery(function($){
        $("#twitter-query").tweet({
          avatar_size: 32,
          count: 5,
          query: "<%= Translation.find_by_key('site.twitter.query').try(:value) %>",
          loading_text: "searching twitter..."
        }).bind("empty", function() { $(this).append('No matching tweets found. Please<p>Please set your twitter search query <%= link_to "here", translations_path %></p>'); });
      });
  </script>
  <% end %>
  <h3>Latest Tweets</h3>
  <div id="twitter-query"></div>
<% end %>
{'fraction_non_alphanumeric': 0.16517036235803137, 'fraction_numerical': 0.009734991887506761, 'mean_word_length': 1.4656, 'pattern_counts': {'":': 0, '<': 215, '<?xml version=': 0, '>': 215, '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': '918782', 'n_tokens_mistral': 2936, 'n_tokens_neox': 2666, 'n_words': 567}