<commit_before><% include_destroy = include_destroy || false %>
<% if track_things.empty? %>
  <div class="row">
    <div class="span12">
      <%=_("No tracked things found.")%>
    </div>
  </div>
<% else %>
  <div class="accordion" id="tracks">
    <% for track_thing in track_things %>
      <div class="accordion-group">
        <div class="accordion-heading">
         <a href="#track_<%=track_thing.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a>
             <%=track_thing.id%>: <code><%=track_thing.track_query%></code> tracked by <%=link_to '<i class="icon-eye-open"></i>'.html_safe, user_admin_url(track_thing.tracking_user) %> <%=link_to h(track_thing.tracking_user.name), main_url(user_url(track_thing.tracking_user)) %>
        </div>
        <div id="track_<%=track_thing.id%>" class="accordion-body collapse">
          <table class="table table-striped table-condensed">
            <tbody>
              <% if include_destroy %>
                <tr>
                  <td colspan="2">
                    <% form_tag '../../user/destroy_track', :class => "form form-inline admin-table-form" do %>
                      <div>
                        <%= hidden_field_tag 'track_id', track_thing.id %>
                        <%= submit_tag "Destroy track", :class => "btn btn-warning" %>
                      </div>
                    <% end %>
                  </td>
                </tr>

              <% end %>
              <% TrackThing.content_columns.each do |column| %>
              <tr>
                <td>
                  <b><%=column.human_name%></b>
                </td>
                <td>
                  <% if column.type.to_s == 'datetime' %>
                    <%= I18n.l(track_thing.send(column.name), :format => "%e %B %Y %H:%M:%S") %>
                    (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(track_thing.send(column.name))) %>)
                  <% elsif column.name == 'track_medium' and track_thing.track_medium == 'feed' %>
                    <%= link_to track_thing.track_medium, atom_feed_url(:track_id => track_thing.id) %>
                  <% else %>
                    <%= h track_thing.send(column.name)%>
                  <% end %>
                </td>
              </tr>
              <% end %>
              <tr>
                <td><b><%=_("Items sent in last month")%></b></td>
                <td><%= track_thing.track_things_sent_emails.size %></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    <% end %>
  </div>
<% end %>
<commit_msg>Link tracks to the relevant public page<commit_after><% include_destroy = include_destroy || false %>
<% if track_things.empty? %>
  <div class="row">
    <div class="span12">
      <%=_("No tracked things found.")%>
    </div>
  </div>
<% else %>
  <div class="accordion" id="tracks">
    <% for track_thing in track_things %>
      <div class="accordion-group">
        <div class="accordion-heading">
          <a href="#track_<%=track_thing.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a>
          <%=track_thing.id%>:
          <% if track_thing.public_body_id %>
            <%= link_to "<code>#{h track_thing.track_query}</code>", main_url(public_body_url(track_thing.public_body)) %>
          <% elsif track_thing.info_request_id %>
            <%= link_to "<code>#{h track_thing.track_query}</code>", main_url(request_url(track_thing.info_request)) %>
          <% elsif track_thing.tracked_user_id %>
            <%= link_to "<code>#{h track_thing.track_query}</code>", main_url(user_url(track_thing.tracked_user)) %>
          <% else %>
            <code><%=h track_thing.track_query%></code>
          <% end %>
          <% if @admin_user.nil? %>
            <%# Do not show this on the list of tracks on the user page, because it’s rather repetitive there %>
            tracked by <%=link_to '<i class="icon-eye-open"></i>'.html_safe, user_admin_url(track_thing.tracking_user) %> <%=link_to h(track_thing.tracking_user.name), main_url(user_url(track_thing.tracking_user)) %>
          <% end %>
        </div>
        <div id="track_<%=track_thing.id%>" class="accordion-body collapse">
          <table class="table table-striped table-condensed">
            <tbody>
              <% if include_destroy %>
                <tr>
                  <td colspan="2">
                    <% form_tag '../../user/destroy_track', :class => "form form-inline admin-table-form" do %>
                      <div>
                        <%= hidden_field_tag 'track_id', track_thing.id %>
                        <%= submit_tag "Destroy track", :class => "btn btn-warning" %>
                      </div>
                    <% end %>
                  </td>
                </tr>

              <% end %>
              <% TrackThing.content_columns.each do |column| %>
              <tr>
                <td>
                  <b><%=column.human_name%></b>
                </td>
                <td>
                  <% if column.type.to_s == 'datetime' %>
                    <%= I18n.l(track_thing.send(column.name), :format => "%e %B %Y %H:%M:%S") %>
                    (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(track_thing.send(column.name))) %>)
                  <% elsif column.name == 'track_medium' and track_thing.track_medium == 'feed' %>
                    <%= link_to track_thing.track_medium, atom_feed_url(:track_id => track_thing.id) %>
                  <% else %>
                    <%= h track_thing.send(column.name)%>
                  <% end %>
                </td>
              </tr>
              <% end %>
              <tr>
                <td><b><%=_("Items sent in last month")%></b></td>
                <td><%= track_thing.track_things_sent_emails.size %></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    <% end %>
  </div>
<% end %>

{'fraction_non_alphanumeric': 0.17097844112769486, 'fraction_numerical': 0.001658374792703151, 'mean_word_length': 1.751368613138686, 'pattern_counts': {'":': 0, '<': 176, '<?xml version=': 0, '>': 186, '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': '5701632', 'n_tokens_mistral': 1991, 'n_tokens_neox': 1781, 'n_words': 320}