Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-08-13 15:39:06 +08:00
commit d7faed7f6d
15 changed files with 70 additions and 37 deletions

View File

@ -597,6 +597,7 @@ class StudentWorkController < ApplicationController
student_work.description = params[:student_work][:description] student_work.description = params[:student_work][:description]
student_work.homework_common_id = @homework.id student_work.homework_common_id = @homework.id
student_work.user_id = User.current.id student_work.user_id = User.current.id
student_work.commit_time = Time.now
student_work.save_attachments(params[:attachments]) student_work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(student_work) render_attachment_warning_if_needed(student_work)
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
@ -791,7 +792,7 @@ class StudentWorkController < ApplicationController
end end
end end
elsif @homework.homework_type == 1 elsif @homework.homework_type == 1
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0) @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil)
end end
@student_work = StudentWork.new @student_work = StudentWork.new
respond_to do |format| respond_to do |format|
@ -826,7 +827,7 @@ class StudentWorkController < ApplicationController
@new_score.user_id = User.current.id @new_score.user_id = User.current.id
@new_score.student_work_id = @work.id @new_score.student_work_id = @work.id
if @is_teacher && @work.work_status == 0 if @is_teacher && @work.work_status == 0
@work.update_column('work_status', 1) @work.update_attributes(:work_status => 1, :commit_time => Time.now)
end end
if User.current.admin? if User.current.admin?
@new_score.reviewer_role = 1 @new_score.reviewer_role = 1

View File

@ -1004,6 +1004,7 @@ class UsersController < ApplicationController
student_work.work_status = 1 student_work.work_status = 1
end end
student_work.commit_time = Time.now
student_work.save student_work.save
send_message_to_teacher(student_work) send_message_to_teacher(student_work)
homework.update_column(:updated_at, Time.now) homework.update_column(:updated_at, Time.now)

View File

@ -2738,7 +2738,7 @@ module ApplicationHelper
link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red' link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end end
else else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 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), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 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), :class => 'c_blue', :title => "匿评已结束"

View File

@ -1,6 +1,6 @@
#学生提交作品表 #学生提交作品表
class StudentWork < ActiveRecord::Base class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
belongs_to :homework_common belongs_to :homework_common
belongs_to :user belongs_to :user

View File

@ -11,6 +11,8 @@
<span>测验时长:<%= exercise.time %>分钟</span> <span>测验时长:<%= exercise.time %>分钟</span>
<% end %> <% end %>
</div> </div>
<pre class="fontGrey2 font_cus"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre> <pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;">
<%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
</pre>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -5,27 +5,27 @@
<div class="cl"></div> <div class="cl"></div>
</h3> </h3>
<ul class="sy_info mt15" id="all_syllabus_attr"> <ul class="sy_info mt15" id="all_syllabus_attr">
<li><label >创建教师</label><span class="fl ml10 sy_cgrey"><%=syllabus.user.show_name %></span></li> <li><label >创建教师</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.user.show_name %></span></li>
<% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %> <% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
<li><label>课程性质</label><span class="fl ml10 sy_cgrey"><%=syllabus.syllabus_type_str %></span></li> <li><label>课程性质</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.syllabus_type_str %></span></li>
<% end %> <% end %>
<% unless syllabus.credit.nil? || syllabus.credit == '' %> <% unless syllabus.credit.nil? || syllabus.credit == '' %>
<li><label>学分</label><span class="fl ml10 sy_cgrey"><%=syllabus.credit %>学分</span></li> <li><label>学分</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.credit %>学分</span></li>
<% end %> <% end %>
<% unless syllabus.hours.nil? || syllabus.hours == '' %> <% unless syllabus.hours.nil? || syllabus.hours == '' %>
<li><label>总学时</label><span class="fl ml10 sy_cgrey"><%=syllabus.hours %>学时</span></li> <li><label>总学时</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.hours %>学时</span></li>
<% end %> <% end %>
<% unless syllabus.theory_hours.nil? || syllabus.theory_hours == '' %> <% unless syllabus.theory_hours.nil? || syllabus.theory_hours == '' %>
<li><label>理论学时</label><span class="fl ml10 sy_cgrey"><%=syllabus.theory_hours %>学时</span></li> <li><label>理论学时</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.theory_hours %>学时</span></li>
<% end %> <% end %>
<% unless syllabus.practice_hours.nil? || syllabus.practice_hours == '' %> <% unless syllabus.practice_hours.nil? || syllabus.practice_hours == '' %>
<li><label>实践学时</label><span class="fl ml10 sy_cgrey"><%=syllabus.practice_hours %>学时</span></li> <li><label>实践学时</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.practice_hours %>学时</span></li>
<% end %> <% end %>
<% unless syllabus.applicable_major.nil? || syllabus.applicable_major == '' %> <% unless syllabus.applicable_major.nil? || syllabus.applicable_major == '' %>
<li><label>适用专业</label><span class="fl ml10 sy_cgrey"><%=syllabus.applicable_major %></span></li> <li><label>适用专业</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.applicable_major %></span></li>
<% end %> <% end %>
<% unless syllabus.pre_course.nil? || syllabus.pre_course == '' %> <% unless syllabus.pre_course.nil? || syllabus.pre_course == '' %>
<li><label>先修课程</label><span class="fl ml10 sy_cgrey"><%=syllabus.pre_course %></span></li> <li><label>先修课程</label><span class="fl ml10 sy_cgrey w110"><%=syllabus.pre_course %></span></li>
<% end %> <% end %>
<% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %> <% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>

