增加问卷修改功能,以及相关js

Poll
sw 11 years ago
parent 450c4b203d
commit d0dc01b992

@ -1,5 +1,5 @@
class PollController < ApplicationController 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] before_filter :find_container, :only => [:new,:create, :index]
def index def index
@ -59,7 +59,7 @@ class PollController < ApplicationController
end end
def destroy def destroy
if @poll.destroy if @poll && @poll.destroy
respond_to do |format| respond_to do |format|
format.js format.js
end end

@ -1 +1,4 @@
alert("删除成功"); <% if @poll%>
$("#polls_<%= @poll.id%>").remove();
<%else%>
<% end %>

@ -17,17 +17,20 @@
<div class="cl"></div> <div class="cl"></div>
<div class="polls_list"> <div class="polls_list">
<% @polls.each do |poll|%> <% @polls.each do |poll|%>
<ul> <ul id="polls_<%= poll.id %>">
<li> <li>
<a href="#" class="polls_title fl"> <a href="#" class="polls_title fl">
<%= poll.polls_name%> <%= poll.polls_name%>
</a> </a>
</li> </li>
<li> <li>
<a href="#" class="pollsbtn fl ml10">统计结果</a> <a href="#" class="pollsbtn fl ml10">
<%= l(:label_statistical_results)%>
</a>
</li> </li>
<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>
<li class="polls_date fr"> <li class="polls_date fr">
<%= format_time poll.created_at%> <%= format_time poll.created_at%>

@ -2244,4 +2244,5 @@ zh:
label_poll_new: 未命名问卷 label_poll_new: 未命名问卷
label_poll: 问卷调查 label_poll: 问卷调查
label_new_poll: 新建问卷 label_new_poll: 新建问卷
label_statistical_results: 统计结果

Loading…
Cancel
Save