<!--Descriptive page name, messages and instructions-->
<h2 class="heading">
  <% if @user %>
    <%= t(".user.page_heading", username: @user.login) %>
  <% else %>
    <%= t(".collection.page_heading_html", collection_link: link_to(@collection.title, @collection)) %>
  <% end %>
</h2>
<!--/descriptions-->
<!--subnav-->
<ul class="navigation actions" role="navigation">
  <% statuses = %i[unreviewed_by_collection unreviewed_by_user rejected_by_collection rejected_by_user approved] %>
  <% known_params = statuses.include?(params[:status]&.to_sym) %>
  <% statuses.each do |status| %>
    <% if @user && status == :unreviewed_by_user %>
      <% # Default and fallback page for user.  If no known_params are present, this is current. %>
      <li><%= span_if_current t(".navigation.#{status}"), user_collection_items_path(@user), !known_params %></li>
    <% elsif @user %>
      <li><%= span_if_current t(".navigation.#{status}"), user_collection_items_path(@user, status: status), params[:status]&.to_sym == status %></li>
    <% elsif @collection && status == :unreviewed_by_collection %>
      <% # Default and fallback page for collection. If no known_params are present, this is current. %>
      <li><%= span_if_current t(".navigation.#{status}"), collection_items_path(@collection), !known_params %></li>
    <% else %>
      <li><%= span_if_current t(".navigation.#{status}"), collection_items_path(@collection, status: status), params[:status]&.to_sym == status %></li>
    <% end %>
  <% end %>
</ul>
<!--/subnav-->

<% if @collection && params[:status] == "unreviewed_by_user" %>
  <p class="notice"><%= t(".collection.notice.unreviewed_by_user") %></p>
<% end %>
<% if @user && params[:status] == "unreviewed_by_collection" %>
  <p class="notice"><%= t(".user.notice.unreviewed_by_collection") %></p>
<% end %>
<% if @collection_items.count < 1 %>
  <p class="note"><%= t(".no_items") %></p>
<% else %>
  <%= form_tag (@user ? update_multiple_user_collection_items_path(@user) : update_multiple_collection_items_path(@collection)), method: :patch do %>
    <ul class="index group">
      <% @collection_items.each do |collection_item| %>
        <%= render "item_fields", collection_item: collection_item %>
      <% end %>
    </ul>
    <%= submit_fieldset %>
  <% end %>

  <%= will_paginate @collection_items %>
<% end %>
<!--/content-->
