|
|
|
@ -2750,15 +2750,15 @@ module ApplicationHelper
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#获取匿评相关连接代码
|
|
|
|
|
def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1)
|
|
|
|
|
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
|
|
|
|
|
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
|
|
|
|
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
|
|
|
|
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
|
|
|
|
case homework.homework_detail_manual.comment_status
|
|
|
|
|
when 1
|
|
|
|
|
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
|
|
|
|
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
|
|
|
|
when 2
|
|
|
|
|
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
|
|
|
|
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
|
|
|
|
when 3
|
|
|
|
|
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
|
|
|
|
|
end
|
|
|
|
@ -2806,7 +2806,7 @@ module ApplicationHelper
|
|
|
|
|
count = homework.student_works.has_committed.count
|
|
|
|
|
if User.current.member_of_course?(homework.course)
|
|
|
|
|
if is_teacher #老师显示作品数量
|
|
|
|
|
link_to "作品(#{count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
|
|
|
|
|
link_to "作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => "c_blue"
|
|
|
|
|
else #学生显示提交作品、修改作品等按钮
|
|
|
|
|
work = cur_user_works_for_homework homework
|
|
|
|
|
project = cur_user_projects_for_homework homework
|
|
|
|
@ -2824,20 +2824,20 @@ module ApplicationHelper
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
|
|
|
|
|
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
|
|
|
|
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
|
|
|
|
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
|
|
|
|
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
|
|
|
|
|
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
|
|
|
|
|
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
|
|
|
|
|
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
|
|
|
|
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
|
|
|
|
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
|
|
|
|
|
else
|
|
|
|
|
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
|
|
|
|
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
link_to "作品(#{count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
|
|
|
|
|
link_to "作品(#{count})",student_work_index_url_in_org(homework.id, 2),:class => "c_blue"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -2860,15 +2860,15 @@ module ApplicationHelper
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
|
|
|
|
|
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
|
|
|
|
|
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
|
|
|
|
|
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
|
|
|
|
link_to "查看作品",student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank'
|
|
|
|
|
link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank'
|
|
|
|
|
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
|
|
|
|
|
link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank'
|
|
|
|
|
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
|
|
|
|
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank'
|
|
|
|
|
else
|
|
|
|
|
link_to "查看作品", student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
|
|
|
|
|
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -3197,13 +3197,13 @@ def homework_common_index_url_in_org(course_id)
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def student_work_index_url_in_org(homework_id, is_focus = '', show_work_id = '')
|
|
|
|
|
def student_work_index_url_in_org(homework_id, tab = 1, is_focus = '', show_work_id = '')
|
|
|
|
|
if is_focus != ''
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s + "&is_focus=" + is_focus.to_s
|
|
|
|
|
elsif show_work_id != ''
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&show_work_id=" + show_work_id.to_s
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s + "&show_work_id=" + show_work_id.to_s
|
|
|
|
|
else
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
|
|
|
|
|
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -3307,7 +3307,12 @@ end
|
|
|
|
|
|
|
|
|
|
#获取所有子节点
|
|
|
|
|
def get_all_children result, jour
|
|
|
|
|
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) || (jour.kind_of? BlogComment) || (jour.kind_of? OrgDocumentComment)
|
|
|
|
|
if jour.kind_of? Message
|
|
|
|
|
jour.children.includes(:author, :praise_tread_cache).each do |jour_child|
|
|
|
|
|
result << jour_child
|
|
|
|
|
get_all_children result, jour_child
|
|
|
|
|
end
|
|
|
|
|
elsif (jour.kind_of? JournalsForMessage) || (jour.kind_of? BlogComment) || (jour.kind_of? OrgDocumentComment)
|
|
|
|
|
jour.children.each do |jour_child|
|
|
|
|
|
result << jour_child
|
|
|
|
|
get_all_children result, jour_child
|
|
|
|
|