From b8dc444cc78e6dcde5b5d3befffa873062f650e7 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 23 Aug 2016 10:17:08 +0800 Subject: [PATCH 01/74] =?UTF-8?q?=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=92=8C=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=9C=A8=E9=A2=98?= =?UTF-8?q?=E5=BA=93=E5=8F=91=E9=80=81=E5=90=8E=EF=BC=8C=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=B9=B6=E8=BF=9B=E8=A1=8C=E5=8F=91=E5=B8=83=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BA=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E5=A4=8D=E5=88=B6=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=87=8C=EF=BC=8C=E5=8B=BE=E9=80=89=E2=80=9C?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E2=80=9D=EF=BC=8C=E5=90=8C=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对应方法:在作业的发布时间点(不用考虑作业是通过何种途径生成的),除了发布作业外,应该为该作业自动创建完整的作品列表(分组作业除外) --- app/controllers/homework_common_controller.rb | 6 ++++++ app/controllers/users_controller.rb | 19 ++----------------- app/helpers/application_helper.rb | 17 +++++++++++++++++ lib/tasks/homework_publishtime.rake | 16 ++++++++++++++++ 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 2f50c8105..6704f7401 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -94,8 +94,10 @@ class HomeworkCommonController < ApplicationController end end + status = false if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0 homework_detail_manual.comment_status = 1 + status = true end eval_start = homework_detail_manual.evaluation_start if eval_start.nil? || (eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1) @@ -145,6 +147,10 @@ class HomeworkCommonController < ApplicationController @homework_detail_programing.save if @homework_detail_programing @homework_detail_group.save if @homework_detail_group + if @homework.homework_type != 3 && homework_detail_manual.comment_status == 1 && status + create_works_list @homework + end + if params[:is_manage] == "1" redirect_to manage_or_receive_homeworks_user_path(User.current.id) elsif params[:is_manage] == "2" diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e929153ad..eb7ee4c03 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1115,23 +1115,8 @@ class UsersController < ApplicationController homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - if homework.homework_type != 3 - students = homework.course.student - if !homework.course.nil? && !students.empty? - name = homework.name - name_str = name + "的作品提交" - str = "" - students.each do |student| - if str != "" - str += "," - end - str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')" - end - #('#{name}的作品提交',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}') - sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str - #StudentWork.create(:name => "#{name}的作品提交", :homework_common_id => homework.id, :user_id => student.student_id) - ActiveRecord::Base.connection.execute sql - end + if homework.homework_type != 3 && homework_detail_manual.comment_status == 1 + create_works_list homework end if params[:quotes] && !params[:quotes].blank? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index da66f249b..304194e6e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3436,3 +3436,20 @@ def course_syllabus_option user = User.current end type end + +def create_works_list homework + students = homework.course.student + if !homework.course.nil? && !students.empty? + name = homework.name + name_str = name + "的作品提交" + str = "" + students.each do |student| + if str != "" + str += "," + end + str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')" + end + sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str + ActiveRecord::Base.connection.execute sql + end +end diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index 5eaeb37cb..2f999384c 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -8,6 +8,22 @@ namespace :homework_publishtime do homework_detail_manual = homework.homework_detail_manual if homework_detail_manual.comment_status == 0 homework_detail_manual.update_column('comment_status', 1) + if homework.homework_type != 3 + students = homework.course.student + if !homework.course.nil? && !students.empty? + name = homework.name + name_str = name + "的作品提交" + str = "" + students.each do |student| + if str != "" + str += "," + end + str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')" + end + sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str + ActiveRecord::Base.connection.execute sql + end + end course = homework.course course.members.each do |m| homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => nil) From 461912bec260ec66978308d7cf18a70b4dfb9369 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 23 Aug 2016 10:50:51 +0800 Subject: [PATCH 02/74] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=8C=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=EF=BC=8C=E9=87=8D=E8=AF=95=E5=90=8E=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=8F=90=E4=BA=A4=EF=BC=8C=E6=8F=90=E4=BA=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=99=84=E4=BB=B6=E4=B8=8D=E6=98=BE=E7=A4=BA=E4=BD=86?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=BC=B9=E6=A1=86=E4=B8=AD=E8=A2=AB=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84=E9=99=84=E4=BB=B6=E5=8F=88=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 722845ef7..9ce0f76f7 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -793,6 +793,7 @@ class StudentWorkController < ApplicationController end elsif @homework.homework_type == 1 @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil) + @work.attachments.destroy_all end @student_work = StudentWork.new respond_to do |format| From 74b15229fb8c7b2359aca672b5a98df6fe11b670 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 23 Aug 2016 17:15:51 +0800 Subject: [PATCH 03/74] =?UTF-8?q?at=E6=89=80=E6=9C=89=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/at/show.json.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb index 6e2a244e4..767c23835 100644 --- a/app/views/at/show.json.erb +++ b/app/views/at/show.json.erb @@ -1,10 +1,10 @@ [ <% @users && @users.each_with_index do |person,index| %> <% if index == 0 %> - {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"} + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "", "searchKey": ""} <%= index != @users.size-1 ? ',' : '' %> <% else %> - {"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} <%= index != @users.size-1 ? ',' : '' %> <% end %> <% end %> From 57ecffc130a637456d5a0df4e0bd6eddc808d7ab Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 24 Aug 2016 10:28:09 +0800 Subject: [PATCH 04/74] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_user_courses.html.erb | 6 ++++++ app/views/layouts/new_base_user.html.erb | 2 +- app/views/users/_courses_list.html.erb | 5 +++-- public/images/syllabus/sy_icons_star.png | Bin 0 -> 18508 bytes public/stylesheets/syllabus.css | 5 +++++ 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 public/images/syllabus/sy_icons_star.png diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index b3b21547e..485ef72ff 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -45,6 +45,12 @@ <%= link_to "论坛",course_boards_path(course), :class => 'user_navmore_li fl',:target => '_blank' %> <%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'user_navmore_add fl', :title => '发布帖子',:target => '_blank' %> + +
  • + <%= link_to "取消收藏", :class => 'user_navmore_li',:target => '_blank' %> +
    +
  • + <% if !course.syllabus.nil? %>
  • <%= link_to "所属课程",syllabus_path(course.syllabus_id), :class => 'user_navmore_li',:target => '_blank' %> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 50e788e2f..d91939c4b 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -157,7 +157,7 @@ <% if !unvisiable %>
    • - <%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> + <%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> <% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> <% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
      diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index 83b9ab56b..42c92b1a0 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -3,11 +3,12 @@
    • <% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %> " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>"> - + +

      <%=course.name %>

      - + <%= course.is_public == 0 ? '私有' : '公开' %>
      diff --git a/public/images/syllabus/sy_icons_star.png b/public/images/syllabus/sy_icons_star.png new file mode 100644 index 0000000000000000000000000000000000000000..2256346d960cb3cae2ebff90ea29447b23fce255 GIT binary patch literal 18508 zcmeI3c{J4h_rO1v3S~)3QJF@1T8vqY!89hjQMPPRi7{rF%$6BzrO~Q9mKJ19C@Fcg zl5CZtgeVez}u zN=XU;0BLiQu`T$n06vitGr`w3>>CRBCdnZ=a{*xXyz!?95TCdZ0HiGGMn*O^UThwl z>&524%#Dm-93M7~&Y%K7Kx2}fzti#I1;mzNs;r}7!@#9jMhE~`&5|gWb54~z29Wp5 z$?M-e5Gv)UFn?|$$)R*_ofIi4^i|5rJWqoop_{`Tw(7i9Y0kK|JE*^}@AK2o1zm|< zqg8>`vi!O7D~@)iZU=O24-oJTDv{Qt())#c(fOoSahP0Z#cj_ScL88PEHEILm$PnE z?qI*m+zV_5@idNYuJ}70ObpT9J?zXQosoSUrH}TP~`96L50~u~io>xecUb>BBX|OR`1y z&et(!qWr=cfM0}Dl&roRz>hOje+a;IL;<6v^D4z)7Gf!=+TzwsSI&Vvk_b>z5nUO( zp;l8NFZz*^|NDW~SIb`AW?V8PE3T5GNw&iiV-r;8k-Eezs^$QI(n!s%FFNa@x;oom zcG9{S{U7e8e(@e)!->n@wR|b~Q&b#~v#RcIbnWP<7vq$P|`lal^p0S8kHLtLjwyMuR^3LgSo(uNi5ZhT?k^2w9ked7x<2b#1*0VRt%zutj8m;2pdUPl_)}^2Q9#ZUiwPVC zfaAp@k@{;yfXdkPHUKDiy>RQf6N(o1BmlrTC1iDu!K^vA6tYTW5^pUjC{Yw8&otJb zv%G{LXE?K+zgX(@!We@^_9gfR@oPC^N-1;WU&>v*h1QYoYL(v_(!)`l>9#QW_QHaL zlHvyC67$H*@S$_vBO2gU5{hvV;&3tvdyJnB>kd`e2)|qIlP;QRxc#ULN%cL#M?p7y ztNy2`rg9kO$mo#*GxUj&%Nxa>i2CZ^IH#g?i>cno+ai zwJ#6YeI$ayuR+Vu{(MH>`sX1Nx5G|KE6Ns7I-Il|Bef_?oV5MsE0-jb`z4l(hVke1 zN^ILNcbl;{D$2~s!pZ2ITCeI=`Fx2@lKb|fZ~p;5e$M);T9EumX@EQaQk0Wv){3{w zmM%+H+xCadJlEr-Lu{TJ;Lm-$(+ z*rT~ovQgH@KHtC7o~wYr8~VyZGIhCa`U&~-Erej;%`6n|>7 zIWxu225EOFa~{?=Uac}=fl);|BCYOGJl&H%?1k*+sj4h-TOZH z&yhYTy|0YqzH*WGqMeH}7UnKO##x-5@i;cF+#dB5qa5dXQuZXj_x{d@4$6fR~LAGw*3VM*$dkocb_$NxMI_mDfwibGB{T@1dc-5AtZ z)ac&l)3>0nr?KCclcb-do-~AK;)i`D^Ktnb^AF@V`BuLnKBn{pc1sRD7?SCJUSl@I z{E#-J_@=+UzeYtHg_XcXEn=W`C<70pD6hRw((`Ht_P;zgx56v`XsK6Pjd|K1c`M!? z@@&%zP$bf_*o)n>urH|1-UPBc9n+Lvntr#vXjSD2?|52%&DF=ehY!ouo3k3S?)OIM z)+Kr;lZ&1eG>wKIIAfA{cYPQxtSqK6W>>|G7|WR9tdovJ$3Vv+$ER85^;>(?dzkf` z7&gkA66Pe}6DqEsyO?mX)GvYAqVP%~a#iiBAv;zhx_7i!syDuOW}ogy@<+9g%#YPe z9xj$&QookBc9##&_n{wyQ_z$C5_>1JH1kgPCQoJ0)7+#%Eyc4NqAKKL{bCjEm>EYh zSf_$2qC1q{=GR_(Jd~DjGokt7Gv<@$5B2WuzVO*nBSHDT%N@ObgAW74POo-6Y)i^W z$hbWi)rH*Vx6OIm=fb7dR}xnw*Q1!_O{H5}3oCZI;fZ?GPgUJw#Ct^1Q$eQ=6`d`D zx9AnA2Gf&y@i_4_v$SS} z&$u}gIfppkaE_$3vx?7gc8TJ9J7!t?y8Dpe}c1?bJQ-K11IHUFR$y^2Q#!mF0}5*U|BAi_kMrE0c(?@)bP}e zmvZyg6OMHzIYxifdA@eH(I>Bi)~3GqG$pNV*90D2bnJ%eprxa6{fn&XXFHxDbWbFn zNKCVprpH`e^Awf4GS`~6X3cTw_P|c&1Lfm~9t^juj&KK?<}(gh)TCXt&9;$QV1Ych zCSc3LEdhC?Lel0Znk}?1Z$?yS?_IE~Fe=9;FXu`_UV!tvR(P?=%>}Aqc8dNQXcyaj zj{y2W?d}S%ipw!$Hm{s)9o}ybYK+{&kiMw=F1$n8mAU=}?{v`ip@_<>l@BV#w8&b0TOMA|YI=Vfm-aCzX^%^VQ3{W%9gl2xkC~?q`)<`_+sBIL>ep#dl9Q~~={<>S4ji@^jq`Td=u+ruRGqv|k@waj*LC>*;ES$E zmw^J#2l%jilUnYEi+b65X2G1Xm!!Y8uzRS(6@8ls*}M;yJ!@~DJU)zs!zQNiy!GG);{jn#mNqaWwhtAi zrGZ0GP&jRvwyp+ROIsVOtq#MW&{{~8CQ=iHz-Z#JC_EMe`}%+rrNB=F9}gPd*4XrG zI8f4qd+~T2JQC^e@2}ynsloQ~M51+db&)6x5`#g2GZ5TB7LOc&U~yF^oqY3SOyyF1 z=o}uM&4P{lCA+hId3td8c%bi(uX!;!-vhC@U)g~akpW~560Lzk{)>^NrC>8A^Ou%f zo{1lLC0{f9Wk9ZdAcu;yrE=N6J`}2nAC<*Z{nbTqzWt8)wY%@?f6c;!^4*f->%*7; z>_I_N8B``1lMC9Rf0+Z1PMcbsA5s|C{A)OB0R3Og#x;{>6QwY@LIkk>@J2pVGLP+J z&t@}-lT|kL>k0hvG+tG(m7C}+54Jyd6#)q~nOg5DZ&YJ4k4gkBaR`(S0)w?j>Ecm3 zcnoe0_=-YJb22#-;=>ZGeGf8^{5xKLm<#p8_Mp=Of6L3%%pZMNTH?)FTppQ4p_&^L z!Q3_IbPqg@iq@u}s8j@&g402u$ygnPJ4OqKz~LxlcMlo`L&0JvlKj#9C)dVoitl(G zfUYMuz6YBEy8m8Q;0|`zrlQCg1Ws318-YesaR@RNt&N~!wY6wCEiw*=o}>u|n&#}M zK-NCs*_cIUOq(;Fiw77?6QxaaN4aYvP}(>g!rdLrMHfrcM$p``np#?#T4ao-?zdci z;pV4MBsv$Yrod@c2G-g{=dq*i_;K``f*1tR9vS~bj zvJch36ReQm*_o4Ge>8)-Cm_drHG}?NSO_lJ@Bg<9zqhOYCzfHViYZ=XmM7JNi2PQ- z-v)kf{sp{9w-D&TUQ5##$vTGIIx-gsstxTe~d^#{@(RYOUsDOVEb6IJ*Y&@ z>DE)jQ&^{2fqxR(O#Vkm(B3KmS63hpp72<*b5iAOE3FZUQ3UNVz z2o{C71oMGtg}5L<1dBpkg84wSLR=6af<+-N!F(WEAub3I!J-hCU_KD75Elf9U{Q!m zFdv9khzkNluqebOm=8oN#03E&SQO$C%m<~pOE(j38q7av0J`k-C7X*l4QHV=0ABa|n3j##2 zD8wb04@4`(1py*h6yg%h2ci|?f&dXL3dAKfb$2V31>Vx?KYs7(>t~n1`(9xblC32G z1gQZ4e;)vh`~$vs1As3I0N%I(0RAKZD6)^a-ZcdPQJT52fqg(@Z%noKW4FbJPVp?8 zvU(b?)>#oOkQd&<>X!DFyu~)3Rx}u}9(WX{I9FkDz@oh`2)!zD#toK)m7%S7L*{hK z+zAOyO-SpB{P1*hF7BP%OqYc8!)pdxiE^a(ox96Fj}=KqrqGoN6mm$SUZSVwm}xeK zY|yTs%kR>cAyHJbiEVT@(LB+ui^T`Fm5nr$`9>v1Zr9shXtnMrj+Ogxwv@l2WL4`N z&XSYZxGORRK#`b3D`HWfx4&H{U;U%})5tM`=vy9g1eX&!s1EptZ*KrtuVou52~lck z*DB*vMRNHL$~m$$m;Sd6O9!6J99Z<|`b{Q|3Cyy56W1Xq>|%8)n!dh;67eBtP%`9>u~w9 z&#NzAEvQX{*W?g%{V)%rda8FhIE=(Kt#GvuvR@u;@!>qlt@PCV=PW`hiG$@=_vq#+ z#D+blpi{}Z+cN84-Q0<=cQ|wIM7Trx<_pMt@sNhYB-t#@ZIOpKD?`uH6{0U+JJP=4 z!R>pF+3c6O*JmrNe?W+`RGU}7`WQ0CF`?4+Y)+Et@m-hNElk#T99dPi`N_1+%b~qtvCOF!F<@llt*r~5t5<;437DH$8D|^1 G?fpNVBhm2y literal 0 HcmV?d00001 diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index c506d3d5f..52b172f23 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -80,6 +80,8 @@ input.syllabus_input_min{ .icons_sy_setting{background: url(../images/syllabus/icons_syllabus.png) -51px -33px no-repeat; width:20px; height:20px; display:block; position:absolute; right:10px; top:10px; } .icons_sy_setting:hover{background: url(../images/syllabus/icons_syllabus.png) -25px -33px no-repeat; } .icons_sy_cir{background: url(../images/syllabus/icons_syllabus.png) 0px -82px no-repeat; width:15px; height:15px; display:block; position:absolute; left:-8px; top:25px;} +.icons_sy_favorite{background: url(../images/syllabus/sy_icons_star.png) 0px 0px no-repeat; width:20px; height:20px; display:block; position:absolute; left:-10px; top:25px;} +.icons_sy_star{background: url(../images/syllabus/sy_icons_star.png) 0px -27px no-repeat; width:20px; height:20px; display:block; position:absolute; left:-10px; top:25px;} .icons_sy_arrow{background: url(../images/syllabus/icons_syllabus.png) -31px -81px no-repeat; width:20px; height:20px; display:block; } .syllabus_h2_top{ font-size:18px; color:#333; font-weight:normal; padding:10px 15px;border-bottom:1px solid #e7e7e7; } .syllabus_category{ padding:10px 15px; background-color:#f6f6f6; border-bottom:1px solid #e7e7e7;} @@ -96,6 +98,9 @@ input.syllabus_input_min{ .syllabus_class_list_more a{ color:#ff7e00;} .syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} +.syllabus_class_property {font-size:12px; padding:0 5px; border-radius:3px; line-height:14px;} +.syllabus_class_private {color:#ff4a1b; border:1px solid #ff4a1b;} +.syllabus_class_open {color:#7dd26c; border:1px solid #7dd26c;} /*新建页面*/ From bb2b51aa8d82bcaec73a8a6a1ccf960d0608a98a Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 24 Aug 2016 10:30:20 +0800 Subject: [PATCH 05/74] =?UTF-8?q?=E6=94=B6=E8=97=8F=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_courses_list.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index 42c92b1a0..7254a0818 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -3,8 +3,8 @@
    • <% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %> " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>"> - - + +

      <%=course.name %>

      From 7d89f69981c6bd27d331ba02a50408fc5a9b264f Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 24 Aug 2016 15:58:23 +0800 Subject: [PATCH 06/74] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=92=8C=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=94=B6=E8=97=8F=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_user_courses.html.erb | 10 ++-- app/views/users/_courses_list.html.erb | 54 +++++++++++-------- ...0160824073554_add_is_collect_to_members.rb | 5 ++ public/stylesheets/syllabus.css | 2 +- 4 files changed, 43 insertions(+), 28 deletions(-) create mode 100644 db/migrate/20160824073554_add_is_collect_to_members.rb diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 2bbd38831..78461b9ba 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -45,12 +45,6 @@ <%= link_to "论坛",course_boards_path(course), :class => 'user_navmore_li fl',:target => '_blank' %> <%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'user_navmore_add fl', :title => '发布帖子',:target => '_blank' %>
    • - -
    • - <%= link_to "取消收藏", :class => 'user_navmore_li',:target => '_blank' %> -
      -
    • - <% if !course.syllabus.nil? %>
    • <%= link_to "所属课程",syllabus_path(course.syllabus_id), :class => 'user_navmore_li',:target => '_blank' %> @@ -58,6 +52,10 @@
    • <% end %> <% if User.current == user %> +
    • + <%= link_to "取消收藏", '', :class => 'user_navmore_li',:target => '_blank' %> +
      +
    • <% if count == 0 %> <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post', :class => 'user_navmore_li',:remote => true %> diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index 7254a0818..ec5b3e462 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -1,31 +1,43 @@ <% unless courses.nil? %> <% courses.each_with_index do |course, i| %> -
    • +
    • <% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %> - " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>"> - - -
    • <% end %> <% if courses.count > 3 %> -
    • - 共<%=courses.count %>个班级,点击全部展开 +
    • + 共<%= courses.count %> + 个班级,点击全部展开
    • <% end %> <% end %> \ No newline at end of file diff --git a/db/migrate/20160824073554_add_is_collect_to_members.rb b/db/migrate/20160824073554_add_is_collect_to_members.rb new file mode 100644 index 000000000..6211d0497 --- /dev/null +++ b/db/migrate/20160824073554_add_is_collect_to_members.rb @@ -0,0 +1,5 @@ +class AddIsCollectToMembers < ActiveRecord::Migration + def change + add_column :is_collect, :members, :integer, :default => 1 + end +end diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index f11c194a6..95cee0b2c 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -96,7 +96,7 @@ input.syllabus_input_min{ .syllabus_class_list_more{padding:8px; text-align:center;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;} .syllabus_class_list_more:hover{ background:#ececec;} .syllabus_class_list_more a{ color:#ff7e00;} -.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +a.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} .syllabus_class_property {font-size:12px; padding:0 5px; border-radius:3px; line-height:14px;} .syllabus_class_private {color:#ff4a1b; border:1px solid #ff4a1b;} From 56b74b755b1602fc847f8aa6e7b91e94f1900fe0 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 24 Aug 2016 17:30:30 +0800 Subject: [PATCH 07/74] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 17 +- app/models/principal.rb | 16 + app/views/layouts/_user_courses.html.erb | 2 +- app/views/layouts/new_base_user.html.erb | 8 +- app/views/users/cancel_collect.js.erb | 0 config/routes.rb | 1 + ...0160824073554_add_is_collect_to_members.rb | 2 +- db/schema.rb | 433 +----------------- 8 files changed, 58 insertions(+), 421 deletions(-) create mode 100644 app/views/users/cancel_collect.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index eb7ee4c03..aabce249c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -42,7 +42,7 @@ class UsersController < ApplicationController :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, - :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks] + :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_collect] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -3424,6 +3424,21 @@ class UsersController < ApplicationController end end + #取消收藏班级/项目 + def cancel_collect + if params[:project] + member = Member.where("user_id = #{@user.id} and project_id = #{params[:project].to_i}") + elsif params[:course] + member = Member.where("user_id = #{@user.id} and course_id = #{params[:course].to_i}") + end + unless member.empty? + member.first.update_attribute(:is_collect => 0) + end + respond_to do |format| + format.js + end +end + def user_projectlist @order, @c_sort, @type, @list_type = 1, 2, 1, 1 #limit = 5 diff --git a/app/models/principal.rb b/app/models/principal.rb index 0c87ec0c6..e65816e83 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -131,6 +131,22 @@ class Principal < ActiveRecord::Base columns.uniq.map {|field| "#{table}.#{field}"} end + #收藏的课程 + def favorite_courses + members = Member.where("user_id = #{self.id} and course_id != -1 and is_collect = 1") + course_ids = members.empty? ? "(-1)" : "(" + members.map{|member| member.course_id}.join(",") + ")" + courses = Course.where("id in #{course_ids}") + return courses + end + + #收藏的项目 + def favorite_projects + members = Member.where("user_id = #{self.id} and project_id != -1 and project_id != 0 and is_collect = 1") + project_ids = members.empty? ? "(-1)" : "(" + members.map{|member| member.project_id}.join(",") + ")" + projects = Project.where("id in #{project_ids}") + return projects + end + protected # Make sure we don't try to insert NULL values (see #4632) diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 78461b9ba..0335aa922 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -53,7 +53,7 @@ <% end %> <% if User.current == user %>
    • - <%= link_to "取消收藏", '', :class => 'user_navmore_li',:target => '_blank' %> + <%= link_to "取消收藏", cancel_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank' %>
    • diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index c4fec04df..5969f17d6 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -158,8 +158,8 @@
      • <%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> - <% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> - <% all_count = @user.courses.visible.where("is_delete =?", 0).count%> + <% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> + <% all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count%>
          @@ -195,8 +195,8 @@
          • <%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%> - <% all_count = @user.projects.visible.count%> - <% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%> + <% all_count = @user.favorite_projects.visible.count%> + <% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
              diff --git a/app/views/users/cancel_collect.js.erb b/app/views/users/cancel_collect.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/routes.rb b/config/routes.rb index 6cbc0812d..6b26eb078 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -667,6 +667,7 @@ RedmineApp::Application.routes.draw do post 'apply_for_resource' match 'manage_or_receive_homeworks', :to => 'users#manage_or_receive_homeworks', :via => :get get 'search_m_r_homeworks' + post 'cancel_collect' # end end #resources :blogs diff --git a/db/migrate/20160824073554_add_is_collect_to_members.rb b/db/migrate/20160824073554_add_is_collect_to_members.rb index 6211d0497..17e088398 100644 --- a/db/migrate/20160824073554_add_is_collect_to_members.rb +++ b/db/migrate/20160824073554_add_is_collect_to_members.rb @@ -1,5 +1,5 @@ class AddIsCollectToMembers < ActiveRecord::Migration def change - add_column :is_collect, :members, :integer, :default => 1 + add_column :members, :is_collect, :integer, :default => 1 end end diff --git a/db/schema.rb b/db/schema.rb index 47b3bf210..414f2d2be 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 => 20160810081337) do +ActiveRecord::Schema.define(:version => 20160824073554) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,28 +52,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - create_table "application_settings", :force => true do |t| - t.integer "default_projects_limit" - t.boolean "signup_enabled" - t.boolean "signin_enabled" - t.boolean "gravatar_enabled" - t.text "sign_in_text" - t.datetime "created_at" - t.datetime "updated_at" - t.string "home_page_url" - t.integer "default_branch_protection", :default => 2 - t.boolean "twitter_sharing_enabled", :default => true - t.text "restricted_visibility_levels" - t.boolean "version_check_enabled", :default => true - t.integer "max_attachment_size", :default => 10, :null => false - t.integer "default_project_visibility" - t.integer "default_snippet_visibility" - t.text "restricted_signup_domains" - t.boolean "user_oauth_applications", :default => true - t.string "after_sign_out_path" - t.integer "session_expire_delay", :default => 10080, :null => false - end - create_table "applied_messages", :force => true do |t| t.integer "user_id" t.integer "applied_id" @@ -82,17 +60,16 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "status", :default => 0 t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "name" t.integer "applied_user_id" t.integer "role" t.integer "project_id" - t.string "name" end create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "role", :default => 0 - t.integer "applied_user_id" + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "role", :default => 0 end create_table "apply_add_schools", :force => true do |t| @@ -207,20 +184,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.string "typeName", :limit => 50 end - create_table "audit_events", :force => true do |t| - t.integer "author_id", :null => false - t.string "type", :null => false - t.integer "entity_id", :null => false - t.string "entity_type", :null => false - t.text "details" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" - add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" - add_index "audit_events", ["type"], :name => "index_audit_events_on_type" - create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -318,17 +281,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" - create_table "broadcast_messages", :force => true do |t| - t.text "message", :null => false - t.datetime "starts_at" - t.datetime "ends_at" - t.integer "alert_type" - t.datetime "created_at" - t.datetime "updated_at" - t.string "color" - t.string "font" - end - create_table "bug_to_osps", :force => true do |t| t.integer "osp_id" t.integer "relative_memo_id" @@ -358,16 +310,14 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false + t.integer "repository_id", :null => false + t.string "revision", :null => false t.string "committer" - t.datetime "committed_on", :null => false + t.datetime "committed_on", :null => false t.text "comments" t.date "commit_date" t.string "scmid" t.integer "user_id" - t.integer "project_id" - t.integer "type", :default => 0 end add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" @@ -647,11 +597,8 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.string "qrcode" end - add_index "courses", ["id"], :name => "id", :unique => true add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id" - add_index "courses", ["tea_id"], :name => "tea_id" - add_index "courses", ["visits"], :name => "visits" create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false @@ -714,15 +661,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "deploy_keys_projects", :force => true do |t| - t.integer "deploy_key_id", :null => false - t.integer "project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" - create_table "discuss_demos", :force => true do |t| t.string "title" t.text "body" @@ -772,16 +710,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "created_at" end - create_table "emails", :force => true do |t| - t.integer "user_id", :null => false - t.string "email", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true - add_index "emails", ["user_id"], :name => "index_emails_on_user_id" - create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -804,25 +732,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - create_table "events", :force => true do |t| - t.string "target_type" - t.integer "target_id" - t.string "title" - t.text "data" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "action" - t.integer "author_id" - end - - add_index "events", ["action"], :name => "index_events_on_action" - add_index "events", ["author_id"], :name => "index_events_on_author_id" - add_index "events", ["created_at"], :name => "index_events_on_created_at" - add_index "events", ["project_id"], :name => "index_events_on_project_id" - add_index "events", ["target_id"], :name => "index_events_on_target_id" - add_index "events", ["target_type"], :name => "index_events_on_target_type" - create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -925,15 +834,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" - create_table "forked_project_links", :force => true do |t| - t.integer "forked_to_project_id", :null => false - t.integer "forked_from_project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true - create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -1063,17 +963,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "identities", :force => true do |t| - t.string "extern_uid" - t.string "provider" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" - add_index "identities", ["user_id"], :name => "index_identities_on_user_id" - create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1220,20 +1109,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "private", :default => 0 end - create_table "keys", :force => true do |t| - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.text "key" - t.string "title" - t.string "type" - t.string "fingerprint" - t.boolean "public", :default => false, :null => false - end - - add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" - add_index "keys", ["user_id"], :name => "index_keys_on_user_id" - create_table "kindeditor_assets", :force => true do |t| t.string "asset" t.integer "file_size" @@ -1245,27 +1120,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "owner_type", :default => 0 end - create_table "label_links", :force => true do |t| - t.integer "label_id" - t.integer "target_id" - t.string "target_type" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" - add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" - - create_table "labels", :force => true do |t| - t.string "title" - t.string "color" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "labels", ["project_id"], :name => "index_labels_on_project_id" - create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1283,6 +1137,7 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.boolean "mail_notification", :default => false, :null => false t.integer "course_id", :default => -1 t.integer "course_group_id", :default => 0 + t.integer "is_collect", :default => 1 end add_index "members", ["project_id"], :name => "index_members_on_project_id" @@ -1317,47 +1172,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "viewed_count", :default => 0 end - create_table "merge_request_diffs", :force => true do |t| - t.string "state" - t.text "st_commits", :limit => 2147483647 - t.text "st_diffs", :limit => 2147483647 - t.integer "merge_request_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true - - create_table "merge_requests", :force => true do |t| - t.string "target_branch", :null => false - t.string "source_branch", :null => false - t.integer "source_project_id", :null => false - t.integer "author_id" - t.integer "assignee_id" - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "milestone_id" - t.string "state" - t.string "merge_status" - t.integer "target_project_id", :null => false - t.integer "iid" - t.text "description" - t.integer "position", :default => 0 - t.datetime "locked_at" - end - - add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" - add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" - add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" - add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" - add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" - add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" - add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" - add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" - add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true - add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" - create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1392,39 +1206,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" - create_table "milestones", :force => true do |t| - t.string "title", :null => false - t.integer "project_id", :null => false - t.text "description" - t.date "due_date" - t.datetime "created_at" - t.datetime "updated_at" - t.string "state" - t.integer "iid" - end - - add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" - add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" - add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true - add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" - - create_table "namespaces", :force => true do |t| - t.string "name", :null => false - t.string "path", :null => false - t.integer "owner_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type" - t.string "description", :default => "", :null => false - t.string "avatar" - end - - add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" - add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true - add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" - add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true - add_index "namespaces", ["type"], :name => "index_namespaces_on_type" - create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -1450,31 +1231,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "notes", :force => true do |t| - t.text "note" - t.string "noteable_type" - t.integer "author_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "project_id" - t.string "attachment" - t.string "line_code" - t.string "commit_id" - t.integer "noteable_id" - t.boolean "system", :default => false, :null => false - t.text "st_diff", :limit => 2147483647 - end - - add_index "notes", ["author_id"], :name => "index_notes_on_author_id" - add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" - add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" - add_index "notes", ["created_at"], :name => "index_notes_on_created_at" - add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" - add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" - add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" - add_index "notes", ["project_id"], :name => "index_notes_on_project_id" - add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" - create_table "notificationcomments", :force => true do |t| t.string "notificationcommented_type" t.integer "notificationcommented_id" @@ -1484,49 +1240,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "oauth_access_grants", :force => true do |t| - t.integer "resource_owner_id", :null => false - t.integer "application_id", :null => false - t.string "token", :null => false - t.integer "expires_in", :null => false - t.text "redirect_uri", :null => false - t.datetime "created_at", :null => false - t.datetime "revoked_at" - t.string "scopes" - end - - add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true - - create_table "oauth_access_tokens", :force => true do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", :null => false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", :null => false - t.string "scopes" - end - - add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true - add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" - add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true - - create_table "oauth_applications", :force => true do |t| - t.string "name", :null => false - t.string "uid", :null => false - t.string "secret", :null => false - t.text "redirect_uri", :null => false - t.string "scopes", :default => "", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.integer "owner_id" - t.string "owner_type" - end - - add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" - add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true - create_table "onclick_times", :force => true do |t| t.integer "user_id" t.datetime "onclick_time" @@ -1684,23 +1397,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "allow_teacher", :default => 0 end - create_table "permissions", :force => true do |t| - t.string "controller", :limit => 30, :default => "", :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "description", :limit => 60, :default => "", :null => false - t.boolean "is_public", :default => false, :null => false - t.integer "sort", :default => 0, :null => false - t.boolean "mail_option", :default => false, :null => false - t.boolean "mail_enabled", :default => false, :null => false - end - - create_table "permissions_roles", :id => false, :force => true do |t| - t.integer "permission_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - end - - add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" - create_table "phone_app_versions", :force => true do |t| t.string "version" t.text "description" @@ -1783,11 +1479,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "project_import_data", :force => true do |t| - t.integer "project_id" - t.text "data" - end - create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1880,16 +1571,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - create_table "protected_branches", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "developers_can_push", :default => false, :null => false - end - - add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" - create_table "pull_requests", :force => true do |t| t.integer "pull_request_id" t.integer "gpid" @@ -2046,25 +1727,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "is_teacher_score", :default => 0 end - create_table "services", :force => true do |t| - t.string "type" - t.string "title" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "active", :default => false, :null => false - t.text "properties" - t.boolean "template", :default => false - t.boolean "push_events", :default => true - t.boolean "issues_events", :default => true - t.boolean "merge_requests_events", :default => true - t.boolean "tag_push_events", :default => true - t.boolean "note_events", :default => true, :null => false - end - - add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" - add_index "services", ["project_id"], :name => "index_services_on_project_id" - create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -2103,26 +1765,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "snippets", :force => true do |t| - t.string "title" - t.text "content", :limit => 2147483647 - t.integer "author_id", :null => false - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_name" - t.datetime "expires_at" - t.string "type" - t.integer "visibility_level", :default => 0, :null => false - end - - add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" - add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" - add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" - add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" - add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" - add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" - create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -2203,10 +1845,11 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false - t.float "work_score" t.integer "simi_id" t.integer "simi_value" + t.float "work_score" t.integer "work_status", :default => 0 + t.datetime "commit_time" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -2254,13 +1897,13 @@ ActiveRecord::Schema.define(:version => 20160810081337) do create_table "sub_domains", :force => true do |t| t.integer "org_subfield_id" - t.integer "priority" + t.integer "priority", :default => 0 t.string "name" t.string "field_type" - t.integer "hide" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "hide", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "subfield_subdomain_dirs", :force => true do |t| @@ -2270,17 +1913,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "subscriptions", :force => true do |t| - t.integer "user_id" - t.integer "subscribable_id" - t.string "subscribable_type" - t.boolean "subscribed" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true - create_table "syllabuses", :force => true do |t| t.string "title" t.text "description" @@ -2510,8 +2142,9 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.string "remark" t.integer "groupid" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "bindtype", :default => 0 end create_table "users", :force => true do |t| @@ -2541,17 +2174,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" add_index "users", ["type"], :name => "index_users_on_type" - create_table "users_star_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" - add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true - add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" - create_table "versions", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :default => "", :null => false @@ -2603,23 +2225,6 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.datetime "updated_at", :null => false end - create_table "web_hooks", :force => true do |t| - t.string "url" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type", :default => "ProjectHook" - t.integer "service_id" - t.boolean "push_events", :default => true, :null => false - t.boolean "issues_events", :default => false, :null => false - t.boolean "merge_requests_events", :default => false, :null => false - t.boolean "tag_push_events", :default => false - t.boolean "note_events", :default => false, :null => false - end - - add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" - add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" - create_table "wechat_logs", :force => true do |t| t.string "openid", :null => false t.text "request_raw" From 69301a11208154fe8d1a54f0dbf7bad580d6ac09 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Aug 2016 10:04:51 +0800 Subject: [PATCH 08/74] =?UTF-8?q?Pull=20reques=E7=99=BB=E5=BD=95=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=88=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 9 +++++++++ app/views/projects/_development_group.html.erb | 10 +++++----- app/views/pull_requests/_show.html.erb | 6 ++++-- app/views/pull_requests/index.html.erb | 5 +++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 5e21f9af0..b67a74439 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,8 +1,10 @@ class PullRequestsController < ApplicationController + before_filter :authorize_logged before_filter :find_project_and_repository before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments, :create_pull_request_comment] + layout "base_projects" include PullRequestsHelper include ApplicationHelper @@ -235,6 +237,13 @@ class PullRequestsController < ApplicationController end private + def authorize_logged + if !User.current.logged? + redirect_to signin_path + return + end + end + def connect_gitlab @g = Gitlab.client end diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 273fcf56a..82bcb5501 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -40,12 +40,12 @@
            <% end %> -<% if allow_pull_request(@project) %> - <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <% if visible_repository?(@project) %> diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index b750728a4..758f70878 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -5,8 +5,10 @@
            <%= get_state(@request.state) %>合并请求 由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %> 于 <%= time_tag(@request.created_at) %> 前提交 · 最后编辑时间 <%= time_tag(@request.updated_at) %> 前 - <% unless @request.state == "merged" %> - <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %> + <% if User.current.login == @request.author.try(:username) || is_project_manager?(User.current.id, @project.id) %> + <% unless @request.state == "merged" %> + <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %> + <% end %> <% end %>
            diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index 78c4759aa..f4fe0725e 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -3,8 +3,9 @@
          • <%= link_to "待处理#{@requests_opened_count}".html_safe, project_pull_requests_path(:type => "1"), :remote => true %>
          • <%= link_to "已处理#{@requests_merged_count}".html_safe, project_pull_requests_path(:type => "2"), :remote => true %>
          • <%= link_to "已关闭#{@requests_closed_count}".html_safe, project_pull_requests_path(:type => "3"), :remote => true %>
          • - - <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> + <% if allow_pull_request(@project) %> + <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> + <% end %>
          From 3778871f587aecafbdbbfc3149845c06655893a3 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Aug 2016 10:39:16 +0800 Subject: [PATCH 09/74] =?UTF-8?q?issue=E5=9C=A8=E9=A1=B9=E7=9B=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E3=80=81=E5=88=97=E8=A1=A8=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_news_replies.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index 1da4bc85e..fcbe59ebf 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -72,6 +72,7 @@ l(:button_delete), {:controller => 'issues',:action => 'delete_journal', :id => activity_id,:journal_id=>comment.id, :user_activity_id => user_activity_id}, :method => 'get', + :confirm => l(:text_are_you_sure), :remote=>true, :class => 'fr mr20', :title => l(:button_delete) From 61fe0fc77c6822faa16e97cfefc7372011c9ae67 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Aug 2016 10:50:18 +0800 Subject: [PATCH 10/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=8F=91=E5=B8=96=E6=97=B6=20=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=20=E5=86=85=E5=AE=B9=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/project.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 13ed76aa4..4d2c0c91a 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -607,11 +607,11 @@ function regexTopicDescription() $("#message_content_span").css('color','#ff0000'); return false; } - else if(name.length >=6000){ - $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); - $("#message_content_span").css('color','#ff0000'); - return false; - } +// else if(name.length >=6000){ +// $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); +// $("#message_content_span").css('color','#ff0000'); +// return false; +// } else { $("#message_content_span").text("填写正确"); @@ -621,11 +621,11 @@ function regexTopicDescription() } function submit_topic_project() { -// if(regexTopicSubject() && regexTopicDescription()) -// { + if(regexTopicSubject() && regexTopicDescription()) + { message_content_editor.sync(); $("#message-form-project").submit(); -// } + } } function reset_topic(){ From 60beb2abab087490215c82ae250f4173c07d5e81 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 25 Aug 2016 11:30:47 +0800 Subject: [PATCH 11/74] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=92=8C=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E6=94=B6=E8=97=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 29 ++++++++++++------- .../_homepage_left_course_list.html.erb | 17 +++++++++++ .../_homepage_left_project_list.html.erb | 17 +++++++++++ app/views/layouts/_user_courses.html.erb | 2 +- app/views/layouts/_user_projects.html.erb | 4 +++ app/views/layouts/new_base_user.html.erb | 29 +++---------------- app/views/users/_collect_course.html.erb | 10 +++++++ app/views/users/_collect_project.html.erb | 10 +++++++ app/views/users/_courses_list.html.erb | 5 ++-- app/views/users/_project_list.html.erb | 5 +++- app/views/users/cancel_collect.js.erb | 0 app/views/users/cancel_or_collect.js.erb | 11 +++++++ app/views/users/user_courselist.html.erb | 3 +- config/routes.rb | 4 +-- 14 files changed, 103 insertions(+), 43 deletions(-) create mode 100644 app/views/layouts/_homepage_left_course_list.html.erb create mode 100644 app/views/layouts/_homepage_left_project_list.html.erb create mode 100644 app/views/users/_collect_course.html.erb create mode 100644 app/views/users/_collect_project.html.erb delete mode 100644 app/views/users/cancel_collect.js.erb create mode 100644 app/views/users/cancel_or_collect.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index aabce249c..a44a3bc01 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -42,7 +42,7 @@ class UsersController < ApplicationController :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, - :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_collect] + :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -1459,15 +1459,15 @@ class UsersController < ApplicationController #显示更多用户课程 def user_courses4show @page = params[:page].to_i + 1 - @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10).offset(@page * 10) - @all_count = @user.courses.visible.where("is_delete =?", 0).count + @courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10).offset(@page * 10) + @all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count end #显示更多用户项目 def user_projects4show @page = params[:page].to_i + 1 - @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10) - @all_count = @user.projects.visible.count + @projects = @user.favorite_projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10) + @all_count = @user.favorite_projects.visible.count end def user_course_activities @@ -3424,20 +3424,27 @@ class UsersController < ApplicationController end end - #取消收藏班级/项目 - def cancel_collect + #收藏班级/项目 + def cancel_or_collect if params[:project] - member = Member.where("user_id = #{@user.id} and project_id = #{params[:project].to_i}") + @project = Project.find params[:project] + member = Member.where("user_id = #{@user.id} and project_id = #{@project.id}") elsif params[:course] - member = Member.where("user_id = #{@user.id} and course_id = #{params[:course].to_i}") + @course = Course.find params[:course] + member = Member.where("user_id = #{@user.id} and course_id = #{@course.id}") end unless member.empty? - member.first.update_attribute(:is_collect => 0) + member.first.update_attribute(:is_collect, member.first.is_collect == 0 ? 1 : 0) + end + if @project + @projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10) + elsif @course + @courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) end respond_to do |format| format.js end -end + end def user_projectlist @order, @c_sort, @type, @list_type = 1, 2, 1, 1 diff --git a/app/views/layouts/_homepage_left_course_list.html.erb b/app/views/layouts/_homepage_left_course_list.html.erb new file mode 100644 index 000000000..1f1f03210 --- /dev/null +++ b/app/views/layouts/_homepage_left_course_list.html.erb @@ -0,0 +1,17 @@ +<% all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count%> +
          +
            + <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %> +
          +
          +<% if !courses.empty? %> + + + +<% end %> + + \ No newline at end of file diff --git a/app/views/layouts/_homepage_left_project_list.html.erb b/app/views/layouts/_homepage_left_project_list.html.erb new file mode 100644 index 000000000..d3fcaf2b5 --- /dev/null +++ b/app/views/layouts/_homepage_left_project_list.html.erb @@ -0,0 +1,17 @@ +<% all_count = @user.favorite_projects.visible.count%> +
          +
            + <%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %> +
          +
          +<% if !projects.empty? %> + + + +<% end %> + + \ No newline at end of file diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 0335aa922..d8b145ddc 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -53,7 +53,7 @@ <% end %> <% if User.current == user %>
        • - <%= link_to "取消收藏", cancel_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank' %> + <%= link_to "取消收藏", cancel_or_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
        • diff --git a/app/views/layouts/_user_projects.html.erb b/app/views/layouts/_user_projects.html.erb index 21b42decd..e8a7f0755 100644 --- a/app/views/layouts/_user_projects.html.erb +++ b/app/views/layouts/_user_projects.html.erb @@ -27,6 +27,10 @@
        • <% end %> <% if User.current == @user %> +
        • + <%= link_to "取消收藏", cancel_or_collect_user_path(user, :project => project.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %> +
          +
        • <% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %> <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 5969f17d6..46cd43ecf 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -159,18 +159,8 @@
        • <%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> <% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> - <% all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count%> -
          -
          -
            - <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %> -
          -
          - <% if !courses.empty? %> - - - - <% end %> +
          + <%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
        • <% if is_current_user %> @@ -195,19 +185,9 @@
          • <%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%> - <% all_count = @user.favorite_projects.visible.count%> <% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%> -
            -
            -
              - <%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %> -
            -
            - <% if !projects.empty? %> - - - - <% end %> +
            + <%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>
          • <% if is_current_user %> @@ -292,7 +272,6 @@
        diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 71694da60..2e14f493b 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -78,7 +78,7 @@
      • -
      • <%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %> +
      • <%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>姓名不能为空
      • <% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %> @@ -175,7 +175,7 @@
      • <%= f.select :language, :Chinese => :zh, :English => :en %>
      • - 确定 + 确定
      • @@ -560,44 +560,80 @@ $("#users_tb_2").click(); <% end %> - $('#my_account_form_link').on("click",(function(e){ - //$('#my_account_form_link').click(function(e){ - if($("#userIdentity").val() == -1 ) { - $("#identity_hint").html('请选择身份').show(); - e.stopImmediatePropagation(); - return; - } - if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 - $("#hint").html('单位名称必须是从下拉列表中选择的,不能手动修改').show(); - e.stopImmediatePropagation(); - return; - } - - //姓名不能为空 - if( $("#lastname").val() == '' ){ - $("#lastname").focus(); - e.stopImmediatePropagation(); - return; - } - - if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写 - $("#hint").html('高校(单位)名称不能为空').show(); - e.stopImmediatePropagation(); - return; - } - - if($("#no").is(":visible") == true && $("#no").val() == ""){ - $("#no").focus(); - e.stopImmediatePropagation(); - return; - } - - $('#my_account_form_btn').click(); - })); +// $('#my_account_form_link').on("click",(function(e){ +// //$('#my_account_form_link').click(function(e){ +// if($("#userIdentity").val() == -1 ) { +// $("#identity_hint").html('请选择身份').show(); +// e.stopImmediatePropagation(); +// return; +// } +// if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 +// $("#hint").html('单位名称必须是从下拉列表中选择的,不能手动修改').show(); +// e.stopImmediatePropagation(); +// return; +// } +// +// //姓名不能为空 +// if( $("#lastname").val() == '' ){ +// $("#lastname").focus(); +// $("#last_name_notice").show(); +// e.stopImmediatePropagation(); +// return; +// } +// +// if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写 +// $("#hint").html('高校(单位)名称不能为空').show(); +// e.stopImmediatePropagation(); +// return; +// } +// +// if($("#no").is(":visible") == true && $("#no").val() == ""){ +// $("#no").focus(); +// e.stopImmediatePropagation(); +// return; +// } +// +// $('#my_account_form').submit(); +// })); $('#my_password_form_link').click(function(){ $('#my_password_form_btn').click(); }); }); + +function my_account_form_submit(){ + if($("#userIdentity").val() == -1 ) { + $("#identity_hint").html('请选择身份').show(); + e.stopImmediatePropagation(); + return; + } + if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 + $("#hint").html('单位名称必须是从下拉列表中选择的,不能手动修改').show(); + e.stopImmediatePropagation(); + return; + } + + //姓名不能为空 + if( $("#lastname").val() == '' ){ + $("#lastname").focus(); + $("#last_name_notice").show(); + e.stopImmediatePropagation(); + return; + } + + if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写 + $("#hint").html('高校(单位)名称不能为空').show(); + e.stopImmediatePropagation(); + return; + } + + if($("#no").is(":visible") == true && $("#no").val() == ""){ + $("#no").focus(); + e.stopImmediatePropagation(); + return; + } + + $('#my_account_form').submit(); +} +<% if hidden_unproject_infos %> + <%= render :partial => 'layouts/new_feedback' %> +<% end %> -
        123
        -<%= render :partial => 'layouts/new_feedback' %> diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index c1f6a5644..976de8235 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -298,6 +298,7 @@
        + <%= render :partial => 'layouts/new_feedback' %> diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb index e9703a943..d28171f5f 100644 --- a/app/views/layouts/new_base.html.erb +++ b/app/views/layouts/new_base.html.erb @@ -59,7 +59,9 @@
        <%= render :partial => 'layouts/footer' %>
        -<%= render :partial => 'layouts/new_feedback' %> +<% if hidden_unproject_infos %> + <%= render :partial => 'layouts/new_feedback' %> +<% end %> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index d1084c794..20754b0ff 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -157,9 +157,7 @@
        - <% hidden_courses = Setting.find_by_name("hidden_courses") %> - <% unvisiable = hidden_courses && hidden_courses.value == "1"%> - <% if !unvisiable %> + <% if hidden_unproject_infos %>
        • <%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> @@ -220,7 +218,9 @@ <%= yield %>
        - <%= render :partial => 'layouts/new_feedback' %> + <% if hidden_unproject_infos %> + <%= render :partial => 'layouts/new_feedback' %> + <% end %>
        <%= render :partial => 'layouts/footer' %> diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index 3727e4a1d..14609f4fc 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -3,6 +3,7 @@
          • + <% if hidden_unproject_infos %>
            • 课程消息
            • @@ -12,7 +13,7 @@
            • <%= link_to "班级问卷", user_message_path(User.current, :type => 'poll'), :class => "homepagePostTypeQuiz postTypeGrey" %>
          • - + <% end %>
            • 项目消息
            • diff --git a/app/views/users/_user_resource_type_filter.html.erb b/app/views/users/_user_resource_type_filter.html.erb index 633e52472..2322c87cb 100644 --- a/app/views/users/_user_resource_type_filter.html.erb +++ b/app/views/users/_user_resource_type_filter.html.erb @@ -4,10 +4,12 @@
            • 全部
            • -
            • - 班级资源 - <%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %> -
            • + <% if hidden_unproject_infos %> +
            • + 班级资源 + <%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %> +
            • + <% end %>
            • 项目资源 <%#= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), id="resource_type_project", :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 9acffce3d..e26113673 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -7,9 +7,7 @@
                • - <% hidden_courses = Setting.find_by_name("hidden_courses") %> - <% unvisiable = hidden_courses && hidden_courses.value == "1"%> - <% if !unvisiable %> + <% if hidden_unproject_infos %>
                • 课程动态
                • <%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
                • diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 2baa9f2f2..578e97b9a 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -21,7 +21,9 @@ <%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %> <%# 课程消息 %> - <%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %> + <% if hidden_unproject_infos %> + <%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %> + <% end %> <%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %> From eda735db58bcc4f313cdd3a247095c09da520830 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 14:40:34 +0800 Subject: [PATCH 59/74] =?UTF-8?q?footer=E6=96=87=E5=AD=97=E5=B1=85?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/structure.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 729bf2f4a..7004c0928 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -455,8 +455,8 @@ a.topnav_login_box:hover {color:#a1ebff;} /*底部*/ #Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/ -.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;} -.footerAbout{ width:365px; margin:0 auto;height:35px; line-height:35px; padding-top: 10px;} +.footerAboutContainer {width:auto; border-bottom:1px solid #efefef; text-align:center;} +.footerAbout{margin:0 auto;height:35px; line-height:35px; padding-top: 10px; display:inline-block;} .languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;} .departments{ width:855px; margin:5px auto;height:40px;line-height:40px;} .departments li {height:40px; line-height:40px;} From 02fbdb57bde037e3d99fa5be26381a811f5a5895 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 14:44:31 +0800 Subject: [PATCH 60/74] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=AD=E7=94=A8=E6=88=B7=E6=B6=88=E6=81=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 578e97b9a..2baa9f2f2 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -21,9 +21,7 @@ <%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %> <%# 课程消息 %> - <% if hidden_unproject_infos %> - <%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %> - <% end %> + <%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %> <%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %> From 9e9b4d12c9c4b27195bf53614c7d478f7e782369 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:00:34 +0800 Subject: [PATCH 61/74] =?UTF-8?q?=E6=96=B0=E6=B3=A8=E5=86=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=8D=E5=8F=91=E9=80=81=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b863c1f70..f2b2b6824 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1162,18 +1162,20 @@ class User < Principal #为新注册用户发送留言 def add_new_jour - if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? - lead_message1 = Message.find(19292) - notes1 = lead_message1.content - lead_message2 = Message.find(19291) - notes2 = lead_message2.content - lead_message3 = Message.find(19504) - notes3 = lead_message3.content - #user_id 默认为课程使者创建 - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - end + if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" + if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? + lead_message1 = Message.find(19292) + notes1 = lead_message1.content + lead_message2 = Message.find(19291) + notes2 = lead_message2.content + lead_message3 = Message.find(19504) + notes3 = lead_message3.content + #user_id 默认为课程使者创建 + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + end + end end # 更新邮箱的同事,更新invite_lists表中的邮箱信息 From 2df6047b03f2a12dc13e95c57502f9bd2343cf1a Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:14:55 +0800 Subject: [PATCH 62/74] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B9=8B=20=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BD=86=E6=98=AF=E6=9C=AA=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E8=B5=84=E6=96=99=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_footer_show.html.erb | 4 +++- app/views/layouts/_logined_header_show.html.erb | 14 ++++++++------ app/views/layouts/new_base_user_show.html.erb | 8 ++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/views/layouts/_footer_show.html.erb b/app/views/layouts/_footer_show.html.erb index 19028ed8a..99e71762d 100644 --- a/app/views/layouts/_footer_show.html.erb +++ b/app/views/layouts/_footer_show.html.erb @@ -4,7 +4,9 @@
                • <%= l(:label_about_us)%>|
                • 服务协议|
                • -
                • <%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|
                • + <% if hidden_unproject_infos %> +
                • <%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|
                • + <% end %>
                • <%= l(:label_forums)%>
                diff --git a/app/views/layouts/_logined_header_show.html.erb b/app/views/layouts/_logined_header_show.html.erb index a6721501e..c593c3e8c 100644 --- a/app/views/layouts/_logined_header_show.html.erb +++ b/app/views/layouts/_logined_header_show.html.erb @@ -10,12 +10,14 @@
              • - - + <% if hidden_unproject_infos %> + + + <% end %>
              - <% hidden_courses = Setting.find_by_name("hidden_courses") %> - <% unvisiable = hidden_courses && hidden_courses.value == "1"%> - <% if !unvisiable %> + <% if hidden_unproject_infos %>
              • 课程 @@ -233,7 +231,9 @@ <%= yield %>
              - <%= render :partial => 'layouts/forbidden_new_feedback' %> + <% if hidden_unproject_infos %> + <%= render :partial => 'layouts/forbidden_new_feedback' %> + <% end %>
              <%= render :partial => 'layouts/footer_show' %> From 718e59c1449583b8c78e1bf77d9246c290b241a8 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 15:31:09 +0800 Subject: [PATCH 63/74] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_selector_for_messages.html.erb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index 14609f4fc..1e2e40e06 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -24,6 +24,7 @@
          • + <% if hidden_unproject_infos %>
            • @@ -35,7 +36,18 @@
            • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
          • - + <% else %> +
          • +
              +
            • 更多
            • +
            • <%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
            • +
            • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
            • +
            • <%= link_to "系统消息", user_system_messages_path(User.current, :type => 'system_messages'), :class => "homepageTypeSystem postTypeGrey" %>
            • +
            • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
            • +
            • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
            • +
            +
          • + <% end %>
        From 1f6bd68e61f35cdb5e4497901ac81bf0102bdce7 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:37:28 +0800 Subject: [PATCH 64/74] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=20=E7=BB=84=E7=BB=87=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/show.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index ab3120a5d..690750fd2 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -20,6 +20,7 @@
          • + <% if hidden_unproject_infos %>
            • 课程动态
            • @@ -33,6 +34,7 @@
          • + <% end %>
            • 项目动态
            • From ac85eadc30c5c5a158517b5344f7dab9a5778cbd Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:42:17 +0800 Subject: [PATCH 65/74] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=88=87=E6=8D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_resource.html.erb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index ee2ea7e4f..6c0e067db 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -8,12 +8,6 @@ function remote_get_resources(user_id,type){ } - $(document).ready(function(){ - $(".resource-switch").click(function(){ - $(".resource-switch").children().removeClass("resource-tab-active"); - $(this).children().addClass("resource-tab-active"); - }); - }); function remote_search(){ $("#resource_search_form").submit(); } @@ -75,5 +69,10 @@
              - + From 9b14b86b642277c4bb4d9f74afb9d95953394187 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 16:01:23 +0800 Subject: [PATCH 66/74] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B9=8B=20=E9=9A=90=E8=97=8F=E7=BB=84=E7=BB=87=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_org_left_subfield_list.html.erb | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 9d043fbb5..a414a1181 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -61,19 +61,21 @@ <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> <% when 'course' %> -
              -
              - 班级 - <% if User.current.logged? and User.current.admin_of_org?(organization) %> - <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%> - <% end %> -
              -
              -
                - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> -
              -
              -
              + <% if hidden_unproject_infos %> +
              +
              + 班级 + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%> + <% end %> +
              +
              +
                + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
              +
              +
              + <% end %> <% when 'project' %>
              From 52a8a64a691a03dfb1fd1de1df43e1e27959d787 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 10:48:13 +0800 Subject: [PATCH 67/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=8F=91=E9=80=81?= =?UTF-8?q?=E4=B8=AD=E5=8E=BB=E6=8E=89=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 3 ++ app/views/files/_tool_settings.html.erb | 12 +++++- app/views/users/_send_part.html.erb | 12 ++++++ public/javascripts/application.js | 49 +++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 app/views/users/_send_part.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a44a3bc01..b385fe610 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2152,6 +2152,7 @@ class UsersController < ApplicationController #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] + @hidden_unproject = hidden_unproject_infos respond_to do |format| format.js end @@ -2171,6 +2172,7 @@ class UsersController < ApplicationController #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids + @hidden_unproject = hidden_unproject_infos respond_to do |format| format.js end @@ -3334,6 +3336,7 @@ class UsersController < ApplicationController #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] + @hidden_unproject = hidden_unproject_infos respond_to do |format| format.js end diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index a0ce42eac..5d96d8da2 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -4,7 +4,11 @@ <% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %> <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
                -
              • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
              • + <% if hidden_unproject_infos %> +
              • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
              • + <% else %> +
              • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
              • + <% end %>
              • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
              • <% if project.is_public? %>
              • @@ -20,7 +24,11 @@ <% end %> <% else %>
                  -
                • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
                • + <% if hidden_unproject_infos %> +
                • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
                • + <% else %> +
                • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
                • + <% end %>
                <% end %> <% end %> diff --git a/app/views/users/_send_part.html.erb b/app/views/users/_send_part.html.erb new file mode 100644 index 000000000..b47386da8 --- /dev/null +++ b/app/views/users/_send_part.html.erb @@ -0,0 +1,12 @@ +<% if @hidden_unproject %> + +<% else %> + +<% end %> \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c2e357e0f..d576ba42f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1153,6 +1153,31 @@ function show_send(id, user_id, send_type){ } } +//为了隐藏非项目功能 +//var sendType = '1'; +var lastSendType ;//初始为发送到我的项目 +function show_send_hidden(id, user_id, send_type){ + if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + }else if( lastSendType == '2'){//组织 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:id, send_type:send_type} + }); + }else{ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + } +} + //id 发送的id //发送的id数组 //send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 @@ -1216,6 +1241,30 @@ function chooseSendType2(res_id,res_ids, user_id, send_type, type){ lastSendType = sendType; } +//隐藏项目其它信息特用 +function chooseSendType2hidden(res_id,res_ids, user_id, send_type, type){ + console.log(res_ids); + sendType = $(".resourcesSendType").val(); + if (sendType === lastSendType) { + return; + } else if(lastSendType != null) { //不是第一次点击的时候 + if (sendType == '1') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project' + '?' + "&type=" + type, + data:{send_id:res_id, send_ids:res_ids ,send_type:send_type} + }); + }else if(sendType == '2'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org' + '?' + "&type=" + type, + data:{send_id:res_id, send_ids:res_ids, send_type:send_type} + }); + } + } + lastSendType = sendType; +} + //组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 function disable_down(source, des, hint){ if (source.attr("checked")){ From 3856ed80330705f5e346252d7ba8c147efa0b7a2 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:00:34 +0800 Subject: [PATCH 68/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=E8=B5=84=E6=BA=90=E5=8F=91=E9=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/_resource_share_for_orgs.html.erb | 17 ++++++++++++----- .../_resource_share_for_project_popup.html.erb | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 36d1c774f..b5aafcb7e 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -4,11 +4,18 @@ <% unless send_ids.blank? %> <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
              <%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index b521bcb90..41133a91e 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -5,11 +5,18 @@ <% unless send_ids.blank? %> <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
              From b2aba0f0bc073e33030ec87ac8da360f174b9295 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:12:56 +0800 Subject: [PATCH 69/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E6=96=B0=E9=97=BB=E5=8F=91=E9=80=81=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E8=AF=BE=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_news.html.erb | 7 ++++++- app/views/users/_share_news_to_org.html.erb | 17 ++++++++++++----- app/views/users/_share_news_to_project.html.erb | 17 ++++++++++++----- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 4c7ec2b04..284f5b821 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -35,7 +35,12 @@
            • <% if User.current.logged? %>
                -
              • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
              • + <% if hidden_unproject_infos %> +
              • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
              • + <% else %> +
              • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %>
              • + <% end %> +
              • <%= link_to( l(:button_edit), diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb index 85d5e7104..c40e05199 100644 --- a/app/views/users/_share_news_to_org.html.erb +++ b/app/views/users/_share_news_to_org.html.erb @@ -1,11 +1,18 @@
                发送到
                - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
                <%= form_tag search_user_org_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb index d4c293304..c9c60198f 100644 --- a/app/views/users/_share_news_to_project.html.erb +++ b/app/views/users/_share_news_to_project.html.erb @@ -2,11 +2,18 @@
                发送到
                - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
                From efa162fdebed98bac0af00108640cefba516a60a Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:16:09 +0800 Subject: [PATCH 70/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_org_subfield_list.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index e567435a5..de37ed054 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -63,7 +63,11 @@
              • <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
                  -
                • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
                • + <% if hidden_unproject_infos %> +
                • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
                • + <% else %> +
                • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
                • + <% end %>
                • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
                • <% if file.container.try(:organization).try(:is_public?) %>
                • From 1444511fd9b78d67a128d43553b296b518950827 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:18:07 +0800 Subject: [PATCH 71/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=20=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_project_show.html.erb | 6 +++++- app/views/users/_share_message_to_org.html.erb | 17 ++++++++++++----- .../users/_share_message_to_project.html.erb | 17 ++++++++++++----- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index ff358f7c3..41c2f7d1f 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -116,7 +116,11 @@ ) if @message.destroyable_by?(User.current) %>
                • <% end %> -
                • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
                • + <% if hidden_unproject_infos %> +
                • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
                • + <% else %> +
                • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
                • + <% end %>
              diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb index 37575a8d5..8c1d81140 100644 --- a/app/views/users/_share_message_to_org.html.erb +++ b/app/views/users/_share_message_to_org.html.erb @@ -1,11 +1,18 @@
              发送到
              - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
              <%= form_tag search_user_org_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb index 89b36e22a..21abd85de 100644 --- a/app/views/users/_share_message_to_project.html.erb +++ b/app/views/users/_share_message_to_project.html.erb @@ -2,11 +2,18 @@
              发送到
              - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
              From c51f725a78c612c72d342a46fd966156077c46e8 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:24:16 +0800 Subject: [PATCH 72/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81=E4=B8=AD?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=20=E6=96=B0=E9=97=BB=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_project_news.html.erb | 7 ++++++- app/views/users/_project_message.html.erb | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 161221526..6b3e8e43c 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -38,7 +38,12 @@
            • <% if User.current.logged? %>
                -
              • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
              • + <% if hidden_unproject_infos %> +
              • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
              • + <% else %> +
              • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %>
              • + <% end %> +
              • <%= link_to(l(:button_edit), {:controller => 'news', :action => 'edit', :id => activity}, :class => 'postOptionLink') if activity.author == User.current %>
              • diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index afc45efde..5ee3ff0ba 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -68,7 +68,11 @@ ) if activity.destroyable_by?(User.current) %> <% end %> -
              • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
              • + <% if hidden_unproject_infos %> +
              • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
              • + <% else %> +
              • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
              • + <% end %>
            From 4903064a5ba651aa1003e9927d757831f8f1f76b Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 12:18:39 +0800 Subject: [PATCH 73/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E5=8F=91=E9=80=81=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 27 ++++++++++++++++++++ app/views/users/_user_resource_info.html.erb | 6 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 3f5138107..e6e9687f3 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -87,6 +87,33 @@ } + function show_send_hidden(){ + $("#contextMenu").hide(); + document.oncontextmenu = function() {return true;} + line.children().css("background-color",'white'); + id = line.children().last().html(); + user_id = line.children().eq(5).html(); + allow = line.children().eq(13).html(); + if( allow == 0){ + alert('您无权发送私有资源') + }else{ + if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>", + data:{send_type:'file'} + }); + }else{ + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>", + data:{send_type:'file'} + }); + } + } + + } + function batch_send(){ if($("#resources_list_form").serialize() == ""){ alert('暂时不支持多页选择,您当前页没有选择任何资源'); diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index e00489193..89f10e87b 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -45,7 +45,11 @@
          • 预览
          • 重命名
          • -
          • 发送
          • + <% if hidden_unproject_infos %> +
          • 发送
          • + <% else %> +
          • 发送
          • + <% end %>
          • 删除
        From 5527b4e3a9c39c1290b7037de5ed7cfcc4aa83cb Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 12:25:35 +0800 Subject: [PATCH 74/74] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E5=BA=95=E7=AB=AF=E5=8F=91=E9=80=81=E9=9A=90=E8=97=8F=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 29 ++++++++++++++++++++ app/views/users/_user_resource_info.html.erb | 12 ++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index e6e9687f3..77a2386fe 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -148,6 +148,35 @@ } } +// 隐藏非项目信息特用 + function batch_send_hidden(){ + if($("#resources_list_form").serialize() == ""){ + alert('暂时不支持多页选择,您当前页没有选择任何资源'); + return ; + } + if (lastSendType === '1'){ + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + }else if (lastSendType === '2'){ + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + } + else{ + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + + } + } + function preview(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index 89f10e87b..d3b169a17 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -23,9 +23,15 @@ 删除
        -
        - 发送至 -
        + <% if hidden_unproject_infos %> +
        + 发送至 +
        + <% else %> +
        + 发送至 +
        + <% end %>
        选择 0 个资源