Conflicts:
	db/schema.rb
This commit is contained in:
lizanle 2015-10-28 17:37:41 +08:00
commit eaba915598
17 changed files with 134 additions and 95 deletions

View File

@ -217,7 +217,12 @@ class HomeworkCommonController < ApplicationController
#评分设置
def score_rule_set
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course]
end
private

View File

@ -108,6 +108,7 @@ class StudentWorkController < ApplicationController
else
@stundet_works = []
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else
if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
@ -128,6 +129,7 @@ class StudentWorkController < ApplicationController
else
@stundet_works = []
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count
end
@score = @b_sort == "desc" ? "asc" : "desc"
@ -456,14 +458,14 @@ class StudentWorkController < ApplicationController
student_work.save
end
end
respond_to do |format|
format.html{
if params[:student_path]
redirect_to student_work_index_url(:homework => @homework.id)
else
redirect_to user_homeworks_user_path(User.current.id)
end
}
if params[:student_path]
redirect_to student_work_index_url(:homework => @homework.id)
else
@user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course]
respond_to do |format|
format.js
end
end
end

View File

@ -2355,16 +2355,16 @@ module ApplicationHelper
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
end
end
end

View File

@ -1,3 +1,4 @@
$('#topnav_course_menu').hide();
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
showModal('ajax-modal', '540px');
$('#ajax-modal').css('height','390px');

View File

@ -7,7 +7,7 @@
<span class="f14 fontGrey3 fl mt5">开启匿评</span>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<%= calendar_for('evaluation_start_time')%>
<%#= calendar_for('evaluation_start_time')%>
</div>
<div class="cl"></div>
<p id="homework_evaluation_start_time" class="c_red"></p>
@ -18,7 +18,7 @@
<span class="f14 fontGrey3 fl mt5">关闭匿评</span>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_end" id="evaluation_end_time" placeholder="关闭匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_end%>"/>
<%= calendar_for('evaluation_end_time')%>
<%#= calendar_for('evaluation_end_time')%>
</div>
<div class="cl"></div>
<p id="homework_evaluation_end_time" class="c_red"></p>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:remote=>true}) %>');
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,6 +1,10 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att') %>');
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");
$(function() { $('#evaluation_start_time').datepicker(datepickerOptions);
$('#evaluation_end_time').datepicker(datepickerOptions);
});

View File

@ -1,66 +1,9 @@
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id},:method => "post") do |f|%>
<% if student_path %>
<%=hidden_field_tag 'student_path', params[:student_path], :value => student_path %>
<% end %>
<div class="markPopup" id="popbox02">
<span class="uploadText">评分设置</span>
<div class="mt15">
<span class="f14 fontGrey3 mr10">迟交扣分</span>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="请输入0-50数值" class=" markInput" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</div>
<div>
<span class="f14 fontGrey3 mr10">缺评扣分</span>
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="请输入0-50数值" class="markInput" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
</div>
<% if homework.homework_type == 2%>
<div>
<span class="f14 fontGrey3 mr10">系统评分</span>
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "markPercentage"} %>
</div>
<script>
$("#sy_proportion").change(function(){
var ta_proportion = 100 - parseInt($("#sy_proportion").val() * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#student_proportion").val("0%");
});
$("#ta_proportion").live("change",function(){
var ta_proportion = 100 - parseInt($("#sy_proportion").val() * 100) - parseInt($("#ta_proportion").val() * 100);
$("#student_proportion").val(ta_proportion + "%");
});
</script>
<% else%>
<script>
$("#ta_proportion").change(function(){
var ta_proportion = $("#ta_proportion").val();
$("#student_proportion").val((100 - parseInt(ta_proportion * 100)) + "%");
});
</script>
<% end%>
<div>
<span class="f14 fontGrey3 mr10">教辅评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing ? homework.homework_detail_programing.ta_proportion * 100 : 0).to_i),homework.homework_detail_manual.ta_proportion), {:class => "markPercentage"} %>
</div>
<div>
<span class="f14 fontGrey3 mr10">学生匿评</span>
<input type="text" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing ? homework.homework_detail_programing.ta_proportion * 100 : 0).to_i%>%" class="markPercentage" readonly>
</div>
<div class="mb20">
<span class="f14 fontGrey3 mr10">教师优先</span>
<input type="checkbox" name="teacher_priority" <%= homework.teacher_priority == 1 ? 'checked' : ''%>/>
<span class="f12 c_red ml10">教师评分为最终评分</span>
</div>
<div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#ajax-modal').find('form').submit();">确定</a>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText linkGrey6" onclick="clickCanel();">取消</a>
</div>
</div>
<div class="cl"></div>
</div>
<% end%>
<% if student_path%>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path},:method => "post") do |f|%>
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%>
<% else %>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course},:method => "post",:remote => true) do |f|%>
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%>
<% end %>

