<commit_before><%#
  TODO: everything here (probably) should move to the ContentSerializer so we don't have this
        heavy logic in a random partial
%>
<%
  relations   = Rails.application.config.content_relations[content.class.name]
  relations ||= []
%>

<div id="associations_panel" class="panel">
  <%= render partial: 'notice_dismissal/messages/07' %>
  <div class="clearfix"></div>

  <div class="card-panel">
    <% content.incoming_page_references.group_by(&:attribute_field_id).each do |field_id, reference_list| %>
      <div class="uppercase grey-text" style="padding-bottom: 0.5em">
        <%= reference_list.first.referencing_page_type %>
        <i class="material-icons" style="position: relative; top: 7px">chevron_right</i>
        <%= reference_list.first.cached_relation_title %>
        <i class="material-icons" style="position: relative; top: 7px; margin: 0 0.3em">link</i>
        <%= reference_list.first.reference_type %>
        <span class="<%= content.class.text_color %>">
          <%= content.name %>
        </span>
      </div>
      <%=
        link_codes = reference_list.map { |ref| "#{ref.referencing_page_type}-#{ref.referencing_page_id}" }
        render partial: "content/display/attribute_value/link", 
                locals: { value: link_codes, content: content }
      %>
    <% end %>

    <% if user_signed_in? %>
      <div class="card-panel yellow lighten-5 black-text">
        Notice: The newest Notebook.ai release is adding the ability to create your own link
        fields, which includes a rather large migration of all existing link fields into a new linking system. 
        Links that haven't been migrated yet can be seen below this message; links on the new system appear above.
        <br /><br />
        Thank you for your patience during this large rewrite! This notice will automatically disappear after the
        migration has completed for everyone.
        <br /><br />
        &mdash; Andrew
      </div>
    <% end %>

    <%# TODO: remove these after finishing link migration script %>
    <% relations.each do |name, params| %>
      <%
        results = params[:related_class].where("#{params[:through_relation].downcase}_id": content.id)
          .map    { |content| content.send(params[:inverse_class].downcase) }
          .select { |content| content && content.readable_by?(current_user || User.new) }
      %>
      <% next unless results.any? %>

      <div class="uppercase grey-text">
        <%= params[:relation_text].to_s.titleize.downcase %> of
      </div>
      <%=
        link_codes = results.map { |page| "#{page.page_type}-#{page.id}" }
        render partial: "content/display/attribute_value/link", 
                locals: { value: link_codes, content: content }
      %>
    <% end %>
  </div>
</div><commit_msg>remove legacy links display & banner<commit_after><%#
  TODO: everything here (probably) should move to the ContentSerializer so we don't have this
        heavy logic in a random partial
%>

<div id="associations_panel" class="panel">
  <%= render partial: 'notice_dismissal/messages/07' %>
  <div class="clearfix"></div>

  <div class="card-panel">
    <% content.incoming_page_references.group_by(&:attribute_field_id).each do |field_id, reference_list| %>
      <div class="uppercase grey-text" style="padding-bottom: 0.5em">
        <%= reference_list.first.referencing_page_type %>
        <i class="material-icons" style="position: relative; top: 7px">chevron_right</i>
        <%= reference_list.first.cached_relation_title %>
        <i class="material-icons" style="position: relative; top: 7px; margin: 0 0.3em">link</i>
        <%= reference_list.first.reference_type %>
        <span class="<%= content.class.text_color %>">
          <%= content.name %>
        </span>
      </div>
      <%=
        link_codes = reference_list.map { |ref| "#{ref.referencing_page_type}-#{ref.referencing_page_id}" }
        render partial: "content/display/attribute_value/link", 
                locals: { value: link_codes, content: content }
      %>
    <% end %>
  </div>
</div>
{'fraction_non_alphanumeric': 0.1400341546718712, 'fraction_numerical': 0.004635276896804099, 'mean_word_length': 3.055390702274975, 'pattern_counts': {'":': 1, '<': 69, '<?xml version=': 0, '>': 69, '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': '1077309', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1203, 'n_words': 295}