From 035e47510f2c8e0ebb00371162b789d20568535b Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 25 Jan 2016 10:37:32 +0800 Subject: [PATCH 01/25] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/images/close.png | Bin 1637 -> 1417 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/stylesheets/images/close.png b/public/stylesheets/images/close.png index 301ba5e85e4af660ec48808a6b3c37aac00e2f78..1246850354ebc0fbdd531a56241f67e5f5e94b49 100644 GIT binary patch delta 782 zcmaFL)5$%-lTm4+SD&h}ZnA-)p@Ny2o}r1UnVF%Ef{}rtk-h;CndusuSecqx8JTbV ztHj7{rl1j?nU|7ZUaUD;gGnaF!qLdg&C%S|$<4&X(9qS?!q~*z(b>Y$#M0H!$ime^ zNueUQz}MHxB|o_|H#M)s)5TT^D595=nPLUi>xN73w#f$^`Wi(^Q|tv6H8dxr#y9Di^5eQ(;b^ohDTsogxy0!r$Nx3^x+t#5vC z$hTWz#hc?^LcSMNGALO%HN3d_J%?m-K$yB4CxZzYcpp*z+*Ur2A6u)K`I@ZdUI3TO9t>FX6pXMN;rfHGlcQYbp*Z zi|&MG?)v2XPUgg}SIfk=rro;w!>r}R1WCpl8z-L(E1Z*d<GdVq8uiU*3P}vcno-a}V^wt^cik+cu zZx*-39R0cazS%S;Q~%r9W|vuSlrk=pbg0|KWzUwfW5q`c7Y(QL2JYbn?`_}3=&>fP zcb+kS-h#3d3}wDfJ)L3a*UW6>2u?cLx_id*;wPnB?#M*`YS7uYgR53I%Y=2e94mJ@ zi|5Au;VLGA&op>+j#PZt7ufp$lwSLu?!`Pl1|aZs^>bP0l+XkK DE;dRD delta 1026 zcmeC=e#$e!lTl%!SD&hZZnA-yfr6Q#o}sacxw*NHf{}rtfxdx}zM+w>p}Cc@k(GhL z#=lC8oTdulnRzMs<;9b=m}Fwy98C-?Oz*Q}aqZU2K(rB6=yADOOOurnvM@Uc_Vov%m9(`EO1SPn6vJd`)|f z?75E_KMy=V^jYrQ_2;$w&i~%C#6v}i#fejg;d6t;4Awe^`v&#-jr>0(^CvL3TsWT3 zP~1{5hw=A;Y&%Ci#V_mMMr2(1!D++XcavLK#MQ7qp6wlj)}#ALOc$7A9~jTSAW|Sc zLGZu)ig~&Zmi%v+c`i4hO(OozAvY`aEeFZj!8XaD0>8VCDQ|$!z z#?==V7hj%x{`vRjgAcgpUFWG?m>sja*KP6Z607nMt*bF+vr9K!2l7oOdaRl1wbXh3 z`R&#UnNvDu9C}&kwm0tmjht=nT&+&WM4Xjw-@d)N)#>4Z*IzF&?e3Neb>*zLTzfNT zo~2BmtjaX6rEkPj4h`w7HVC z)l09Lr$bC=6=&yzL-J0+@2+KS?Yo;-Uw_7|!(mQP#k3FKJaxp1-@knuIGN;h(8G#p~&sh8xvsy{q0_EwFgwq9oV<-15G7 zK=5L_;MG?@Wte0=tysz~G9&qs_J$VzL;Gh}RaFUfx}0*FeLrt|wTW+d_1-x4Z97gz zxhc8Vyy0BUJnguJ+CB#VU#W?F``GF%?AZiU8hGU1&RP6NcwSG`wE!8@$vnI5Z#uEa z?U(=fVnUxn!#mE(hO{)JGo{@JoKH6xtFY$?@4CHLvgFhR=NN^+7>0EZCd=g>)L+ni g_m;#n=KZV^47PC}EAA{WlVkt_Pgg&ebxsLQ05_GaYXATM From b6e13340e56a09dfd4060760df1b744379466645 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 15:33:50 +0800 Subject: [PATCH 02/25] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80?= =?UTF-8?q?=E7=9A=84=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 4 ++- .../users/_user_journalsformessage.html.erb | 27 +++++++++++++++++-- app/views/words/create_reply.js.erb | 6 +---- app/views/words/destroy.js.erb | 12 ++++++--- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index d24427a9d..699a5e8ca 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -73,7 +73,6 @@ class WordsController < ApplicationController # render 'test/index' # } format.js { - @reply_type = params[:reply_type] @user_activity_id = params[:user_activity_id] @activity = JournalsForMessage.find(parent_id) @is_activity = params[:is_activity] @@ -95,6 +94,9 @@ class WordsController < ApplicationController @user = User.find(@journal_destroyed.jour_id) @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @is_user = true + @user_activity_id = params[:user_activity_id] if params[:user_activity_id] + @is_activity = params[:is_activity].to_i if params[:is_activity] + @activity = @journal_destroyed.parent if @journal_destroyed.parent elsif @journal_destroyed.jour_type == 'HomeworkCommon' @homework = HomeworkCommon.find @journal_destroyed.jour_id if params[:user_activity_id] diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index e30fd1824..d7247621a 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -39,6 +39,22 @@ 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
+ <% if activity.user == User.current || User.current.admin?%> +
+
    +
  • +
      +
    • + <%= link_to(l(:label_bid_respond_delete), + {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', + :class => "postOptionLink", :title => l(:button_delete)) %> +
    • +
    +
  • +
+
+ <% end%>
@@ -71,7 +87,7 @@
    <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> <% replies_all_i = replies_all_i + 1 %> -
  • +
  • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
    @@ -90,6 +106,14 @@ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> +
    <%= comment.notes.html_safe %> @@ -112,7 +136,6 @@ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> - <%= hidden_field_tag 'reply_type',params[:reply_type],:value =>'user' %> <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
    diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index d4d9a2cd7..d9e00a112 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,10 +1,6 @@ <% if @save_succ %> <% if @user_activity_id %> - <% if @reply_type == 'user' %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); - <% else %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); - <% end %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); <% else %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 6a56249a3..6d0055718 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -2,13 +2,19 @@ alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> <% if @is_user%> - var destroyedItem = $('#<%=@journal_destroyed.id%>'); + <% if @activity %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); + init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + <% else %> + $("#user_activity_<%= @user_activity_id%>").hide(); + <% end %> + /*var destroyedItem = $('#<%#=@journal_destroyed.id%>'); destroyedItem.fadeOut(600,function(){ destroyedItem.remove(); }); - <% if @jours_count && @jours_count == 0 %> + <%# if @jours_count && @jours_count == 0 %> $("#user_jour_list").css("padding","0px"); - <% end %> + <%# end %>*/ <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); From 184e0ee6898bd1a034f93cf711acc926eb6d8e93 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 16:50:34 +0800 Subject: [PATCH 03/25] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E3=80=81=E8=AF=BE=E7=A8=8B=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E3=80=81=E4=BD=9C=E4=B8=9A=E4=B8=AA=E6=95=B0=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 1 + lib/redmine/menu_manager.rb | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 68386de44..c7b4dc615 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,6 +29,7 @@ class AdminController < ApplicationController def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? + @lastest_login_user_count = User.all.count end def projects diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index a2d2214b6..f9ce21987 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -1,3 +1,4 @@ +#coding=utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -180,8 +181,20 @@ module Redmine end def render_single_menu_node(item, caption, url, selected) - - link_to(h(caption), url, item.html_options(:selected => selected)) + title = h(caption) + case title + when '作业' + title = h(caption) + "(#{HomeworkCommon.all.count})" + when '组织列表' + title = h(caption) + "(#{Organization.all.count})" + when '项目列表' + title = h(caption) + "(#{Project.all.count})" + when '课程列表' + title = h(caption) + "(#{Course.all.count})" + when '用户列表' + title = h(caption) + "(#{User.all.count})" + end + link_to(title, url, item.html_options(:selected => selected)) end From 945d0a933f527337764393a6f0959071dffa1dfa Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 17:34:04 +0800 Subject: [PATCH 04/25] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=B8=BA=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 1 - app/controllers/users_controller.rb | 6 ++++++ db/schema.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c7b4dc615..68386de44 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,7 +29,6 @@ class AdminController < ApplicationController def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? - @lastest_login_user_count = User.all.count end def projects diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b155e9f90..8794808a3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1633,6 +1633,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end elsif params[:send_ids].present? @@ -1668,6 +1671,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end end diff --git a/db/schema.rb b/db/schema.rb index b2c74a96c..8af34d878 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1371,6 +1371,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 + t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end From 821ade7985401ba8dc43cb40d2b74b5612e02654 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 26 Jan 2016 11:00:24 +0800 Subject: [PATCH 05/25] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E8=AF=BE=E7=A8=8B=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_project_info.html.erb | 4 +- .../_programing_work_show.html.erb | 279 +++++++++--------- app/views/student_work/_show.html.erb | 277 ++++++++--------- .../_work_attachments_status.html.erb | 2 +- 4 files changed, 282 insertions(+), 280 deletions(-) diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index 60fc6f96d..98670dba0 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -9,13 +9,13 @@ <%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
    -
    <%= @course.is_public == 0 ? "私有课程" : "公开课程" %> +
    ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %> <% if @course.id == 370 %> 精品课程 <% end %>
    -ID:<%= @course.id%> +加入课程
    -
  • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> -
  • -
  • - <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> -
  • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> - -
  • - <%= render :partial => 'student_work_praise' %> -
  • - <% end%> -
    - -
  • - 编程代码: -
    -
    -
    -
    -
  • - -
  • - - 测试结果: - -
    - <% work.student_work_tests.each_with_index do |test, index| %> -
    -

    - 第<%= work.student_work_tests.count - index%>次测试 -

    - - <%= test.created_at.to_s(:db) %> - -
    -
    - <% if test.status.to_i == -2 %> -
    - <%= test.results.first %> -
    - <% else %> -
    -
      - <% test.results.each_with_index do |x, i| %> -
    • - 测试<%=i+1%> - <% if x["status"].to_i != 0 %> - 测试错误! - 您的输出: - <%=x["result"]%> - 正确输出: - <%=x["output"]%> -
      - <% else %> - 测试正确! -
      - <% end %> -
    • - <% end %> -
    -
    - <% end %> - <% end %> -
    -
  • - -
  • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> - -
    - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
    - <% end%> -
    -
  • -
