问卷显示权限管理

This commit is contained in:
z9hang 2015-01-16 10:59:25 +08:00
parent dc2c96f59a
commit 0dc0ba3a4a
2 changed files with 43 additions and 29 deletions

View File

@ -11,34 +11,46 @@
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>">
<li>
<% if has_commit_poll?(poll.id ,User.current) %>
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
<% else %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
</li>
<li>
<%if @is_teacher%>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
<% end%>
</li>
<li>
<% if @is_teacher%>
<%= link_to(l(:button_delete), poll,
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
<% end%>
</li>
<li>
<% if @is_teacher%>
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
<% end%>
</li>
<li class="polls_date fr">
<%= format_time poll.created_at%>
</li>
</ul>
<% unless !@is_teacher && poll.polls_status != 2 %>
<ul id="polls_<%= poll.id %>">
<li>
<% if @is_teacher %>
<% if has_commit_poll?(poll.id ,User.current) %>
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
<% else %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
<% else %>
<% if has_commit_poll?(poll.id ,User.current) && poll.polls_status == 2 %>
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
<% elsif (!has_commit_poll?(poll.id ,User.current)) && poll.polls_status == 2 %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
<% end %>
</li>
<li>
<%if @is_teacher%>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
<% end%>
</li>
<li>
<% if @is_teacher && poll.polls_status == 1 #新建状态的问卷可删除%>
<%= link_to(l(:button_delete), poll,
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
<% end%>
</li>
<li>
<% if @is_teacher && poll.polls_status == 1 #新建状态的问卷可编辑%>
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
<% end%>
</li>
<li class="polls_date fr">
<%= format_time poll.created_at%>
</li>
</ul>
<% end %>
<div class="cl"></div>
<% end%>

View File

@ -217,7 +217,9 @@
</ul>
<div class="cl"></div>
<div class="ur_buttons" style="width: 100px;">
<%= link_to "提交",commit_poll_poll_path(@poll), :method => :post,:class => "ur_button",:format => 'js',:remote=>true %>
<% if @poll.polls_status == 2 %>
<%= link_to "提交",commit_poll_poll_path(@poll), :method => :post,:class => "ur_button",:format => 'js',:remote=>true %>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_progress_text">答题已完成 <strong class="ur_progress_number">0%</strong> </div>