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

91 lines
2.9 KiB
Plaintext
Raw Normal View History

<% has_commit = has_commit_poll?(poll.id ,User.current)%>
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
2015-01-20 11:42:28 +08:00
<li title="<%= poll.polls_name %>">
<% if @is_teacher %>
<% if has_commit %>
<sapn class="polls_title fl">
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
</sapn>
2015-01-20 11:42:28 +08:00
<% else %>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl" %>
2015-01-20 11:42:28 +08:00
<% end %>
<% else %>
<% if has_commit && poll.polls_status == 2 %>
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 500px;width: auto;" %>
<% elsif !has_commit && poll.polls_status == 2 %>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
2015-01-20 11:42:28 +08:00
<% end %>
<% end %>
</li>
<% if !@is_teacher && has_commit && poll.polls_status == 2%>
<li class="pollsbtn_tip fl ml5">已答</li>
<% end %>
<%if @is_teacher%>
2015-01-27 09:45:15 +08:00
<% if poll.polls_status == 1 || poll.polls_status == 3 %>
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
<% elsif poll.polls_status == 2%>
<li>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
</li>
<% end%>
<% end%>
2015-01-27 09:45:15 +08:00
<%if @is_teacher %>
<% if poll.polls_status == 1 %>
2015-01-27 09:45:15 +08:00
<li>
<a href="#" class="pollsbtn btn_pu fl ml5" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>);">
发布问卷
</a>
</li>
<% elsif poll.polls_status == 2%>
2015-01-27 09:45:15 +08:00
<li>
<a href="#" class="pollsbtn btn_de fl ml5" onclick="republish_poll(<%= poll.id%>);">
取消发布
</a>
</li>
<% else%>
<li class="pollsbtn fl ml10 pollsbtn_grey">
发布问卷
</li>
<% end%>
2015-01-27 09:45:15 +08:00
<% end%>
2015-01-20 11:42:28 +08:00
<li>
<% if @is_teacher %>
<!--新建状态的问卷可删除-->
<%= link_to(l(:button_delete), poll,
2015-01-27 09:45:15 +08:00
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml15 mr10") %>
2015-01-20 11:42:28 +08:00
<% end%>
</li>
2015-01-27 09:45:15 +08:00
<% if @is_teacher%>
<% if poll.polls_status == 1 %>
<li>
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml15"%>
</li>
<% else%>
<li class="polls_de_grey fr ml15">
编辑
</li>
2015-01-20 11:42:28 +08:00
<% end%>
2015-01-27 09:45:15 +08:00
<% end%>
<% if @is_teacher%>
<% if poll.polls_status == 2 %>
<li>
<a class="polls_de fr ml15" onclick="close_poll(<%= poll.id%>);">关闭</a>
</li>
<% else %>
<li class="polls_de_grey fr ml15">
关闭
</li>
<% end%>
<% end %>
<li class="polls_date fr mr10">
2015-01-20 11:42:28 +08:00
<%= format_time poll.created_at%>
</li>