<h3>
  <%=l(:label_contest_plural)%>
</h3>

<%= form_tag({}, :method => :get) do %>
    <fieldset>
      <label for='name'>
        竞赛:
      </label>
      <%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '竞赛名称' %>
      <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
      <%= link_to l(:button_clear), {:controller => 'admin', :action => 'contests'}, :class => 'icon icon-reload' %>
    </fieldset>
<% end %>
&nbsp;

<div class="autoscroll">
  <table class="list" style="width: 100%;table-layout: fixed">
    <thead>
    <tr>
      <th style="width: 40px;">
        序号
      </th>
      <th style="width: 180px;">
        竞赛
      </th>
      <th style="width: 40px;">
        公开
      </th>
      <th style="width: 80px;">
        创建者
      </th>
      <th style="width: 40px;">
        成员数
      </th>
      <th style="width: 40px;">
        提交数
      </th>
      <th style="width: 80px;">
        创建于
      </th>
      <th style="width: 130px;">
        最新动态时间
      </th>
    </tr>
    </thead>
    <tbody>
    <% @contests.each do |contest| %>
        <tr class="<%= cycle("odd", "even") %>">
          <td style="text-align: center;">
            <%= contest.id %>
          </td>
          <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=contest.name%>'>
            <span>
              <%= link_to contest.name, contest_path(contest), :target => '_blank' %>
            </span>
          </td>
          <td align="center">
            <%= checked_image contest.is_public %>
          </td>
          <td style="text-align: center; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=contest.user.show_name%>'>
            <span>
              <%= link_to contest.user.show_name, user_path(contest.user), :target => '_blank' %>
            </span>
          </td>
          <td align="center">
            <%=contest.contest_members.count %>
          </td>
          <td align="center">
            <%=contest.works.count %>
          </td>
          <td align="center">
            <%= format_date(contest.created_at) %>
          </td>
          <td align="center">
            <%= contest.contest_acts.order("updated_at asc").last.updated_at.strftime('%Y-%m-%d %H:%M:%S') %>
          </td>
        </tr>
    <% end %>
    </tbody>
  </table>
</div>

<div class="pagination">
  <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

<% html_title(l(:label_project_plural)) -%>