parent
3f9855f25c
commit
70f14f851d
|
@ -8,7 +8,18 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
def index
|
||||
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||
if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
else #学生
|
||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||
@stundet_works = @homework.student_works.where(:user_id => User.current.id)
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #开启匿评,显示匿评作品和我的作品
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
end
|
||||
end
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
respond_to do |format|
|
||||
|
@ -70,6 +81,7 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
def show
|
||||
@score = student_work_score @work,User.current
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -2291,4 +2291,39 @@ module ApplicationHelper
|
|||
end
|
||||
link
|
||||
end
|
||||
#学生根据传入作业确定显示为编辑作品还是新建作品
|
||||
def student_new_homework homework
|
||||
work = cur_user_works_for_homework homework
|
||||
if work.nil?
|
||||
link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit'
|
||||
else
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
|
||||
"<span class='fr mr10 pr_join_span ' title='已开启匿评不能修改作品'>#{l(:label_edit_homework)}</span>".html_safe
|
||||
else
|
||||
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def student_anonymous_comment homework
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
||||
when 2
|
||||
"<span class='fr mr10 pr_join_span '>正在匿评中</span>".html_safe
|
||||
when 3
|
||||
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
||||
end
|
||||
elsif homework.homework_type == 0
|
||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||
elsif homework.homework_type == 2
|
||||
"<span class='fr mr10 pr_join_span '>编程作业</span>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
#获取当前用户在指定作业下提交的作业的集合
|
||||
def cur_user_works_for_homework homework
|
||||
homework.student_works.where("user_id = ?",User.current).first
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,40 +1,5 @@
|
|||
# encoding: utf-8
|
||||
module HomeworkCommonHelper
|
||||
def student_new_homework homework
|
||||
work = cur_user_works_for_homework homework
|
||||
if work.nil?
|
||||
link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit'
|
||||
else
|
||||
if homework.homework_type == 2 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
|
||||
"<span class='fr mr10 pr_join_span ' title='已开启匿评不能修改作品'>#{l(:label_edit_homework)}</span>".html_safe
|
||||
else
|
||||
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def student_anonymous_comment homework
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
||||
when 2
|
||||
"<span class='fr mr10 pr_join_span '>正在匿评中</span>".html_safe
|
||||
when 3
|
||||
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
||||
end
|
||||
elsif homework.homework_type == 0
|
||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||
elsif homework.homework_type == 2
|
||||
"<span class='fr mr10 pr_join_span '>编程作业</span>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
#获取当前用户在指定作业下提交的作业的集合
|
||||
def cur_user_works_for_homework homework
|
||||
homework.student_works.where("user_id = ?",User.current).first
|
||||
end
|
||||
|
||||
#迟交扣分下拉框
|
||||
def late_penalty_option
|
||||
type = []
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
<span class=" ml5">分</span>
|
||||
<div class="cl"></div></li>
|
||||
<li >
|
||||
<span class="tit_fb"> 批阅结果:</span>
|
||||
<div>
|
||||
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
|
||||
</div>
|
||||
<% if @is_teacher%> <!-- 老师才可以上传批阅结果 -->
|
||||
<span class="tit_fb"> 批阅结果:</span>
|
||||
<div>
|
||||
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
|
||||
</div>
|
||||
<%end%>
|
||||
<a href="javascript:void(0);" class="blue_n_btn fr" onclick="$(this).parent().parent().submit();">提交</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="show_hwork">
|
||||
<ul>
|
||||
<li >
|
||||
<li class="fl">
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
<%=format_time @work.created_at %>
|
||||
</li>
|
||||
|
||||
<% if @work.user == User.current %> <!-- 我的作业,显示编辑和删除按钮 -->
|
||||
<li class="fr" >
|
||||
<a href="javascript:void(0);" class=" pic_del" ></a>
|
||||
</li>
|
||||
<li class="fr" >
|
||||
<a href="javascript:void(0);" class=" pic_edit" ></a>
|
||||
</li>
|
||||
<% end%>
|
||||
<% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%> <!-- 普通作业或者编程作业,或者是匿评结束阶段,显示点赞按钮 -->
|
||||
<li class="fr" >
|
||||
<a href="javascript:void(0);" class="orange_btn" style="font-size:12px;" >赞(10)</a>
|
||||
</li>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<li >-->
|
||||
<!--<span class="tit_fb"> 参与人员:</span>-->
|
||||
<!--程梦雯 王强-->
|
||||
|
@ -34,12 +50,15 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="add_student_score_<%= @work.id%>" class="mt10 ">
|
||||
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
|
||||
</div>
|
||||
<% if @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
|
||||
<!-- 老师 || 匿评作业 && 开启匿评状态 && 不是当前用户自己的作品 -->
|
||||
<div id="add_student_score_<%= @work.id%>" class="mt10 ">
|
||||
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</ul>
|
||||
|
||||
<div class="ping_box" id="score_list_<%= @work.id%>">
|
||||
<div class="ping_box" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%@work.student_works_scores.order("created_at desc").each do |score|%>
|
||||
<div id="work_score_<%= score.id%>">
|
||||
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
|
||||
|
|
|
@ -6,6 +6,7 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
|
|||
<% else %>
|
||||
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
|
||||
<% end%>
|
||||
$("#score_list_<%= @work.id%>").removeAttr("style");
|
||||
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
|
||||
$(function(){
|
||||
|
|
|
@ -36,18 +36,22 @@
|
|||
所有作品(<span class="c_red"><%= @stundet_works.count%></span>)
|
||||
</a>
|
||||
</span>
|
||||
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
||||
<div class="fr">
|
||||
<% if @homework.student_works.empty?%>
|
||||
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
|
||||
<% else%>
|
||||
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
|
||||
remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
|
||||
<% end%>
|
||||
<% if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3%>
|
||||
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
||||
<% end%>
|
||||
<% if @is_teacher%>
|
||||
<div class="fr">
|
||||
<% if @homework.student_works.empty?%>
|
||||
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
|
||||
<% else%>
|
||||
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
|
||||
remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
|
||||
<% end%>
|
||||
|
||||
<%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
|
||||
<span class="mt3 fr " style="color:#136b3b;">导出全部:</span>
|
||||
</div>
|
||||
<%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
|
||||
<span class="mt3 fr " style="color:#136b3b;">导出全部:</span>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div><!---code_list end--->
|
||||
<ul class="hwork_ul">
|
||||
|
@ -102,8 +106,13 @@
|
|||
<h4 class="r_txt_tit mb5">
|
||||
<%= @homework.name%>
|
||||
</h4>
|
||||
<%= homework_anonymous_comment(@homework)%>
|
||||
<%= link_to(l(:button_edit),edit_homework_common_path(@homework), :class => "fr mr10 work_edit") %>
|
||||
<% if @is_teacher%>
|
||||
<%= homework_anonymous_comment(@homework)%>
|
||||
<%= link_to(l(:button_edit),edit_homework_common_path(@homework), :class => "fr mr10 work_edit") %>
|
||||
<% else%>
|
||||
<%= student_anonymous_comment @homework %>
|
||||
<%= student_new_homework @homework %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div id="bid_description_<%= @homework.id%>" class="mt5 upload_img">
|
||||
|
|
|
@ -147,6 +147,7 @@ a:hover.work_edit{color: #fff; background: #64bdd9;}
|
|||
.hovertab a{color:#fff; background-color:#64bdd9; text-decoration:none;}
|
||||
.dis{display:block; }
|
||||
.undis{display:none;}
|
||||
.c_red{ color:#de030d;}
|
||||
.f_12{ font-size:12px;}
|
||||
.w_40{ width:40px; border:1px solid red;}
|
||||
.dis_ul{ height:70px; border-bottom:1px dashed #d4d4d4; margin-bottom:10px;}
|
||||
|
@ -354,7 +355,6 @@ a:hover.st_add{ color:#ff8e15;}
|
|||
.upload_box{ width:430px; margin:15px auto;}
|
||||
|
||||
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
|
||||
.r_txt_tit{max-width:480px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
|
||||
|
||||
blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;word-break: break-all;word-wrap: break-word;}
|
||||
.respond-form{display: none;margin: auto;clear: both;}
|
||||
|
@ -505,7 +505,7 @@ a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: ce
|
|||
|
||||
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; color:#64bdd9; }
|
||||
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
|
||||
.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
|
||||
.r_txt_tit{max-width:450px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
|
||||
|
||||
/*日历选择图*/
|
||||
img.ui-datepicker-trigger {
|
||||
|
@ -637,8 +637,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
|||
.hwork_tit a{ width:255px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
|
||||
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
|
||||
.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
|
||||
a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
|
||||
a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;}
|
||||
a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;overflow: hidden;}
|
||||
a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;overflow: hidden;}
|
||||
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
|
||||
.show_hwork ul li{ margin-bottom:5px;}
|
||||
.show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
|
||||
|
|
Loading…
Reference in New Issue