socialforge/app/views/poll/_poll.html.erb

93 lines
4.8 KiB
Plaintext

<% has_commit = has_commit_poll?(poll.id ,User.current)%>
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<% if @is_teacher%>
<div>
<div title="<%= poll_name %>">
<div style="width: 600px;float: left;">
<% if has_commit %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% else %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% end %>
<% if poll.polls_status == 1 %>
<span class="exercise_status_nop fl mt3"></span>
<% elsif poll.polls_status == 2 %>
<span class="exercise_status_pub fl mt3"></span>
<% else %>
<span class="exercise_status_end fl mt3"></span>
<% end%>
</div>
</div>
<div id="exercise_opr_<%=poll.id %>" class="none fr">
<a href="javascript:void(0)" onClick="delete_exercise(<%=poll.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
<% if poll.polls_status == 1 %>
<%= link_to '', edit_poll_path(poll.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
<% end%>
</div>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">创建时间:<%= format_time(poll.created_at) %></span>
<% if poll.polls_status > 1 %>
<span class="c_grey fl mr15">发布时间:<%= poll.published_at.nil? ? '未设置' : format_time(poll.published_at) %></span>
<% end %>
<% if poll.polls_status > 1 %>
<span class="c_grey fl mr15">答题:<span class="c_blue" title="已答学生数/未答学生数"><%= poll.poll_users.count %> / <%=@course.student.count %></span></span>
<% end %>
<% if poll.polls_status == 1 %>
<div><a href="javascript:" class="pollsbtn btn_pu fr ml10" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>,<%= index%>);">发布问卷</a></div>
<% elsif poll.polls_status == 2%>
<div><a href="javascript:" class="pollsbtn btn_de fr ml10" onclick="republish_poll(<%= poll.id%>, <%=index %>);">取消发布</a></div>
<% else%>
<div class="pollsbtn fr ml10 pollsbtn_grey ml10">发布问卷</div>
<% end%>
<% if poll.polls_status == 1%>
<div class="pollsbtn fr ml10 pollsbtn_grey">统计结果</div>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<div><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr ml10"%></div>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="pollsbtn fr ml10" onclick="close_poll(<%= poll.id%>, <%=index %>);" href="javascript:">关闭</a></li>
<% else %>
<li class="pollsbtn fr ml10 pollsbtn_grey" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<% if poll.polls_status == 1%>
<li class="pollsbtn fr ml10 pollsbtn_grey">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "pollsbtn fr ml10"%></li>
<% end%>
<div class="clear"></div>
</div>
<% else%>
<% if poll.polls_status == 2%>
<div>
<% if has_commit%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_com fl ml5"></span>
<%else%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_nocom fl ml5"></span>
<%end%>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">发布时间:<%= format_time(poll.published_at) %></span>
<span class="c_grey fl mr15">答题:<span class="c_blue" title="已答学生数/未答学生数"><%= poll.poll_users.count %> / <%=@course.student.count %></span></span>
<% if poll.show_result == 1 %>
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr"%></li>
<%else%>
<li class="pollsbtn fr pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
<%end%>
<% end %>
<div class="clear"></div>
</div>
<% end%>
<% end%>