<% content_for(:title) { "Table of Contents - #{setting(:name)}" } %>
<div class="container" id="toc-header">
  <div class="welcome">All volumes and issues</div>
  <div class="hero-small">
    <div class="hero-title">
      <%= image_tag "icon_papers.svg", height: "32px" %>
      <h1>Table of Contents</h1>
    </div>
  </div>
</div>

<div class="container">
  <table class="toc-table">
    <tbody>
      <tr>
        <td>
          <div class="d-inline-block text-truncate">
            <%= image_tag "icon_papers.svg", height: "16px" %>
            <strong><%= link_to "Current issue", toc_current_issue_path, title: "Papers in current issue", style: "max-width: 450px;" %></strong>
          </div>
        </td>
        <td>
        </td>
      </tr>
      <% @issues_by_volume.each_pair do |v, issues_in_v| %>
      <% if issues_in_v.present? %>
      <tr>
        <td>
          <strong><%= link_to "Volume #{v} (#{@years[@volumes.index(v)]})", toc_volume_path(volume: v), title: "Papers from volume #{v}", class: "d-inline-block text-truncate", style: "max-width: 450px;" %></strong>
        </td>
        <td class="issue-paper">
          <% issues_in_v.each do |i| %>
            <%= link_to("Issue #{i.to_s.rjust(3, "0")}".html_safe, toc_issue_path(issue: i), title: "Papers in issue #{i}", class: "d-inline-block text-truncate px-2", style: "max-width: 450px;") if i.present? %>
          <% end %>
        </td>
        <td>
        </td>
      </tr>
      <% end %>
      <% end %>
    </tbody>
  </table>
</div>
