This commit is contained in:
sw 2015-09-07 14:21:10 +08:00
commit 2dad88d7d1
5 changed files with 27 additions and 4 deletions

View File

@ -42,6 +42,9 @@ group :development, :test do
gem 'pry-byebug' gem 'pry-byebug'
end end
gem 'pry-stack_explorer' gem 'pry-stack_explorer'
if RUBY_PLATFORM =~ /darwin/
gem 'puma'
end
end end
gem 'rspec-rails', '~> 3.0' gem 'rspec-rails', '~> 3.0'

View File

@ -2334,6 +2334,20 @@ module ApplicationHelper
end end
end end
end end
#动态列表中,确定学生是该提交还是进列表
def student_work_activity_submit_status(opt={})
default_opt = {class: 'c_blue'}.merge(opt)
is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
homework = default_opt[:homework]
work = cur_user_works_for_homework homework
if work.nil? && !is_teacher
link_to "提交("+homework.student_works.count.to_s+")", new_student_work_path(:homework => homework.id), :class=> default_opt[:class]
else
link_to "提交("+homework.student_works.count.to_s+")", student_work_index_path(:homework => homework.id), :class=> default_opt[:class]
end
end
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher def user_for_homework_common homework,is_teacher

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%= link_to "提交("+activity.student_works.count.to_s+")", student_work_index_path(:homework => activity.id), :class=> "c_blue" %> <%= student_work_activity_submit_status(homework: activity) %>
</div> </div>
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div> <div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
</div> </div>

View File

@ -1,6 +1,6 @@
<% has_commit = has_commit_poll?(activity.id ,User.current)%> <% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% if has_commit || activity.user_id == User.current %> <% if ( activity.polls_status==2) %>
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">

View File

@ -42,7 +42,7 @@ $(function(){
data.index = $('.ProResultTop').length+1; data.index = $('.ProResultTop').length+1;
} }
if (typeof cb == 'function') {cb(); return;} if (typeof cb == 'function') {cb(data); return;}
var html=bt('t:result-list',data); var html=bt('t:result-list',data);
@ -74,7 +74,13 @@ $(function(){
} }
if (!tested) { if (!tested) {
test_program(function(){ test_program(function(data){
if (data.status!=0) {
var r=confirm("测试不通过,是否强制提交?");
if (!r) {
return;
}
};
$(".HomeWorkCon form").submit(); $(".HomeWorkCon form").submit();
}); });
return; return;