From 1eb41478b2d551731c06570f358cdfa25fe94cc6 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 9 May 2016 17:06:10 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=92=8C=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81=E5=AE=9E=E7=8E=B0=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 ++ app/controllers/words_controller.rb | 4 +- .../_org_course_homework.html.erb | 66 ++++++++++++++---- app/views/users/_course_homework.html.erb | 67 ++++++++++++++----- app/views/users/_reply_to.html.erb | 2 + .../users/_user_homework_detail.html.erb | 4 +- app/views/words/reply_to_homework.js.erb | 5 +- 7 files changed, 121 insertions(+), 33 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0dd947be4..01d87374c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -95,7 +95,13 @@ class UsersController < ApplicationController case params[:type] when 'HomeworkCommon' @reply = JournalsForMessage.find params[:reply_id] + if params[:user_activity_id] + @user_activity_id = params[:user_activity_id] + else + @user_activity_id = -1 + end @is_in_course = params[:is_in_course] + @course_activity = params[:course_activity].to_i end respond_to do |format| format.js diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index e17f03c38..fa084e349 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -317,7 +317,9 @@ class WordsController < ApplicationController update_org_activity(@homework_common.class,@homework_common.id) respond_to do |format| format.js{ - @is_in_course = params[:is_in_course] + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i } end else diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 19cdcf2f1..179e4678e 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -276,7 +276,8 @@ <% count=activity.journals_for_messages.count %>
-
回复 +
回复 + ︿ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> @@ -318,23 +319,60 @@ <% else %> <%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> - <%= format_time(comment.created_on) %> - - <% if comment.user == User.current %> - + <%= time_from_now(comment.created_on) %> +
+ <% unless comment.m_parent_id.nil? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents parents_rely, comment %> + <% length = parents_rely.length %> +
+ <% if length <= 3 %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> +
+
+
+ <%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %> +
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %> +
+
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %>
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %> +
<% end %> - - -
+
+ <% end %>
<%= comment.notes.html_safe %>
+
+
+ + + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + + <%= link_to( + l(:button_reply), + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + + <% if User.current.admin? ||is_teacher || comment.user == User.current%> + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> + <% end %> + +
+
+
+

diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index b6ea36de5..a96ae5d74 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -285,7 +285,8 @@ <% count=activity.journals_for_messages.count %>
-
回复 +
回复 + ︿ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> @@ -327,24 +328,60 @@ <% else %> <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> - <%= format_time(comment.created_on) %> - - <% if comment.user == User.current %> - + <%= time_from_now(comment.created_on) %> +
+ <% unless comment.m_parent_id.nil? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents parents_rely, comment %> + <% length = parents_rely.length %> +
+ <% if length <= 3 %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - <% end %> - - - -
+
+ <% end %>
<%= comment.notes.html_safe %>
+
+
+ + + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + + <%= link_to( + l(:button_reply), + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + + <% if User.current.admin? ||is_teacher || comment.user == User.current%> + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> + <% end %> + +
+
+
+

diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index ccfc07db2..30f4e3542 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -4,6 +4,8 @@
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %> > + > + >
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 30bec6685..fde67f472 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -373,7 +373,7 @@ <%= link_to( l(:button_reply), - {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course}, + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course, :course_activity => -1}, :remote => true, :method => 'get', :title => l(:button_reply)) %> @@ -381,7 +381,7 @@ <% if User.current.admin? ||is_teacher || comment.user == User.current%> - <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course,:course_activity=>-1}, + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course, :course_activity => -1}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> <% end %> diff --git a/app/views/words/reply_to_homework.js.erb b/app/views/words/reply_to_homework.js.erb index 85275277a..7da72fa54 100644 --- a/app/views/words/reply_to_homework.js.erb +++ b/app/views/words/reply_to_homework.js.erb @@ -1,4 +1,7 @@ -<% if @is_in_course %> +<% if @user_activity_id != -1 %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); +<% else %> $("#homework_common_<%= @homework_common.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "HomeworkCommon"); <% end %> \ No newline at end of file From f6d7df73936aab80417869e9b52f5a34eb510168 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 9 May 2016 18:40:21 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E2=80=9C=E5=88=86=E4=BA=AB=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=94=B3=E8=AF=B7=E2=80=9D=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 10 +++ app/views/admin/apply_for_homework.html.erb | 89 +++++++++++++++++++++ config/locales/zh.yml | 1 + config/routes.rb | 1 + lib/redmine.rb | 1 + lib/redmine/menu_manager.rb | 2 + 6 files changed, 104 insertions(+) create mode 100644 app/views/admin/apply_for_homework.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 99732fc6b..11dfbf5f4 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -593,4 +593,14 @@ class AdminController < ApplicationController end end + #分享作业申请 + def apply_for_homework + homeworks = ApplyHomework.where("user_id != 0") + @homework = paginateHelper homeworks,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end + end + end diff --git a/app/views/admin/apply_for_homework.html.erb b/app/views/admin/apply_for_homework.html.erb new file mode 100644 index 000000000..1c7a04901 --- /dev/null +++ b/app/views/admin/apply_for_homework.html.erb @@ -0,0 +1,89 @@ +

+ <%=l(:label_apply_homework)%> +

+ +
+ + + + + + + + + + + + + + <%@count=@page*30 %> + <% for homework in @homework do %> + <% unless homework.nil? %> + <% @count+=1 %> + + + <% c_h = HomeworkCommon.find homework.homework_common_id %> + <% if c_h %> + + <% if c_h.course %> + + <% end %> + + <% end %> + + + + + <% end %> + <% end %> + +
+ 序号 + + 作业名称 + + 课程名称 + + 作者 + + 申请者 + + 申请状态 + + 申请日期 +
+ <%=@count %> + + <%=link_to(c_h.try(:name), student_work_index_path(:homework => c_h.id))%> + + <%= link_to(c_h.course.name, course_path(c_h.course.id)) %> + <%= c_h.try(:user)%><% else %><%=c_h.try(:user).try(:realname) %><% end %>'> + <% if c_h.try(:user).try(:realname) == ' '%> + <%= link_to(c_h.try(:user), user_path(c_h.user_id)) %> + <% else %> + <%= link_to(c_h.try(:user).try(:realname), user_path(c_h.user_id)) %> + <% end %> + <%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'> + <% if homework.try(:user).try(:realname) == ' '%> + <%= link_to(homework.try(:user), user_path(homework.user_id)) %> + <% else %> + <%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %> + <% end %> + + <% if homework.status == 1 %> + 待审核 + <% elsif homework.status == 2 %> + 已通过 + <% else %> + 已拒绝 + <% end %> + + <%=format_date( homework.created_at ) %> +
+
+ + + +<% html_title(l(:label_apply_homework)) -%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 088ce3d8e..55124cf58 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -419,6 +419,7 @@ zh: label_project_all: 所有的项目 label_project_latest: 最近的项目 label_issue: 问题 + label_apply_homework: 分享作业申请 label_issue_view_all: 查看所有问题 label_issues_by: "按 %{value} 分组显示问题" diff --git a/config/routes.rb b/config/routes.rb index afefc9e3c..6b06feebc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -985,6 +985,7 @@ RedmineApp::Application.routes.draw do match 'admin/latest_login_users', as: :latest_login_users match 'admin/latest_login_teachers', as: :latest_login_teachers get 'admin/homework' + get 'admin/apply_for_homework' resources :auth_sources do member do diff --git a/lib/redmine.rb b/lib/redmine.rb index 47ee3d38f..7fec36426 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -395,6 +395,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :course_resource_list, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list menu.push :project_resource_list, {:controller => 'admin', :action => 'project_resource_list'}, :caption => :label_project_resource_list menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework + menu.push :apply_for_homework, {:controller => 'admin', :action => 'apply_for_homework'}, :caption => :label_apply_homework end #Modified by young diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index f9ce21987..6d1bb2fcb 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -193,6 +193,8 @@ module Redmine title = h(caption) + "(#{Course.all.count})" when '用户列表' title = h(caption) + "(#{User.all.count})" + when '分享作业申请' + title = h(caption) + "(#{ApplyHomework.where("user_id != 0").count})" end link_to(title, url, item.html_options(:selected => selected)) From 11017d72c5b63e18611f6226f3d7380a7e6b843a Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 May 2016 11:28:24 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=AF=B9=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E7=9A=84=E8=AF=84=E5=88=86=E5=8F=AF=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_add_score.html.erb | 28 +++++++++++-- .../_no_teacher_score_notice.html.erb | 15 +++++++ public/javascripts/course.js | 42 ++++++++++++++++++- 3 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 app/views/student_work/_no_teacher_score_notice.html.erb diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index a2137d103..ca580bebc 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -7,8 +7,9 @@

  • 评分: - - + + +
  • <% if @is_teacher%> @@ -16,6 +17,8 @@
    <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
    +
    + <%end%> 提交
    @@ -28,12 +31,29 @@ $('#hint_message_'+id).html("为了对其他学生的作品负责,请您务必填写评语"); $("#hint_message_"+id).css('color','#ff0000'); $("#score_comment_"+id).focus(); - } else { + } else if (parseFloat($("#score_"+id).val()) == -1) { + $('#score_notice_span_'+id).html("请先评分"); + $('#score_notice_span_'+id).show(); + $("#score_"+id).focus(); + } + else { $("#work_submit_"+id).parent().parent().submit(); $('#about_hwork_'+id).html(''); } <% else %> - $("#work_submit_"+id).parent().parent().submit(); + if($.trim($('#score_comment_'+id).val()) == "" && parseFloat($("#score_"+id).val()) == -1 && $("#attachments_fields"+id).children().length == 0){ + $("#none_notice_"+id).show(); + } else if(parseFloat($("#score_"+id).val()) == -1) { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/no_teacher_score_notice') %>'); + showModal('ajax-modal', '450px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); + } + else { + $("#work_submit_" + id).parent().parent().submit(); + } <% end %> } \ No newline at end of file diff --git a/app/views/student_work/_no_teacher_score_notice.html.erb b/app/views/student_work/_no_teacher_score_notice.html.erb new file mode 100644 index 000000000..12b3025a9 --- /dev/null +++ b/app/views/student_work/_no_teacher_score_notice.html.erb @@ -0,0 +1,15 @@ +
    +
    +

    + 当前作品未进行评分,是否确定提交? +

    + +
    +
    \ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 4e698e6f2..cdaf8866a 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1057,10 +1057,26 @@ $.fn.peSlider = function(settings){ max: parseFloat(input.attr('max')), value: parseFloat(input.val()) }); + if(parseFloat(input.val()) == -1){ + input.css("color", "#fff"); + input.next().next().html("未评分"); + input.next().next().show(); + } else{ + input.css("color", "#000"); + input.next().next().hide(); + } slider .insertBefore(input) .slider(sliderOptions) .bind('slide', function(e, ui){ + if(ui.value == -1){ + input.css("color", "#fff"); + input.next().next().html("未评分"); + input.next().next().show(); + } else { + input.css("color", "#000"); + input.next().next().hide(); + } input.val(ui.value); friendlyVal = input.val() + ' ' + thisUnits; slider.find('a').attr({ @@ -1081,6 +1097,14 @@ $.fn.peSlider = function(settings){ .keyup(function(){ var inVal = parseFloat(input.val()); if( !isNaN(inVal) ){ + if(inVal == -1){ + input.css("color", "#fff"); + input.next().next().html("未评分"); + input.next().next().show(); + } else { + input.css("color", "#000"); + input.next().next().hide(); + } slider.slider('value', inVal); input.val(slider.slider('value')); } @@ -1088,6 +1112,14 @@ $.fn.peSlider = function(settings){ .change(function(){ var inVal = parseFloat(input.val()); if( !isNaN(inVal) ){ + if(inVal == -1){ + input.css("color", "#fff"); + input.next().next().html("未评分"); + input.next().next().show(); + } else { + input.css("color", "#000"); + input.next().next().hide(); + } slider.slider('value', inVal); input.val(slider.slider('value')); } @@ -1095,7 +1127,15 @@ $.fn.peSlider = function(settings){ .blur(function(){ var inVal = parseFloat(input.val()); if( isNaN(inVal) ){ - input.val(0); + input.val(-1); + } + if(input.val() == -1){ + input.css("color", "#fff"); + input.next().next().html("未评分"); + input.next().next().show(); + } else { + input.css("color", "#000"); + input.next().next().hide(); } }); if( !settings.step ){ From ba07e564dbf8f5411f2270ba30c1a8efc9e0ebe1 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 May 2016 11:51:41 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E8=80=81=E5=B8=88=E8=AF=84=E5=88=86?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_add_score.html.erb | 3 +++ app/views/student_work/_no_teacher_score_notice.html.erb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index ca580bebc..29fd8b63a 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -56,4 +56,7 @@ } <% end %> } + function submit_teacher_score(){ + $("#work_submit_<%=work.id %>").parent().parent().submit(); + } \ No newline at end of file diff --git a/app/views/student_work/_no_teacher_score_notice.html.erb b/app/views/student_work/_no_teacher_score_notice.html.erb index 12b3025a9..02febb5d5 100644 --- a/app/views/student_work/_no_teacher_score_notice.html.erb +++ b/app/views/student_work/_no_teacher_score_notice.html.erb @@ -4,7 +4,7 @@ 当前作品未进行评分,是否确定提交?

    - + 确  定 From 5baf467d13e9fe5d18345bdf70a5e7be9351f1a2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 May 2016 15:26:08 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E4=BD=9C=E5=93=81=E8=AF=84=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 56 +++++++++++++++------- app/helpers/student_work_helper.rb | 2 +- app/views/student_work/_add_score.html.erb | 2 +- app/views/student_work/add_score.js.erb | 6 +-- public/stylesheets/courses.css | 8 ++-- public/stylesheets/new_user.css | 4 +- 6 files changed, 50 insertions(+), 28 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e80b90d7b..c0e54df70 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -614,38 +614,60 @@ class StudentWorkController < ApplicationController render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2 @score = student_work_score @work,User.current if @score - @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" - @score.score = params[:score] if params[:score] + @new_score = StudentWorksScore.new + if params[:score] + @new_score.score = params[:score].to_i == -1 ? @score.score : params[:score] + end + @new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" + @new_score.user_id = User.current.id + @new_score.student_work_id = @work.id if User.current.admin? - @score.reviewer_role = 1 + @new_score.reviewer_role = 1 else role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name - @score.reviewer_role = get_role_by_name(role) + @new_score.reviewer_role = get_role_by_name(role) + end + if @is_teacher + @is_new = true + @is_last_a = false + else + @is_new = false end - @is_new = false + + #@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" + #@score.score = params[:score] if params[:score] + #if User.current.admin? + # @score.reviewer_role = 1 + #else + # role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name + # @score.reviewer_role = get_role_by_name(role) + #end + #@is_new = false else @is_last_a = @work.student_works_scores.empty? - @score = StudentWorksScore.new - @score.score = params[:score] if params[:score] - @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" - @score.user_id = User.current.id - @score.student_work_id = @work.id + @new_score = StudentWorksScore.new + if params[:score] + @new_score.score = params[:score].to_i == -1 ? nil : params[:score] + end + @new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" + @new_score.user_id = User.current.id + @new_score.student_work_id = @work.id if User.current.admin? - @score.reviewer_role = 1 + @new_score.reviewer_role = 1 else role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name - @score.reviewer_role = get_role_by_name(role) + @new_score.reviewer_role = get_role_by_name(role) end @is_new = true end - @score.save_attachments(params[:attachments]) - render_attachment_warning_if_needed(@score) + @new_score.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(@new_score) - if @score.save - case @score.reviewer_role + if @new_score.save + case @new_score.reviewer_role when 1 #教师评分:最后一个教师评分为最终评分 - @work.teacher_score = @score.score + @work.teacher_score = @new_score.score when 2 #教辅评分 教辅评分显示平均分 @work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f when 3 #学生评分 学生评分显示平均分 diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 4e11e153e..74788751b 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -23,7 +23,7 @@ module StudentWorkHelper #获取指定用户对某一作业的评分结果 def student_work_score work,user - StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).first + StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last end #获取指定评分的角色 diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 29fd8b63a..74f81a30b 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -45,7 +45,7 @@ $("#none_notice_"+id).show(); } else if(parseFloat($("#score_"+id).val()) == -1) { $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/no_teacher_score_notice') %>'); - showModal('ajax-modal', '450px'); + showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 762aa4a8a..d3cb963f6 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -1,10 +1,10 @@ -$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @score}) %>"); +$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>"); $('#score_<%= @work.id%>').peSlider({range: 'min'}); <% if @is_new%> - $("#score_list_<%= @work.id%>").prepend("
    <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score,:is_last => @is_last_a}) %>
    "); + $("#score_list_<%= @work.id%>").prepend("
    <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %>
    "); <% else %> - $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score,:is_last => @is_last}) %>"); + $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>"); <% end%> $("#score_list_<%= @work.id%>").removeAttr("style"); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b81a7a7b6..2bc77b8ff 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -434,8 +434,8 @@ span.author { font-size: 0.9em; color: #888; } .bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; } .bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; } .hwork_txt{ width:560px; padding-left:5px; background:#fff;} -a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:10px;} -a:hover.tijiao{ background:#0f99a9;} +a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#269ac9; text-align:center; padding-top:4px; float:left; margin-right:10px;} +a:hover.tijiao{ background:#297fb8;} .members_left{ float:left; width:410px; margin-right:20px; text-align:center;} .members_left{} .members_left ul li{ height:30px; border-bottom:1px solid #E4E4E4; width:410px; padding-top:10px; } @@ -497,8 +497,8 @@ a.xls{ margin-left:5px; color:#136b3b;} .ni_con p{ color:#808181; } .ni_con a:hover{ text-decoration:none;} .ni_btn{ width:190px; margin:15px auto; line-height:1.9;} -a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:15px;} -a:hover.tijiao{ background:#0f99a9;} +a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#269ac9; text-align:center; padding-top:4px; float:left; margin-right:15px;} +a:hover.tijiao{ background:#297fb8;} .c_pink{ color:#e65d5e;} .ni_con_work { width:300px; margin:25px 20px;} .ni_con_work p{ color:#808181; } diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index be6cea109..20bc59a0e 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1222,8 +1222,8 @@ blockquote { .bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; } .bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; } .hwork_txt{ width:560px; padding-left:5px; background:#fff;} -a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:10px;} -a:hover.tijiao{ background:#0f99a9;} +a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#269ac9; text-align:center; padding-top:4px; float:left; margin-right:10px;} +a:hover.tijiao{ background:#297fb8;} .members_left{ float:left; width:410px; margin-right:20px; text-align:center;} .members_left{} .members_left ul li{ height:30px; border-bottom:1px solid #E4E4E4; width:410px; padding-top:10px; } From 9bc8ccbb9e69fc75435b093bff5a6472740013ca Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 11 May 2016 09:18:55 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E6=95=99=E8=BE=85=E5=8F=AF=E5=8F=AA?= =?UTF-8?q?=E8=AF=84=E8=AF=AD=E4=B8=8D=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 79 ++++++++++--------- .../_org_course_homework.html.erb | 4 +- app/views/student_work/_add_score.html.erb | 20 ++--- .../student_work/_evaluation_un_work.html.erb | 4 +- .../_no_teacher_score_notice.html.erb | 2 +- .../student_work/_student_work_score.html.erb | 10 ++- .../student_work/add_comments_to_work.js.erb | 6 ++ app/views/users/_course_homework.html.erb | 3 +- .../users/_user_homework_detail.html.erb | 4 +- config/routes.rb | 1 + 10 files changed, 73 insertions(+), 60 deletions(-) create mode 100644 app/views/student_work/add_comments_to_work.js.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index c0e54df70..3c103f98b 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -613,51 +613,39 @@ class StudentWorkController < ApplicationController #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2 @score = student_work_score @work,User.current + #@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" + #@score.score = params[:score] if params[:score] + #if User.current.admin? + # @score.reviewer_role = 1 + #else + # role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name + # @score.reviewer_role = get_role_by_name(role) + #end + #@is_new = false + @is_last_a = @work.student_works_scores.empty? + @new_score = StudentWorksScore.new + if @score && params[:score] + @new_score.score = params[:score].to_i == -1 ? @score.score : params[:score] + elsif @score.nil? && params[:score] + @new_score.score = params[:score].to_i == -1 ? nil : params[:score] + end + @new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" + @new_score.user_id = User.current.id + @new_score.student_work_id = @work.id + if User.current.admin? + @new_score.reviewer_role = 1 + else + role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name + @new_score.reviewer_role = get_role_by_name(role) + end if @score - @new_score = StudentWorksScore.new - if params[:score] - @new_score.score = params[:score].to_i == -1 ? @score.score : params[:score] - end - @new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" - @new_score.user_id = User.current.id - @new_score.student_work_id = @work.id - if User.current.admin? - @new_score.reviewer_role = 1 - else - role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name - @new_score.reviewer_role = get_role_by_name(role) - end if @is_teacher @is_new = true @is_last_a = false else @is_new = false end - - #@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" - #@score.score = params[:score] if params[:score] - #if User.current.admin? - # @score.reviewer_role = 1 - #else - # role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name - # @score.reviewer_role = get_role_by_name(role) - #end - #@is_new = false else - @is_last_a = @work.student_works_scores.empty? - @new_score = StudentWorksScore.new - if params[:score] - @new_score.score = params[:score].to_i == -1 ? nil : params[:score] - end - @new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" - @new_score.user_id = User.current.id - @new_score.student_work_id = @work.id - if User.current.admin? - @new_score.reviewer_role = 1 - else - role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name - @new_score.reviewer_role = get_role_by_name(role) - end @is_new = true end @@ -669,15 +657,20 @@ class StudentWorkController < ApplicationController when 1 #教师评分:最后一个教师评分为最终评分 @work.teacher_score = @new_score.score when 2 #教辅评分 教辅评分显示平均分 - @work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f + #@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f + ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") + @work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f when 3 #学生评分 学生评分显示平均分 - @work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f + #@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f + stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") + @work.student_score = stu_score.first.score.try(:round, 2).to_f end @homework.update_attributes(:updated_at => Time.now) update_course_activity(@homework.class,@homework.id) update_user_activity(@homework.class,@homework.id) update_org_activity(@homework.class,@homework.id) if @work.save + @work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first respond_to do |format| format.js end @@ -710,6 +703,14 @@ class StudentWorkController < ApplicationController end end + #提交未评分的评语 + def add_comments_to_work + @work = StudentWork.find params[:id] + respond_to do |format| + format.js + end + end + #为作品点赞 def praise_student_work pt = PraiseTread.new diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 179e4678e..8a780ea78 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -140,8 +140,8 @@
    <% if activity.student_works.count != 0 %> <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> - <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> + <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> <% unless student_work_scores.empty? %> <% last_score = student_work_scores.first %>
    diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 74f81a30b..8dfc0a171 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -7,7 +7,7 @@

  • 评分: - +
  • @@ -44,19 +44,21 @@ if($.trim($('#score_comment_'+id).val()) == "" && parseFloat($("#score_"+id).val()) == -1 && $("#attachments_fields"+id).children().length == 0){ $("#none_notice_"+id).show(); } else if(parseFloat($("#score_"+id).val()) == -1) { - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/no_teacher_score_notice') %>'); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); + $.ajax({ + type: "GET", + url: "/student_work/"+id+"/add_comments_to_work", + data: 'text', + success: function (data) { + } + }); } else { $("#work_submit_" + id).parent().parent().submit(); } <% end %> } - function submit_teacher_score(){ - $("#work_submit_<%=work.id %>").parent().parent().submit(); + function submit_teacher_score(id){ + $("#work_submit_"+id).parent().parent().submit(); + hideModal(); } \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 8e1c16264..965d126ee 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -70,11 +70,11 @@ <% end %> <% unless student_work.student_score.nil?%> - (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>) + (<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>)
    现共有 -  <%= student_work.student_works_scores.where(:reviewer_role => 3).count%>  +  <%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>  名学生进行了匿评,平均分为  <%= format("%.1f",student_work.student_score)%> 分。
    diff --git a/app/views/student_work/_no_teacher_score_notice.html.erb b/app/views/student_work/_no_teacher_score_notice.html.erb index 02febb5d5..5a8c768cc 100644 --- a/app/views/student_work/_no_teacher_score_notice.html.erb +++ b/app/views/student_work/_no_teacher_score_notice.html.erb @@ -4,7 +4,7 @@ 当前作品未进行评分,是否确定提交?

    - + 确  定 diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb index c800ae8d0..64e5ffa01 100644 --- a/app/views/student_work/_student_work_score.html.erb +++ b/app/views/student_work/_student_work_score.html.erb @@ -6,10 +6,12 @@ (<%= student_work_score_role score%>) - 评分: - - <%= score.score%>分 - + <% unless score.score.nil? %> + 评分: + + <%= score.score%>分 + + <% end %> 回复 <%=format_time score.updated_at %> diff --git a/app/views/student_work/add_comments_to_work.js.erb b/app/views/student_work/add_comments_to_work.js.erb new file mode 100644 index 000000000..c14986c81 --- /dev/null +++ b/app/views/student_work/add_comments_to_work.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/no_teacher_score_notice', :locals => {:work => @work}) %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index a96ae5d74..232a58700 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -140,7 +140,8 @@
    <% if activity.student_works.count != 0 %> <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> + <%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> + <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> <% unless student_work_scores.empty? %> <% last_score = student_work_scores.first %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index fde67f472..6eb52f9d4 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -144,8 +144,8 @@
    <% if homework_common.student_works.count != 0 %> <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> - <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> + <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> <% unless student_work_scores.empty? %> <% last_score = student_work_scores.first %>
    diff --git a/config/routes.rb b/config/routes.rb index 6b06feebc..37cdeb22a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -266,6 +266,7 @@ RedmineApp::Application.routes.draw do post 'add_score' post 'revise_attachment' get 'retry_work' + get 'add_comments_to_work' get 'praise_student_work' get 'forbidden_anonymous_comment' end From fdefbf3795fe7cab2d20e44a3a03101e153a150b Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 11 May 2016 15:31:33 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=89=93=E5=88=86?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E7=82=B9=E5=87=BB=E4=B8=8D=E4=BC=9A=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_add_score.html.erb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 8dfc0a171..e051a4d99 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -25,6 +25,7 @@ <% end%> \ No newline at end of file From 9ec488684b1e0aad209c6777b32bf3c29aa3fc47 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 09:30:06 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E5=88=86=E4=BA=AB=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=9A=84=E6=B6=88=E6=81=AF=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/apply_homework.rb | 2 +- app/models/homework_common.rb | 1 + app/models/user.rb | 1 + app/views/admin/apply_for_homework.html.erb | 2 +- app/views/users/_homework_repository.html.erb | 2 +- app/views/users/_user_message_course.html.erb | 31 +++++++++---------- app/views/users/apply_for_homework.js.erb | 2 +- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/app/models/apply_homework.rb b/app/models/apply_homework.rb index 0a7c505a4..f4ded9733 100644 --- a/app/models/apply_homework.rb +++ b/app/models/apply_homework.rb @@ -1,5 +1,5 @@ class ApplyHomework < ActiveRecord::Base - #status:1. 待审核 2.审核通过 3.已拒绝 + #status:1. 等待回复 2.审核通过 3.已拒绝 belongs_to :user belongs_to :homework_common attr_accessible :status, :user_id, :homework_common_id diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index f8e222b0f..ac3303c15 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -15,6 +15,7 @@ class HomeworkCommon < ActiveRecord::Base has_many :student_works, :dependent => :destroy, :conditions => "is_test=0" has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :journals_for_messages, :as => :jour, :dependent => :destroy + has_many :apply_homeworks, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 # 课程动态 has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy diff --git a/app/models/user.rb b/app/models/user.rb index 2a9a13c73..cf71ec42c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -108,6 +108,7 @@ class User < Principal has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy has_many :student_work_projects, :dependent => :destroy + has_many :apply_homeworks, :dependent => :destroy #end has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, diff --git a/app/views/admin/apply_for_homework.html.erb b/app/views/admin/apply_for_homework.html.erb index 1c7a04901..25d15f707 100644 --- a/app/views/admin/apply_for_homework.html.erb +++ b/app/views/admin/apply_for_homework.html.erb @@ -65,7 +65,7 @@ <% if homework.status == 1 %> - 待审核 + 等待回复 <% elsif homework.status == 2 %> 已通过 <% else %> diff --git a/app/views/users/_homework_repository.html.erb b/app/views/users/_homework_repository.html.erb index 738de678c..6443942fb 100644 --- a/app/views/users/_homework_repository.html.erb +++ b/app/views/users/_homework_repository.html.erb @@ -43,7 +43,7 @@ <% if ah.nil? %> <%= link_to("请求分享", apply_homework_user_path(User.current.id,:homework_id => homework.id), :class => 'green_btn_share c_white', :remote => true) %> <% elsif ah.status == 1 %> - 待审核 + 等待回复 <% elsif ah.status == 2 %> 可引用 <% elsif ah.status == 3 %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index f3942d95e..9d49f687f 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -231,17 +231,17 @@ <% end %> <% if ma.course_message_type == "HomeworkCommon" && ma.status == 5 %>
      -
    • +
    • - 系统提示 - ">您有了新的引用作业申请: + <%= link_to User.find(ma.apply_user_id).show_name, + user_path(User.find(ma.apply_user_id)), :class => "newsBlue homepageNewsPublisher" %> + ">申请引用作业:
    • -
    • +
    • <% content = ma.content.nil? ? '' : ':'+ ma.content.to_s %> - <%=User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}" %> + <%= link_to User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}", student_work_index_path(:homework => ma.course_message.id), :title => User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}",:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %> -
    • @@ -262,19 +262,18 @@ <% end %> <% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 %> <% end %> + + <% if ma.course_message_type == "StudentWork" && ma.status == 2 %> + + <% end %> <% if ma.course_message_type == "Course" %>
        From b3782c5d0cd6d773dcdb614ec67522da5d3440e7 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 10:47:07 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 390d45cbc..d3f681a06 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -652,4 +652,5 @@ class AdminController < ApplicationController respond_to do |format| format.html end - endend + end +end From 7761bd53137782e729ece061a8f29a0855946f9a Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 10:49:12 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=9A=84=E2=80=9C=E6=9C=89=E6=96=B0=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E4=BA=86=E2=80=9D=E6=94=B9=E6=88=90=E2=80=9C=E6=9C=89?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98=E5=8A=A8=E6=80=81=E4=BA=86?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 163469723..18f027dce 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2141,7 +2141,7 @@ zh: label_journals_comment_template: 您的留言有新回复了 label_blog_comment_template: 您的博客有新回复了 label_new_blog_template: 有新博客了 - label_new_issue_template: 有新缺陷了 + label_new_issue_template: 有新的问题动态了 label_new_notice_template: 您的课程有新通知了 #edit yk label_code_work_tests: 代码测试列表 From ca5f03f2ea5aa89264ea1003d21d9a558940c14b Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 14:13:34 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=EF=BC=8C=E8=AF=84?= =?UTF-8?q?=E9=98=85=E4=BD=9C=E5=93=81=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 5 +++++ app/models/student_works_score.rb | 16 +++++++++++++-- app/views/users/_user_message_course.html.erb | 20 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 10971d46f..4b5ac227f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -256,6 +256,11 @@ class JournalsForMessage < ActiveRecord::Base end end if self.jour_type == 'HomeworkCommon' + if self.m_parent_id.nil? + if self.user_id != self.jour.user_id + self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false) + end + end count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count if count == 0 ws = WechatService.new diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb index aa38c5dcd..b2fc4fdcd 100644 --- a/app/models/student_works_score.rb +++ b/app/models/student_works_score.rb @@ -18,17 +18,29 @@ class StudentWorksScore < ActiveRecord::Base receiver = self.student_work.user # 判断是第一次评阅还是更新 status:0 新建;1 更新 if self.created_at == self.updated_at - if self.comment.nil? + if self.comment.nil? && self.score self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false, :content => "作业评分:#{self.score}", :status=> false) + elsif self.score.nil? && self.comment + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "评语:#{self.comment}", :status=> false) + elsif self.comment.nil? && self.score.nil? + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "上传了批阅附件", :status=> false) else self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false, :content => "作业评分:#{self.score}    评语:#{self.comment}", :status=> false) end else # 更新 - if self.comment.nil? + if self.comment.nil? && self.score self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false, :content => "作业评分:#{self.score}", :status=> true) + elsif self.score.nil? && self.comment + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "评语:#{self.comment}", :status=> true) + elsif self.comment.nil? && self.score.nil? + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "上传了批阅附件", :status=> true) else self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false, :content => "作业评分:#{self.score}    评语:#{self.comment}", :status=> true) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index f8e6655d9..6736b1de2 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -409,6 +409,26 @@
      • <%= time_tag(ma.created_at).html_safe %>
      <% end %> + <% elsif ma.course_message.jour_type == 'HomeworkCommon' %> + <% else %>
      • From ac5a9c87acae384b920d9441ec439d6e8b821837 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 14:59:12 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E2=80=9C=E5=90=8C=E6=84=8F|=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E2=80=9D=E8=B0=83=E6=95=B4=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_apply_homework_course_message.html.erb | 27 ++++++++ .../_join_course_course_message.html.erb | 37 ++++++++++ app/views/users/_user_message_course.html.erb | 69 ++----------------- .../users/dealwith_apply_homework.js.erb | 12 +--- app/views/users/dealwith_apply_request.js.erb | 12 +--- public/stylesheets/new_user.css | 2 + 6 files changed, 72 insertions(+), 87 deletions(-) create mode 100644 app/views/users/_apply_homework_course_message.html.erb create mode 100644 app/views/users/_join_course_course_message.html.erb diff --git a/app/views/users/_apply_homework_course_message.html.erb b/app/views/users/_apply_homework_course_message.html.erb new file mode 100644 index 000000000..cf048bcd6 --- /dev/null +++ b/app/views/users/_apply_homework_course_message.html.erb @@ -0,0 +1,27 @@ +
      • +
      • + <%= link_to User.find(ma.apply_user_id).show_name, + user_path(User.find(ma.apply_user_id)), :class => "newsBlue homepageNewsPublisher" %> + ">申请引用作业: +
      • +
      • + <% content = ma.content.nil? ? '' : ':'+ ma.content.to_s %> + <%= link_to User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}", student_work_index_path(:homework => ma.course_message.id), :title => User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}",:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %> + + +
      • + +
      • + + <% if ma.apply_result == 0 || ma.apply_result.nil?%> + <%= link_to '同意',dealwith_apply_homework_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%> + | + <%= link_to '拒绝',dealwith_apply_homework_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%> + <% elsif ma.apply_result == 1%> + 您已经同意了该申请 + <% elsif ma.apply_result == 2%> + 您已经拒绝了该申请 + <%end %> + +
      • +
      • <%= time_tag(ma.created_at).html_safe %>
      • \ No newline at end of file diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb new file mode 100644 index 000000000..28675b7eb --- /dev/null +++ b/app/views/users/_join_course_course_message.html.erb @@ -0,0 +1,37 @@ +
      • +
      • + 系统提示 + ">您有了新的课程成员申请: +
      • +
      • + + <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id), + :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> + + + +
      • + +
      • + + <% if ma.status == 0 || ma.status.nil?%> + <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%> + | + <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%> + <% elsif ma.status == 1%> + 您已经同意了该申请 + <% elsif ma.status == 2%> + 您已经拒绝了该申请 + <%end %> + +
      • +
      • <%= time_tag(ma.created_at).html_safe %>
      • \ No newline at end of file diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 6736b1de2..d278c7d74 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -230,34 +230,8 @@
      <% end %> <% if ma.course_message_type == "HomeworkCommon" && ma.status == 5 %> -
        -
      • -
      • - <%= link_to User.find(ma.apply_user_id).show_name, - user_path(User.find(ma.apply_user_id)), :class => "newsBlue homepageNewsPublisher" %> - ">申请引用作业: -
      • -
      • - <% content = ma.content.nil? ? '' : ':'+ ma.content.to_s %> - <%= link_to User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}", student_work_index_path(:homework => ma.course_message.id), :title => User.find(ma.apply_user_id).show_name+"申请引用作业\""+"#{HomeworkCommon.find(ma.course_message_id).name}"+"\"#{content}",:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %> - - -
      • - -
      • - - <% if ma.apply_result == 0 || ma.apply_result.nil?%> - <%= link_to '同意',dealwith_apply_homework_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%> - | - <%= link_to '拒绝',dealwith_apply_homework_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%> - <% elsif ma.apply_result == 1%> - 您已经同意了该申请 - <% elsif ma.apply_result == 2%> - 您已经拒绝了该申请 - <%end %> - -
      • -
      • <%= time_tag(ma.created_at).html_safe %>
      • +
          + <%= render :partial => 'apply_homework_course_message', :locals => {:ma => ma} %>
        <% end %> <% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 %> @@ -574,43 +548,8 @@
      <% end %> <% if ma.course_message_type == "JoinCourseRequest" %> -
        -
      • -
      • - 系统提示 - ">您有了新的课程成员申请: -
      • -
      • - <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id), - :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> - - - -
      • - -
      • - - <% if ma.status == 0 || ma.status.nil?%> - <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%> - | - <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%> - <% elsif ma.status == 1%> - 您已经同意了该申请 - <% elsif ma.status == 2%> - 您已经拒绝了该申请 - <%end %> - -
      • -
      • <%= time_tag(ma.created_at).html_safe %>
      • +
          + <%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
        <% end %> <% if ma.course_message_type == "CourseRequestDealResult" %> diff --git a/app/views/users/dealwith_apply_homework.js.erb b/app/views/users/dealwith_apply_homework.js.erb index 0f6f1af61..5cfe83d58 100644 --- a/app/views/users/dealwith_apply_homework.js.erb +++ b/app/views/users/dealwith_apply_homework.js.erb @@ -1,11 +1 @@ -$("#deal_info_<%=@msg.id%>").html( - <% if @msg.apply_result == 0 || @msg.apply_result.nil?%> - <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>@msg.id),:remote=>'true'%> - '|' -<%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>@msg.id),:remote=>'true'%> -<% elsif @msg.apply_result == 1%> -'您已经同意了该申请' -<% elsif @msg.apply_result == 2%> -'您已经拒绝了该申请' -<%end %> -); \ No newline at end of file +$("#course_message_homework_<%=@msg.id %>").html('<%= escape_javascript(render :partial => 'users/apply_homework_course_message', :locals => {:ma => @msg}) %>'); \ No newline at end of file diff --git a/app/views/users/dealwith_apply_request.js.erb b/app/views/users/dealwith_apply_request.js.erb index e31c0be85..c71fd25cb 100644 --- a/app/views/users/dealwith_apply_request.js.erb +++ b/app/views/users/dealwith_apply_request.js.erb @@ -1,11 +1 @@ -$("#deal_info_<%=@msg.id%>").html( -<% if @msg.status == 0 || @msg.status.nil?%> -<%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>@msg.id),:remote=>'true'%> -'|' -<%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>@msg.id),:remote=>'true'%> -<% elsif @msg.status == 1%> - '您已经同意了该申请' -<% elsif @msg.status == 2%> - '您已经拒绝了该申请' -<%end %> -); \ No newline at end of file +$("#course_message_join_<%=@msg.id %>").html('<%= escape_javascript(render :partial => 'users/join_course_course_message', :locals => {:ma => @msg}) %>'); \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 8a49df253..2d8b1c2b8 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -620,6 +620,8 @@ a.homepageMenuControl {float:left; width:180px;} .homepageSystenMessageContent {width:281px; max-width:291px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; } .homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContentWarn2 {width:60px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} a.homepageWhite {color:#ffffff;} From d4c1f27533b2c45c9cd3f45b21f34c3c2bc0648c Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 15:29:20 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E7=A7=81=E6=9C=89=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=88=86=E4=BA=AB=E6=97=B6=EF=BC=8C=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E8=A6=81=E6=B1=82=E5=86=99=E8=AF=B7=E6=B1=82=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E7=9A=84=E8=AF=B4=E6=98=8E=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_apply_homework.html.erb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/views/users/_apply_homework.html.erb b/app/views/users/_apply_homework.html.erb index cd906fc8f..ddfac69cc 100644 --- a/app/views/users/_apply_homework.html.erb +++ b/app/views/users/_apply_homework.html.erb @@ -1,16 +1,28 @@
        <%= form_tag(apply_for_homework_user_path(:id=>User.current.id,:homework_id=>homework.id), :multipart => true,:remote => true,:name=>"apply_for_homework_form",:id=>'apply_for_homework_form') do %> -

        请求分享

        -

        - 请求说明(可选): - +

        申请分享

        +

        + 申请说明(必选): +

        + <% end %>
        -
        \ No newline at end of file +
    + \ No newline at end of file From 582c305a4709822009a844562f10d965cfc8dcfa Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 16:29:39 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E8=BF=87=E7=9A=84=E4=BD=9C=E4=B8=9A=E5=9C=A8=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=90=8E=E4=B8=8D=E5=BA=94=E8=AF=A5=E5=9C=A8?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=A2=98=E5=BA=93=E4=B8=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 35 +++++++++++++++++++---------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0440c0c80..60d9bb67c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -634,18 +634,27 @@ class UsersController < ApplicationController course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")" @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id in #{course_ids}").order("#{@order} #{@b_sort}") elsif params[:type] == "3" #申请题库 - #apply_homeworks = ApplyHomework.where("user_id = ?",@user.id) + none_visible_course = Course.where("is_delete = 1") + none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")" + #apply_homeworks = ApplyHomework.where("user_id = ?",@user.id).order('created_at desc') #homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")" - #@homeworks = HomeworkCommon.where("id in #{homework_ids}") - sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} order by ah.created_at desc" + #@homeworks = HomeworkCommon.where("id in #{homework_ids} and course_id not in #{none_visible_course_ids}") + + sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} and homework_commons.course_id not in #{none_visible_course_ids} order by ah.created_at desc" @homeworks = HomeworkCommon.find_by_sql(sql) end - if params[:property] && params[:property] == "1" - @homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}") - elsif params[:property] && params[:property] == "2" - @homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}") - elsif params[:property] && params[:property] == "3" - @homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}") + if params[:property] + all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")" + if params[:property] == "1" + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1") + #@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}") + elsif params[:property] == "2" + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2") + #@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}") + elsif params[:property] == "3" + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3") + #@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}") + end end @type = params[:type] @property = params[:property] @@ -723,13 +732,15 @@ class UsersController < ApplicationController elsif params[:type] == "3" #申请题库 apply_homeworks = ApplyHomework.where("user_id = ?",@user.id) homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")" + none_visible_course = Course.where("is_delete = 1") + none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")" if @order == "course_name" - sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}" + sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where courses.is_delete = 0 and homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}" @homeworks = HomeworkCommon.find_by_sql(sql) elsif @order == "user_name" - @homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}") + @homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and course_id not in #{none_visible_course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}") else - @homeworks = HomeworkCommon.where("id in #{homework_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}") + @homeworks = HomeworkCommon.where("id in #{homework_ids} and (name like '%#{search}%') and course_id not in #{none_visible_course_ids} and homework_type in #{type_ids}").order("#{@order} #{@b_sort}") end end =begin From 8af04595193bdc634b367da6c6f0e1e6350eabd9 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 16:56:50 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=E4=B8=8D=E5=BA=94=E5=87=BA=E7=8E=B0=E5=B7=B2=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 60d9bb67c..8995a5aee 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1371,7 +1371,7 @@ class UsersController < ApplicationController shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" + user_course_ids = (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" project_types = "('Message','Issue','ProjectCreateInfo')" principal_types = "JournalsForMessage" From 565d5e3bcc90548a99c60bb4e18b5d4e3174f53a Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 12 May 2016 17:41:27 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E5=88=97=E8=A1=A8html=E4=BB=A3=E7=A0=81=E9=87=8D=E6=9E=84?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=BA=8F=E5=8F=B7=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_student_exercise.html.erb | 34 ++---- app/views/exercise/_student_table.html.erb | 1 + .../student_work/_evaluation_title.html.erb | 16 +-- .../_evaluation_un_title.html.erb | 20 ++- .../student_work/_evaluation_un_work.html.erb | 65 +++++----- .../student_work/_evaluation_work.html.erb | 115 ++++++++---------- public/stylesheets/courses.css | 16 ++- public/stylesheets/public.css | 4 +- 8 files changed, 130 insertions(+), 141 deletions(-) diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 3bcd6b83f..d7a1b85bb 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -50,29 +50,19 @@ }*/
      -
    • -
        -
      • - <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %> -
      • -
        -
      • -
          -
        • - <%=exercise.user.show_name %> -
        • -
        • - <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> -
        • -
        • - -- -
        • -
        -
      • -
        -
      +
    • 1
    • +
    • + <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(exercise.user)) %>
    • -
    • +
    • + <%=exercise.user.show_name %> +
    • + <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> +
    • +
    • + -- +
    • +
    • <% if exercise.created_at%> <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>  <% if @exercise.end_time <= exercise.created_at %> diff --git a/app/views/exercise/_student_table.html.erb b/app/views/exercise/_student_table.html.erb index 719667973..8957c5048 100644 --- a/app/views/exercise/_student_table.html.erb +++ b/app/views/exercise/_student_table.html.erb @@ -1,5 +1,6 @@
      • + 序号    姓名 学号 diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb index 2ef5ee9af..257fcb94a 100644 --- a/app/views/student_work/_evaluation_title.html.erb +++ b/app/views/student_work/_evaluation_title.html.erb @@ -1,13 +1,15 @@
          -
        • - 作品名称 +
        • 序号
        • +
        •  
        • +
        • + 作品名称 +
        • <% if @homework.homework_type != 3 %> - 姓名 - 学号 +
        • 姓名
        • +
        • 学号
        • <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> - 关联项目 +
        • 关联项目
        • <% end %> -
        • 时间 @@ -19,7 +21,7 @@
        • <% end%> -
        • +
        • 我的评分
        \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index aee833b70..08edeff91 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,21 +1,29 @@
          -
        • - 作品名称 +
        • 序号
        • +
        •  
        • +
        • + 作品名称 +
        • <% if @homework.homework_type != 3 %> - <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl" ,:remote => true%> +
        • + <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml18" ,:remote => true%> <% if @show_all && @order == "lastname"%> <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%> <% end%> +
        • +
        • - <%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%> + <%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml30" ,:remote => true%> <% if @show_all && @order == "student_id"%> <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%> <% end%> +
        • <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> - 关联项目 +
        • + 关联项目 +
        • <% end %> -
        • <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%> diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 8e1c16264..e9518df7a 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -1,44 +1,35 @@
            -
          • -
              -
            • - <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %> -
            • -
              -
            • - <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> -
              - <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> -
              +
            • 1
            • +
            • + <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %> +
            • +
              +
            • + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> +
              + <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> +
              +
            • + <% if @homework.homework_type != 3 %> +
            • + <%= student_work.user.show_name%>
            • -
            • - <% if @homework.homework_type != 3 %> -
                -
              • - <%= student_work.user.show_name%> -
              • -
              • "> - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
              • -
              - <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> -
                - <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> -
              • - <%= link_to( student_work.project.name, project_path(student_work.project.id))%> -
              • - <% else %> -
              • - <%= student_work.project.name %> -
              • - <% end %> -
              - <% end %> +
            • " onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;"> + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
            • -
              -
            -
          • + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> +
          • + <%= link_to( student_work.project.name, project_path(student_work.project.id))%> +
          • + <% else %> +
          • + <%= student_work.project.name %> +
          • + <% end %> + <% end %> +
  • <% if student_work.created_at && @homework.end_time%> <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index ad2ee56c3..51263e5ba 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -6,74 +6,63 @@ <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> <% is_my_work = pro && pro.student_work_id == student_work.id%> <% end %> -
  • -
      - <% if is_my_work%> -
    • - <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %> -
    • -
    • - <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> -
      - <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w230"%> -
      + + <% if is_my_work%> +
    • 1
    • +
    • + <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40", style: "display:block;") %> +
    • +
    • +
      + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%> +
      +
    • +
      + <% if @homework.homework_type != 3 %> +
    • + <%= student_work.user.show_name%>
    • -
    • - <% if @homework.homework_type != 3 %> -
        -
      • - <%= student_work.user.show_name%> -
      • -
      • "> - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
      • -
      - <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> -
        - <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> -
      • - <%= link_to( student_work.project.name, project_path(student_work.project.id))%> -
      • - <% else %> -
      • - <%= student_work.project.name %> -
      • - <% end %> -
      - <% end %> +
    • " onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;"> + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
    • - <% else%> -
    • - <%= image_tag(url_to_avatar(""),width:"40", height: "40") %> + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> +
    • + <%= link_to( student_work.project.name, project_path(student_work.project.id))%> +
    • + <% else %> +
    • + <%= student_work.project.name %> +
    • + <% end %> + <% end %> +
      + <% else%> +
    • 1
    • +
    • + <%= image_tag(url_to_avatar(""),width:"40", height: "40", style: "display:block;") %> +
    • +
    • +
      + <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%> +
      +
    • + <% if @homework.homework_type != 3 %> +
    • + 匿名
    • -
    • -
      - <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w230"%> -
      +
    • + --
    • -
    • - <% if @homework.homework_type != 3 %> -
        -
      • - 匿名 -
      • -
      • - -- -
      • -
      - <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> -
        -
      • - 匿名 -
      • -
      - <% end %> + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
    • + 匿名
    • - <% end%> + <% end %> + <% end%> -
    -
  • -
  • +
  • <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %> [迟交] @@ -89,7 +78,7 @@ <% end%> <% my_score = student_work_score(student_work,User.current) %> -
  • +
  • <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
  • diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b81a7a7b6..b8f32986f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -51,14 +51,18 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .hworkTip em {display:block; border-width:8px; position:absolute; bottom:4px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} .hworkTip span {display:block; border-width:8px; position:absolute; bottom:4px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;} .hworkList340 {width:335px; text-align:left; height:50px; line-height:50px;padding-left:5px;} -.hworkList80 {width:80px; text-align:center;} +.hworkList30 {width:30px; text-align:center;} .hworkList50 {width:50px; text-align:center;} +.hworkList60 {width:60px; text-align:center;} +.hworkList80 {width:80px; text-align:center;} .hworkList130 {width:130px; text-align:center;} +.hworkList160 {width:160px; text-align:center;} +.hworkList260 {width:260px; text-align:left;} .codeList{ float:right; font-size:12px; color:#484848; padding:0px 3px; width:714px; margin-bottom:10px; } -.hworkName {width:115px; float:left; line-height:18px;} +.hworkName {width:80px; float:left; line-height:18px;} .hworkName div{max-height: 40px;overflow: hidden;} -.hworkStName {width:60px; max-width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} -.hworkStID {width:80px; max-width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} +.hworkStName {width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;} +.hworkStID {width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;} .hworkDate {max-width:150px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:14px; line-height:14px; font-size:12px; color:#888888;} .hworkMenu {width:100px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-110px; font-size:12px; color:#888888; display:none; line-height:2; z-index:99;} a.hworkExport {background:url(../images/homepage_icon2.png) -10px -401px no-repeat; padding-left:23px;} @@ -79,12 +83,14 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .StudentName{display: table-cell;width: 115px;vertical-align: middle;text-align: left;height: 40px;} .width385{width: 385px;} .width505{width: 505px;} +.width130{width: 130px;} .width165{width: 165px;} .width180{width: 180px;} .width525{width: 525px;} .width285{width: 285px;} .width255{width: 255px;} .width530{width: 530px;} +.ml18 {margin-left:18px;} .mr95{margin-right: 95px;} .mr140 {margin-right: 140px;} .ml100{margin-left: 100px;} @@ -1223,7 +1229,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .ml7 {margin-left:7px;} .tac {text-align:center;} .proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;} -.hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} +.hworkPrName {width:160px; max-width:160px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} .relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} .captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 7345cad35..9b47490d3 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -87,6 +87,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml100{ margin-left:100px;} .ml110{ margin-left:110px;} .ml125 { margin-left:125px;} +.ml200 {margin-left:200px;} .ml320{ margin-left:320px;} .ml150 { margin-left:150px;} .mr-5 {margin-right:-5px;} @@ -144,7 +145,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w50 {width:50px;} .w60{ width:60px;} .w70{ width:70px;} -.w80{ width:80px;} +.w80{ width:80px !important;} .w90{ width:90px;} .w100{width: 100px;} .w125{width:125px;} @@ -154,6 +155,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w170{width:170px;} .w230{width:230px !important;} .w235{ width:235px !important;} +.w250{ width:250px !important;} .w280{ width:280px;} .w265{ width: 265px;} .w270{ width: 270px;} From 0f61994252038b66528a98ca5c4bcb512f2d6800 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 May 2016 17:49:07 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=BC=98=E7=A7=80=E6=8E=92=E8=A1=8C=E4=B8=AD?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=93=BE=E6=8E=A5=EF=BC=8C=E5=9C=A8=E6=89=93?= =?UTF-8?q?=E5=BC=80=E7=9A=84=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AE=9A=E4=BD=8D=E5=88=B0=E8=AF=A5=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E4=BD=9C=E5=93=81=E5=B9=B6=E9=BB=98=E8=AE=A4=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=AF=A5=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 +++- .../organizations/_org_course_homework.html.erb | 14 ++++++++++++-- .../student_work/_evaluation_un_work.html.erb | 1 + app/views/student_work/_student_work_list.html.erb | 2 +- app/views/users/_course_homework.html.erb | 4 ++-- app/views/users/_user_homework_detail.html.erb | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9b19b8c7c..bbf67f6a3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2997,9 +2997,11 @@ def homework_common_index_url_in_org(course_id) Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s end -def student_work_index_url_in_org(homework_id, is_focus = '') +def student_work_index_url_in_org(homework_id, is_focus = '', show_work_id = '') if is_focus != '' Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s + elsif show_work_id != '' + Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&show_work_id=" + show_work_id.to_s else Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s end diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 8a780ea78..b4ca46959 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -159,8 +159,18 @@ <% end %> <% student_works.each_with_index do |sw, i| %>
    - <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id), :alt => "学生头像" %> - + + <% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %> + <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id, '', sw.id), :alt => "学生头像" %> + + <% else %> + <%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %> + + <% end %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>

    分数:<%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分

    diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 965d126ee..ad7f12efa 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -1,4 +1,5 @@ +
      • diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index ca76b0f2a..66e3a4818 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -49,7 +49,6 @@
        <% end%> +<% end%> From 979598f334c042f434493708bb3afdd93845535a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 13 May 2016 11:06:47 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=97=AE=E7=AD=94?= =?UTF-8?q?=E5=8C=BA=E5=B8=96=E5=AD=90=E7=9A=84=E5=8F=91=E9=80=81=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E8=BF=9E=E7=BB=AD=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_new.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 3deb04f6c..df61d2b9c 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -2,6 +2,7 @@ <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> <% end %>