commit
6f009df2e7
@ -1,9 +1,60 @@
|
||||
<h3>修改作业</h3>
|
||||
<script type="text/javascript">
|
||||
function regexName()
|
||||
{
|
||||
var name = $("#bid_name").val();
|
||||
|
||||
if(name=="")
|
||||
{
|
||||
$("#bid_name_span").text("名称不能为空");
|
||||
$("#bid_name_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#bid_name_span").text("填写正确");
|
||||
$("#bid_name_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function regexDeadLine()
|
||||
{
|
||||
var deadline = $("#bid_deadline").val();
|
||||
var regex = /^\d{4}-\d{2}-\d{2}$/;
|
||||
if(deadline=="")
|
||||
{
|
||||
$("#bid_deadline_span").text("截止日期不能为空");
|
||||
$("#bid_deadline_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else if(regex.test(deadline))
|
||||
{
|
||||
$("#bid_deadline_span").text("填写正确");
|
||||
$("#bid_deadline_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#bid_deadline_span").text("截止日期格式错误");
|
||||
$("#bid_deadline_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function submitHomework(id)
|
||||
{
|
||||
if(regexDeadLine()&®exName())
|
||||
{
|
||||
$("#edit_bid_" + id).submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<h3><%= l(:label_edit_homework) %></h3>
|
||||
|
||||
<%= labelled_form_for @bid do |f| %>
|
||||
<div class="box tabular">
|
||||
<%#= render :partial => 'homework_form', :locals => { :f => f } %>
|
||||
<%= render :partial => 'homework_form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<input type="button" onclick="submitHomework(<%= @bid.id%>);" value="<%= l(:button_create)%>" class="enterprise">
|
||||
<% end %>
|
||||
</div>
|
@ -0,0 +1,5 @@
|
||||
class AddOpenStudentToCourse < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses, :open_student, :integer, :default => 0
|
||||
end
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
class UpdateBidsProportion < ActiveRecord::Migration
|
||||
def up
|
||||
Bid.where("proportion is null").each do |bid|
|
||||
bid.proportion = 60
|
||||
bid.save
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue