<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
<% if @is_teacher%>
    <li title="<%= exercise.exercise_name %>">
      <div style="width: 310px;float: left;">
        <%# if has_commit %>
            <%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
        <%# else %>
            <%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
        <%# end %>
        <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
      </div>
    </li>

    <%# if exercise.exercise_status == 2 %>
        <!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
    <%# else %>
        <!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
    <%# end%>

    <%# if exercise.exercise_status == 1%>
        <!--<li class="polls_de_grey fr ml5">导出</li>-->
    <%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
        <!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
    <%# end%>
    <% if exercise.exercise_status == 1 %>
        <li><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
    <% elsif exercise.exercise_status == 2%>
        <li><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
    <% else%>
        <li class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</li>
    <% end%>

    <% if exercise.exercise_status == 1%>
        <li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
    <% else %>
        <li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
    <% end%>

    <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10")  %>

    <% if exercise.exercise_status == 1 %>
        <li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%></li>
        <li class="polls_date fr"><%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%></li>
    <% elsif exercise.exercise_status == 2 %>
        <li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
        <li class="polls_date fr">已发布</li>
    <% else %>
        <li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
        <li class="polls_date fr">已截止</li>
    <% end%>

<% else%>
    <% if exercise.exercise_status != 1%>
        <%# if has_commit%>
            <!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
            <li class="pollsbtn_tip fl ml5">已答</li-->
        <%#else%>
        <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
        <% if exercise.end_time <= Time.now && has_commit_exercise?(exercise.id, User.current.id) %>
            <li class="pollsbtn_tip fl ml5">已答</li>
        <% end %>
        <%#end%>
    <% end%>
    <li class="polls_date fr mr10">截止时间：<%= format_time(exercise.end_time.to_s)%></li>
<% end%>