parent
22688dd5da
commit
cc5eb3d0af
|
@ -139,9 +139,9 @@ class AttachmentsController < ApplicationController
|
|||
# Make sure association callbacks are called
|
||||
container = @attachment.container
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
if container.attachments.empty?
|
||||
container.delete
|
||||
end
|
||||
#if container.attachments.empty?
|
||||
#container.delete
|
||||
#end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or respond_path(@bid) }
|
||||
|
|
|
@ -36,14 +36,19 @@ class HomeworkAttachController < ApplicationController
|
|||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
@homework.save
|
||||
#@homework.save
|
||||
|
||||
respond_to do |format|
|
||||
if @homework.save
|
||||
format.html { redirect_to @homework, notice: 'Post was successfully created.' }
|
||||
format.json { render json: @homework, status: :created, location: @homework }
|
||||
#ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
|
||||
#format.html { redirect_to project_for_bid_path(:id => @homework.bid), notice: l(:notice_attendingcontest_work_successfully_created) }
|
||||
# format.json { render json: @softapplication, status: :created, location: @softapplication }
|
||||
flash[:notice] = l(:notice_attendingcontest_work_successfully_created)
|
||||
redirect_back_or_default(project_for_bid_path)
|
||||
else
|
||||
format.js { render status: 406 }
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @homework.errors, status: :unprocessable_entity }
|
||||
# format.json { render json: @softapplication.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
#end
|
||||
|
@ -65,15 +70,10 @@ class HomeworkAttachController < ApplicationController
|
|||
|
||||
def update
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
respond_to do |format|
|
||||
if @homework.update_attributes(params[:homework])
|
||||
format.html { redirect_to @homework, notice: 'Homework was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @homework.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
#@homework.name = params[:name]
|
||||
#@homework.name = params[:description]
|
||||
#@homework.save
|
||||
@homework.update_attribute(params[:homework])
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
<% end %>
|
||||
<% display_id = im_watching_student_id? @bid%>
|
||||
<% @homework_list.each do |homework|%>
|
||||
<% if homework.attachments.any?%>
|
||||
<table width="660px" border="0" align="center">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
|
||||
|
@ -81,7 +80,7 @@
|
|||
<%= format("%.2f", sum * 1.0 / stars_reates_count) %>
|
||||
</td>
|
||||
<td valign="top" align="right">
|
||||
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %>
|
||||
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.created_at.to_s) %>
|
||||
<span class="required">迟交</span>
|
||||
<% end %>
|
||||
</td>
|
||||
|
@ -118,6 +117,5 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=raw l(:label_new_homework)%> </p>
|
||||
<div class="box">
|
||||
<%= @homework.attachments.count %>
|
||||
<%= form_for(@homework) do |f|%>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong>标 题:</strong>
|
||||
|
|
Loading…
Reference in New Issue