实现修改、删除作业后页面跳转
This commit is contained in:
parent
1a0de23b38
commit
5ef1332ded
|
@ -32,16 +32,17 @@ class HomeworkAttachController < ApplicationController
|
||||||
:bid_id => bid_id
|
:bid_id => bid_id
|
||||||
}
|
}
|
||||||
|
|
||||||
@bid = Bid.find bid_id
|
#@bid = Bid.find bid_id
|
||||||
@homework_list = @bid.homeworks
|
#@homework_list = @bid.homeworks
|
||||||
|
|
||||||
@homework = HomeworkAttach.new(options)
|
@homework = HomeworkAttach.new(options)
|
||||||
@homework.save_attachments(params[:attachments])
|
@homework.save_attachments(params[:attachments])
|
||||||
render_attachment_warning_if_needed(@homework)
|
render_attachment_warning_if_needed(@homework)
|
||||||
|
|
||||||
respond_to do |format|
|
if @homework.save
|
||||||
if @homework.save
|
respond_to do |format|
|
||||||
redirect_to project_for_bid_path
|
format.html { redirect_to project_for_bid_path @homework.bid }
|
||||||
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
|
@ -68,20 +69,22 @@ class HomeworkAttachController < ApplicationController
|
||||||
@homework.name = name
|
@homework.name = name
|
||||||
@homework.description = description
|
@homework.description = description
|
||||||
#@homework.save_attachments(params[:attachments])
|
#@homework.save_attachments(params[:attachments])
|
||||||
@homework.save
|
if @homework.save
|
||||||
#@homework.name = params[:name]
|
respond_to do |format|
|
||||||
#@homework.name = params[:description]
|
format.html { redirect_to project_for_bid_path @homework.bid }
|
||||||
#@homework.save
|
format.json { head :no_content }
|
||||||
#@homework.update_attribute(params[:homework])
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@homework = HomeworkAttach.find(params[:id])
|
@homework = HomeworkAttach.find(params[:id])
|
||||||
@homework.destroy
|
if @homework.destroy
|
||||||
#respond_to do |format|
|
respond_to do |format|
|
||||||
# format.html {render @homework}
|
format.html { redirect_to project_for_bid_path @homework.bid }
|
||||||
# format.json {render json: @homework}
|
format.json { head :no_content }
|
||||||
#end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#显示作业信息
|
#显示作业信息
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% display_id = im_watching_student_id? @bid%>
|
<% display_id = im_watching_student_id? @bid%>
|
||||||
<% @homework_list.each do |homework|%>
|
<% @homework_list.each do |homework|%>
|
||||||
<table width="660px" border="0" align="center">
|
<table width="660px" border="0" align="center" id="homework_attach_<%= homework.id %>" >
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
|
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
|
||||||
<td>
|
<td>
|
||||||
|
|
Loading…
Reference in New Issue