Merge branch 'Homework' into develop

Homework v20141105
sw 11 years ago
commit 01350442fb

@ -511,7 +511,7 @@ class BidsController < ApplicationController
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*, all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score
FROM homework_attaches FROM homework_attaches
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1
@ -806,6 +806,7 @@ class BidsController < ApplicationController
@bid.description = params[:bid][:description] @bid.description = params[:bid][:description]
@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.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]
@ -822,7 +823,7 @@ class BidsController < ApplicationController
flash[:notice] = l(:label_bid_succeed) flash[:notice] = l(:label_bid_succeed)
end end
end end
redirect_to course_for_bid_path(@bid) redirect_to course_homework_url(params[:course_id])
else else
@bid.safe_attributes = params[:bid] @bid.safe_attributes = params[:bid]
@homework = @bid @homework = @bid
@ -861,6 +862,7 @@ class BidsController < ApplicationController
@bid.description = params[:bid][:description] @bid.description = params[:bid][:description]
@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.reward_type = 3 @bid.reward_type = 3
@bid.deadline = params[:bid][:deadline] @bid.deadline = params[:bid][:deadline]
@bid.budget = 0 @bid.budget = 0
@ -1006,28 +1008,18 @@ class BidsController < ApplicationController
@bid = Bid.find(params[:id]) @bid = Bid.find(params[:id])
if(@bid.comment_status == 0) if(@bid.comment_status == 0)
homeworks = @bid.homeworks homeworks = @bid.homeworks
if(homeworks && homeworks.count >= 4) if(homeworks && homeworks.size >= 2)
@bid.update_column('comment_status', 1) homeworks.each_with_index do |homework, index|
users = homeworks.map { |h| h.user } user = homework.user
n = @bid.evaluation_num
@start_index = rand(homeworks.size) n = n < homeworks.size ? n : homeworks.size - 1
while users[0] == homeworks[@start_index].user assigned_homeworks = get_assigned_homeworks(homeworks, n, index)
@start_index = rand(homeworks.size) assigned_homeworks.each do |h|
end @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: h.id)
3.times do |i|
homework_start_index = @start_index + i
users.each_with_index do |user, index|
actual_index = homework_start_index + index
actual_index = (actual_index < homeworks.size ? actual_index : actual_index - homeworks.size)
if user != homeworks[actual_index]
@homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: homeworks[actual_index].id)
@homework_evaluation.save @homework_evaluation.save
end end
end end
end @bid.update_column('comment_status', 1)
# 修改状态为 '启动匿评'
#@bid.update_column('comment_status', 1)
@statue = 1 @statue = 1
else else
@statue = 2 @statue = 2
@ -1053,6 +1045,11 @@ class BidsController < ApplicationController
private private
def get_assigned_homeworks(homeworks, n, index)
homeworks += homeworks
homeworks[index + 1 .. index + n]
end
def find_bid def find_bid
if params[:id] if params[:id]
@bid = Bid.find(params[:id], :include => [{:homeworks => :user}]) @bid = Bid.find(params[:id], :include => [{:homeworks => :user}])

@ -672,10 +672,10 @@ class CoursesController < ApplicationController
page = 1 + offset / @limit page = 1 + offset / @limit
end end
@feedback_count = @jours.count #@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, page #@feedback_pages = Paginator.new @feedback_count, @limit, page
@offset ||= @feedback_pages.offset #@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] @jour = paginateHelper @jours,10
@state = false @state = false
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses'} format.html{render :layout => 'base_courses'}

@ -103,7 +103,7 @@ class HomeworkAttachController < ApplicationController
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*, all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score
FROM homework_attaches FROM homework_attaches
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1
@ -227,7 +227,7 @@ class HomeworkAttachController < ApplicationController
def create def create
bid = Bid.find params[:bid_id] bid = Bid.find params[:bid_id]
if User.current.admin? || User.current.member_of_course?(bid.courses.first) # modify by nwb if User.current.admin? || User.current.member_of_course?(bid.courses.first) # modify by nwb
if bid.homeworks.where("user_id = ?",User.current).count == 0 if bid.homeworks.where("user_id = ?",User.current).empty?
user_id = params[:user_id] user_id = params[:user_id]
bid_id = params[:bid_id] bid_id = params[:bid_id]
if params[:homework_attach] if params[:homework_attach]

