rtopitt/bolao2014

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

Summary

Maintainability
Test Coverage
<% content_for(:title) { Match.model_name.human(count: 2) } %>

<div class="row">
  <div class="small-12 column">
    <h2><%= Match.model_name.human(count: 2) %></h2>
  </div>
</div>

<div class="row">
  <div class="small-12 column">
    <table>
      <tbody>
        <% @matches.each do |match| %>
          <tr>
            <td><%= link_to "##{match.number}", match_path(match) %></td>
            <td class="hide-for-small-only"><%= match.round_text %></td>
            <td class="hide-for-small-only"><%= l match.played_at, format: :short %></td>
            <td class="text-center hide-for-small-only"><%= match.team_a_flag_or_? %></td>
            <td class="text-left"><%= match.team_a_name_or_? %></td>
            <td class="text-center">
              <%= match.goals_a_or_? %> x <%= match.goals_b_or_? %>
              <% if match.with_known_penalty_goals? %>
                <br /><%= match.penalty_goals_a_or_? %> x <%= match.penalty_goals_b_or_? %>
                <br />(<%= t('.on_penaltys') %>)
              <% end %>
            </td>
            <td class="text-right"><%= match.team_b_name_or_? %></td>
            <td class="text-center hide-for-small-only"><%= match.team_b_flag_or_? %></td>
            <td class="hide-for-small-only">
              <%= link_to t('.view'), match_path(match) %>
              <% if admin_logged_in? %>
                <%= link_to t('.edit'), edit_admin_match_path(match), class: 'admin-action' %>
              <% end %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>