From 216bc7f70f6c4855c3530797d35e6756eee9c135 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 6 Sep 2015 22:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E4=BA=A4=E7=8A=B6=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 3 +++ app/helpers/application_helper.rb | 14 ++++++++++++++ app/views/users/_course_homework.html.erb | 2 +- public/javascripts/homework.js | 10 ++++++++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 01671daf9..a690b224b 100644 --- a/Gemfile +++ b/Gemfile @@ -42,6 +42,9 @@ group :development, :test do gem 'pry-byebug' end gem 'pry-stack_explorer' + if RUBY_PLATFORM =~ /darwin/ + gem 'puma' + end end gem 'rspec-rails', '~> 3.0' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2f210f466..f4a70117f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2334,6 +2334,20 @@ module ApplicationHelper 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 diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f29512b0e..516365f81 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -17,7 +17,7 @@