diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 38b953732..c36877092 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -89,7 +89,9 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + #老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? || + (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) @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").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 @@ -110,7 +112,7 @@ class StudentWorkController < ApplicationController 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? #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表 @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 @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 @@ -166,6 +168,7 @@ class StudentWorkController < ApplicationController def create if params[:student_work] + @submit_result = true student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id] student_work ||= StudentWork.new student_work.name = params[:student_work][:name] @@ -181,7 +184,6 @@ class StudentWorkController < ApplicationController else student_work.late_penalty = 0 end - if student_work.save course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first if course_activity @@ -193,20 +195,16 @@ class StudentWorkController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| - format.html { - flash[:notice] = l(:notice_successful_create) - redirect_to student_work_index_url(:homework => @homework.id) - } + format.js end return end end + @submit_result = false respond_to do |format| - format.html { - flash[:notice] = l(:notice_failed_create) - redirect_to new_student_work_url(:homework => @homework.id) - } + format.js end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6c4ec91b..795147446 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2372,10 +2372,12 @@ module ApplicationHelper 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 "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 + link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' else - link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' + link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" end end end diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index d37feeb57..873144afe 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -73,11 +73,18 @@
  • 身      份: - + <% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%> + + <%else%> + + <%end%>
  • diff --git a/app/views/courses/set_course_outline.js.erb b/app/views/courses/set_course_outline.js.erb index a43a62c7d..e920005cd 100644 --- a/app/views/courses/set_course_outline.js.erb +++ b/app/views/courses/set_course_outline.js.erb @@ -3,6 +3,6 @@ hideModal(); <% else %> $("#course_outline_bar").html(' ') <%end %> -<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%> +<%#if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%> window.location.href='<%=syllabus_course_path(@course) %>'; -<% end %> +<%# end %> diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index bf6980dd2..bb3421cba 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -58,7 +58,7 @@ '取消大纲', {:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id}, :method => :delete, - :data => {:confirm => '确定取消么'}, + :data => {:confirm => '您确定要取消么?'}, :class => 'postOptionLink' ) if User.current && User.current.id == @article.author.id %>
  • diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index 26c69d225..4ed0a538a 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,6 +1,6 @@