1.老师评价、学生匿评、学生留言不同情况下页面刷新
2.修改老师评价、学生匿评、学生留言是载入中在弹出窗后面显示 3.修改老师未批列表 4.取消关闭作业详细信息列表时界面刷新,改为评论时刷新页面 5.修改作业显示界面缺失参数报错
This commit is contained in:
parent
5bd8cc76f4
commit
277e5ecad3
|
@ -22,23 +22,10 @@ class HomeworkAttachController < ApplicationController
|
|||
#获取未批作业列表
|
||||
def get_not_batch_homework
|
||||
sort, direction = params[:sort] || "s_socre", params[:direction] || "desc"
|
||||
if sort == 't_socre'
|
||||
order_by = "t_score #{direction}"
|
||||
elsif sort == 's_socre'
|
||||
order_by = "s_score #{direction}"
|
||||
elsif sort == 'time'
|
||||
order_by = "created_at #{direction}"
|
||||
end
|
||||
teachers = find_course_teachers @course
|
||||
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 NOT IN #{teachers}) AS s_score
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
||||
ORDER BY #{order_by}) AS table1
|
||||
WHERE table1.t_score IS NULL")
|
||||
get_not_batch_homework_list sort,direction,teachers, @bid.id
|
||||
@cur_page = params[:page] || 1
|
||||
@cur_type = 1
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
@direction = direction == 'asc'? 'desc' : 'asc'
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -57,8 +44,8 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
teachers = find_course_teachers @course
|
||||
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} and stars IS NOT NULL) 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 IN (#{teachers}) and stars IS NOT NULL) 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
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
||||
ORDER BY #{order_by}) AS table1
|
||||
WHERE table1.t_score IS NOT NULL")
|
||||
|
@ -83,8 +70,8 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
teachers = find_course_teachers @course
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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 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 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
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
||||
ORDER BY #{order_by}")
|
||||
@cur_page = params[:page] || 1
|
||||
|
@ -101,8 +88,8 @@ class HomeworkAttachController < ApplicationController
|
|||
@is_student_batch_homework = true
|
||||
teachers = find_course_teachers @course
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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 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 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 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
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
|
@ -120,15 +107,15 @@ class HomeworkAttachController < ApplicationController
|
|||
@is_my_homework = true
|
||||
teachers = find_course_teachers @course
|
||||
all_homework_list = HomeworkAttach.find_by_sql("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 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 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
|
||||
FROM homework_attaches
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_attaches.user_id = #{User.current.id}")
|
||||
#如果我没有创建过作业,就检索我是否参与了某个作业
|
||||
if all_homework_list.empty?
|
||||
all_homework_list = HomeworkAttach.find_by_sql("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 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 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
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_users ON homework_users.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_users.user_id = #{User.current.id}")
|
||||
|
@ -401,14 +388,14 @@ class HomeworkAttachController < ApplicationController
|
|||
#@teaher_score = teacher_score_for_homework @homework
|
||||
|
||||
#is_student = is_cur_course_student @homework.bid.courses.first
|
||||
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
|
||||
@is_teacher = is_course_teacher User.current,@homework.bid.courses.first
|
||||
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
|
||||
#@is_comprehensive_evaluation 1:教师评论,2:学生匿评,3:学生留言
|
||||
if User.current.member_of_course?(@homework.bid.courses.first)
|
||||
if is_teacher
|
||||
if @is_teacher
|
||||
@is_comprehensive_evaluation = 1 #教师评论
|
||||
else
|
||||
if is_student && @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分
|
||||
if @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分
|
||||
@is_comprehensive_evaluation = 2 #匿评
|
||||
else #是学生未开启匿评或者已经进行评分
|
||||
@is_comprehensive_evaluation = 3 #留言
|
||||
|
@ -459,19 +446,26 @@ class HomeworkAttachController < ApplicationController
|
|||
def addjours
|
||||
@homework = HomeworkAttach.find(params[:jour_id])
|
||||
#保存评分
|
||||
@homework.rate(params[:stars_value],User.current.id,:quality)
|
||||
@homework.rate(params[:stars_value],User.current.id,:quality) if params[:stars_value] && params[:stars_value] != "0"
|
||||
#保存评论
|
||||
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
|
||||
if @add_jour.is_comprehensive_evaluation == 3
|
||||
@cur_is_comprehensive_evaluation = params[:is_comprehensive_evaluation]
|
||||
if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言
|
||||
@homework.addjours User.current.id, params[:new_form][:user_message],0,@cur_is_comprehensive_evaluation
|
||||
end
|
||||
|
||||
@cur_page = params[:cur_page] || 1
|
||||
@cur_type = params[:cur_type] || 5
|
||||
teachers = searchTeacherAndAssistant @homework.bid.courses.first
|
||||
if @cur_is_comprehensive_evaluation == "3"
|
||||
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
|
||||
@jour = paginateHelper @jours,5
|
||||
elsif @add_jour.is_comprehensive_evaluation == 2
|
||||
elsif @cur_is_comprehensive_evaluation == "2"
|
||||
annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
|
||||
unless annymous_users.nil? || annymous_users == ""
|
||||
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
|
||||
end
|
||||
elsif @add_jour.is_comprehensive_evaluation == 1
|
||||
teachers = searchTeacherAndAssistant @homework.bid.courses.first
|
||||
@m_score = params[:stars_value].to_i
|
||||
elsif @cur_is_comprehensive_evaluation == "1"
|
||||
@comprehensive_evaluation = []
|
||||
teachers.each do|teacher|
|
||||
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
|
||||
|
@ -486,7 +480,7 @@ class HomeworkAttachController < ApplicationController
|
|||
if is_teacher
|
||||
@is_comprehensive_evaluation = 1 #教师评论
|
||||
else
|
||||
if is_student && @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分
|
||||
if @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分
|
||||
@is_comprehensive_evaluation = 2 #匿评
|
||||
else #是学生未开启匿评或者已经进行评分
|
||||
@is_comprehensive_evaluation = 3 #留言
|
||||
|
@ -496,6 +490,33 @@ class HomeworkAttachController < ApplicationController
|
|||
@is_comprehensive_evaluation = 3
|
||||
end
|
||||
|
||||
#teachers = find_course_teachers @homework.bid.courses.first
|
||||
teachers_str = teachers.map{|teacher| teacher.user_id}.join(",")
|
||||
if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面
|
||||
@bid = @homework.bid
|
||||
get_not_batch_homework_list "s_socre","desc",teachers_str,@homework.bid_id
|
||||
elsif @cur_type == "2" #老师已批列表
|
||||
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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_str}) and stars IS NOT NULL) 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_str})) AS s_score
|
||||
FROM homework_attaches WHERE id = #{@homework.id}").first
|
||||
elsif @cur_type == "3" #全部作业列表
|
||||
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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_str})) 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_str})) AS s_score
|
||||
FROM homework_attaches WHERE id = #{@homework.id}").first
|
||||
elsif @cur_type == "4" #匿评作业列表
|
||||
@is_student_batch_homework = true
|
||||
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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_str})) 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_str})) AS s_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
|
||||
WHERE homework_attaches.id = #{@homework.id}").first
|
||||
else #其他的不用管
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -570,16 +591,7 @@ class HomeworkAttachController < ApplicationController
|
|||
|
||||
#获取课程的老师列表
|
||||
def find_course_teachers course
|
||||
teachers = "("
|
||||
teacher_members = searchTeacherAndAssistant(course)
|
||||
teacher_members.each do |member|
|
||||
if member == teacher_members.last
|
||||
teachers += member.user_id.to_s + ")"
|
||||
else
|
||||
teachers += member.user_id.to_s + ","
|
||||
end
|
||||
end
|
||||
teachers
|
||||
searchTeacherAndAssistant(course).map{|teacher| teacher.user_id}.join(",")
|
||||
end
|
||||
|
||||
#获取作业教师评分所占比例
|
||||
|
@ -591,5 +603,22 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
teacher_proportion
|
||||
end
|
||||
|
||||
def get_not_batch_homework_list sort,direction,teachers,bid_id
|
||||
if sort == 't_socre'
|
||||
order_by = "t_score #{direction}"
|
||||
elsif sort == 's_socre'
|
||||
order_by = "s_score #{direction}"
|
||||
elsif sort == 'time'
|
||||
order_by = "created_at #{direction}"
|
||||
end
|
||||
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 NOT IN (#{teachers})) AS s_score
|
||||
FROM homework_attaches WHERE bid_id = #{bid_id}
|
||||
ORDER BY #{order_by}) AS table1
|
||||
WHERE table1.t_score IS NULL")
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -58,53 +58,53 @@
|
|||
{
|
||||
hideModal($("#popbox"));
|
||||
// 评了分的则刷新列表
|
||||
switch (cur_type)
|
||||
{
|
||||
case 1:
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "<%= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "<%= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "<%= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "<%= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
// switch (cur_type)
|
||||
// {
|
||||
// case 1:
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: "<%#= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
// data: 'text',
|
||||
// success: function (data) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// case 2:
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: "<%#= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
// data: 'text',
|
||||
// success: function (data) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// case 3:
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: "<%#= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
// data: 'text',
|
||||
// success: function (data) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// case 4:
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: "<%#= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
|
||||
// data: 'text',
|
||||
// success: function (data) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// case 5:
|
||||
// break;
|
||||
// default :
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
@ -50,10 +50,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function submit1()
|
||||
function submit1(is_teacher)
|
||||
{
|
||||
if($("#stars_value").val() == "0"){alert("您还没有打分");return;}
|
||||
if($("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;}
|
||||
if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;}
|
||||
$('#jours_submit').parent().submit();
|
||||
}
|
||||
</script>
|
||||
|
@ -63,6 +63,8 @@
|
|||
:action => 'addjours',
|
||||
:jour_id => homework_attach.id,
|
||||
:is_comprehensive_evaluation => is_comprehensive_evaluation,
|
||||
:cur_page => cur_page,
|
||||
:cur_type => cur_type,
|
||||
:sta => sta}) do |f|%>
|
||||
<!-- 打分 -->
|
||||
<div class="ping_star" id="star_score">
|
||||
|
@ -88,7 +90,7 @@
|
|||
%>
|
||||
<%= f.text_field :reference_user_id, :style=>"display:none"%>
|
||||
<div style="float:right">
|
||||
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1();"><%= l(:label_submit_comments) %></a>
|
||||
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1(<%= is_teacher%>);"><%= l(:label_submit_comments) %></a>
|
||||
</div>
|
||||
<% else %>
|
||||
<div style="font-size: 14px;margin:10px;text-align: center">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<% bid = homework.bid%>
|
||||
<li class="pic_head" style="line-height: 1.2;">
|
||||
<% if is_student_batch_homework %>
|
||||
<!-- 学生匿评 不现实姓名、头像,以及相关的连接 -->
|
||||
|
@ -46,7 +47,7 @@
|
|||
<!-- 是老师,所有列表正常显示 -->
|
||||
<li class="wping">
|
||||
<%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %>
|
||||
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red"> 迟交!</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
@ -54,7 +55,7 @@
|
|||
<!-- 是学生 -->
|
||||
<% if is_my_homework %>
|
||||
<!-- 我的作品,在未开启匿评和未使用匿评,显示为编辑和删除 -->
|
||||
<% if @bid.comment_status == 0 || @bid.open_anonymous_evaluation == 0 %>
|
||||
<% if bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 %>
|
||||
<li class="wmine">
|
||||
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
|
||||
<% if homework.user == User.current || User.current.admin? %>
|
||||
|
@ -85,21 +86,21 @@
|
|||
<% end %>
|
||||
<% elsif is_student_batch_homework%>
|
||||
<!-- 学生匿评列表 -->
|
||||
<% if @bid.comment_status == 1 %>
|
||||
<% if bid.comment_status == 1 %>
|
||||
<!-- 处于开启匿评阶段,可以正常评分 -->
|
||||
<li class="wping">
|
||||
<%= link_to l(:label_anonymous_comments),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %>
|
||||
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red"> 迟交!</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% elsif @bid.comment_status == 2%>
|
||||
<% elsif bid.comment_status == 2%>
|
||||
<!-- 处于匿评已关闭阶段,不容许评分 -->
|
||||
<li class="wping" title="关闭匿评后不可继续评分">
|
||||
<a style="background:#8e8e8e;">
|
||||
<%= l(:label_anonymous_comments) %>
|
||||
</a>
|
||||
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red"> 迟交!</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
|
|
@ -1,41 +1,5 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
|
||||
|
||||
<%# reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<script type="text/javascript" language="javascript">
|
||||
var W3CDOM = document.createElement && document.getElementsByTagName;
|
||||
|
||||
// window.onload = setMaxLength;
|
||||
$(document).ready(setMaxLength());
|
||||
function setMaxLength() {
|
||||
if (!W3CDOM) return;
|
||||
var textareas = document.getElementsByTagName('textarea');
|
||||
for (var i=0;i<textareas.length;i++) {
|
||||
var textarea = textareas[i];
|
||||
setMaxLengthItem(textareas[i]);
|
||||
}
|
||||
}
|
||||
function setMaxLengthItem(textarea){
|
||||
if (textarea.getAttribute('maxlength')) {
|
||||
var counter = document.createElement('div');
|
||||
counter.className = 'counter';
|
||||
var counterClone = counter.cloneNode(true);
|
||||
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
|
||||
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
|
||||
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
|
||||
textarea.onkeyup = textarea.onchange = checkMaxLength;
|
||||
textarea.onkeyup();
|
||||
}
|
||||
}
|
||||
|
||||
function checkMaxLength() {
|
||||
var maxLength = this.getAttribute('maxlength');
|
||||
var currentLength = this.value.length;
|
||||
if (currentLength > maxLength)
|
||||
this.relatedElement.className = 'toomuch';
|
||||
else
|
||||
this.relatedElement.className = '';
|
||||
this.relatedElement.firstChild.nodeValue = currentLength;
|
||||
}
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
|
||||
|
@ -113,7 +77,12 @@
|
|||
</span>
|
||||
</p>
|
||||
<div id="add_jour">
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation, :m_score => @m_score} %>
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0,
|
||||
:is_comprehensive_evaluation => @is_comprehensive_evaluation,
|
||||
:m_score => @m_score,
|
||||
:cur_page => @cur_page,
|
||||
:cur_type => @cur_type,
|
||||
:is_teacher => @is_teacher} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---ping_con end--->
|
||||
|
|
|
@ -1,19 +1,35 @@
|
|||
//教师评论
|
||||
<% if @add_jour.is_comprehensive_evaluation == 1 %>
|
||||
HoverLi(4);
|
||||
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>');
|
||||
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>');
|
||||
<% if @cur_is_comprehensive_evaluation == "1" %>
|
||||
HoverLi(4);
|
||||
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>');
|
||||
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>');
|
||||
//匿评
|
||||
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
|
||||
$('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation})) %>');
|
||||
HoverLi(5);
|
||||
$('#jour_count_5').html('<%= @anonymous_comments.count %>');
|
||||
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>');
|
||||
<% elsif @cur_is_comprehensive_evaluation == "2" %>
|
||||
$('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0,
|
||||
:is_comprehensive_evaluation => @is_comprehensive_evaluation,
|
||||
:cur_type => @cur_type, :cur_page => @cur_page, :m_score => @m_score, :is_teacher => false})) %>');
|
||||
HoverLi(5);
|
||||
$('#jour_count_5').html('<%= @anonymous_comments.count %>');
|
||||
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>');
|
||||
//留言
|
||||
<% else %>
|
||||
HoverLi(3);
|
||||
$('#jour_count_3').html('<%= @jours.count %>');
|
||||
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>');
|
||||
HoverLi(3);
|
||||
$('#jour_count_3').html('<%= @jours.count %>');
|
||||
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>');
|
||||
<% end %>
|
||||
$('#new_form_user_message').val("");
|
||||
$('#new_form_reference_user_id').val("");
|
||||
$('#new_form_reference_user_id').val("");
|
||||
|
||||
<% if @cur_is_comprehensive_evaluation == "1" || @cur_is_comprehensive_evaluation == "2" %>
|
||||
<% if @cur_type == "1" %>
|
||||
$("#tbc_01").html('<%= escape_javascript(render(:partial => 'homework_attach/homeworks_list',:locals => {:homeworks => @homework_list,
|
||||
:homework_count => @obj_count,
|
||||
:remote => false,:is_student_batch_homework => false})) %>');
|
||||
|
||||
<% elsif @cur_type == "2" || @cur_type == "3" || @cur_type == "4" %>
|
||||
<% is_teacher = is_course_teacher(User.current,@homework.bid.courses.first) %>
|
||||
$("#homework_li_<%= @homework.id%>").html('<%= escape_javascript(render(:partial => 'homework_attach/homework',:locals => {:homework => @result_homework || @homework,
|
||||
:is_student_batch_homework => @is_student_batch_homework || false,
|
||||
:is_my_homework => false, :is_teacher => is_teacher})) %>');
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework}) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').css('height','569px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
"<a href='#' onclick='hidden_homework_atert_form("+
|
||||
<%= @cur_page%> + "," + <%= @cur_type%> +
|
||||
");'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
"<a href='#' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
||||
|
||||
|
|
|
@ -2044,7 +2044,7 @@ width:20%;
|
|||
font-weight:bold;
|
||||
text-align:center;
|
||||
padding:0.6em;
|
||||
z-index:100;
|
||||
z-index:100000;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue