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