- -
- <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
-
- -
- <%student_work_scores.each do |student_score|%> -
- <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
- <% end%> -
- - 收起 -
- - +
+
+
    +
  • + 上交时间: + <%=format_time work.created_at %> +
  • + + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> + +
  • + <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> +
  • +
  • + <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> +
  • + <% end%> + <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> + +
  • + <%= render :partial => 'student_work_praise' %> +
  • + <% end%> +
    + +
  • + 编程代码: +
    +
    +
    +
    +
  • + +
  • + + 测试结果: + +
    + <% work.student_work_tests.each_with_index do |test, index| %> +
    +

    + 第<%= work.student_work_tests.count - index%>次测试 +

    + + <%= test.created_at.to_s(:db) %> + +
    +
    + <% if test.status.to_i == -2 %> +
    + <%= test.results.first %> +
    + <% else %> +
    +
      + <% test.results.each_with_index do |x, i| %> +
    • + 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
      + <% else %> + 测试正确! +
      + <% end %> +
    • + <% end %> +
    +
    + <% end %> + <% end %> +
    +
  • + +
  • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> + +
    + <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> +
    + <% end%> +
    +
  • +
+ +
+ <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
+
+ +
+ <%student_work_scores.each do |student_score|%> +
+ <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> +
+ <% end%> +
+
+ + 收起 +
+
+ diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 662ddece4..d66a30718 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,139 +1,140 @@ -
-
- <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> - <% if @homework.homework_type != 3 %> - <% is_my_work = work.user == User.current%> - <% else %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% is_my_work = pro && pro.student_work_id == work.id%> - <% end %> -
    -
  • - 上交时间: - <%=format_time work.created_at %> -
  • - - <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> - -
  • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %> -
  • -
  • - <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%> -
  • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %> - -
  • - <%= render :partial => 'student_work_praise' %> -
  • - <% end%> -
    - - - - <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> -
    -
  • - 参与人员: - <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> - <% members = work.student_work_projects.where("is_leader = 0") %> - <% members.each do |member| if !members.empty? %> - 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> - <% end %> - <% end %> -
  • - <% if @homework.homework_detail_group.base_on_project == 1 %> -
  • - 关联项目: - <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - <% else %> - <%=work.project.name %> - <% end %> - <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - (综合评分:<%=work.project.project_score.score.to_i %>) -
  • - <% end %> - <% end%> - -
  • - 内容: -
    - <%= text_format(work.description) if work.description%> -
    -
    -
  • -
  • - 附件: - <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> - <% if com_attachments.empty?%> - 尚未提交附件 - <% else%> -
    - <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %> -
    - <% end%> -
    -
  • -
  • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%> - -
    - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
    - <% end%> -
    -
  • -
