app/views/content/panels/_associations.html.erb
<%#
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>