@ -424,10 +424,10 @@ class ProjectsController < ApplicationController
end end
@feedback_count = @jours.count #@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, @page #@feedback_pages = Paginator.new @feedback_count, @limit, @page
@offset ||= @feedback_pages.offset #@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] @jour = paginateHelper @jours,10
@state = false @state = false
@base_courses_tag = @project.project_type @base_courses_tag = @project.project_type

@ -280,11 +280,11 @@ class UsersController < ApplicationController
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
end end
@limit = 10 #@limit = 10
@feedback_count = @jours.count #@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset #@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] @jour = paginateHelper @jours,10
@state = false @state = false
end end
# end # end

@ -27,11 +27,7 @@ class WordsController < ApplicationController
end end
end end
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
@limit = 10 @jour = paginateHelper @jours,10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
respond_to do |format| respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}

@ -37,9 +37,9 @@
<span id="<%=bid.id %>_anonymous_comment"> <span id="<%=bid.id %>_anonymous_comment">
<% case bid.comment_status %> <% case bid.comment_status %>
<% when 0 %> <% when 0 %>
<%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评" %> <%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评", disable_with: '加载中...' %>
<% when 1 %> <% when 1 %>
<%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分\n是否确定关闭匿评" %> <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评" %>
<% when 2 %> <% when 2 %>
匿评结束 匿评结束
<% end %> <% end %>

@ -32,7 +32,7 @@
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %> <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
</p> </p>
<p> <p>
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %> <%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:100px;", :readonly => true, :onchange => "regexDeadLine();") %>
<%= calendar_for('bid_deadline')%> <%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span"> <span id="bid_deadline_span">
</span> </span>
@ -43,6 +43,10 @@
<p> <p>
<%= f.select :proportion, proportion_option %> <%= f.select :proportion, proportion_option %>
</p> </p>
<p>
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
</p>
<p> <p>
<%= hidden_field_tag 'course_id', @course.id %> <%= hidden_field_tag 'course_id', @course.id %>
</p> </p>

