diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 8b37ca8e4..6e6fa7d20 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -151,7 +151,7 @@ class HomeworkCommonController < ApplicationController @homework.description = params[:homework_common][:description] @homework.end_time = params[:homework_common][:end_time] @homework.publish_time = params[:homework_common][:publish_time] - @homework.homework_type = params[:homework_common][:homework_type] + @homework.homework_type = params[:homework_common][:homework_type] if params[:homework_common][:homework_type] unless @homework.late_penalty == params[:late_penalty] @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| student_work.late_penalty = params[:late_penalty] diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 20cdc6659..dae0bcab6 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -13,8 +13,9 @@ class StudentWorkController < ApplicationController def index @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @is_teacher = User.current.allowed_to?(:as_teacher,@course) - unless @group == "0" || @group.nil? - group_students = CourseGroup.find_by_id(@group).users + course_group = CourseGroup.find_by_id(@group) if @group + if course_group + group_students = course_group.users if group_students.empty? student_in_group = '(0)' else diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 47a3b59ae..64a478187 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2345,6 +2345,34 @@ module ApplicationHelper #将文本内的/n转换为
def text_format text - text.gsub("\n","
").html_safe + text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","
").html_safe + end + + #评分规则显示 + def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil + if absence_penalty + if late_penalty.to_i == 0 && absence_penalty.to_i == 0 + notice = "尚未设置评分规则" + if is_teacher + notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") + end + elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0 + notice = "迟交扣#{late_penalty}分,缺评扣分未设置" + elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0 + notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分" + elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0 + notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分" + end + else + if late_penalty.to_i == 0 + notice = "尚未设置评分规则" + if is_teacher + notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") + end + else + notice = "迟交扣#{late_penalty}分" + end + end + notice.html_safe end end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index a2ff6dbab..81f817ee9 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -53,31 +53,4 @@ module HomeworkCommonHelper link end - #评分规则显示 - def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil - if absence_penalty - if late_penalty.to_i == 0 && absence_penalty.to_i == 0 - notice = "尚未设置评分规则" - if is_teacher - notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") - end - elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0 - notice = "迟交扣#{late_penalty}分,缺评扣分未设置" - elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0 - notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分" - elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0 - notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分" - end - else - if late_penalty.to_i == 0 - notice = "尚未设置评分规则" - if is_teacher - notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") - end - else - notice = "迟交扣#{late_penalty}分" - end - end - notice.html_safe - end end \ No newline at end of file diff --git a/app/views/files/searchone4reload.html.erb b/app/views/files/searchone4reload.html.erb index 4512e52dd..75dd7bcab 100644 --- a/app/views/files/searchone4reload.html.erb +++ b/app/views/files/searchone4reload.html.erb @@ -2,26 +2,29 @@ <% if file.is_public? || User.current.member_of_course?(course) %>
- <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> - - <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> - + + <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> + <% else %> <% end %> <% else %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <% end %> + <%= file_preview_tag(file, class: 'f_l re_open') %> <% else %> <% end %>
-
+

文件大小:<%= number_to_human_size(file.filesize) %>

<%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 008f88138..806768954 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -98,7 +98,7 @@
  • - 测试 +
  • @@ -116,7 +116,7 @@
  • - 测试 +
  • diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 1eaee54af..781277b57 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -48,9 +48,9 @@ <%= link_to "所有作品(#{@stundet_works.count})".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%> <% if @show_all%> - - <%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if @is_teacher %> - 搜索 + + <%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if(@is_teacher && course_group_list(@course).count > 0) %> + 搜索 <%= link_to("缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank") if((@is_teacher || User.current.admin?) && @homework.homework_type == 1) %> <% end%> <% if @is_teacher%> @@ -165,15 +165,10 @@
    扣分标准:
    - 迟交扣 - <%= @homework.late_penalty%> - 分 <% if @homework.homework_type == 1%> - ,缺评一个作品扣 - <%= @homework.homework_detail_manual.absence_penalty%> - 分 + <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher,@homework.homework_detail_manual.absence_penalty%> <% else%> - 。 + <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher%> <% end%>
    diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index a0998f539..db848d2cd 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -6,7 +6,7 @@
    <% if show_name %> - <%= image_tag url_to_avatar(journal.user),:width => '30',:height => '30' %> + <%= image_tag url_to_avatar(reply.user),:width => '30',:height => '30' %> <% else %> <%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %> <% end %> diff --git a/public/javascripts/course.js b/public/javascripts/course.js index db1f761f2..7c165a4c6 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -861,14 +861,19 @@ function clickOK(path) }); } //查询 -function SearchByName(name,group,url,event) +function SearchByName(url,event) { var keycode = (event.keyCode ? event.keyCode : event.which); if(keycode == '13'){ - location.href = url + "&name=" + name + "&group=" + group; + location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val(); } } -function SearchByName_1(name,group,url) +function SearchByName_1(url) { - location.href = url + "&name=" + name + "&group=" + group; + if($("#late_penalty").val() == null){ + location.href = url + "&name=" + $("#course_student_name").val() + } + else{ + location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val(); + } }