增加问卷修改功能,以及相关js
This commit is contained in:
parent
450c4b203d
commit
d0dc01b992
|
@ -1,5 +1,5 @@
|
|||
class PollController < ApplicationController
|
||||
before_filter :find_poll_and_course, :only => [:edit,:update,:destory]
|
||||
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy]
|
||||
before_filter :find_container, :only => [:new,:create, :index]
|
||||
|
||||
def index
|
||||
|
@ -59,7 +59,7 @@ class PollController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if @poll.destroy
|
||||
if @poll && @poll.destroy
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
alert("删除成功");
|
||||
<% if @poll%>
|
||||
$("#polls_<%= @poll.id%>").remove();
|
||||
<%else%>
|
||||
<% end %>
|
||||
|
|
|
@ -17,17 +17,20 @@
|
|||
<div class="cl"></div>
|
||||
<div class="polls_list">
|
||||
<% @polls.each do |poll|%>
|
||||
<ul>
|
||||
<ul id="polls_<%= poll.id %>">
|
||||
<li>
|
||||
<a href="#" class="polls_title fl">
|
||||
<%= poll.polls_name%>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="pollsbtn fl ml10">统计结果</a>
|
||||
<a href="#" class="pollsbtn fl ml10">
|
||||
<%= l(:label_statistical_results)%>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="polls_de fr ml20 mr10">删除</a>
|
||||
<%= link_to(l(:button_delete), poll,
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
|
||||
</li>
|
||||
<li class="polls_date fr">
|
||||
<%= format_time poll.created_at%>
|
||||
|
|
|
@ -2244,4 +2244,5 @@ zh:
|
|||
label_poll_new: 未命名问卷
|
||||
label_poll: 问卷调查
|
||||
label_new_poll: 新建问卷
|
||||
label_statistical_results: 统计结果
|
||||
|
||||
|
|
Loading…
Reference in New Issue