crowdAI/crowdai

View on GitHub
app/concepts/leaderboard/views/table_row.erb

Summary

Maintainability
Test Coverage
<tr id='participant-<%= entry.participant_id %>' class='<%= leader_class %>'>
  <td></td>
  <td></td>
  <td class='change'>
    <%= ranking_change(entry) %>
  </td>

  <td class="position">
    <strong><%= "%02d." % (entry.row_num) %></strong>
  </td>

  <td class="participant">
    <div class="user-link">
      <%= link_to participant_path(participant) do %>
        <%= concept(Image::Cell,participant) %>
      <% end %>
      <div class='text-badge'>
        <%= link_to truncate(entry.name, length: 10), participant_path(entry.slug) %>
          <% if participant.admin? %>
            <span class='badge badge-accent'>Admin</span>
          <% end %>
          <% if organizer_badge?(
              challenge_id: entry.challenge_id,
              participant_id: participant.id) %>
            <span class='badge'>Organizer</span>
          <% end %>
      </div>
    </div>
  </td>

  <% if cols.include?(:media) %>
    <td class="video">
      <%= concept(Leaderboard::Cell::Media,
            entry,
            size: :thumb,
            submission_id: entry.submission_id,
            current_participant: current_participant) %>
    </td>
  <% end %>

  <td class="score">
    <strong><%= entry.score %></strong>
  </td>

  <% if cols.include?(:score_secondary) %>
  <td class="score">
    <strong><%= entry.score_secondary %></strong>
  </td>
  <% end %>

  <% if policy(entry).submission_detail? %>
    <td class="entries">
      <%= link_to entry.entries,
            challenge_leaderboard_submission_detail_path(
              challenge_id: entry.challenge_id,
              leaderboard_id: entry.id,
              participant_id: entry.participant_id),
            id: "participant-link-#{ entry.participant_id }",
            remote: true %>
    </td>
  <% else %>
    <td class="entries"><%= entry.entries %></td>
  <% end %>

  <% if cols.include?(:post_challenge) %>
  <td class="post-challenge"></td>
  <% end %>

  <td class="last-submission">
    <%= entry.created_at.strftime("%a, %e %b %Y %R") %>
  </td>
  <td class='action'>
    <% if challenge.submissions_page %>
      <%= link_to challenge_submission_path(
            @challenge, entry.submission_id),
            class: 'btn btn-secondary' do %>
              <i class="fa fa-arrows-alt" aria-hidden="true"></i>
      <% end %>
    <% end %>
  </td>
  <td></td>
  <td></td>
</tr>