ChaelCodes/HuntersKeepers

View on GitHub
app/views/hunters/index.html.erb

Summary

Maintainability
Test Coverage
<h1>Hunters</h1>

<table class="table">
  <thead>
    <tr>
      <th>Name</th>
      <% unless mobile_device? %>
        <th>Playbook</th>
        <th>Harm</th>
        <th>Luck</th>
        <th>Exp</th>
      <% end %>
      <th colspan="2"></th>
    </tr>
  </thead>

  <tbody>
    <% @hunters.each do |hunter| %>
      <tr>
        <td><%= link_to hunter.name, hunter %></td>
        <% unless mobile_device? %>
          <td><%= link_to_playbook(hunter) %></td>
          <% if hunter.retired? %>
            <td colspan="3" class="has-text-centered">Retired</td>
          <% else %>
            <td class="has-text-centered"><%= hunter.harm %></td>
            <td class="has-text-centered"><%= hunter.luck %></td>
            <td class="has-text-centered"><%= hunter.experience %></td>
          <% end %>
        <% end %>
        <td>
          <% if policy(hunter).edit? %>
            <%= link_to 'Edit', edit_hunter_path(hunter) %>
          <% end %>
        </td>
        <td>
        <% if policy(hunter).destroy? %>
          <%= link_to 'Destroy', hunter, method: :delete, data: { confirm: 'Are you sure?' } %>
        <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= link_to 'New Hunter', new_hunter_path %>