parent
861dbc854e
commit
91cb6e29d5
|
@ -807,6 +807,7 @@ class BidsController < ApplicationController
|
||||||
@bid.is_evaluation = params[:bid][:is_evaluation]
|
@bid.is_evaluation = params[:bid][:is_evaluation]
|
||||||
@bid.proportion = params[:bid][:proportion]
|
@bid.proportion = params[:bid][:proportion]
|
||||||
@bid.evaluation_num = params[:bid][:evaluation_num]
|
@bid.evaluation_num = params[:bid][:evaluation_num]
|
||||||
|
@bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
|
||||||
@bid.reward_type = 3
|
@bid.reward_type = 3
|
||||||
# @bid.budget = params[:bid][:budget]
|
# @bid.budget = params[:bid][:budget]
|
||||||
@bid.deadline = params[:bid][:deadline]
|
@bid.deadline = params[:bid][:deadline]
|
||||||
|
@ -863,6 +864,7 @@ class BidsController < ApplicationController
|
||||||
@bid.is_evaluation = params[:bid][:is_evaluation]
|
@bid.is_evaluation = params[:bid][:is_evaluation]
|
||||||
@bid.proportion = params[:bid][:proportion]
|
@bid.proportion = params[:bid][:proportion]
|
||||||
@bid.evaluation_num = params[:bid][:evaluation_num]
|
@bid.evaluation_num = params[:bid][:evaluation_num]
|
||||||
|
@bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
|
||||||
@bid.reward_type = 3
|
@bid.reward_type = 3
|
||||||
@bid.deadline = params[:bid][:deadline]
|
@bid.deadline = params[:bid][:deadline]
|
||||||
@bid.budget = 0
|
@bid.budget = 0
|
||||||
|
|
|
@ -511,6 +511,7 @@ class CoursesController < ApplicationController
|
||||||
def new_homework
|
def new_homework
|
||||||
@homework = Bid.new
|
@homework = Bid.new
|
||||||
@homework.safe_attributes = params[:bid]
|
@homework.safe_attributes = params[:bid]
|
||||||
|
@homework.open_anonymous_evaluation = 1
|
||||||
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
else
|
else
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
<%= f.select :proportion, proportion_option %>
|
<%= f.select :proportion, proportion_option %>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
|
||||||
|
<span>未开启匿评作业将直接进入众评点赞阶段</span>
|
||||||
|
</p>
|
||||||
|
<p id="evaluation_num_p">
|
||||||
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
|
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
|
||||||
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
|
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -43,35 +43,66 @@
|
||||||
{
|
{
|
||||||
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
||||||
var regex = /^\d+$/;
|
var regex = /^\d+$/;
|
||||||
if(evaluation_num=="")
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
if(evaluation_num=="")
|
||||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if(regex.test(evaluation_num))
|
|
||||||
{
|
|
||||||
if(evaluation_num > 0)
|
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("填写正确");
|
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
||||||
$("#bid_evaluation_num_span").css('color','#008000');
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||||
return true;
|
return false;
|
||||||
|
}
|
||||||
|
else if(regex.test(evaluation_num))
|
||||||
|
{
|
||||||
|
if(evaluation_num > 0)
|
||||||
|
{
|
||||||
|
$("#bid_evaluation_num_span").text("填写正确");
|
||||||
|
$("#bid_evaluation_num_span").css('color','#008000');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
||||||
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
||||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
return true;
|
||||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$("#bid_open_anonymous_evaluation").click(function(){
|
||||||
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||||
|
{
|
||||||
|
$("#evaluation_num_p").slideDown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#evaluation_num_p").slideUp();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||||
|
{
|
||||||
|
$("#evaluation_num_p").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#evaluation_num_p").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function submitHomework(id)
|
function submitHomework(id)
|
||||||
{
|
{
|
||||||
if(regexDeadLine()&®exName()&®exEvaluationNum())
|
if(regexDeadLine()&®exName()&®exEvaluationNum())
|
||||||
|
|
|
@ -49,6 +49,10 @@
|
||||||
<%= f.select :proportion, proportion_option %>
|
<%= f.select :proportion, proportion_option %>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
|
||||||
|
<span>未开启匿评作业将直接进入众评点赞阶段</span>
|
||||||
|
</p>
|
||||||
|
<p id="evaluation_num_p">
|
||||||
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
|
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
|
||||||
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
|
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -43,35 +43,55 @@
|
||||||
{
|
{
|
||||||
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
||||||
var regex = /^\d+$/;
|
var regex = /^\d+$/;
|
||||||
if(evaluation_num=="")
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
if(evaluation_num=="")
|
||||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if(regex.test(evaluation_num))
|
|
||||||
{
|
|
||||||
if(evaluation_num > 0)
|
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("填写正确");
|
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
||||||
$("#bid_evaluation_num_span").css('color','#008000');
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||||
return true;
|
return false;
|
||||||
|
}
|
||||||
|
else if(regex.test(evaluation_num))
|
||||||
|
{
|
||||||
|
if(evaluation_num > 0)
|
||||||
|
{
|
||||||
|
$("#bid_evaluation_num_span").text("填写正确");
|
||||||
|
$("#bid_evaluation_num_span").css('color','#008000');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
||||||
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
||||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
return true;
|
||||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$("#bid_open_anonymous_evaluation").click(function(){
|
||||||
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||||
|
{
|
||||||
|
$("#evaluation_num_p").slideDown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#evaluation_num_p").slideUp();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function submitHomework()
|
function submitHomework()
|
||||||
{
|
{
|
||||||
if(regexDeadLine()&®exName()&®exEvaluationNum())
|
if(regexDeadLine()&®exName()&®exEvaluationNum())
|
||||||
|
|
|
@ -2198,3 +2198,4 @@ zh:
|
||||||
label_submit_comments: 提交评论
|
label_submit_comments: 提交评论
|
||||||
field_evaluation_num: 匿评分配数量
|
field_evaluation_num: 匿评分配数量
|
||||||
label_my_score: 我的评分
|
label_my_score: 我的评分
|
||||||
|
field_open_anonymous_evaluation: 是否开启匿评
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddOpenAnonymousEvaluation < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :bids, :open_anonymous_evaluation, :integer, default: 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :bids, :open_anonymous_evaluation
|
||||||
|
end
|
||||||
|
end
|
15
db/schema.rb
15
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20141105012624) do
|
ActiveRecord::Schema.define(:version => 20141119011439) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -95,21 +95,22 @@ ActiveRecord::Schema.define(:version => 20141105012624) do
|
||||||
|
|
||||||
create_table "bids", :force => true do |t|
|
create_table "bids", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "budget", :null => false
|
t.string "budget", :null => false
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.date "deadline"
|
t.date "deadline"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", :null => false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", :null => false
|
||||||
t.integer "commit"
|
t.integer "commit"
|
||||||
t.integer "reward_type"
|
t.integer "reward_type"
|
||||||
t.integer "homework_type"
|
t.integer "homework_type"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
t.string "password"
|
t.string "password"
|
||||||
t.integer "is_evaluation"
|
t.integer "is_evaluation"
|
||||||
t.integer "proportion", :default => 60
|
t.integer "proportion", :default => 60
|
||||||
t.integer "comment_status", :default => 0
|
t.integer "comment_status", :default => 0
|
||||||
t.integer "evaluation_num", :default => 3
|
t.integer "evaluation_num", :default => 3
|
||||||
|
t.integer "open_anonymous_evaluation", :default => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "boards", :force => true do |t|
|
create_table "boards", :force => true do |t|
|
||||||
|
|
Loading…
Reference in New Issue