<h1>Flag History</h1>
<p>
  Below is a list of all the flags you have cast and the outcome of each of them. Moderators handling your flags may also
  have left you feedback.
</p>

<h3>
  <%= pluralize(@flags.count, 'flag') %>
</h3>
<h4><%= @statuses.map { |s, c| "#{c} #{s.present? ? s : 'pending'}" }.join(', ') %></h4>

<% @flags.each do |flag| %>
  <div class="widget">
    <div class="item-list">
      <%= render 'posts/type_agnostic', show_type_tag: true, show_category_tag: true, post: flag.post %>
    </div>
    <div class="widget--body">
      <p>
        <% status_colors = { helpful: 'is-green', declined: 'is-red', pending: 'is-muted' } %>
        <span class="badge is-tag <%= status_colors[(flag.status || 'pending').to_sym] %> is-filled">
          <%= flag.status || 'pending' %>
        </span>
        <%= flag.reason %>
        <% if flag.message.present? %>
          &mdash; response: <em><%= flag.message %></em>
        <% end %>
      </p>
    </div>
  </div>
<% end %>

<%= will_paginate @flags, renderer: BootstrapPagination::Rails %>
