<commit_before><% title @data_type.name %>

<strong>Description:</strong>
<%=h @data_type.description %> <br /> <br />

<strong>Data fields:</strong>
    <ul>
      <% for field in @data_type.data_fields %>
        <li>
          <strong><%= field.name %></strong>
          <%= link_to "[edit]", edit_data_type_data_field_path(@data_type, field) %>
          <%= link_to "[x]", data_type_data_field_path(@data_type, field), :confirm => 'Delete this data field?', :method => :delete %>
        </li>
        <ul style="margin-left: 1em">
          <li>Type: <%= field.display_type.humanize %>
          <li>Values: <%= (field.values.nil? or field.values.empty?) ? "none" : field.values %>
        </ul>
      <% end %>
    </ul>
    <br>
    <%= button_to "Add a new data field", new_data_type_data_field_path(@data_type), :method => :get %>
  </p>
  <strong>Data objects of this type:</strong>
  <table class = "tablesorter">
    <tr>
      <th>Name</th>
      <th>Description</th>
      <% @data_type.data_fields.each do |df| %>
      <th>
        <%= df.name %>
       </th>
      <% end %>
    </tr>
    <% for obj in @data_type.data_objects %>
      <% entry = obj.data_entries.last.data_fields_with_contents unless obj.data_entries.empty? %>
      <tr>
        <td>
          <%= link_to "#{obj.name}", obj %>
        </td>
        <td>
          <%= obj.description %>
	   </td>
        <% @data_type.data_fields.each do |df| %>
        <td>
         <%= entry[df.id.to_s] if entry %>
          </td>
		<td>  <%= link_to "Delete", obj,  
            :confirm => 'Are you sure you want to destroy this data object? This will destroy all entries belonging to this object.', 
            :method => :delete %>
			</td>
        <% end %>
      </tr>
    <% end %>
  </table>
  <%= link_to "New Data Object", new_data_type_data_object_path(@data_type), :method => :get %> <br /> <br />


  <p>
    <%= link_to "Edit", edit_data_type_path(@data_type) %> | 
    <%= link_to "Destroy", @data_type, :confirm => 'Are you sure? This will destroy all data objects of this type, as well as their associated entries.', :method => :delete %> |
    <%= link_to "View All", data_types_path %>
  </p><commit_msg>Tidied up data entries show page<commit_after><% title @data_type.name %>

<strong>Description:</strong>
<%=h @data_type.description %> <br /> <br />

<h2><strong>Data fields:</strong></h2>

<table class = "tablesorter">
	<tr>
       <th>Name</th>
	   <th>Type</th>
       <th>Values </th>
	</tr>
	<% for field in @data_type.data_fields %>
	<tr>
	  <td> <%= field.name%> </td>
	  <td> <%= field.display_type.humanize %></td>
	  <td> <%= (field.values.nil? or field.values.empty?) ? "none" : field.values %> </td>
	  <td> <%= link_to "Edit", edit_data_type_data_field_path(@data_type, field) %> </td>
	  <td> <%= link_to "Delete", data_type_data_field_path(@data_type, field), :confirm => 'Delete this data field?', :method => :delete %></td>
	<% end %>		
	</tr>
</table>
    <%= link_to "New Data Field", new_data_type_data_field_path(@data_type), :method => :get %> <br /> <br  />


  <h2><strong>Data objects of this type:</strong></h2>
  <table class = "tablesorter">
    <tr>
      <th>Name</th>
      <th>Description</th>
      <% @data_type.data_fields.each do |df| %>
      <th>
        <%= df.name %>
      </th>
      <% end %>
    </tr>
    <% for obj in @data_type.data_objects %>
      <% entry = obj.data_entries.last.data_fields_with_contents unless obj.data_entries.empty? %>
    <tr>
      <td>
        <%= link_to "#{obj.name}", obj %>
      </td>
      <td>
        <%= obj.description %>
	  </td>
        <% @data_type.data_fields.each do |df| %>
      <td>
        <%= entry[df.id.to_s] if entry %>
      </td>
    <% end %>
	  <td>
		<%= link_to "Edit", edit_data_object_path(obj) %>
	  </td>
      <td>  
		<%= link_to "Delete", obj, :confirm => 'Are you sure you want to destroy this data object? This will destroy all entries belonging to this object.',:method => :delete %>
	  </td>
    </tr>
    <% end %>
  </table>
  <%= link_to "New Data Object", new_data_type_data_object_path(@data_type), :method => :get %> <br /> <br />


  <p>
    <%= link_to "Edit", edit_data_type_path(@data_type) %> | 
    <%= link_to "Destroy", @data_type, :confirm => 'Are you sure? This will destroy all data objects of this type, as well as their associated entries.', :method => :delete %> |
    <%= link_to "View All", data_types_path %>
  </p>
{'fraction_non_alphanumeric': 0.18967452300785634, 'fraction_numerical': 0.001122334455667789, 'mean_word_length': 2.6948590381426203, 'pattern_counts': {'":': 0, '<': 162, '<?xml version=': 0, '>': 178, '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': '3084357', 'n_tokens_mistral': 1681, 'n_tokens_neox': 1546, 'n_words': 370}