<div class="container papers-hero">
  <div class="hero-small">
    <div class="hero-title">
    <% if @filtering %>
      <%= image_tag "icon_papers.svg", height: "32px" %><h1><%= Rails.application.settings['abbreviation'] %> Papers: <%= @term %></h1>
    <% else %>
      <%= image_tag "icon_papers.svg", height: "32px" %><h1><%= Rails.application.settings['abbreviation'] %> Papers</h1>
    <% end %>
    </div>
  </div>
  <% if @badge %>
    <%= render partial: "badge", locals: { badge: @badge } %>
  <% end %>
</div>

<div class="container">

  <div class="paper-header">
    <div class="btn-group" role="group" aria-label="Paper Status">

      <%= link_to papers_path, class: "tabnav-tab #{selected_class('index')}" do %>
        <span class="count-label">All Papers</span>
        <div class="count-badge"><%= raw Paper.public_everything.count %></div>
      <% end %>
      <%= link_to published_papers_path, class: "tabnav-tab #{selected_class('popular')}" do %>
        <span class="count-label">Published Papers</span>
        <div class="count-badge"><%= raw Paper.visible.count %></div>
      <% end %>
      <%= link_to active_papers_path, class: "tabnav-tab #{selected_class('active')}" do %>
        <span class="count-label">Active Papers</span>
        <div class="count-badge"><%= raw Paper.public_in_progress.count %></div>
      <% end %>
    </div>

    <%= form_for("", url: search_papers_path, method: 'get', html: { class: "form-inline my-2 my-lg-0 float-right"}) do |f| %>
    <div class="input-group mb-3">
      <%- placeholder_text = params[:q].nil? ? "Search by title, tag, author, or language":params[:q]%>
      <%= f.text_field :q, placeholder:placeholder_text , class: "form-control", size: "35" %>
      <div class="input-group-append">
        <%= button_tag(type: 'submit', class: "btn btn-outline-secondary", name: "search_button") do %>
          <%= octicon "search" %>
        <% end %>
      </div>
    </div>
    <% end %>
  </div>

  <div id ="primary-content row" class="paper-list">
    <%= render partial: "list", locals: { papers: @papers } %>
  </div>
  <div class="row">
    <div class="pagination_helper">
      <%== pagy_info(@pagy, item_name: t("paper", count: @papers.size)) %>
    </div>
    <%= pagy_pagination @pagy %>
  </div>
</div>
