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