View File

@ -0,0 +1,61 @@
<div class="markPopup" id="popbox02">
<span class="uploadText">评分设置</span>
<div class="mt15">
<span class="f14 fontGrey3 mr10">迟交扣分</span>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="请输入0-50数值" class=" markInput" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</div>
<div>
<span class="f14 fontGrey3 mr10">缺评扣分</span>
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="请输入0-50数值" class="markInput" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
</div>
<% if homework.homework_type == 2%>
<div>
<span class="f14 fontGrey3 mr10">系统评分</span>
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "markPercentage"} %>
</div>
<script>
$("#sy_proportion").change(function(){
var ta_proportion = 100 - parseInt($("#sy_proportion").val() * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#student_proportion").val("0%");
});
$("#ta_proportion").live("change",function(){
var ta_proportion = 100 - parseInt($("#sy_proportion").val() * 100) - parseInt($("#ta_proportion").val() * 100);
$("#student_proportion").val(ta_proportion + "%");
});
</script>
<% else%>
<script>
$("#ta_proportion").change(function(){
var ta_proportion = $("#ta_proportion").val();
$("#student_proportion").val((100 - parseInt(ta_proportion * 100)) + "%");
});
</script>
<% end%>
<div>
<span class="f14 fontGrey3 mr10">教辅评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing ? homework.homework_detail_programing.ta_proportion * 100 : 0).to_i),homework.homework_detail_manual.ta_proportion), {:class => "markPercentage"} %>
</div>
<div>
<span class="f14 fontGrey3 mr10">学生匿评</span>
<input type="text" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing ? homework.homework_detail_programing.ta_proportion * 100 : 0).to_i%>%" class="markPercentage" readonly>
</div>
<div class="mb20">
<span class="f14 fontGrey3 mr10">教师优先</span>
<input type="checkbox" name="teacher_priority" <%= homework.teacher_priority == 1 ? 'checked' : ''%>/>
<span class="f12 c_red ml10">教师评分为最终评分</span>
</div>
<div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#ajax-modal').find('form').submit();">确定</a>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText linkGrey6" onclick="clickCanel();">取消</a>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -2,8 +2,11 @@
<span class="c_dark f14 fb fl mr30">
作品
<font class="f12 c_red">
<%= @stundet_works.count%>
<%= @student_work_count%>
</font>
<% if !@is_teacher && @stundet_works.empty?%>
<span class="f12 c_red">未提交</span>
<% end %>
</span>
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
<div class="hworkSearchBox">

View File

@ -59,6 +59,10 @@
<div class="HomeWorkP">
<%= @homework.description.html_safe %>
</div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %>
<div class="cl"></div>
</div>
</div>
</div><!----HomeWorkBox end-->
<div class="cl"></div>

View File

@ -0,0 +1,8 @@
clickCanel();
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
<% end %>

View File

@ -56,28 +56,31 @@
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
<div class="cl"></div>
</div>
<%# if is_teacher%>
<!--<div class="homepagePostSetting">
<% if is_teacher%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%#= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => 0), :class => "postOptionLink"%>
<%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => 0), :class => "postOptionLink"%>
</li>
<li>
<%#= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%#= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
</li>
<li>
<%#= homework_anonymous_comment activity %>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
</li>
<li>
<%= homework_anonymous_comment activity %>
</li>
</ul>
</li>
</ul>
</div>
<%# end%>-->
<% end%>
</div>
<div class="cl"></div>
</div>

View File

@ -69,7 +69,7 @@
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) %>
<%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course),:class => "postOptionLink", :remote => true) %>
</li>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%>

View File

@ -1,3 +1,4 @@
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>

View File

@ -42,11 +42,15 @@ module Trustie
end
def repository
project.repository
unless project.nil?
project.repository
end
end
def isGitlabProject?
repository && repository.gitlab?
unless repository.nil?
repository && repository.gitlab?
end
end
end

View File

@ -483,8 +483,8 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
.resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;}
.searchIconPopup:hover {cursor: pointer}
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;}
.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;}
.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
.sendCourseName {font-size:12px; color:#5f6060;display:inline-block}