- -
- <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
-
- -
- <%student_work_scores.each do |student_score|%> -
- <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
- <% end%> -
- - 收起 -
-
- \ No newline at end of file diff --git a/app/views/student_work/_work_attachments_status.html.erb b/app/views/student_work/_work_attachments_status.html.erb index c4b2a795e..6a8591197 100644 --- a/app/views/student_work/_work_attachments_status.html.erb +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -1,7 +1,7 @@ <% attachments.each_with_index do |attachment,i| %>
- + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> From 520811fdc79fbae2b94644ee016322774bb694a2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 11:17:55 +0800 Subject: [PATCH 06/25] =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8C=89=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 18 ++++++----------- app/controllers/words_controller.rb | 1 + app/models/journals_for_message.rb | 2 +- ...160126024429_update_journal_for_message.rb | 20 +++++++++++++++++++ db/schema.rb | 2 +- 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20160126024429_update_journal_for_message.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8794808a3..cb8afd3a1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -755,23 +755,17 @@ class UsersController < ApplicationController if params[:type].present? case params[:type] when "public" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC') when "private" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC') else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 699a5e8ca..351be4e64 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -62,6 +62,7 @@ class WordsController < ApplicationController update_forge_activity('JournalsForMessage',parent_id) update_org_activity('JournalsForMessage',parent_id) update_principal_activity('JournalsForMessage',parent_id) + (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) end respond_to do |format| # format.html { diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 9e0ce2dd2..cdcf9d19e 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :reset_counters! - after_update :update_ativity + #after_update :update_activity after_destroy :reset_counters! after_save :be_user_score after_destroy :down_user_score diff --git a/db/migrate/20160126024429_update_journal_for_message.rb b/db/migrate/20160126024429_update_journal_for_message.rb new file mode 100644 index 000000000..f6b848c79 --- /dev/null +++ b/db/migrate/20160126024429_update_journal_for_message.rb @@ -0,0 +1,20 @@ +class UpdateJournalForMessage < ActiveRecord::Migration + def up + journals = JournalsForMessage.where("m_parent_id is null and jour_type ='Principal' ") + count = journals.count / 30 + 2 + transaction do + for i in 1 ... count do i + journals.page(i).per(30).each do |jour| + act = UserActivity.where("act_type='JournalsForMessage' and act_id = #{jour.id}").first + unless act.nil? + jour.updated_on = act.updated_at + jour.save + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8af34d878..736ce0f4e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160122143138) do +ActiveRecord::Schema.define(:version => 20160126024429) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 19003f27fca2dcbd89d4c79ad829bbbbc9205882 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 15:05:45 +0800 Subject: [PATCH 07/25] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0is=5F?= =?UTF-8?q?copy=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 5 ++++- db/migrate/20160126031857_add_is_copy_to_course.rb | 5 +++++ db/schema.rb | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160126031857_add_is_copy_to_course.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 43a49c7d9..0697f0d0a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -441,7 +441,10 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if params[:copy_course] copy_course = Course.find params[:copy_course].to_i - @course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource) + @course.is_copy = 1 + @course.open_student = copy_course.open_student + @course.publish_resource = copy_course.publish_resource + @course.save if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| diff --git a/db/migrate/20160126031857_add_is_copy_to_course.rb b/db/migrate/20160126031857_add_is_copy_to_course.rb new file mode 100644 index 000000000..f60914bbd --- /dev/null +++ b/db/migrate/20160126031857_add_is_copy_to_course.rb @@ -0,0 +1,5 @@ +class AddIsCopyToCourse < ActiveRecord::Migration + def change + add_column :courses, :is_copy, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 736ce0f4e..42a5ea702 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160126024429) do +ActiveRecord::Schema.define(:version => 20160126031857) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -501,6 +501,7 @@ ActiveRecord::Schema.define(:version => 20160126024429) do t.string "end_term" t.integer "is_excellent", :default => 0 t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 end create_table "custom_fields", :force => true do |t| From af7ca36c92ad8f8bcbf0931e8d4293d292b05243 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 15:59:39 +0800 Subject: [PATCH 08/25] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=96=E9=80=80=E5=87=BA=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 9 ++++----- app/views/layouts/_project_info.html.erb | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4e90fc106..f326f2099 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -697,17 +697,16 @@ module CoursesHelper def join_in_course_header(course, user, options=[]) if user.logged? joined = course.members.map{|member| member.user_id}.include? user.id - text = joined ? ("".html_safe + l(:label_course_exit_student)) : ("".html_safe + l(:label_course_join_student)) + text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link = "#{l(:label_course_join_student)}" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) + link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) else - link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "#{l(:label_course_exit_student)}".html_safe + link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") end else - link = "#{l(:label_course_join_student)}" + - "#{l(:label_course_exit_student)}" + link = "#{l(:label_course_join_student)}" end link.html_safe end diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index d4b5b20fe..db9e24a36 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -15,7 +15,10 @@ <% end %>
-加入课程 + <% unless is_teacher %> + +
<%= join_in_course_header(@course, User.current) %>
+ <% end %>
+<% end %> \ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index bc960154e..5c91a37fc 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -36,6 +36,9 @@
作业
+
+ <%= render :partial => 'homework_search_form',:locals => {:course=>@course} %> +
@@ -50,8 +53,8 @@ <% end%>
<% end%> - <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %> +
diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 36f823a9a..28544fbf3 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -14,6 +14,7 @@ .homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-container {float: left;} +
<% homework_commons.each do |homework_common|%>