Merge branch 'develop' into gitlab_guange

This commit is contained in:
huang 2015-12-04 15:54:56 +08:00
commit 4d0956dff1
7 changed files with 103 additions and 1 deletions

View File

@ -6,6 +6,14 @@ class ExerciseController < ApplicationController
include ExerciseHelper
def index
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
publish_exercises.each do |exercise|
exercise.update_column('exercise_status', 2)
end
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
end_exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
if @course.is_public == 0 && !User.current.member_of_course?(@course)
render_403
return
@ -24,6 +32,14 @@ class ExerciseController < ApplicationController
end
def show
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
publish_exercises.each do |exercise|
exercise.update_column('exercise_status', 2)
end
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
end_exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
unless User.current.member_of_course?(@course)
render_403
return

View File

@ -35,6 +35,5 @@
$("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>");
$("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>");
/*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/
document.getElementById("exercise_description").innerHTML = <%=exercise.exercise_description.html_safe %>;
}
</script>

View File

@ -0,0 +1,30 @@
<div class="fl">
<div class="cl"></div>
<span style="font-weight:normal;">
<a href="javascript:void(0);" class="blueCir ml5" onclick="$('#_file<%=work.id %>').click();">上传附件</a>
<%#= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'blueCir ml5' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file#{work.id}",
:class => 'file_selector',
:multiple => true,
:onchange => "addReviseFiles(this, '#{work.id}');",
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all),
:containerid => "#{work.id}"
} %>
</span>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>

View File

@ -61,6 +61,31 @@
</li>
</ul>
<!--<div class="resubAtt">
<span class="resubTitle">追加修订附件</span>
</div>
<div class="mt15">
<span class="tit_fb"> 追加附件:</span>
<a href="javascript:void(0);" class="link_file fl" >socket实验-123456-王强revise.zip</a>
<span id="attachments_fields<%= work.id%>" xmlns="http://www.w3.org/1999/html">
<span id="attachments_p<%= work.id %>">-->
<%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
<%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<!--<span class="ispublic-label"><%#= l(:field_is_public)%>:</span>-->
<%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%#= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%#= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
<!--</span>
</span>
<span class="ml5">(123KB)</span><br />
<span class="tit_fb">追加时间:</span>2015-12-03 11:00&nbsp;&nbsp;(此时其他同学作品尚未公开)
</div>
<div class="mt5">
<%#= render :partial => 'student_work/revise_attachments', :locals => {:work => work } %>
<a href="javascript:void(0);" class="blueCir ml5" title="请选择文件上传">上传附件</a>
</div>
<div class="cl"></div>-->
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%student_work_scores.each do |student_score|%>
<div id="work_score_<%= student_score.id%>">

View File

@ -0,0 +1,9 @@
# encoding: utf-8
class AddAttachmentType < ActiveRecord::Migration
def up
Attachmentstype.create(typeId:3,typeName:'修订附件')
end
def down
end
end

View File

@ -0,0 +1,18 @@
#coding=utf-8
namespace :exercise_publish do
desc "publish exercise and end exercise"
task :publish => :environment do
exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
exercises.each do |exercise|
exercise.update_column('exercise_status', 2)
end
end
task :end => :environment do
exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
end
end

View File

@ -1192,3 +1192,8 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;}
.rightArrow {margin:50px 15px 0px 15px; float:left;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;}
.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;}
a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.blueCir{ background:#3598db; color:#fff;}