@ -1,7 +1,7 @@
<script type="text/javascript"> <script type="text/javascript">
function regexName() function regexName()
{ {
var name = $("#bid_name").val(); var name = $.trim($("#bid_name").val());
if(name=="") if(name=="")
{ {
@ -18,7 +18,7 @@
} }
function regexDeadLine() function regexDeadLine()
{ {
var deadline = $("#bid_deadline").val(); var deadline = $.trim($("#bid_deadline").val());
var regex = /^\d{4}-\d{2}-\d{2}$/; var regex = /^\d{4}-\d{2}-\d{2}$/;
if(deadline=="") if(deadline=="")
{ {
@ -39,10 +39,42 @@
return false; return false;
} }
} }
function regexEvaluationNum()
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
if(evaluation_num=="")
{
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
$("#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").css('color','#008000');
return true;
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
function submitHomework(id) function submitHomework(id)
{ {
if(regexDeadLine()&&regexName()) if(regexDeadLine()&&regexName()&&regexEvaluationNum())
{ {
$("#edit_bid_" + id).submit(); $("#edit_bid_" + id).submit();
} }

@ -1,8 +1,10 @@
<% if @statue == 1%> <% if @statue == 1%>
alert('启动成功'); alert('启动成功');
$("#<%= @bid.id %>_start_anonymous_comment").html('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>'); $("#<%= @bid.id %>_start_anonymous_comment").remove();
$("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment" %>');
$("#<%= @bid.id%>_stop_anonymous_comment").attr("data-confirm","关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评");
<% elsif @statue == 2 %> <% elsif @statue == 2 %>
alert('启动失败\n作业总数大于4份时才能启动匿评'); alert('启动失败\n作业总数大于等于2份时才能启动匿评');
<% elsif @statue == 3%> <% elsif @statue == 3%>
alert("已开启匿评,请务重复开启"); alert("已开启匿评,请务重复开启");
<% end %> <% end %>

@ -1,3 +1,4 @@
<div class="dis">
<div class="msg_box" id='leave-message'> <div class="msg_box" id='leave-message'>
<h4>留言内容</h4> <h4>留言内容</h4>
<%= render :partial => 'new', :locals => {:contest => @contest, :sta => @state} %> <%= render :partial => 'new', :locals => {:contest => @contest, :sta => @state} %>
@ -9,4 +10,5 @@
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> <%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div> </div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true%></ul> <ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
</div>

@ -1,3 +1,4 @@
<div class="dis">
<div class="msg_box" id='leave-message'> <div class="msg_box" id='leave-message'>
<% reply_allow = JournalsForMessage.create_by_user? User.current %> <% reply_allow = JournalsForMessage.create_by_user? User.current %>
@ -26,4 +27,5 @@
<div id="history"> <div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> <%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div> </div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
</div>

@ -37,7 +37,7 @@
</p> </p>
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> <% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p> <p>
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %> <%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:100px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %>
<%= calendar_for('bid_deadline')%> <%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span"> <span id="bid_deadline_span">
</span> </span>
@ -48,6 +48,10 @@
<p> <p>
<%= f.select :proportion, proportion_option %> <%= f.select :proportion, proportion_option %>
</p> </p>
<p>
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
</p>
<p> <p>
<%= hidden_field_tag 'course_id', @course.id %> <%= hidden_field_tag 'course_id', @course.id %>
</p> </p>

@ -43,10 +43,4 @@ function checkMaxLength() {
} }
</script> </script>
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
<% html_title(l(:label_course_feedback)) -%> <% html_title(l(:label_course_feedback)) -%>

@ -1,7 +1,7 @@
<script type="text/javascript"> <script type="text/javascript">
function regexName() function regexName()
{ {
var name = $("#bid_name").val(); var name = $.trim($("#bid_name").val());
if(name=="") if(name=="")
{ {
@ -18,7 +18,7 @@
} }
function regexDeadLine() function regexDeadLine()
{ {
var deadline = $("#bid_deadline").val(); var deadline = $.trim($("#bid_deadline").val());
var regex = /^\d{4}-\d{2}-\d{2}$/; var regex = /^\d{4}-\d{2}-\d{2}$/;
if(deadline=="") if(deadline=="")
{ {
@ -39,10 +39,42 @@
return false; return false;
} }
} }
function regexEvaluationNum()
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
if(evaluation_num=="")
{
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
$("#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").css('color','#008000');
return true;
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
function submitHomework() function submitHomework()
{ {
if(regexDeadLine()&&regexName()) if(regexDeadLine()&&regexName()&&regexEvaluationNum())
{ {
$("#new_bid").submit(); $("#new_bid").submit();
} }

@ -19,7 +19,9 @@
<span style="color:#a6a6a6; margin-right:20px; margin-left:10px;"><%= format_time(jour.created_on) %></span> <span style="color:#a6a6a6; margin-right:20px; margin-left:10px;"><%= format_time(jour.created_on) %></span>
<span style="font-weight:bold; color:#a6a6a6; "> <span style="font-weight:bold; color:#a6a6a6; ">
<% if show_score %> <% if show_score %>
<span style="float:left">
<%= l(:label_work_rating) %> <%= l(:label_work_rating) %>
</span>
<%= render :partial => 'show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %> <%= render :partial => 'show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %>
<% end %> <% end %>
</span> </span>

@ -1,11 +1,11 @@
<% if is_comprehensive_evaluation == 3 || User.current == homework.user%> <% if is_comprehensive_evaluation == 3 || User.current == homework.user%>
<%= l(:label_work_rating) %> <!-- <#%= l(:label_work_rating) %>
<%= render :partial => 'show_score', locals: {:stars => totle_score} %> <%#= render :partial => 'show_score', locals: {:stars => totle_score} %> -->
<% elsif is_comprehensive_evaluation == 2 %> <% elsif is_comprehensive_evaluation == 2 %>
<%= l(:label_work_rating) %>
<% if has_evaluation %> <% if has_evaluation %>
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
<% else %> <% else %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %> <%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
<% end %> <% end %>

@ -107,9 +107,9 @@
<span id="<%=@bid.id %>_anonymous_comment"> <span id="<%=@bid.id %>_anonymous_comment">
<% case @bid.comment_status %> <% case @bid.comment_status %>
<% when 0 %> <% when 0 %>
<%= link_to '启动匿评', start_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评" %> <%= link_to '启动匿评', start_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评", disable_with: '加载中...' %>
<% when 1 %> <% when 1 %>
<%= link_to '关闭匿评', stop_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分\n是否确定关闭匿评" %> <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评" %>
<% when 2 %> <% when 2 %>
匿评结束 匿评结束
<% end %> <% end %>

@ -1,3 +1,4 @@
<div class="dis">
<div class="msg_box" id='leave-message'> <div class="msg_box" id='leave-message'>
<% reply_allow = JournalsForMessage.create_by_user? User.current %> <% reply_allow = JournalsForMessage.create_by_user? User.current %>
@ -24,6 +25,7 @@
</div> </div>
<div id="history"> <div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> <%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %>
</div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
</div> </div>

@ -0,0 +1,55 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<div class="ping_ctt">
<div id="tbc_01" class="ping_dis">
<% if journals.size > 0 %>
<% for journal in journals %>
<div class="ping_C" id='word_li_<%= journal.id.to_s %>'>
<div class="ping_dispic"><a target="_blank" href="#"><%= image_tag(url_to_avatar(journal.user)) %></a></div>
<div class="ping_discon" style="width: 85%;">
<div class="ping_distop">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
<div class="cl"></div>
<p><%= textilizable journal.notes%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span style="float: right">
<% if journal.user == User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
:class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} %>
<% end %>
</span>
<span class="font_lighter" style="float: right">
<%= l(:label_bids_published) %>&nbsp;
<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
</div>
<div style="clear: both;"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</div>
</div>

@ -0,0 +1,14 @@
<div class="dis">
<div class="msg_box" id='leave-message'>
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<h3><%= l(:label_user_response) %><span id="jour_count"><%= @obj_count%></span></h3>
<%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
</div>
<div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
</div>

@ -1,18 +1,7 @@
<div style="margin-top: 30px"> <% reply_allow = JournalsForMessage.create_by_user? User.current %>
<div id='leave-message'> <%= stylesheet_link_tag 'css', :media => 'all' %>
<%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
</div>
<div style="border-bottom: 1px dashed rgb(204, 204, 204);font-size: 14px; font-family: '微软雅黑'; padding-bottom: 10px; font-weight: bold; color:#807a76">
<%= l(:label_newfeedback_message) %><%= @feedback_count%>
</div>
<div id="message" style="font-size: 14px;"> <%= render :partial => 'user_jours',
<%= render :partial => 'words/message', :locals => {:jour => @jour, :state => @state, :user => @user, :feedback_pages => @feedback_pages} %> :locals => { :journals => @jour, :state => false}
</div> %>
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
</div>
<% html_title(l(:label_responses)) -%> <% html_title(l(:label_responses)) -%>

@ -64,12 +64,12 @@ function checkMaxLength() {
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div id='<%= ids %>' class="respond-form"> <div id='<%= ids %>' class="respond-form">
<% if reply_allow %> <% if reply_allow %>
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => show_name} %>
<% end %> <% end %>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div> <div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> <%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => show_name } %>
</div> </div>
</li> </li>
<% end %> <% end %>

@ -1,4 +1,6 @@
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); //$('#message').html('<#%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages,:show_name => true})) %>');
$('#history').html('<%= escape_javascript(render(:partial => 'users/history',:locals => { :journals => @jour, :state => false})) %>')
$('#jour_count').html('<%= @obj_count%>')
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val(""); $('#new_form_user_message').val("");
$('#new_form_reference_user_id').val(""); $('#new_form_reference_user_id').val("");

@ -1459,7 +1459,7 @@ zh:
label_newtype_contest: 发布竞赛 label_newtype_contest: 发布竞赛
label_user_information: "与我相关" label_user_information: "与我相关"
label_bid_succeed: "需求发布成功" label_bid_succeed: "作业创建成功"
label_wrong_budget: 错误的金额格式 label_wrong_budget: 错误的金额格式
label_wrong_date: 时间格式错误,请输入正确的时间 yyyy-mm-dd label_wrong_date: 时间格式错误,请输入正确的时间 yyyy-mm-dd
label_bidding_succeed: 应标成功 label_bidding_succeed: 应标成功
@ -2184,3 +2184,4 @@ zh:
label_anonymous_comments: 匿评 label_anonymous_comments: 匿评
label_anonymous: 匿名 label_anonymous: 匿名
label_submit_comments: 提交评论 label_submit_comments: 提交评论
field_evaluation_num: 匿评分配数量

@ -0,0 +1,5 @@
class AddEvaluationNumToBid < ActiveRecord::Migration
def change
add_column :bids, :evaluation_num, :integer, default: 3
end
end

@ -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 => 20141102054414) do ActiveRecord::Schema.define(:version => 20141105012624) 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
@ -109,6 +109,7 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
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
end end
create_table "boards", :force => true do |t| create_table "boards", :force => true do |t|
@ -178,13 +179,6 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
create_table "class_members", :force => true do |t|
t.integer "member_id"
t.integer "course_class_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "code_review_assignments", :force => true do |t| create_table "code_review_assignments", :force => true do |t|
t.integer "issue_id" t.integer "issue_id"
t.integer "change_id" t.integer "change_id"
@ -317,14 +311,6 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
t.integer "container_id", :default => 0 t.integer "container_id", :default => 0
end end
create_table "course_classes", :force => true do |t|
t.string "name"
t.text "explain"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "course_infos", :force => true do |t| create_table "course_infos", :force => true do |t|
t.integer "course_id" t.integer "course_id"
t.integer "user_id" t.integer "user_id"

@ -82,7 +82,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.ping_star{ width:160px; color:#333; font-weight:bold; margin-bottom:5px;} .ping_star{ width:160px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;} .ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;}
.ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;} .ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;}
.ping_con textarea{ width:455px; height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} .ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}
a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;} a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;}
a:hover.ping_sub{ background:#14a8b9;} a:hover.ping_sub{ background:#14a8b9;}
@ -92,7 +92,7 @@ a:hover.ping_sub{ background:#14a8b9;}
.recall_head img{ height:30px; width:30px;} .recall_head img{ height:30px; width:30px;}
.recall_head a:hover{border:1px solid #15bccf;} .recall_head a:hover{border:1px solid #15bccf;}
.recall_head img:hover{border:1px solid #15bccf;} .recall_head img:hover{border:1px solid #15bccf;}
.recall_con{ float:left;color:#777777; width:90%; margin-left:10px; } .recall_con{ float:left;color:#777777; margin-left:10px; }
.recall_con a{ color:#15bccf; } .recall_con a{ color:#15bccf; }
.ping_list{ margin-top:15px;} .ping_list{ margin-top:15px;}
@ -110,7 +110,7 @@ a:hover.ping_sub{ background:#14a8b9;}
.ping_C{border-bottom:1px dashed #CCC; padding:5px;} .ping_C{border-bottom:1px dashed #CCC; padding:5px;}
.ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;} .ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;}
.ping_dispic img{ height:46px; width:46px;} .ping_dispic img{ height:46px; width:46px;}
.ping_discon{ float:left; width:372px; margin-left:15px;} .ping_discon{ float:left; width:350px; margin-left:15px;}
.ping_distop span{ float:left;} .ping_distop span{ float:left;}
.ping_distop p{ color:#5f5f5f;} .ping_distop p{ color:#5f5f5f;}
.ping_disfoot a{ float:right; color:#15bccf; margin-left:5px;} .ping_disfoot a{ float:right; color:#15bccf; margin-left:5px;}

Loading…
Cancel
Save