View File

@ -31,9 +31,11 @@
<div class="HomeWorkCon mt15" nhname='student_work_form'> <div class="HomeWorkCon mt15" nhname='student_work_form'>
<%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%> <%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
<div class=" c_red mb10"> <% if @homework.anonymous_comment == 0 %>
提示:作品名称和描述中不要出现真实的姓名信息 <div class=" c_red mb10">
</div> 提示:作品名称和描述中不要出现真实的姓名信息
</div>
<% end %>
<div class="cl"></div> <div class="cl"></div>
<% if @homework.homework_type == 3 %> <% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span> <span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>

View File

@ -235,9 +235,11 @@
:action => 'create', :action => 'create',
:homework => @homework.id :homework => @homework.id
},:remote=>true ) do |f| %> },:remote=>true ) do |f| %>
<div class=" c_red mb10"> <% if @homework.anonymous_comment == 0 %>
提示:作品名称和描述中不要出现真实的姓名信息 <div class=" c_red mb10">
</div> 提示:作品名称和描述中不要出现真实的姓名信息
</div>
<% end %>
<div class="cl"></div> <div class="cl"></div>
<% if @homework.homework_type == 3 %> <% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span> <span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>

View File

@ -135,9 +135,9 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if activity.student_works.has_committed.count != 0 %> <% if activity.student_works.has_committed.count != 0 %>
<% sw = activity.student_works.has_committed.reorder("created_at desc").first %> <% sw = activity.student_works.has_committed.reorder("commit_time desc").first %>
<div class="mt10 homepagePostDeadline mb10"> <div class="mt10 homepagePostDeadline mb10">
#&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 #&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>

View File

@ -24,11 +24,4 @@
<div class="courseSendCancel"> <div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText linkGrey6" id="cancel_group">取消</a> <a href="javascript:void(0);" class="sendSourceText linkGrey6" id="cancel_group">取消</a>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<script type="text/javascript">
$(function(){
if($.trim($("#base_on_project").val()) == 1) {
$("#base_on_project").attr('checked','checked');
}
});
</script>

View File

@ -146,9 +146,9 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if homework_common.student_works.has_committed.count != 0 %> <% if homework_common.student_works.has_committed.count != 0 %>
<% sw = homework_common.student_works.has_committed.reorder("created_at desc").first %> <% sw = homework_common.student_works.has_committed.reorder("commit_time desc").first %>
<div class="mt10 homepagePostDeadline mb10"> <div class="mt10 homepagePostDeadline mb10">
#&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 #&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
@ -302,7 +302,7 @@
<% count=homework_common.journals_for_messages.count %> <% count=homework_common.journals_for_messages.count %>
<div class="homepagePostReply"> <div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => homework_common, :user_activity_id => -1, :is_in_course => is_in_course,:course_activity=>-1} %> <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => homework_common, :user_activity_id => homework_common.id, :is_in_course => is_in_course,:course_activity=>-1} %>
<% comments = homework_common.journals_for_messages.reorder("created_on desc").limit(3) %> <% comments = homework_common.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %> <% if count > 0 %>

View File

@ -10,6 +10,9 @@
} else { } else {
$("#anonymous_comment").attr('checked',false); $("#anonymous_comment").attr('checked',false);
} }
if($.trim($("#base_on_project").val()) == 1) {
$("#base_on_project").attr('checked','checked');
}
<% if edit_mode && homework.is_program_homework? %> <% if edit_mode && homework.is_program_homework? %>
$("#BluePopupBox a.BlueCirBtn").click(); $("#BluePopupBox a.BlueCirBtn").click();
<% end %> <% end %>

View File

@ -27,9 +27,19 @@
<%# end %> <%# end %>
</div> </div>
<p id="nodata" class="nodata" style="display:<%= @list.count > 0 ? 'none' : 'block' %>;"><%= l(:label_no_data) %></p> <p id="nodata" class="nodata" style="display:<%= @list.count > 0 ? 'none' : 'block' %>;"><%= l(:label_no_data) %></p>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
<!--<ul class="wlist" style=" border:none;">-->
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>-->
<!--</ul>-->
<!--<div class="cl"></div>-->
</div> </div>
<ul class="wlist" style=" border:none;">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<!--</div>--> <!--</div>-->

View File

@ -0,0 +1,16 @@
class AddCommitTimeToStudentWork < ActiveRecord::Migration
def change
add_column :student_works, :commit_time, :datetime
count = StudentWork.all.count / 30 + 2
transaction do
for i in 1 ... count do i
StudentWork.page(i).per(30).each do |work|
if work.work_status != 0
work.update_column("commit_time", work.created_at)
end
end
end
end
end
end

View File

@ -1552,7 +1552,10 @@ function pop_box_new(value, Width, Height){
document.onmousemove = null; document.onmousemove = null;
} }
new Drag("popupWrap"); $(".sy_popup_con").mousedown(function(event){
event.stopPropagation();
new Drag("popupWrap");
});
} }
// 公共提示弹框样式 // 公共提示弹框样式