<%
  set_meta_tags title:       @content.name,
                description: "#{%w(a e i o u).include?(content.class.name.downcase[0]) ? "An" : "A"} #{@content.class.name.downcase} on Notebook.ai",
                image_src:   @content.first_public_image,
                og:          { type: 'website' }
%>

<%= content_for :full_width_page_header do %>
  <%= render partial: 'content/display/image_card_header' %>

  <!--
  <div class="row" style="margin-top: -1px; margin-bottom: 30px;">
    <div class="col s12 <%= content.class.color %>">
      <ul class="tabs tabs-fixed-width <%= content.class.color %>">
        <li class="tab"><a href="#test1" class="white-text active"><%= @content.class.name %> details</a></li>
        <li class="tab"><a href="#test2" class="white-text">References</a></li>
        <li class="tab"><a href="#test4" class="white-text">Comments</a></li>
      </ul>
    </div>
  </div>
  -->
        
<% end %>

<div class="row flex">
  <div class="col s12 m3">
    <div class="sticky-below-navbar">
      <%=
        render partial: 'content/display/sidelinks',
          locals: {
            editing: false,
            content: @serialized_content
          }
      %>
      <%=
        render partial: 'content/display/sideactions',
          locals: {
            editing: false,
            content: @serialized_content
          }
      %>
    </div>
  </div>

  <div class="col s12 m9">
    <div class="card">
      <div class="card-image">
        <%= render partial: 'content/display/floating_action_buttons', locals: { editing: false } %>
      </div>
    </div>
    <% @serialized_content.data[:categories].each do |serialized_category| %>
      <%=
        # Some categories get special views. This switch checks for those and falls back on
        # the regular view if it's not a special case.
        case serialized_category[:name]
          when 'gallery'
            render partial: 'content/form/images/gallery',  locals: { content: content } if @content.image_uploads.any?

          when 'contributors'
            render partial: 'content/display/contributors', locals: { content: content } if @content.is_a?(Universe)

          else
            render partial: 'content/display/category_panel',
              locals: {
                content: @serialized_content,
                category: serialized_category
              }
        end
      %>
    <% end %>

    <%# For most pages, we also want to render a bunch of other panels in case they're needed %>
    <%= render partial: 'content/panels/in_this_universe', locals: { content: content } if @content.is_a?(Universe) %>
    <%= render partial: 'content/panels/documents',        locals: { content: content } if @serialized_content.documents.any? %>
    <%= render partial: 'content/panels/shares',           locals: { content: content } if @content.content_page_shares.any? %>
    <%= render partial: 'content/panels/timelines',        locals: { content: content } if @content.timelines.any? %>
    <%= render partial: 'content/panels/collections',      locals: { content: content } if @content.page_collection_submissions.accepted.any? %>
    <%= render partial: 'content/panels/associations',     locals: { content: content } %>
  </div>
</div>

<%= render partial: 'content/display/visitor_cta', locals: { content: @serialized_content } %>
<%= render partial: 'content/share', locals: { shared_content: @content} %>
