<%#
  We're deprecating this quick reference partial in favor of the new sidebar design we're using in documents
%>

<%# Usage: render partial: 'content/display/quick_reference', locals: { content: @content } %>
<%
  serialized_content = ContentSerializer.new(content)
%>

<h4 class="reference-title">
  <i class="material-icons <%= content.class.text_color %>"><%= content.class.icon %></i>
  <%= link_to content.name, content %>
  <% if content.respond_to?(:universe) && content.universe %>
    <%= link_to content.universe do %>
      <i class="material-icons <%= Universe.text_color %> right tooltipped" data-position="left" data-delay="300" data-tooltip="<%= content.universe.name %>">
        <%= Universe.icon %>
      </i>
    <% end %>
  <% end %>
</h4>

<ul class="collapsible">
  <% serialized_content.data[:categories].each do |category| %>
    <% next if ['changelog'].include?(category[:name]) %>
    <% next unless category[:fields].any? { |field| field[:value].present? } %>
    <li>
      <div class="collapsible-header">
        <i class="material-icons grey-text"><%= category[:icon] %></i>
        <%= category[:label] %>
      </div>
      <div class="collapsible-body">
        <span>
          <table class="highlight">
            <% category[:fields].each do |field| %>
              <% next unless field[:value].present? %>
              <tr>
                <td class="grey-text text-darken-1"><%= field[:label] %></td>
                <td>
                  <% if field[:type] == 'universe' && serialized_content.data[:universe].present? %>
                    <%= link_to serialized_content.data[:universe][:name], universe_path(field[:value]) %>
                  <% else %>
                    <%= field[:value] %>
                  <% end %>
                </td>
              </tr>
            <% end %>
          </table>
        </span>
      </div>
    </li>
  <% end %>
</ul>
