From 863ec9d3967f0b208b31cf7fae96b7ecde94cfdb Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 22 Aug 2016 16:50:14 +0800 Subject: [PATCH 001/170] =?UTF-8?q?iphone=E4=B8=8B=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/app.html | 1 + public/assets/wechat/blog_detail.html | 2 +- public/assets/wechat/course_discussion.html | 2 +- public/assets/wechat/course_notice.html | 2 +- public/assets/wechat/homework_detail.html | 2 +- public/assets/wechat/issue_detail.html | 2 +- public/assets/wechat/jour_message_detail.html | 2 +- public/assets/wechat/project_discussion.html | 2 +- .../wechat/directives/iphone_recognize.js | 17 +++++++++++++++++ 9 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 public/javascripts/wechat/directives/iphone_recognize.js diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html index d49caedd5..5ab1dcb5a 100644 --- a/public/assets/wechat/app.html +++ b/public/assets/wechat/app.html @@ -39,6 +39,7 @@ + diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index c1e2fd2fd..daeec493d 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -69,7 +69,7 @@ -
+
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 3d7444c95..78a3fa0b7 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -66,7 +66,7 @@
-
+
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 95eeda60b..f991656b4 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -46,7 +46,7 @@
-
+
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 77aa0a48d..6ead09e69 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -70,7 +70,7 @@
-
+
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 14df1cfb1..b4d39d04e 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -52,7 +52,7 @@
-
+
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index b94bca8b2..41f7290e5 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -65,7 +65,7 @@
-
+
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index fef0a2f6e..4557ba55f 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -65,7 +65,7 @@
更多
-
+
diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js new file mode 100644 index 000000000..0d435e1a2 --- /dev/null +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -0,0 +1,17 @@ +/** + * Created by ttang on 2016/8/22. + */ +app.directive('iphoneRecognize',function(){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + var userAgent = navigator.userAgent; + if (/ipad|iphone|mac/i.test(navigator.userAgent)){ + element.css({"position":"relative","padding":"1px 0"}); + $(".post-wrapper").css("margin-bottom","0"); + $("#all_homework_reply").css("margin-bottom","0"); + } + } + } +}); \ No newline at end of file From b8dc444cc78e6dcde5b5d3befffa873062f650e7 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 23 Aug 2016 10:17:08 +0800 Subject: [PATCH 002/170] =?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 965d8930dcbbd4d7fa60ff083d59f8723ce72a14 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 10:23:46 +0800 Subject: [PATCH 003/170] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 24 ++++ public/assets/wechat/class.html | 134 +++++++++++++++++- .../javascripts/wechat/controllers/class.js | 118 ++++++++++++--- .../javascripts/wechat/controllers/project.js | 1 + 4 files changed, 257 insertions(+), 20 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 369185ca2..b28d3eca0 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -287,6 +287,30 @@ module Mobile end end + desc "获取课程动态" + params do + requires :id, type: Integer + requires :token, type: String + end + post 'activities' do + authenticate! + + user = current_user + + course_types = "('Message','News','HomeworkCommon','Poll','Course')" + activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') + + page = params[:page] ? params[:page] : 0 + all_count = activities.count + activities = activities.limit(10).offset(page * 10) + count = activities.count + present :data, activities, with: Mobile::Entities::Activity,user: user + present :all_count, all_count + present :count, count + present :page, page + present :status, 0 + end + desc "课程作业列表" params do requires :token, type: String diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index e720c90c9..a1eb45a52 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -16,7 +16,139 @@ -
+ +
+
+
+
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+ 迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
+ 缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} +
+
+
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+
+
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+ +
+
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
更多
+
+
+ +
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index d372f6826..a0c575d92 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -5,6 +5,39 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location var courseid = $routeParams.id; var tag = $routeParams.tag; + vm.course_activities_page = rms.get('course_activities_page') || 0; + vm.course_activities = rms.get("course_activities") || []; + vm.course_has_more = rms.get("course_has_more"); + + vm.course = rms.get("course") || null; + + var getClassActivities = function(page){ + $http({ + method: 'POST', + url: apiUrl + "courses/activities?id=" + courseid, + data:{token:auth.token(),page:page} + }).then(function successCallback(response) { + console.log(response.data); + if(response.data.status == 0){ + vm.class_activities_page = response.data.page; + if(response.data.page > 0) + { + vm.course_activities = vm.class_activities.concat(response.data.data); + } + else{ + vm.course_activities = response.data.data; + vm.course_activities_page = 0; + vm.course_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + } + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + + + }, function errorCallback(response) { + }); + }; var getUsers = function(){ if(vm.teachers.length<=0){ @@ -35,7 +68,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } ) } - } + }; var getResources = function(){ if(vm.resources.length<=0){ @@ -46,7 +79,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.resources_tag = true; }); } - } + }; var getHomeworks = function(){ if(vm.homeworks.length <=0){ @@ -56,7 +89,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.homeworks_tag = true; }); } - } + }; var getExercises = function(){ if(vm.exercises.length <=0){ @@ -66,7 +99,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.exercises_tag = true; }); } - } + }; vm.isTeacher = false; @@ -75,6 +108,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.currentTab = index; vm.searchText = ''; + vm.showActivities = false; vm.showClassMate = false; vm.showResources = false; vm.showHomework = false; @@ -84,35 +118,43 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.exercises_tag = false; if(vm.isTeacher){ - if(index == 1){ //课件 + if(index == 1){ + getClassActivities(0); + vm.showActivities = true; + } + else if(index == 2){ //课件 getResources(); vm.showResources = true; - } else if(index==2){ //作业 + } + else if(index==3){ //作业 getHomeworks(); vm.showHomework = true; - } else if(index==3){ //小测验 - getExercises(); - vm.showTestcase = true; - } else if(index==4){ //学生管理 + } + else if(index==4){ //学生管理 getUsers(); vm.showClassMate = true; } } else { - if(index == 2){ + if(index == 1){ + getClassActivities(0); + vm.showActivities = true; + } + else if(index == 3){ getUsers(); vm.showClassMate = true; - } else if(index==1){ + } + else if(index==2){ getResources(); vm.showResources = true; } } rms.save("tab_num",index); - } + }; vm.tabRecord = rms.get('tab_num') || 1; - vm.course = {}; +// vm.course = {}; vm.students = []; vm.teachers = []; vm.reviewers = []; //待审批 @@ -126,6 +168,11 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.alertService = alertService.create(); vm.invite = function(){ + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save("course_has_more",vm.course_has_more); + rms.save("course",vm.course); + $location.path("/invite_code").search({id: courseid}); }; @@ -133,7 +180,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.myresource_sendIndex = index; rms.save('myresource_sendIndex',index); $location.path("/send_class_list").search({id: r.id}); - } + }; $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( function(response) { @@ -161,12 +208,12 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location var resetMenu = function(is_teacher){ vm.isTeacher = is_teacher; if(is_teacher){ - vm.menus = ["课件", "作业", "测验", "成员管理"]; + vm.menus = ["动态", "课件", "作业", "成员管理"]; } else { - vm.menus = ['课件', "我的同学"]; + vm.menus = ['动态','课件', "我的同学"]; } - } + }; vm.onSetting = function(user){ rms.save('current_edit_member', user); @@ -178,8 +225,41 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location rms.save('current_course', vm.course); $location.path("/review_class_member").search({id: courseid,user_id: user.id}); - } + }; + //跳到详情页 + vm.goDetail = function(type, act_id,id){ + rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("course",vm.course); +// $location.path('/'+type+'/'+act_id); + $location.path("/"+type).search({id: act_id}); + }; + vm.addPraise = function(act){ + for(var i in vm.course_activities){ + if(vm.course_activities[i].act_id == act.act_id){ + vm.course_activities[i].praise_count += 1; + vm.course_activities[i].has_praise = true; + break; + } + } + + common.addCommonPraise(act); + }; + + vm.decreasePraise = function(act){ + for(var i in vm.course_activities){ + if(vm.course_activities[i].act_id == act.act_id){ + vm.course_activities[i].praise_count -= 1; + vm.course_activities[i].has_praise = false; + break; + } + } + + common.decreaseCommonPraise(act); + }; }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 08987e491..826a16424 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -114,6 +114,7 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut //跳到详情页 vm.goDetail = function(type, act_id,id){ rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); + rms.save('project_activities_page',vm.project_activities_page); rms.save("project_activities",vm.project_activities); rms.save('project_has_more', vm.project_has_more); rms.save("project",vm.project); From bbc0277d39aeb9484b3c57e1d2000faf66353057 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 10:23:55 +0800 Subject: [PATCH 004/170] =?UTF-8?q?iphone=E7=AB=AF=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86js=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/directives/iphone_recognize.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js index 0d435e1a2..fabba0e51 100644 --- a/public/javascripts/wechat/directives/iphone_recognize.js +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -8,9 +8,16 @@ app.directive('iphoneRecognize',function(){ link: function(scope, element){ var userAgent = navigator.userAgent; if (/ipad|iphone|mac/i.test(navigator.userAgent)){ - element.css({"position":"relative","padding":"1px 0"}); - $(".post-wrapper").css("margin-bottom","0"); - $("#all_homework_reply").css("margin-bottom","0"); + $("#postInput1").bind('focus',function(){ + element.css({"position":"relative","padding":"1px 0"}); + $(".post-wrapper").css("margin-bottom","0"); + $("#all_homework_reply").css("margin-bottom","0"); + }); + $("#postInput1").bind('blur',function(){ + element.css("position","fixed"); + $(".post-wrapper").css("margin-bottom","10px"); + $("#all_homework_reply").css("margin-bottom","50px"); + }); } } } From e473a18487ba4bf9265fbe0508cba636968b2aa1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 10:26:39 +0800 Subject: [PATCH 005/170] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=94=99=E5=88=86?= =?UTF-8?q?=E6=94=AF=20=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 24 ---- public/assets/wechat/class.html | 134 +----------------- .../javascripts/wechat/controllers/class.js | 66 ++------- .../javascripts/wechat/controllers/project.js | 1 - 4 files changed, 10 insertions(+), 215 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b28d3eca0..369185ca2 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -287,30 +287,6 @@ module Mobile end end - desc "获取课程动态" - params do - requires :id, type: Integer - requires :token, type: String - end - post 'activities' do - authenticate! - - user = current_user - - course_types = "('Message','News','HomeworkCommon','Poll','Course')" - activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') - - page = params[:page] ? params[:page] : 0 - all_count = activities.count - activities = activities.limit(10).offset(page * 10) - count = activities.count - present :data, activities, with: Mobile::Entities::Activity,user: user - present :all_count, all_count - present :count, count - present :page, page - present :status, 0 - end - desc "课程作业列表" params do requires :token, type: String diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index a1eb45a52..e720c90c9 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -16,139 +16,7 @@ - -
-
-
-
-
-
-
-
-
- -
{{act.latest_update}}
-
- -
-
- 迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
- 缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} -
-
-
- -
-
-
{{act.praise_count}}
-
{{act.praise_count}}
-
- -
-
-
-
-
- -
-
-
-
-
-
- -
{{act.latest_update}}
-
- -
-
-
-
-
- -
-
-
{{act.praise_count}}
-
{{act.praise_count}}
-
- -
-
-
-
-
- -
-
-
-
-
-
- -
{{act.latest_update}}
-
- -
-
-
- -
-
- -
-
-
{{act.praise_count}}
-
{{act.praise_count}}
-
- -
-
-
-
-
- - -
-
-
-
-
- - -
-
-
-
-
-
-
-
-
更多
-
-
- -
+
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index a0c575d92..cd6d57d34 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -5,29 +5,23 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location var courseid = $routeParams.id; var tag = $routeParams.tag; - vm.course_activities_page = rms.get('course_activities_page') || 0; - vm.course_activities = rms.get("course_activities") || []; - vm.course_has_more = rms.get("course_has_more"); - - vm.course = rms.get("course") || null; - var getClassActivities = function(page){ $http({ method: 'POST', - url: apiUrl + "courses/activities?id=" + courseid, + url: apiUrl + "projects/activities?id=" + projectid, data:{token:auth.token(),page:page} }).then(function successCallback(response) { console.log(response.data); if(response.data.status == 0){ - vm.class_activities_page = response.data.page; + vm.project_activities_page = response.data.page; if(response.data.page > 0) { - vm.course_activities = vm.class_activities.concat(response.data.data); + vm.project_activities = vm.project_activities.concat(response.data.data); } else{ - vm.course_activities = response.data.data; - vm.course_activities_page = 0; - vm.course_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + vm.project_activities = response.data.data; + vm.project_activities_page = 0; + vm.project_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; } } else{ @@ -108,7 +102,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.currentTab = index; vm.searchText = ''; - vm.showActivities = false; vm.showClassMate = false; vm.showResources = false; vm.showHomework = false; @@ -119,8 +112,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(vm.isTeacher){ if(index == 1){ - getClassActivities(0); - vm.showActivities = true; + getClassActivities(); } else if(index == 2){ //课件 getResources(); @@ -137,8 +129,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } else { if(index == 1){ - getClassActivities(0); - vm.showActivities = true; + getClassActivities(); } else if(index == 3){ getUsers(); @@ -154,7 +145,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.tabRecord = rms.get('tab_num') || 1; -// vm.course = {}; + vm.course = {}; vm.students = []; vm.teachers = []; vm.reviewers = []; //待审批 @@ -168,11 +159,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.alertService = alertService.create(); vm.invite = function(){ - rms.save('course_activities_page',vm.course_activities_page); - rms.save("course_activities",vm.course_activities); - rms.save("course_has_more",vm.course_has_more); - rms.save("course",vm.course); - $location.path("/invite_code").search({id: courseid}); }; @@ -227,39 +213,5 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/review_class_member").search({id: courseid,user_id: user.id}); }; - //跳到详情页 - vm.goDetail = function(type, act_id,id){ - rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); - rms.save('course_activities_page',vm.course_activities_page); - rms.save("course_activities",vm.course_activities); - rms.save('course_has_more', vm.course_has_more); - rms.save("course",vm.course); -// $location.path('/'+type+'/'+act_id); - $location.path("/"+type).search({id: act_id}); - }; - - vm.addPraise = function(act){ - for(var i in vm.course_activities){ - if(vm.course_activities[i].act_id == act.act_id){ - vm.course_activities[i].praise_count += 1; - vm.course_activities[i].has_praise = true; - break; - } - } - - common.addCommonPraise(act); - }; - - vm.decreasePraise = function(act){ - for(var i in vm.course_activities){ - if(vm.course_activities[i].act_id == act.act_id){ - vm.course_activities[i].praise_count -= 1; - vm.course_activities[i].has_praise = false; - break; - } - } - - common.decreaseCommonPraise(act); - }; }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 826a16424..08987e491 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -114,7 +114,6 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut //跳到详情页 vm.goDetail = function(type, act_id,id){ rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); - rms.save('project_activities_page',vm.project_activities_page); rms.save("project_activities",vm.project_activities); rms.save('project_has_more', vm.project_has_more); rms.save("project",vm.project); From 461912bec260ec66978308d7cf18a70b4dfb9369 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 23 Aug 2016 10:50:51 +0800 Subject: [PATCH 006/170] =?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 34acb1aa2f2509fc5597863c3c1cda198b523141 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 11:05:49 +0800 Subject: [PATCH 007/170] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E5=B8=83=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class.html | 10 ++++++---- public/assets/wechat/project.html | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index a1eb45a52..764bff0a5 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -17,7 +17,7 @@ -
+
@@ -143,9 +143,13 @@
-
+
更多
+
@@ -198,7 +202,5 @@ 请登录Trustie网站,在PC浏览器中上传测验。

- -
diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 733f0899d..5da7a68c7 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -5,7 +5,7 @@ {{menu}}
-
+
@@ -95,9 +95,12 @@
-
+
更多
+
From 7d671c77583c2135c14e0fb39b7f70e5110dc2a9 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 15:04:48 +0800 Subject: [PATCH 008/170] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86padding=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/weui/weixin.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 7375fc80c..52125b768 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -220,7 +220,7 @@ a.underline {text-decoration:underline;} .amount-arrow {height:14px; line-height:14px; vertical-align:middle; margin-top:12px;} .new-class-btn {font-size:15px; color:#fff; background-color:#3b94d6; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;} .join-class-btn {font-size:15px; color:#444; background-color:#ccc; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;} -.new-class-input {width:60%; color:#555; height:16px; line-height:16px; border:none; outline:none; padding:11px 0;} +.new-class-input {width:60%; color:#555; height:16px; line-height:16px; border:none; outline:none; padding:10px 0;} .class-list-setting {position:absolute; top:11px; right:10px;} .class-setting-wrap {width:38px; height:38px; position:absolute; top:0; right:0;} From c8c5f5d415b25d87ab17a7d6a291e03de9f563b2 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 16:36:59 +0800 Subject: [PATCH 009/170] =?UTF-8?q?iphone=E4=B8=8Bflex=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/weui/weixin.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 52125b768..25293a027 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -92,14 +92,14 @@ a.underline {text-decoration:underline;} /*tab*/ .tab-wrap {position:relative; width:100%; line-height:38px; display:-webkit-box; display:-moz-box; display:-ms-flexbox; display:-webkit-flex; display:flex; font-size:13px; background-color:#fff;} -.tab-wrap a {position:relative; display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; flex:1;} +.tab-wrap a {position:relative; display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; -webkit-flex:1; flex:1;} .tab-wrap a:first-child:after {display:none;} .tab-wrap a:after {content:" "; position:absolute; left:0; top:0; width:1px; height:100%; border-left:1px solid #ccc; color:#707070;} .weixin-tab {text-align:center; border-bottom:1px solid #ccc;} /*bottom-tab*/ .bottom-tab-wrap {position:fixed; width:100%; bottom:0; line-height:38px; display:-webkit-box; display:-moz-box; display:-ms-flexbox; display:-webkit-flex; display:flex; font-size:13px; background-color:#fff;} -.bottom-tab-wrap a {display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; flex:1; position:relative;} +.bottom-tab-wrap a {display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; -webkit-flex:1; flex:1; position:relative;} .bottom-tab-wrap a:after {content:" "; position:absolute; left:0; top:0; width:1px; height:100%; border-left:1px solid #ccc; color:#707070;} /*动态样式*/ From c612104fabf9fcd4c620e015aee55fb2ac468dee Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 16:52:35 +0800 Subject: [PATCH 010/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=91=E5=B8=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 79 +++++++++++++++ app/api/mobile/apis/projects.rb | 39 ++++++++ public/assets/wechat/class.html | 4 +- public/assets/wechat/class_publishissue.html | 14 +++ public/assets/wechat/class_publishnotice.html | 14 +++ public/assets/wechat/project.html | 2 +- public/assets/wechat/project_publishnote.html | 14 +++ .../javascripts/wechat/controllers/class.js | 96 ++++++++++++++----- .../wechat/controllers/class_list.js | 5 + .../wechat/controllers/class_publishissue.js | 73 ++++++++++++++ .../wechat/controllers/class_publishnotice.js | 72 ++++++++++++++ .../javascripts/wechat/controllers/project.js | 15 +++ .../wechat/controllers/project_publishnote.js | 74 ++++++++++++++ public/javascripts/wechat/others/routes.js | 3 + 14 files changed, 475 insertions(+), 29 deletions(-) create mode 100644 public/assets/wechat/class_publishissue.html create mode 100644 public/assets/wechat/class_publishnotice.html create mode 100644 public/assets/wechat/project_publishnote.html create mode 100644 public/javascripts/wechat/controllers/class_publishissue.js create mode 100644 public/javascripts/wechat/controllers/class_publishnotice.js create mode 100644 public/javascripts/wechat/controllers/project_publishnote.js diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b28d3eca0..bfd559402 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -582,6 +582,85 @@ module Mobile end end + desc "发布班级通知" + params do + requires :id, type: Integer + requires :token, type: String + requires :text, type: String + requires :title, type: String + end + post ':id/publishnotice' do + authenticate! + + #老师或教辅才能发通知 + c = Course.find("#{params[:id]}") + + my_member = c.member_principals.where("users.id=#{current_user.id}").first + + roles_ids = [] + my_member.roles.each do |role| + roles_ids << role.id + end + if my_member && (roles_ids.include?(7)|| roles_ids.include?(9) || roles_ids.include?(3)) + + tmpparams = {} + tmpparams['title'] = params[:title] + tmpparams['description'] = params[:text] + tmpparams['sticky'] = 0 + + news = News.new(:course => c, :author => current_user) + #render :layout => 'base_courses' + news.safe_attributes = tmpparams + + news.save! + + present :status, 0 + else + present :status, -1 + present :message,"学生不能发布通知" + end + end + + desc "发布班级问题" + params do + requires :id, type: Integer + requires :token, type: String + requires :text, type: String + end + post ':id/publishissue' do + authenticate! + + c = Course.find("#{params[:id]}") + + boards = c.boards.includes(:last_message => :author).all + if c.boards.empty? + board = c.boards.build + board.name = "班级问答区" + board.description = c.name.to_s + board.project_id = -1 + if board.save + boards = c.boards.includes(:last_message => :author).all + end + end + + board = boards.first + + message = Message.new + message.author = current_user + message.board = board + + tmpparams = {} + tmpparams['subject'] = params[:title] + tmpparams['content'] = params[:text] + + message.safe_attributes = tmpparams + + message.save! + + present :status, 0 + + end + end end end diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb index 05d4036f9..2202fbd13 100644 --- a/app/api/mobile/apis/projects.rb +++ b/app/api/mobile/apis/projects.rb @@ -229,6 +229,45 @@ module Mobile present :message, result[:message] end + desc "发布项目帖子" + params do + requires :id, type: Integer + requires :token, type: String + requires :text, type: String + end + post ':id/publishnote' do + authenticate! + + project = Project.find("#{params[:id]}") + + boards = project.boards.includes(:last_message => :author).all + if project.boards.empty? + board = project.boards.build + board.name = "项目讨论区" + board.description = project.name.to_s + board.course_id = -1 + if board.save + boards = project.boards.includes(:last_message => :author).all + end + end + + board = boards.first + + message = Message.new + message.author = current_user + message.board = board + + tmpparams = {} + tmpparams['subject'] = params[:title] + tmpparams['content'] = params[:text] + + message.safe_attributes = tmpparams + + message.save! + + present :status, 0 + + end end end end diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 764bff0a5..d60aed1bd 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -147,8 +147,8 @@
更多
diff --git a/public/assets/wechat/class_publishissue.html b/public/assets/wechat/class_publishissue.html new file mode 100644 index 000000000..1d840239c --- /dev/null +++ b/public/assets/wechat/class_publishissue.html @@ -0,0 +1,14 @@ +
+
+ +
{{current_course.name}}
+
标题
+
+
+ 取消 + 确定 +
+ + + +
\ No newline at end of file diff --git a/public/assets/wechat/class_publishnotice.html b/public/assets/wechat/class_publishnotice.html new file mode 100644 index 000000000..25c485737 --- /dev/null +++ b/public/assets/wechat/class_publishnotice.html @@ -0,0 +1,14 @@ +
+
+ +
{{current_course.name}}
+
标题
+
+
+ 取消 + 确定 +
+ + + +
\ No newline at end of file diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 5da7a68c7..5b460ecad 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -99,7 +99,7 @@
更多
diff --git a/public/assets/wechat/project_publishnote.html b/public/assets/wechat/project_publishnote.html new file mode 100644 index 000000000..5da49397c --- /dev/null +++ b/public/assets/wechat/project_publishnote.html @@ -0,0 +1,14 @@ +
+
+ +
{{current_project.name}}
+
标题
+
+
+ 取消 + 确定 +
+ + + +
\ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index a0c575d92..91641ddcd 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -1,4 +1,4 @@ -app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common){ +app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout){ // common.checkLogin(); var vm = $scope; @@ -103,7 +103,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.isTeacher = false; - vm.currentTab = 1; +// vm.currentTab = 1; + + vm.currentTab = rms.get('tab_num'); + vm.tab = function(index){ vm.currentTab = index; vm.searchText = ''; @@ -119,7 +122,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(vm.isTeacher){ if(index == 1){ - getClassActivities(0); + if(vm.course_activities.length <= 0){ + getClassActivities(0); + } vm.showActivities = true; } else if(index == 2){ //课件 @@ -137,7 +142,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } else { if(index == 1){ - getClassActivities(0); + if(vm.course_activities.length <= 0){ + getClassActivities(0); + } vm.showActivities = true; } else if(index == 3){ @@ -149,10 +156,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.showResources = true; } } - rms.save("tab_num",index); + rms.save("tab_num",vm.currentTab); }; - vm.tabRecord = rms.get('tab_num') || 1; +// vm.tabRecord = rms.get('tab_num') || 1; // vm.course = {}; vm.students = []; @@ -182,48 +189,61 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/send_class_list").search({id: r.id}); }; - $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( - function(response) { - console.log(response.data); + if(!vm.currentTab){ + $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( + function(response) { + console.log(response.data); - if (response.data.status == 0){ - vm.course = response.data.data; - resetMenu(vm.course.current_user_is_teacher,vm.tabRecord); - if(tag){ - vm.tab(4); - tag = null; + if (response.data.status == 0){ + vm.course = response.data.data; + resetMenu(vm.course.current_user_is_teacher,vm.currentTab); + if(tag){ + vm.tab(4); + tag = null; + vm.currentTab = 4; + } + else{ + vm.currentTab = 1; + vm.tab(vm.currentTab); + } } else{ - vm.tab(vm.tabRecord); + vm.alertService.showMessage('提示', response.data.message); } + } - else{ - vm.alertService.showMessage('提示', response.data.message); - } + ); + }else { + $timeout(function(){ + window.scrollTo(0, rms.get("yoffset")); + }); + } - } - ); - - - var resetMenu = function(is_teacher){ + var resetMenu = function(is_teacher,index){ vm.isTeacher = is_teacher; if(is_teacher){ vm.menus = ["动态", "课件", "作业", "成员管理"]; } else { vm.menus = ['动态','课件', "我的同学"]; } - + vm.tab(index); }; + if(vm.course){ + resetMenu(vm.course.current_user_is_teacher,vm.currentTab); + } + + vm.onSetting = function(user){ rms.save('current_edit_member', user); + rms.save("tab_num",vm.currentTab); $location.path("/edit_class_member").search({id: courseid,user_id: user.id}); }; vm.review = function(user){ rms.save('current_review_member', user); rms.save('current_course', vm.course); - + rms.save("tab_num",vm.currentTab); $location.path("/review_class_member").search({id: courseid,user_id: user.id}); }; @@ -233,6 +253,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location rms.save('course_activities_page',vm.course_activities_page); rms.save("course_activities",vm.course_activities); rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); rms.save("course",vm.course); // $location.path('/'+type+'/'+act_id); $location.path("/"+type).search({id: act_id}); @@ -262,4 +283,27 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location common.decreaseCommonPraise(act); }; + vm.goPublishNotice = function(){ + if(!vm.isTeacher){ + return; + } + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); + rms.save("course",vm.course); + rms.save('current_course', vm.course); + $location.path("/class_publishnotice").search({id:courseid}); + }; + + vm.goPublishIssue = function(){ + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); + rms.save("course",vm.course); + rms.save('current_course', vm.course); + $location.path("/class_publishissue").search({id:courseid}); + }; + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class_list.js b/public/javascripts/wechat/controllers/class_list.js index cc5250970..5d3ca5b93 100644 --- a/public/javascripts/wechat/controllers/class_list.js +++ b/public/javascripts/wechat/controllers/class_list.js @@ -49,6 +49,11 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo } vm.goClass = function (course_id) { + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + rms.save("course",null); + rms.save("tab_num",null); console.log(course_id); $location.path("/class").search({id: course_id}); } diff --git a/public/javascripts/wechat/controllers/class_publishissue.js b/public/javascripts/wechat/controllers/class_publishissue.js new file mode 100644 index 000000000..1cd7f1285 --- /dev/null +++ b/public/javascripts/wechat/controllers/class_publishissue.js @@ -0,0 +1,73 @@ +app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){ +// common.checkLogin(); + + var vm = $scope; + vm.current_course = rms.get('current_course'); + + vm.issuetitle = ""; + vm.issue = ""; + var course_id = $routeParams.id; + + vm.alertService = alertService.create(); + + if(!vm.current_course){ + $http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then( + function(response) { + console.log(response.data); + if (response.data.status == 0){ + vm.current_course = response.data.data; + console.log("courses"); + console.log(response.data.data); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + if(!vm.current_course){ + vm.tip_1 = "该班级不存在或已被删除"; + } + + } + ); + } + + vm.cancel = function(){ + window.history.back(); + }; + + //发布问题 即项目讨论区 + vm.publishIssue = function(){ + if(vm.issuetitle.length == 0) + { + vm.alertService.showMessage('提示', '标题不能为空'); + return; + } + + if(vm.issue.length == 0) + { + vm.alertService.showMessage('提示', '内容不能为空'); + return; + } + + var text = vm.issue.replace(/\n/g,'
'); + + $http.post(config.apiUrl + "courses/"+course_id+"/publishissue", + {token: auth.token(),title: vm.issuetitle, text: text} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService.showMessage('提示', '您已成功发布问题',function(){ + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + $location.path("/class").search({id: course_id}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + + } + }); + + }; + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class_publishnotice.js b/public/javascripts/wechat/controllers/class_publishnotice.js new file mode 100644 index 000000000..a0b9ab676 --- /dev/null +++ b/public/javascripts/wechat/controllers/class_publishnotice.js @@ -0,0 +1,72 @@ +app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){ +// common.checkLogin(); + + var vm = $scope; + vm.current_course = rms.get('current_course'); + + var course_id = $routeParams.id; + + vm.alertService = alertService.create(); + + vm.noticetitle = ""; + vm.notice = ""; + + if(!vm.current_course){ + $http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then( + function(response) { + console.log(response.data); + if (response.data.status == 0){ + vm.current_course = response.data.data; + console.log("courses"); + console.log(response.data.data); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + if(!vm.current_course){ + vm.tip_1 = "该班级不存在或已被删除"; + } + + } + ); + } + vm.cancel = function(){ + window.history.back(); + }; + + //发布通知 只有老师能发布 + vm.publishNotice = function(){ + if(vm.noticetitle.length == 0) + { + vm.alertService.showMessage('提示', '标题不能为空'); + return; + } + + if(vm.notice.length == 0) + { + vm.alertService.showMessage('提示', '内容不能为空'); + return; + } + + var text = vm.notice.replace(/\n/g,'
'); + + $http.post(config.apiUrl + "courses/"+course_id+"/publishnotice", + {token: auth.token(),title: vm.noticetitle, text: text} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService.showMessage('提示', '您已成功发布通知',function(){ + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + $location.path("/class").search({id: course_id}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); + + }; + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 826a16424..c45696668 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -238,4 +238,19 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut $location.path("/review_project_member").search({id: projectid,user_id: user.id}); } + vm.goPublishNote = function(){ + rms.save('project_activities_page',vm.project_activities_page); + rms.save("project_activities",vm.project_activities); + rms.save("project_has_more",vm.project_has_more); + + rms.save("project",vm.project); + rms.save("project_master_members",vm.project_master_members); + rms.save("project_develop_members",vm.project_develop_members); + rms.save("project_report_members",vm.project_report_members); + rms.save("review_master_members",vm.review_master_members); + rms.save("review_develop_members",vm.review_develop_members); + rms.save('current_project', vm.project); + $location.path("/project_publishnote").search({id:projectid}); + }; + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project_publishnote.js b/public/javascripts/wechat/controllers/project_publishnote.js new file mode 100644 index 000000000..231faaea6 --- /dev/null +++ b/public/javascripts/wechat/controllers/project_publishnote.js @@ -0,0 +1,74 @@ +app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){ +// common.checkLogin(); + + var vm = $scope; + vm.current_project = rms.get('current_project'); + + var project_id = $routeParams.id; + + vm.alertService = alertService.create(); + + vm.notetitle = ""; + vm.note = ""; + + if(!vm.current_project){ + $http.get(config.apiUrl+ 'projects/'+project_id+"?token="+auth.token()).then( + function(response) { + console.log(response.data); + if (response.data.status == 0){ + vm.current_project = response.data.data; + console.log("projects"); + console.log(response.data.data); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + + if(!vm.current_project){ + vm.tip_1 = "该项目不存在或已被删除"; + } + + } + ); + } + vm.cancel = function(){ + window.history.back(); + }; + + //发布通知 只有老师能发布 + vm.publishNote = function(){ + if(vm.notetitle.length == 0) + { + vm.alertService.showMessage('提示', '标题不能为空'); + return; + } + + if(vm.note.length == 0) + { + vm.alertService.showMessage('提示', '内容不能为空'); + return; + } + + var text = vm.note.replace(/\n/g,'
'); + + $http.post(config.apiUrl + "projects/"+project_id+"/publishnote", + {token: auth.token(),title: vm.notetitle, text: text} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService.showMessage('提示', '您已成功发布帖子',function(){ + rms.save('project_activities_page',0); + rms.save("project_activities",[]); + rms.save("project_has_more",false); + rms.save('tab_num',null); + $location.path("/project").search({id: project_id}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); + + }; + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index 7311c66c1..2182e16ee 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -40,6 +40,8 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController')) .when('/join_class', makeRoute('join_class.html', 'JoinClassController')) .when('/review_class_member', makeRoute('review_class_member.html', 'ReviewClassMemberController')) + .when('/class_publishnotice', makeRoute('class_publishnotice.html', 'ClassPublishNoticeController')) + .when('/class_publishissue', makeRoute('class_publishissue.html', 'ClassPublishIssueController')) .when('/project_list', makeRoute('project_list.html', 'ProjectListController')) .when('/project', makeRoute('project.html', 'ProjectController')) .when('/edit_project_member', makeRoute('edit_project_member.html', 'EditProjectMemberController')) @@ -47,6 +49,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/project_invite_code', {templateUrl: rootPath + 'project_invite_code.html', controller: 'ProjectInviteCodeController'}) .when('/join_project', makeRoute('join_project.html', 'JoinProjectController')) .when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController')) + .when('/project_publishnote', makeRoute('project_publishnote.html', 'ProjectPublishNoteController')) .when('/login_tip', makeRoute('login_tip.html', 'LoginTipController')) .otherwise({ redirectTo: '/activites' From 74b15229fb8c7b2359aca672b5a98df6fe11b670 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 23 Aug 2016 17:15:51 +0800 Subject: [PATCH 011/170] =?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 c5cedbfcc26d1a8beb88517216904010bf69ef0a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 17:37:23 +0800 Subject: [PATCH 012/170] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=92=8C=E9=A1=B9=E7=9B=AE=E5=AE=A1=E6=A0=B8=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 8 ++++++-- app/services/wechat_service.rb | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index cfa5f4414..b21d82e87 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -435,8 +435,12 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - if params[:userid] - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&userid=#{params[:userid]}" and return + if params[:state].match("review_class_member") || params[:state].match("review_project_member") + useridstr = params[:state].split('/')[1] + end + + if useridstr + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return elsif params[:id] redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return else diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 3b6cfe930..c28c5f7b2 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -115,8 +115,8 @@ class WechatService # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}" tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 - tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - # tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 + # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { touser:openid, @@ -149,8 +149,8 @@ class WechatService # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}" tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 - tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - # tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 + # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { @@ -188,8 +188,8 @@ class WechatService # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}" tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 - tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - # tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 + # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { From 3af5bc581321575e4e78a53062eae363bc6c5904 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 17:42:48 +0800 Subject: [PATCH 013/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/wechat_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index c28c5f7b2..a9a62bc66 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -116,7 +116,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { touser:openid, @@ -150,7 +150,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { @@ -189,7 +189,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { From e0ab93b739936740f0fb1129a1d051c784b97e97 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 09:30:28 +0800 Subject: [PATCH 014/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index b21d82e87..b06a72137 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -436,6 +436,7 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] if params[:state].match("review_class_member") || params[:state].match("review_project_member") + @path = params[:state].split('/')[0] useridstr = params[:state].split('/')[1] end From 2e1e9391b6600772951a4f4088d64ea082bbb4cd Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 09:39:41 +0800 Subject: [PATCH 015/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/wechat_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index a9a62bc66..c28c5f7b2 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -116,7 +116,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { touser:openid, @@ -150,7 +150,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { @@ -189,7 +189,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { From 0eb1c1a392e4283941a7025b41ac18cd0793918d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 09:45:18 +0800 Subject: [PATCH 016/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index b06a72137..54486221e 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -435,11 +435,10 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - if params[:state].match("review_class_member") || params[:state].match("review_project_member") + # if params[:state].match("review_class_member") || params[:state].match("review_project_member") @path = params[:state].split('/')[0] useridstr = params[:state].split('/')[1] - end - + # end if useridstr redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return elsif params[:id] From 57ecffc130a637456d5a0df4e0bd6eddc808d7ab Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 24 Aug 2016 10:28:09 +0800 Subject: [PATCH 017/170] =?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 018/170] =?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 f8dfe85156ffd19ea38a6cc6834e8342408819d6 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 11:03:38 +0800 Subject: [PATCH 019/170] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A8=A1=E7=89=88=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 21 ++++++++++++++++ app/services/projects_service.rb | 24 +++++++++++++++++++ app/services/wechat_service.rb | 13 +++++++++- config/wechat.yml.template | 1 + config/wechat.yml.test | 1 + public/assets/wechat/class.html | 2 +- public/assets/wechat/send_class_list.html | 2 +- .../javascripts/wechat/controllers/class.js | 13 +++++++++- .../wechat/controllers/send_class_list.js | 1 + 9 files changed, 74 insertions(+), 4 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 63ef30b35..b0c83e869 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -189,6 +189,15 @@ class IssuesController < ApplicationController # 给该issue在它所在的项目中所有的issues中所在的位置给一个序号 @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save + + senduser = User.find(params[:issue][:assigned_to_id]) + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| format.html { @@ -581,6 +590,18 @@ class IssuesController < ApplicationController end end @issue.safe_attributes = issue_attributes + + senduser = User.find(params[:issue][:assigned_to_id]) + + if senduser.id != User.current.id + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + end + @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) true diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 56dfaceff..8de96fff4 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -331,4 +331,28 @@ class ProjectsService {:status => status,:message => message} end + def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id + count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + if count == 0 + title = "您有新的issue需要解决" + remark = "点击详情查看issue" + + case priority_id + when 1 + priority = "低" + when + priority = "正常" + when + priority = "高" + when + priority = "紧急" + when + priority = "立刻" + end + + ws = WechatService.new + ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark + end + end + end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index c28c5f7b2..e1b849c13 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -417,8 +417,19 @@ class WechatService end Rails.logger.info "send over. #{req}" end + end - + def project_issue_notice(user_id, type, id, first, key1, key2,remark="") + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[project_issue_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end end end \ No newline at end of file diff --git a/config/wechat.yml.template b/config/wechat.yml.template index e6b942f09..adda8e7e8 100644 --- a/config/wechat.yml.template +++ b/config/wechat.yml.template @@ -24,6 +24,7 @@ default: &default create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs" project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E" join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg" + project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/config/wechat.yml.test b/config/wechat.yml.test index c0676cc26..8c0dafc2f 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -24,6 +24,7 @@ default: &default create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" + project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index d60aed1bd..8ab2a7d03 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -190,7 +190,7 @@
      - +
      {{r.homework_name}}发送

      暂无作业,
      请登录Trustie网站,在PC浏览器中上传作业。

      diff --git a/public/assets/wechat/send_class_list.html b/public/assets/wechat/send_class_list.html index b6d250d5d..1fe699a20 100644 --- a/public/assets/wechat/send_class_list.html +++ b/public/assets/wechat/send_class_list.html @@ -8,7 +8,7 @@
      {{syllabus.title}}
        -
      • +
      diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 91641ddcd..95d108151 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -186,7 +186,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.sendFile = function(r,index){ vm.myresource_sendIndex = index; rms.save('myresource_sendIndex',index); - $location.path("/send_class_list").search({id: r.id}); + $location.path("/send_class_list").search({id: r.id,course_id: courseid}); }; if(!vm.currentTab){ @@ -306,4 +306,15 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/class_publishissue").search({id:courseid}); }; + vm.goHomeworkDetail = function(id){ + rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); + rms.save("course",vm.course); +// $location.path('/'+type+'/'+act_id); + $location.path("/homework").search({id: id}); + } + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/send_class_list.js b/public/javascripts/wechat/controllers/send_class_list.js index ead0860f5..815d0d4b3 100644 --- a/public/javascripts/wechat/controllers/send_class_list.js +++ b/public/javascripts/wechat/controllers/send_class_list.js @@ -3,6 +3,7 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co var vm = $scope; var send_id = $routeParams.id; + vm.course_id = $routeParams.course_id; //发送类别 1课件 2作业 3测验 vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1; From bd3911c072fb457fcd74f42212ebc812a4254f7a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 11:22:34 +0800 Subject: [PATCH 020/170] . --- app/controllers/issues_controller.rb | 34 ++++++++++---------- app/services/projects_service.rb | 46 ++++++++++++++-------------- app/services/wechat_service.rb | 24 +++++++-------- config/wechat.yml.test | 1 - 4 files changed, 52 insertions(+), 53 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b0c83e869..1e79f64bf 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -190,13 +190,13 @@ class IssuesController < ApplicationController @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save - senduser = User.find(params[:issue][:assigned_to_id]) - issue_id = @issue.id - issue_title = params[:issue][:subject] - priority_id = params[:issue][:priority_id] - - ps = ProjectsService.new - ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + # senduser = User.find(params[:issue][:assigned_to_id]) + # issue_id = @issue.id + # issue_title = params[:issue][:subject] + # priority_id = params[:issue][:priority_id] + # + # ps = ProjectsService.new + # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| @@ -591,16 +591,16 @@ class IssuesController < ApplicationController end @issue.safe_attributes = issue_attributes - senduser = User.find(params[:issue][:assigned_to_id]) - - if senduser.id != User.current.id - issue_id = @issue.id - issue_title = params[:issue][:subject] - priority_id = params[:issue][:priority_id] - - ps = ProjectsService.new - ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id - end + # senduser = User.find(params[:issue][:assigned_to_id]) + # + # if senduser.id != User.current.id + # issue_id = @issue.id + # issue_title = params[:issue][:subject] + # priority_id = params[:issue][:priority_id] + # + # ps = ProjectsService.new + # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + # end @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 8de96fff4..5f8d5323a 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -331,28 +331,28 @@ class ProjectsService {:status => status,:message => message} end - def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id - count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count - if count == 0 - title = "您有新的issue需要解决" - remark = "点击详情查看issue" - - case priority_id - when 1 - priority = "低" - when - priority = "正常" - when - priority = "高" - when - priority = "紧急" - when - priority = "立刻" - end - - ws = WechatService.new - ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark - end - end + # def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id + # count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + # if count == 0 + # title = "您有新的issue需要解决" + # remark = "点击详情查看issue" + # + # case priority_id + # when 1 + # priority = "低" + # when + # priority = "正常" + # when + # priority = "高" + # when + # priority = "紧急" + # when + # priority = "立刻" + # end + # + # ws = WechatService.new + # ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark + # end + # end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index e1b849c13..429c95f60 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -419,17 +419,17 @@ class WechatService end end - def project_issue_notice(user_id, type, id, first, key1, key2,remark="") - uw = UserWechat.where(user_id: user_id).first - unless uw.nil? - data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark - begin - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) - rescue Exception => e - Rails.logger.error "[project_issue_notice] ===> #{e}" - end - Rails.logger.info "send over. #{req}" - end - end + # def project_issue_notice(user_id, type, id, first, key1, key2,remark="") + # uw = UserWechat.where(user_id: user_id).first + # unless uw.nil? + # data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark + # begin + # req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + # rescue Exception => e + # Rails.logger.error "[project_issue_notice] ===> #{e}" + # end + # Rails.logger.info "send over. #{req}" + # end + # end end \ No newline at end of file diff --git a/config/wechat.yml.test b/config/wechat.yml.test index 8c0dafc2f..c0676cc26 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -24,7 +24,6 @@ default: &default create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" - project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" From e0957113d811d9b1be025bc5691a6db2975d7faf Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 11:28:50 +0800 Subject: [PATCH 021/170] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 34 ++++++++++---------- app/services/projects_service.rb | 46 ++++++++++++++-------------- app/services/wechat_service.rb | 24 +++++++-------- config/wechat.yml.test | 1 + 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 1e79f64bf..b0c83e869 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -190,13 +190,13 @@ class IssuesController < ApplicationController @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save - # senduser = User.find(params[:issue][:assigned_to_id]) - # issue_id = @issue.id - # issue_title = params[:issue][:subject] - # priority_id = params[:issue][:priority_id] - # - # ps = ProjectsService.new - # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + senduser = User.find(params[:issue][:assigned_to_id]) + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| @@ -591,16 +591,16 @@ class IssuesController < ApplicationController end @issue.safe_attributes = issue_attributes - # senduser = User.find(params[:issue][:assigned_to_id]) - # - # if senduser.id != User.current.id - # issue_id = @issue.id - # issue_title = params[:issue][:subject] - # priority_id = params[:issue][:priority_id] - # - # ps = ProjectsService.new - # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id - # end + senduser = User.find(params[:issue][:assigned_to_id]) + + if senduser.id != User.current.id + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + end @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 5f8d5323a..8de96fff4 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -331,28 +331,28 @@ class ProjectsService {:status => status,:message => message} end - # def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id - # count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count - # if count == 0 - # title = "您有新的issue需要解决" - # remark = "点击详情查看issue" - # - # case priority_id - # when 1 - # priority = "低" - # when - # priority = "正常" - # when - # priority = "高" - # when - # priority = "紧急" - # when - # priority = "立刻" - # end - # - # ws = WechatService.new - # ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark - # end - # end + def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id + count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + if count == 0 + title = "您有新的issue需要解决" + remark = "点击详情查看issue" + + case priority_id + when 1 + priority = "低" + when + priority = "正常" + when + priority = "高" + when + priority = "紧急" + when + priority = "立刻" + end + + ws = WechatService.new + ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark + end + end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 429c95f60..423676983 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -419,17 +419,17 @@ class WechatService end end - # def project_issue_notice(user_id, type, id, first, key1, key2,remark="") - # uw = UserWechat.where(user_id: user_id).first - # unless uw.nil? - # data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark - # begin - # req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) - # rescue Exception => e - # Rails.logger.error "[project_issue_notice] ===> #{e}" - # end - # Rails.logger.info "send over. #{req}" - # end - # end + def project_issue_notice(user_id, type, id, first, key1, key2,remark="",uid=0) + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark,0 + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[project_issue_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end + end end \ No newline at end of file diff --git a/config/wechat.yml.test b/config/wechat.yml.test index c0676cc26..8c0dafc2f 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -24,6 +24,7 @@ default: &default create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" + project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" From 7d89f69981c6bd27d331ba02a50408fc5a9b264f Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 24 Aug 2016 15:58:23 +0800 Subject: [PATCH 022/170] =?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 023/170] =?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 f35c3e85285e0eef2bbd751e358a33f445d2b058 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 09:45:23 +0800 Subject: [PATCH 024/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E3=80=81issue=E5=A2=9E=E5=8A=A0=E4=BA=8C=E7=BA=A7=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/activities.rb | 2 +- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/apis/issues.rb | 16 ++- app/api/mobile/apis/newss.rb | 15 ++- app/api/mobile/entities/activity.rb | 4 + app/api/mobile/entities/issue.rb | 120 +++++++++++++++++- app/api/mobile/entities/news.rb | 109 +++++++++++++++- app/services/projects_service.rb | 8 +- public/assets/wechat/activities.html | 72 +++++++++++ public/assets/wechat/class.html | 79 +++++++++++- public/assets/wechat/course_notice.html | 57 +++++++-- public/assets/wechat/issue_detail.html | 45 ++++++- public/assets/wechat/myresource.html | 2 +- .../wechat/templates/comment_reply.html | 4 +- .../javascripts/wechat/controllers/class.js | 8 +- .../wechat/controllers/course_notice.js | 33 ++++- .../javascripts/wechat/controllers/issue.js | 31 ++++- .../wechat/controllers/myresource.js | 5 + 18 files changed, 553 insertions(+), 59 deletions(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 4d07c23f8..69d9ef524 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -29,7 +29,7 @@ module Mobile if container_type == "All" || container_type == "Course" shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course')" + course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" end page = params[:page] ? params[:page] : 0 diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index bfd559402..d26779332 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -297,7 +297,7 @@ module Mobile user = current_user - course_types = "('Message','News','HomeworkCommon','Poll','Course')" + course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') page = params[:page] ? params[:page] : 0 diff --git a/app/api/mobile/apis/issues.rb b/app/api/mobile/apis/issues.rb index dfd5a3335..271e3419d 100644 --- a/app/api/mobile/apis/issues.rb +++ b/app/api/mobile/apis/issues.rb @@ -17,11 +17,21 @@ module Mobile #0一级回复的更多 1 二级回复的更多 type = params[:type] || 0 page = params[:page] || 0 - issue = Issue.find params[:id] - present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page + + is_public = 1 + + if type == 0 + issue = Issue.find params[:id] + issue.project.is_public + present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page + else + jour = Journal.find params[:id] + present :data, jour, with: Mobile::Entities::Issue,user: user,type: type,page: page + end + present :type, type present :page, page - present :is_public, issue.project.is_public + present :is_public,is_public present :status, 0 rescue Exception=>e present :status, -1 diff --git a/app/api/mobile/apis/newss.rb b/app/api/mobile/apis/newss.rb index c2e2fcb5c..810e4ff2a 100644 --- a/app/api/mobile/apis/newss.rb +++ b/app/api/mobile/apis/newss.rb @@ -14,14 +14,19 @@ module Mobile #0一级回复的更多 1 二级回复的更多 type = params[:type] || 0 page = params[:page] || 0 - news = News.find params[:id] is_public = 1 - if news.project - is_public = news.project.is_public - elsif news.course - is_public = news.course.is_public + if type == 0 + news = News.find params[:id] + + if news.project + is_public = news.project.is_public + elsif news.course + is_public = news.course.is_public + end + else + news = Comment.find params[:id] end present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 2856354a1..95940c0c5 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -40,6 +40,8 @@ module Mobile ac.act.subject unless ac.nil? || ac.act.nil? elsif ac.act_type == "JournalsForMessage" ac.act.private == 0 ? "留言" : "私信" unless ac.nil? || ac.act.nil? + elsif ac.act_type == "Poll" + ac.act.polls_name unless ac.nil? || ac.act.nil? end when :description if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News" @@ -48,6 +50,8 @@ module Mobile strip_html(ac.act.content) unless ac.nil? || ac.act.nil? elsif ac.act_type == "JournalsForMessage" strip_html(ac.act.notes) unless ac.nil? || ac.act.nil? + elsif ac.act_type == "Poll" + ac.act.polls_description unless ac.nil? || ac.act.nil? end when :latest_update time_from_now ac.updated_at unless ac.nil? diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb index 9cbeb3459..e3dbb5023 100644 --- a/app/api/mobile/entities/issue.rb +++ b/app/api/mobile/entities/issue.rb @@ -36,15 +36,42 @@ module Mobile issue.id when :title issue.subject + when :subject + issue.subject + when :description + issue.description + when :done_ratio + issue.done_ratio end end + elsif issue.is_a?(::Journal) + case f + when :content + issue[:notes] + when :lasted_comment + time_from_now issue.created_on + when :act_id + issue.id + end end end end - expose :subject - expose :description - expose :author, using: Mobile::Entities::User - expose :done_ratio + issue_expose :subject + issue_expose :description + expose :author, using: Mobile::Entities::User do |f, opt| + if f.is_a?(::Issue) + f.send(:author) + end + end + expose :user,using: Mobile::Entities::User do |f, opt| + if f.is_a?(::Journal) + f.send(:user) + end + end + issue_expose :content + issue_expose :lasted_comment + + issue_expose :done_ratio issue_expose :title issue_expose :act_type issue_expose :act_id @@ -55,11 +82,29 @@ module Mobile issue_expose :comment_count issue_expose :project_name issue_expose :praise_count - expose :issue_journals, using: Mobile::Entities::Journal do |f, opt| + + expose :id + # expose :issue_journals, using: Mobile::Entities::Journal do |f, opt| + # if f.is_a?(::Issue) + # f.journals.where("notes is not null and notes != ''").reverse + # end + # end + + expose :all_children, using: Mobile::Entities::Issue do |f, opt| + #f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages) if f.is_a?(::Issue) - f.journals.where("notes is not null and notes != ''").reverse + # f.journals_for_messages.reverse + if !opt[:children] && opt[:type] == 0 + opt[:children] = true + tStart = opt[:page]*5 + tEnd = (opt[:page]+1)*5 - 1 + + all_comments = f.journals.where("notes is not null and notes != ''").reorder("created_on desc") + all_comments[tStart..tEnd] + end end end + expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| has_praise = false current_user = options[:user] @@ -67,6 +112,69 @@ module Mobile has_praise = obj.empty? ? false : true has_praise end + + expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options| + if instance.is_a?(::Journal) + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, instance) + parents_reply.count + end + end + + expose :parents_reply_bottom, using:Mobile::Entities::Issue do |f,opt| + if f.is_a? (::Journal) + #取二级回复的底楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 0 && !opt[:bottom] + if opt[:type] == 1 + # opt[:bottom] = true + # parents_reply[opt[:page]..opt[:page]] + else + opt[:bottom] = true + parents_reply[0..0] + end + else + [] + end + end + end + + expose :parents_reply_top, using:Mobile::Entities::Issue do |f,opt| + if f.is_a? (::Journal) + #取二级回复的顶楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 2 && !opt[:top] + if opt[:type] == 1 + opt[:top] = true + tStart = (opt[:page]-1)*5+2 + tEnd = (opt[:page])*5+2 - 1 + + if tEnd >= parents_reply.count - 1 + tEnd = parents_reply.count - 2 + end + + if tStart <= parents_reply.count - 2 + parents_reply = parents_reply.reverse[tStart..tEnd] + parents_reply.reverse + else + [] + end + else + opt[:top] = true + parents_reply = parents_reply.reverse[0..1] + parents_reply.reverse + end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse + else + [] + end + end + end end end end \ No newline at end of file diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index be9fa3ceb..a64081d8a 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -28,6 +28,16 @@ module Mobile f.comments.count end end + elsif f.is_a?(::Comment) + case field + when :content + f[:comments] + when :lasted_comment + time_from_now f.created_on + when :act_id + f.id + end + elsif f.is_a?(Hash) && !f.key?(field) n = f[:news] comments = f[:comments] @@ -43,14 +53,16 @@ module Mobile end end end - news_expose :id + expose :id #新闻标题 news_expose :title - expose :author,using: Mobile::Entities::User do |f, opt| + expose :user,using: Mobile::Entities::User do |f, opt| obj = nil if f.is_a?(::News) && f.respond_to?(:author) obj = f.send(:author) + elsif f.is_a?(::Comment) && f.respond_to?(:author) + obj = f.send(:author) elsif f.is_a?(Hash) && f.key?(:author) obj = f[:author] end @@ -73,14 +85,34 @@ module Mobile news_expose :praise_count #课程名字 news_expose :course_name + news_expose :lasted_comment + #评论 - expose :comments, using: Mobile::Entities::Comment do |f, opt| - if f.is_a?(Hash) && f.key?(:comments) - f[:comments] - elsif f.is_a?(::News) && f.respond_to?(:comments) - f.comments.reverse + # expose :comments, using: Mobile::Entities::Comment do |f, opt| + # if f.is_a?(Hash) && f.key?(:comments) + # f[:comments] + # elsif f.is_a?(::News) && f.respond_to?(:comments) + # f.comments.reverse + # end + # end + + news_expose :content + + expose :all_children, using: Mobile::Entities::News do |f, opt| + #f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages) + if f.is_a?(::News) + # f.journals_for_messages.reverse + if !opt[:children] && opt[:type] == 0 + opt[:children] = true + tStart = opt[:page]*5 + tEnd = (opt[:page]+1)*5 - 1 + + all_comments = f.comments.reorder("created_on desc") + all_comments[tStart..tEnd] + end end end + expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| has_praise = false current_user = options[:user] @@ -88,6 +120,69 @@ module Mobile has_praise = obj.empty? ? false : true has_praise end + + expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options| + if instance.is_a?(::Comment) + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, instance) + parents_reply.count + end + end + + expose :parents_reply_bottom, using:Mobile::Entities::News do |f,opt| + if f.is_a? (::Comment) + #取二级回复的底楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 0 && !opt[:bottom] + if opt[:type] == 1 + # opt[:bottom] = true + # parents_reply[opt[:page]..opt[:page]] + else + opt[:bottom] = true + parents_reply[0..0] + end + else + [] + end + end + end + + expose :parents_reply_top, using:Mobile::Entities::News do |f,opt| + if f.is_a? (::Comment) + #取二级回复的顶楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 2 && !opt[:top] + if opt[:type] == 1 + opt[:top] = true + tStart = (opt[:page]-1)*5+2 + tEnd = (opt[:page])*5+2 - 1 + + if tEnd >= parents_reply.count - 1 + tEnd = parents_reply.count - 2 + end + + if tStart <= parents_reply.count - 2 + parents_reply = parents_reply.reverse[tStart..tEnd] + parents_reply.reverse + else + [] + end + else + opt[:top] = true + parents_reply = parents_reply.reverse[0..1] + parents_reply.reverse + end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse + else + [] + end + end + end end end end \ No newline at end of file diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 8de96fff4..cfd6aeb2c 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -340,13 +340,13 @@ class ProjectsService case priority_id when 1 priority = "低" - when + when 2 priority = "正常" - when + when 3 priority = "高" - when + when 4 priority = "紧急" - when + when 5 priority = "立刻" end diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index a4aa9a4c7..548641748 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -127,6 +127,78 @@
            +
            +
            +
            +
            +
            +
            + +
            {{act.latest_update}}
            +
            + +
            +
            +
            + +
            +
            + + + + + + + + + + +
            +
            +
            +
            +
            + +
            +
            +
            +
            +
            +
            + +
            {{act.latest_update}}
            +
            + +
            +
            +
            + +
            +
            + +
            +
            +
            {{act.praise_count}}
            +
            {{act.praise_count}}
            +
            + +
            +
            +
            +
            +
            +
            diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 8ab2a7d03..6c1c35860 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -41,7 +41,7 @@
            - +
            {{act.praise_count}}
            @@ -76,7 +76,7 @@
        - +
        {{act.praise_count}}
        @@ -112,7 +112,7 @@
        - +
        {{act.praise_count}}
        @@ -128,6 +128,77 @@
        +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        +
        + +
        +
        + + + + + + + + + + +
        +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        +
        + +
        +
        + +
        +
        +
        {{act.praise_count}}
        +
        {{act.praise_count}}
        +
        + +
        +
        +
        +
        +
        @@ -144,7 +215,7 @@
        -
        更多
        +
        更多
        发布通知 diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index f991656b4..af9f22da1 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -6,11 +6,11 @@
        私有内容,请谨慎传播
        -
        +
        @@ -30,20 +30,55 @@
        -
        -
        -
        + + + + + + + + + + + + + + + + +
        +
        +
        -
        +
        -
        {{comments.created_on}}
        +
        {{journal.lasted_comment}}
        -
        + +
        + + +
        点击展开更多楼层
        +
        + +
        {{reply_bottom.lasted_comment}}
        +
        +
        +
        +
        +
        + +
        +
        +
        更多
        +
        diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index b4d39d04e..c10d15ddb 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -36,20 +36,55 @@
        -
        -
        -
        + + + + + + + + + + + + + + + + +
        +
        +
        -
        {{journal.created_on}}
        +
        {{journal.lasted_comment}}
        -
        + +
        + + +
        点击展开更多楼层
        +
        + +
        {{reply_bottom.lasted_comment}}
        +
        +
        +
        +
        +
        + +
        +
        +
        更多
        +
        diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index e58b1c80c..8bfa818de 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -23,7 +23,7 @@
        -
        {{r.homework_name}}发送
        +
        {{r.homework_name}}发送
        diff --git a/public/assets/wechat/templates/comment_reply.html b/public/assets/wechat/templates/comment_reply.html index f5699abca..992acc56d 100644 --- a/public/assets/wechat/templates/comment_reply.html +++ b/public/assets/wechat/templates/comment_reply.html @@ -4,7 +4,7 @@
          {{journal.parents_reply_top[i].lasted_comment}}
          @@ -19,7 +19,7 @@
            {{journal.parents_reply_top[i].lasted_comment}}
            diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 95d108151..1605ac71b 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -11,7 +11,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.course = rms.get("course") || null; - var getClassActivities = function(page){ + vm.getClassActivities = function(page){ $http({ method: 'POST', url: apiUrl + "courses/activities?id=" + courseid, @@ -22,7 +22,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.class_activities_page = response.data.page; if(response.data.page > 0) { - vm.course_activities = vm.class_activities.concat(response.data.data); + vm.course_activities = vm.course_activities.concat(response.data.data); } else{ vm.course_activities = response.data.data; @@ -123,7 +123,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(vm.isTeacher){ if(index == 1){ if(vm.course_activities.length <= 0){ - getClassActivities(0); + vm.getClassActivities(0); } vm.showActivities = true; } @@ -143,7 +143,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } else { if(index == 1){ if(vm.course_activities.length <= 0){ - getClassActivities(0); + vm.getClassActivities(0); } vm.showActivities = true; } diff --git a/public/javascripts/wechat/controllers/course_notice.js b/public/javascripts/wechat/controllers/course_notice.js index 9f9ba83d6..48ec19889 100644 --- a/public/javascripts/wechat/controllers/course_notice.js +++ b/public/javascripts/wechat/controllers/course_notice.js @@ -8,8 +8,37 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au replyType: 'News', urlName: 'course_notice', loadCallback: function(data){ - $scope.news = data.data; - $scope.is_public = data.is_public; + console.log(data.data); + + //回复级别 0 一级回复 1 二级回复 + replytype = data.type; + page = data.page; + + if (replytype == 0){ + if (page == 0){ + $scope.news = data.data; + $scope.page = 0; + $scope.is_public = data.is_public; + } + else{ + $scope.news.all_children = $scope.news.all_children.concat(data.data.all_children); + } + $scope.has_more = $scope.news.all_children.length < $scope.news.comment_count; + console.log($scope.has_more); + } + else{ + comment_id = data.data.id; + for (var i in $scope.news.all_children) { + var comment = $scope.news.all_children[i]; + if(comment.id == comment_id){ +// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top); + comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top); + } + } + } + + + }, replyCallback: function(){ } diff --git a/public/javascripts/wechat/controllers/issue.js b/public/javascripts/wechat/controllers/issue.js index 131fab6f6..91db1d535 100644 --- a/public/javascripts/wechat/controllers/issue.js +++ b/public/javascripts/wechat/controllers/issue.js @@ -7,9 +7,34 @@ app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'c replyType: 'Issue', urlName: 'issues', loadCallback: function(data){ - console.log(data); - $scope.issue = data.data; - $scope.is_public = data.is_public; + console.log(data.data); + + //回复级别 0 一级回复 1 二级回复 + replytype = data.type; + page = data.page; + + if (replytype == 0){ + if (page == 0){ + $scope.issue = data.data; + $scope.page = 0; + $scope.is_public = data.is_public; + } + else{ + $scope.issue.all_children = $scope.issue.all_children.concat(data.data.all_children); + } + $scope.has_more = $scope.issue.all_children.length < $scope.issue.comment_count; + console.log($scope.has_more); + } + else{ + comment_id = data.data.id; + for (var i in $scope.issue.all_children) { + var comment = $scope.issue.all_children[i]; + if(comment.id == comment_id){ +// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top); + comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top); + } + } + } }, replyCallback: function(){ } diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 089b63dfc..3c5e46a75 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -147,4 +147,9 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.tab(currentTab); + vm.goHomeworkDetail = function(id){ + rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); + $location.path("/homework").search({id: id}); + } + }] ); From 69301a11208154fe8d1a54f0dbf7bad580d6ac09 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Aug 2016 10:04:51 +0800 Subject: [PATCH 025/170] =?UTF-8?q?Pull=20reques=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=88=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=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 026/170] =?UTF-8?q?issue=E5=9C=A8=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E3=80=81=E5=88=97=E8=A1=A8=E3=80=81=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8A=A8=E6=80=81=E4=B8=AD=E5=88=A0=E9=99=A4=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=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 027/170] =?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 4932b9fad83201b001c73ae494b7a748a0987b35 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 10:55:22 +0800 Subject: [PATCH 028/170] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=95=99=E8=A8=80?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/activities.rb | 2 +- app/api/mobile/apis/courses.rb | 2 +- config/menu.yml | 2 +- config/menu.yml.production | 2 +- config/menu.yml.test | 2 +- public/assets/wechat/activities.html | 70 ++++++++++++++-------------- public/assets/wechat/class.html | 70 ++++++++++++++-------------- 7 files changed, 75 insertions(+), 75 deletions(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 69d9ef524..4d07c23f8 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -29,7 +29,7 @@ module Mobile if container_type == "All" || container_type == "Course" shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" + course_types = "('Message','News','HomeworkCommon','Poll','Course')" end page = params[:page] ? params[:page] : 0 diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index d26779332..bfd559402 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -297,7 +297,7 @@ module Mobile user = current_user - course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" + course_types = "('Message','News','HomeworkCommon','Poll','Course')" activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') page = params[:page] ? params[:page] : 0 diff --git a/config/menu.yml b/config/menu.yml index 52272e8a0..8cc920707 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -8,7 +8,7 @@ button: sub_button: - type: "view" - name: "我的课程" + name: "我的班级" url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" diff --git a/config/menu.yml.production b/config/menu.yml.production index c1431172e..55318e811 100644 --- a/config/menu.yml.production +++ b/config/menu.yml.production @@ -8,7 +8,7 @@ button: sub_button: - type: "view" - name: "我的课程" + name: "我的班级" url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" diff --git a/config/menu.yml.test b/config/menu.yml.test index dc4aacbe5..45e23aaf3 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -8,7 +8,7 @@ button: sub_button: - type: "view" - name: "我的课程" + name: "我的班级" url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 548641748..506dcc724 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -163,41 +163,41 @@
      • -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        -
        - -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 6c1c35860..349c3bd75 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -164,41 +164,41 @@
        -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        -
        - -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        From 6abdb47ec5f07e4db4bd14cd9f06e6d307aa8b6b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 11:25:51 +0800 Subject: [PATCH 029/170] =?UTF-8?q?=E6=A8=A1=E7=89=88=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A0=87=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/projects_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index ca89e252a..fc7f25d1f 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -334,8 +334,8 @@ class ProjectsService def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count if count == 0 - title = "您有新的issue需要解决" - remark = "点击详情查看issue" + title = "您有新的issue需要解决。" + remark = "点击详情查看issue。" case priority_id when "1" From 60beb2abab087490215c82ae250f4173c07d5e81 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 25 Aug 2016 11:30:47 +0800 Subject: [PATCH 030/170] =?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 @@
        +<% 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 e05780cc3f5f482617273a01acc786ba43effaec Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 10:48:43 +0800 Subject: [PATCH 097/170] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=86=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E6=97=B6=E9=97=B4=E7=9A=84=E6=B5=8B=E9=AA=8C=E4=B8=8D?= =?UTF-8?q?=E5=BA=94=E6=9C=89=E4=BF=9D=E5=AD=98=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E8=80=8C=E6=98=AF=E7=9B=B4=E6=8E=A5=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_student.html.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index e157ea155..02db5e766 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -218,8 +218,12 @@ <% end %>
        - <%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %> - <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %> + <% if exercise.time == -1 %> + <%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %> + <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %> + <% else %> + <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:84px;",:format => 'js',:remote=>true %> + <% end %>
        From e0fed38f1d87b30c51ad9b73cf9ff2eecf257b32 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 10:53:58 +0800 Subject: [PATCH 098/170] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=8F=8A=E5=88=A0=E9=99=A4=E6=88=90=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class.html | 558 ++++++++++---------- public/assets/wechat/edit_class_member.html | 42 +- 2 files changed, 304 insertions(+), 296 deletions(-) diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 9b69916c8..07e918336 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -1,277 +1,281 @@ -
        -
        -
        邀请码
        -
        - {{menu}} -
        - - - - - - - - - - - - - -
        -
        -
        -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        - 迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
        - 缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} -
        -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        - -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        -
        -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        - -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        -
        - -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        - -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        -
        - -
        -
        - - - - - - - - - - -
        -
        -
        -
        -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        -
        -
        -
        - - -
        -
        -
        -
        -
        -
        -
        -
        -
        更多
        -
        - -
        - -
        -
        - -
        -
        - -
        -
        {{r.filename}}发送
        -

        暂无课件,
        - 请登录Trustie网站,在PC浏览器中上传课件。

        -
        -
        -
        授课老师
        - -
        - {{teacher.name}} - - 管理员 - 助教 -
        -
        - -
        - {{reviewer.name}} - 待审批 ▶ -
        -
        - - -
        我的同学
        -
        - {{student.name}} - -
        -
        -
        - -
        -
        {{r.homework_name}}发送
        -

        暂无作业,
        - 请登录Trustie网站,在PC浏览器中上传作业。

        - -
        - -
        -
        {{r.exercise_name}}发送
        -

        暂无测验,
        - 请登录Trustie网站,在PC浏览器中上传测验。

        -
        - - -
        +
        +
        +
        邀请码
        +
        + {{menu}} +
        + + + + + + + + + + + + + +
        +
        +
        +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        + 迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
        + 缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} +
        +
        +
        + +
        +
        +
        {{act.praise_count}}
        +
        {{act.praise_count}}
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        {{act.praise_count}}
        +
        {{act.praise_count}}
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        +
        + +
        +
        + +
        +
        +
        {{act.praise_count}}
        +
        {{act.praise_count}}
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        +
        + +
        +
        + + + + + + + + + + +
        +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        +
        + + +
        +
        +
        +
        +
        +
        +
        +
        +
        更多
        +
        + +
        + +
        +
        + +
        +
        + +
        +
        {{r.filename}}发送
        +

        暂无课件,
        + 请登录Trustie网站,在PC浏览器中上传课件。

        +
        +
        +
        授课老师
        + +
        + {{teacher.name}} + + 管理员 + 助教 +
        +
        + +
        + {{reviewer.name}} + 待审批 ▶ +
        +
        + + +
        我的同学
        +
        + {{student.name}} + +
        +
        + + +
        + +
        +
        {{r.homework_name}}发送
        +

        暂无作业,
        + 请登录Trustie网站,在PC浏览器中上传作业。

        + +
        + +
        +
        {{r.exercise_name}}发送
        +

        暂无测验,
        + 请登录Trustie网站,在PC浏览器中上传测验。

        +
        + + +
        diff --git a/public/assets/wechat/edit_class_member.html b/public/assets/wechat/edit_class_member.html index f27ab76cb..9c335394a 100644 --- a/public/assets/wechat/edit_class_member.html +++ b/public/assets/wechat/edit_class_member.html @@ -1,19 +1,23 @@ -
        -
        -
        -
        角色变更
        -
        {{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
        -
        角色
        -
          -
        • -
        • -
        • -
        -
        - 取消 - 确定 -
        -
        - - -
        +
        +
        +
        +
        成员管理
        +
        {{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
        +
        角色变更
        +
          +
        • +
        • +
        • +
        +
        删除成员
        +
          +
        • +
        +
        + 取消 + 确定 +
        +
        + + +
        From cc7b97192e1e8db2b2404bc6f84bc98a59d53df1 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 11:27:37 +0800 Subject: [PATCH 099/170] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E4=B8=8B=E7=9A=84=E6=96=87?= =?UTF-8?q?=E5=AD=97=E9=93=BE=E6=8E=A5=E5=88=B0=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 17 ++++++++++------- app/views/users/_user_homework_detail.html.erb | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 1b6d8298f..20ee54afd 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -215,15 +215,18 @@
        - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> - <% end %> <% com_time = project.project_score.commit_time %> <% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

        <%=(User.find project.user_id).show_name %>(组长)

        -

        <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>  <%= project.project_score.changeset_num %>提交

        + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像", :target => '_blank' %> + + <% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %> + + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %> + + + <% end %>
        项目名称:<%=project.name %>
        创建者:<%=(User.find project.user_id).show_name %>(组长)
        diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 49095d62f..8c606add6 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -225,15 +225,18 @@
        - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %> - <% end %> <% com_time = project.project_score.commit_time %> <% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

        <%=(User.find project.user_id).show_name %>(组长)

        -

        <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>  <%= project.project_score.changeset_num %>提交

        + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像", :target => '_blank' %> + + <% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %> + + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %> + + + <% end %>
        项目名称:<%=project.name %>
        创建者:<%=(User.find project.user_id).show_name %>(组长)
        From 48f110bbc80927233520f2aab1931dc77b42057b Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 13:53:11 +0800 Subject: [PATCH 100/170] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=80=E5=87=BA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_project_member.html | 46 +-- public/assets/wechat/project.html | 291 +++++++++--------- 2 files changed, 172 insertions(+), 165 deletions(-) diff --git a/public/assets/wechat/edit_project_member.html b/public/assets/wechat/edit_project_member.html index 51294f43e..5d3559cff 100644 --- a/public/assets/wechat/edit_project_member.html +++ b/public/assets/wechat/edit_project_member.html @@ -1,21 +1,25 @@ -
        -
        -
        -
        角色变更
        -
        {{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
        -
        角色
        -
          -
        • -
        • -
        • -
        -
        - 取消 - 确定 -
        -
        - - - - -
        +
        +
        +
        +
        成员管理
        +
        {{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
        +
        角色变更
        +
          +
        • +
        • +
        • +
        +
        删除成员
        +
          +
        • +
        +
        + 取消 + 确定 +
        +
        + + + + +
        diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 5b460ecad..18e85fea9 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -1,144 +1,147 @@ -
        -
        -
        邀请码
        -
        - {{menu}} -
        - -
        -
        -
        -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        - 状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
        - 指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}% -
        -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        - - -
        -
        -
        -
        -
        -
        - -
        {{act.latest_update}}
        -
        - -
        -
        -
        -
        -
        - -
        -
        -
        {{act.praise_count}}
        -
        {{act.praise_count}}
        -
        - -
        -
        -
        -
        -
        - -
        -
        -
        -
        -
        - - -
        -
        -
        -
        -
        -
        -
        -
        -
        更多
        -
        - -
        - -
        -
        -
        - -
        -
        -
        管理人员({{project_master_members.length}})
        -
        - {{master.user.real_name == "" ? master.user.name : master.user.real_name }} - -
        -
        -
        - {{user.real_name == "" ? user.name : user.real_name }} - 待审批 ▶ -
        -
        - -
        开发人员({{project_develop_members.length}})
        -
        - {{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}} - -
        -
        -
        - {{user.real_name == "" ? user.name : user.real_name}} - 待审批 ▶ -
        -
        -
        报告人员({{project_report_members.length}})
        -
        - {{report.user.real_name == "" ? report.user.name : report.user.real_name}} - -
        -
        -
        - - -
        +
        +
        +
        邀请码
        +
        + {{menu}} +
        + +
        +
        +
        +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        + 状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
        + 指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}% +
        +
        +
        + +
        +
        +
        {{act.praise_count}}
        +
        {{act.praise_count}}
        +
        + +
        +
        +
        +
        +
        + + +
        +
        +
        +
        +
        +
        + +
        {{act.latest_update}}
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        {{act.praise_count}}
        +
        {{act.praise_count}}
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        +
        +
        + + +
        +
        +
        +
        +
        +
        +
        +
        +
        更多
        +
        + +
        + +
        +
        +
        + +
        +
        +
        管理人员({{project_master_members.length}})
        +
        + {{master.user.real_name == "" ? master.user.name : master.user.real_name }} + +
        +
        +
        + {{user.real_name == "" ? user.name : user.real_name }} + 待审批 ▶ +
        +
        + +
        开发人员({{project_develop_members.length}})
        +
        + {{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}} + +
        +
        +
        + {{user.real_name == "" ? user.name : user.real_name}} + 待审批 ▶ +
        +
        +
        报告人员({{project_report_members.length}})
        +
        + {{report.user.real_name == "" ? report.user.name : report.user.real_name}} + +
        +
        + +
        + + +
        From a8575f2a158621640ea1d66857bf8c683eff9f43 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 14:08:19 +0800 Subject: [PATCH 101/170] =?UTF-8?q?=E6=9A=82=E6=97=B6=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=90=8D=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_course_activity.html.erb | 42 +++++++-------- app/views/layouts/new_base_user.html.erb | 46 ++++++++-------- app/views/layouts/new_base_user_show.html.erb | 48 ++++++++--------- .../_org_left_subfield_list.html.erb | 54 +++++++++---------- .../projects/_project_activities.html.erb | 52 +++++++++--------- public/javascripts/application.js | 44 +++++++-------- 6 files changed, 143 insertions(+), 143 deletions(-) diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 993c767d6..c71e5ade4 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -11,27 +11,27 @@ $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); }) - $(".homepagePostPortrait").mouseover(function(){ - onImage = true; - $(this).children(".userCard").css("display","block"); - }) - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false){ - $(cur).children(".userCard").css("display", "none"); - } - }, 500); - }) - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }) - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }) +// $(".homepagePostPortrait").mouseover(function(){ +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }) +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false){ +// $(cur).children(".userCard").css("display", "none"); +// } +// }, 500); +// }) +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }) +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); }) diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index e60593387..2d927b6fe 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -33,31 +33,31 @@ $(document).ready(function(){ $("#relateProject,.relatePInfo").mouseover(function(){ $(".relatePInfo").css("display","block"); - }) + }); $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); - }) - $(".homepagePostPortrait").mouseover(function(){ - onImage = true; - $(this).children(".userCard").css("display","block"); - }) - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false) { - $(cur).children(".userCard").css("display","none"); - } - },500); - }) - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }) - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }) + }); +// $(".homepagePostPortrait").mouseover(function(){ +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }); +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false) { +// $(cur).children(".userCard").css("display","none"); +// } +// },500); +// }); +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }); +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); }) diff --git a/app/views/layouts/new_base_user_show.html.erb b/app/views/layouts/new_base_user_show.html.erb index b49df8829..a1b911d09 100644 --- a/app/views/layouts/new_base_user_show.html.erb +++ b/app/views/layouts/new_base_user_show.html.erb @@ -33,34 +33,34 @@ $(document).ready(function(){ $("#relateProject,.relatePInfo").mouseover(function(){ $(".relatePInfo").css("display","block"); - }) + }); $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); - }) - $(".homepagePostPortrait").mouseover(function(){ - onImage = true; - $(this).children(".userCard").css("display","block"); - }) - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false) { - $(cur).children(".userCard").css("display","none"); - } - },500); - }) - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }) - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }) + }); +// $(".homepagePostPortrait").mouseover(function(){ +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }); +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false) { +// $(cur).children(".userCard").css("display","none"); +// } +// },500); +// }); +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }); +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); - }) + }); $(".coursesLineGrey").mouseout(function(){ $(this).css("color","#808080"); }); diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 9d043fbb5..0ce839d1f 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -4,45 +4,45 @@ $(document).ready(function(){ $("#relateProject,.relatePInfo").mouseover(function(){ $(".relatePInfo").css("display","block"); - }) + }); $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); - }) - $(".homepagePostPortrait").mouseover(function(){ - onImage = true; - $(this).children(".userCard").css("display","block"); - }) - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false) { - $(cur).children(".userCard").css("display", "none"); - } - }, 500); - }) - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }) - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }) + }); +// $(".homepagePostPortrait").mouseover(function(){ +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }); +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false) { +// $(cur).children(".userCard").css("display", "none"); +// } +// }, 500); +// }); +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }); +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); - }) + }); $(".coursesLineGrey").mouseout(function(){ $(this).css("color","#808080"); - }) + }); $(".homepagePostSetting,.coursesLineGrey").mouseover(function(){ $(this).prev().css("color","#ffffff"); $(this).css("z-index", "9999"); - }) + }); $(".homepagePostSetting").mouseout(function(){ $(this).prev().css("color","#808080"); $(this).css("z-index", "1"); - }) + }); //二级菜单滑动时箭头方向控制 $(".homepageLeftMenuMoreIcon").toggle(function(){ diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index 2e119ed7c..3660b5986 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -5,41 +5,41 @@ $(document).ready(function(){ $("#relateProject,.relatePInfo").mouseover(function(){ $(".relatePInfo").css("display","block"); - }) + }); $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); - }) - $(".homepagePostPortrait").mouseover(function(){ - onImage = true; - $(this).children(".userCard").css("display","block"); - }) - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false) { - $(cur).children(".userCard").css("display", "none"); - } - }, 500); - }) - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }) - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }) + }); +// $(".homepagePostPortrait").mouseover(function(){ +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }); +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false) { +// $(cur).children(".userCard").css("display", "none"); +// } +// }, 500); +// }); +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }); +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); - }) + }); $(".coursesLineGrey").mouseout(function(){ $(this).css("color","#808080"); - }) + }); $(".homepagePostSetting,.coursesLineGrey").mouseover(function(){ $(this).prev().css("color","#ffffff"); $(this).css("z-index", "9999"); - }) + }); $(".homepagePostSetting").mouseout(function(){ $(this).prev().css("color","#808080"); $(this).css("z-index", "1"); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c2e357e0f..d527f6b0e 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -25,28 +25,28 @@ function description_show_hide(id){ //名片的显示 function user_card_show_hide() { - $(".homepagePostPortrait").mouseover(function(){ - $(".userCard").css("display","none"); - onImage = true; - $(this).children(".userCard").css("display","block"); - }); - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false){ - $(cur).children(".userCard").css("display", "none"); - } - }, 500); - }); - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }); - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }); +// $(".homepagePostPortrait").mouseover(function(){ +// $(".userCard").css("display","none"); +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }); +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false){ +// $(cur).children(".userCard").css("display", "none"); +// } +// }, 500); +// }); +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }); +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); } function cleanArray (actual){ From 076feb17e8f900114da9b31f6eef1068e6726478 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 14:12:04 +0800 Subject: [PATCH 102/170] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E7=9A=84=E7=8F=AD=E7=BA=A7=E5=88=97=E8=A1=A8=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E2=80=9C=E4=B8=BB=E8=AE=B2=E8=80=81=E5=B8=88=E2=80=9D=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E2=80=9C=E5=88=9B=E5=BB=BA=E8=80=81=E5=B8=88=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/syllabuses/_syllabus_course_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index 4384ba2ee..1388aa1d4 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -27,7 +27,7 @@

        - 主讲老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %> + 创建老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %> <% if User.current.admin? || User.current.allowed_to?(:as_teacher,course) %> <% homework_num = course.homework_commons.count %> <% else %> From 292e778a8cea4eaeaf8903263f1c0bd8a9129955 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 31 Aug 2016 14:21:38 +0800 Subject: [PATCH 103/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E5=92=8C?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 79 +++++++++++++++++++ app/api/mobile/apis/projects.rb | 73 +++++++++++++++++ app/models/at_message.rb | 7 +- app/services/courses_service.rb | 31 ++++++++ app/services/projects_service.rb | 63 +++++++++++++++ .../javascripts/wechat/controllers/class.js | 43 +++++++++- .../javascripts/wechat/controllers/project.js | 40 ++++++++++ 7 files changed, 332 insertions(+), 4 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index bfd559402..cd5d945e3 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -661,6 +661,85 @@ module Mobile end + desc "删除班级成员" + params do + requires :id, type: Integer + requires :token, type: String + requires :user_id, type: Integer + end + post ':id/deletemember' do + authenticate! + + status = -1 + + if(current_user.id != params[:user_id].to_i) + #权限 + c = Course.find("#{params[:id]}") + if c.tea_id != params[:user_id].to_i + + my_member = c.member_principals.where("users.id=#{current_user.id}").first + + roles_ids = [] + my_member.roles.each do |role| + roles_ids << role.id + end + + if my_member && roles_ids.include?(3) + #删除该成员 + cs = CoursesService.new + status = cs.delete_course_member(c,params[:user_id].to_i,current_user) + else + status = -2 + end + else + status = -3 + end + else + status = -4 + end + + out = {status: status} + message = case status + when 0; "删除成功" + when -1; "您还未登录" + when -2; "对不起您没有权限" + when -3; "不能删除班级管理员" + when -4; "不能删除自己" + when 1; "该用户不在该班级中" + else; "未知错误,请稍后再试" + end + out.merge(message: message) + end + + desc "退出班级" + params do + requires :id, type: Integer + requires :token, type: String + end + post ':id/quit' do + authenticate! + + #管理员不能退 + cs = CoursesService.new + c = Course.find("#{params[:id]}") + + user = current_user + + if c.tea_id != user.id + status = cs.exit_course({:object_id => params[:id]}, user) + else + status = 3 + end + out = {status: status} + message = case status + when 0; "退出成功" + when 1; "您不在课程中" + when 2; "您还未登录" + when 3; "管理员不能退出班级" + else; "未知错误,请稍后再试" + end + out.merge(message: message) + end end end end diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb index 2202fbd13..b66f6c25f 100644 --- a/app/api/mobile/apis/projects.rb +++ b/app/api/mobile/apis/projects.rb @@ -268,6 +268,79 @@ module Mobile present :status, 0 end + + desc "删除项目成员" + params do + requires :id, type: Integer + requires :token, type: String + requires :user_id, type: Integer + end + post ':id/deletemember' do + authenticate! + + status = -1 + + if(current_user.id != params[:user_id].to_i) + #权限 + project = Project.find("#{params[:id]}") + if project.tea_id != params[:user_id].to_i + + my_member = project.member_principals.where("users.id=#{current_user.id}").first + + roles_ids = [] + my_member.roles.each do |role| + roles_ids << role.id + end + + if my_member && roles_ids.include?(3) + #删除该成员 + ps = ProjectsService.new + status = ps.project_delete_member(project,params[:user_id].to_i,current_user) + else + status = -2 + end + else + status = -3 + end + else + status = -4 + end + + out = {status: status} + message = case status + when 0; "退出成功" + when 1; "该用户不在该项目中" + when -1; "您还未登录" + when -2; "您没有权限" + when -3; "不能删除项目创建者" + when -4; "不能删除自己" + else; "未知错误,请稍后再试" + end + out.merge(message: message) + end + + desc "退出项目" + params do + requires :id, type: Integer + requires :token, type: String + end + post ':id/quit' do + authenticate! + + ps = ProjectsService.new + status = ps.exit_project(params[:id],current_user) + + out = {status: status} + message = case status + when 0; "退出成功" + when -3; "您不在课程中" + when -1; "您还未登录" + when -2; "项目创建者不能退出项目" + else; "未知错误,请稍后再试" + end + out.merge(message: message) + end + end end end diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 1c0c88d89..4c3ca9b74 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -35,6 +35,7 @@ class AtMessage < ActiveRecord::Base end end + #@的时候发微信模版消息通知被@的人 def send_wechat_message shield_type = "" container_id = 0 @@ -57,15 +58,15 @@ class AtMessage < ActiveRecord::Base case at_message_type when "Issue" + #新建issue shield_type = "Project" container_id = at_message.project.id type = "issues" detail_id = topic.id detail_title = at_message.subject when "Journal" - + #issue回复 topic = get_root_parent at_message.journalized - shield_type = "Project" container_id = at_message.journalized.project.id type = "issues" @@ -89,10 +90,10 @@ class AtMessage < ActiveRecord::Base end when 'JournalsForMessage' if at_message.jour && at_message.jour.course + #作业回复 shield_type = "Course" container_id = at_message.jour.course.id type = "homework" - detail_id = at_message.jour.id detail_title = at_message.jour.name else diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 7d574bada..c5084f228 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -1284,5 +1284,36 @@ class CoursesService status end + #删除班级成员 + def delete_course_member course,user_id,current_user + if current_user.nil? + state = -1 + return state + end + + member = course.members.where("user_id=?",user_id).first + + if member != nil + + member.destroy + user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, course.id) + if user_admin.size > 0 + user_admin.each do |user| + user.destroy + end + end + joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id) + joined.each do |join| + join.delete + end + roles = Role.givable.all[3..5] + #移出课程发送消息 + CourseMessage.create(:user_id => member.user_id, :course_id => course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => current_user.id) + return 0 + else + return 1 + end + end + end diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index fc7f25d1f..5d22244a9 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -355,4 +355,67 @@ class ProjectsService end end + #删除项目成员 + def project_delete_member project,user_id,current_user + if user.nil? + state = -1 + return state + end + + member = project.members.where("user_id=?",user_id).first + + if member != nil + member.destroy + # end + user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id) + if user_admin.size > 0 + user_admin.each do |user| + user.destroy + end + end + user_grade = UserGrade.where("user_id = ? and project_id = ?", member.user_id, project.id) + if user_grade.size > 0 + user_grade.each do |grade| + grade.destroy + end + end + # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除 + applied_projects = AppliedProject.where(:project_id => project.id, :user_id => member.user_id).first + unless applied_projects.nil? + applied_projects.delete + end + #移出项目发送消息 + ForgeMessage.create(:user_id => member.user_id, :project_id => project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => current_user.id) + return 0 + else + return 1 + end + end + + def exit_project project,user + if user.nil? + state = -1 + return state + end + + if project.user_id == user.id + state = -2 + return state + end + + members = Member.where(:user_id => user.id, :project_id=>project.id).first + if members != nil && members.roles.first.to_s != "Manager" + members.destroy + # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除 + applied_projects = AppliedProject.where(:project_id => project.id, :user_id => members.user_id).first + unless applied_projects.nil? + applied_projects.delete + end + state = 0 + else + state = -3 + end + return state + end + end diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 6721d4d12..06e15f1d5 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -325,6 +325,47 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location rms.save("course",vm.course); // $location.path('/'+type+'/'+act_id); $location.path("/homework").search({id: id}); - } + }; + + vm.deleteMember = function(user_id){ + $http({ + method: 'POST', + url: apiUrl + "courses/deletemember?id=" + courseid, + data:{token:auth.token(),user_id:user_id} + }).then(function successCallback(response) { + console.log(response.data); + + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + + }); + }; + + vm.quit = function(){ + $http({ + method: 'POST', + url: apiUrl + "courses/quit?id=" + courseid, + data:{token:auth.token()} + }).then(function successCallback(response) { + console.log(response.data); + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); + }; + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index c45696668..298e9b96f 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -253,4 +253,44 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut $location.path("/project_publishnote").search({id:projectid}); }; + vm.deleteMember = function(user_id){ + $http({ + method: 'POST', + url: apiUrl + "projects/deletemember?id=" + projectid, + data:{token:auth.token(),user_id:user_id} + }).then(function successCallback(response) { + console.log(response.data); + + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + + }); + }; + + vm.quit = function(){ + $http({ + method: 'POST', + url: apiUrl + "projects/quit?id=" + projectid, + data:{token:auth.token()} + }).then(function successCallback(response) { + console.log(response.data); + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); + }; + }]); \ No newline at end of file From ec15474c3ad8307096307212ea68a1a8cc7540e4 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 14:30:16 +0800 Subject: [PATCH 104/170] =?UTF-8?q?=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=97=B6=EF=BC=8C=E7=A1=AE=E5=AE=9A=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=A0=B7=E5=BC=8F=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/app.html | 1 + public/assets/wechat/edit_class_member.html | 4 ++-- public/assets/wechat/edit_project_member.html | 4 ++-- .../wechat/directives/submit_start.js | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 public/javascripts/wechat/directives/submit_start.js diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html index 5ab1dcb5a..fdd4d3276 100644 --- a/public/assets/wechat/app.html +++ b/public/assets/wechat/app.html @@ -40,6 +40,7 @@ + diff --git a/public/assets/wechat/edit_class_member.html b/public/assets/wechat/edit_class_member.html index 9c335394a..ec8965caa 100644 --- a/public/assets/wechat/edit_class_member.html +++ b/public/assets/wechat/edit_class_member.html @@ -9,13 +9,13 @@

      • -
        删除成员
        +
        删除成员
        diff --git a/public/assets/wechat/edit_project_member.html b/public/assets/wechat/edit_project_member.html index 5d3559cff..5b9ea8bb1 100644 --- a/public/assets/wechat/edit_project_member.html +++ b/public/assets/wechat/edit_project_member.html @@ -9,13 +9,13 @@
      • -
        删除成员
        +
        删除成员
        diff --git a/public/javascripts/wechat/directives/submit_start.js b/public/javascripts/wechat/directives/submit_start.js new file mode 100644 index 000000000..cbdc469ab --- /dev/null +++ b/public/javascripts/wechat/directives/submit_start.js @@ -0,0 +1,17 @@ +/** + * Created by ttang on 2016/8/31. + */ +app.directive('submitStart',["$timeout",function(timer){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + timer(function(){ + $("#manageDelete,.login-box").click(function(){ + element.removeClass("bg-grey c-white"); + element.addClass("link-blue2"); + }); + }) + } + } +}]); From 8494d71e8ebdd8536200fa85cc5b98824cab3475 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 14:33:29 +0800 Subject: [PATCH 105/170] =?UTF-8?q?=E2=80=9C=E8=AF=BE=E7=A8=8B=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E2=80=9D=E4=B8=8D=E6=98=BE=E7=A4=BA=EF=BC=8C=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E5=90=8D=E7=A7=B0=E4=B8=BA=E7=A9=BA=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E2=80=9C=E8=AF=BE=E7=A8=8B=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_syllabus_eng_name.html.erb | 4 ++-- app/views/layouts/_syllabus_info.html.erb | 2 +- app/views/layouts/_syllabus_title.html.erb | 5 +++-- app/views/syllabuses/edit_syllabus_eng_name.js.erb | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/layouts/_syllabus_eng_name.html.erb b/app/views/layouts/_syllabus_eng_name.html.erb index 959e28bb7..82114f86f 100644 --- a/app/views/layouts/_syllabus_eng_name.html.erb +++ b/app/views/layouts/_syllabus_eng_name.html.erb @@ -1,9 +1,9 @@

        <% if syllabus.eng_name && !syllabus.eng_name.empty? %> <%=syllabus.eng_name %> <% else%> - 课程英文名称 + <% end %> <% if User.current == syllabus.user || User.current.admin? %> - <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');"%> + <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');", :title => '编辑课程英文名称'%> <% end %>

        \ No newline at end of file diff --git a/app/views/layouts/_syllabus_info.html.erb b/app/views/layouts/_syllabus_info.html.erb index a52b05228..0ab6ecc68 100644 --- a/app/views/layouts/_syllabus_info.html.erb +++ b/app/views/layouts/_syllabus_info.html.erb @@ -6,4 +6,4 @@
        <%= render :partial => 'layouts/syllabus_eng_name', :locals => {:syllabus => @syllabus}%>
        - + \ No newline at end of file diff --git a/app/views/layouts/_syllabus_title.html.erb b/app/views/layouts/_syllabus_title.html.erb index 6407a19a2..1f24fcf26 100644 --- a/app/views/layouts/_syllabus_title.html.erb +++ b/app/views/layouts/_syllabus_title.html.erb @@ -1,5 +1,6 @@ -

        课程名称:<%=syllabus.title %> +

        + <%=syllabus.title %> <% if User.current == syllabus.user || User.current.admin? %> - <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');"%> + <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');", :title => '编辑课程名称'%> <% end %>

        diff --git a/app/views/syllabuses/edit_syllabus_eng_name.js.erb b/app/views/syllabuses/edit_syllabus_eng_name.js.erb index 8a4c1efa8..129683d4f 100644 --- a/app/views/syllabuses/edit_syllabus_eng_name.js.erb +++ b/app/views/syllabuses/edit_syllabus_eng_name.js.erb @@ -1,3 +1,4 @@ $("#syllabus_eng_name_show").html("<%= escape_javascript render :partial => 'layouts/syllabus_eng_name', :locals => {:syllabus => @syllabus} %>"); $("#syllabus_eng_name_show").show(); +$("#syllabus_edit_ng_name_png").show(); $("#syllabus_eng_name_edit").hide(); \ No newline at end of file From eda735db58bcc4f313cdd3a247095c09da520830 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 14:40:34 +0800 Subject: [PATCH 106/170] =?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 107/170] =?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 9c327fe05ec798b6b4be71aa87304cd3f1321f80 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 14:59:27 +0800 Subject: [PATCH 108/170] =?UTF-8?q?at=E7=AC=A6=E5=8F=B7=E5=89=8D=E9=9D=A2?= =?UTF-8?q?=E6=98=AF=E6=A0=87=E7=82=B9=E7=AC=A6=E5=8F=B7=E6=88=96=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E7=A9=BA=E6=A0=BC=E8=BF=98=E6=98=AF=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/at/jquery.atwho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/assets/kindeditor/at/jquery.atwho.js b/public/assets/kindeditor/at/jquery.atwho.js index cd2caf6ca..3086d4438 100644 --- a/public/assets/kindeditor/at/jquery.atwho.js +++ b/public/assets/kindeditor/at/jquery.atwho.js @@ -1140,7 +1140,7 @@ $.fn.atwho["default"] = { searchKey: "name", suffix: void 0, hideWithoutSuffix: false, - startWithSpace: true, + startWithSpace: false, highlightFirst: true, limit: 5, maxLen: 20, From 9e9b4d12c9c4b27195bf53614c7d478f7e782369 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:00:34 +0800 Subject: [PATCH 109/170] =?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 4c59acf5a3a205c9ca59172398d77678f1237bed Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 15:04:56 +0800 Subject: [PATCH 110/170] =?UTF-8?q?issue=E7=BC=96=E8=BE=91=E5=90=8E?= =?UTF-8?q?=E7=82=B9=E8=B5=9E=E6=8C=89=E9=92=AE=E4=B8=8D=E8=A7=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/update.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/update.js.erb b/app/views/issues/update.js.erb index 16ca863e4..bd4385340 100644 --- a/app/views/issues/update.js.erb +++ b/app/views/issues/update.js.erb @@ -6,7 +6,7 @@ $("#issue_detail").show(); $("#issue_edit").hide(); $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); -$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') +$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>'); //edit里的编辑器貌似显示不出来,所以手动js生成。 issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", From 2df6047b03f2a12dc13e95c57502f9bd2343cf1a Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:14:55 +0800 Subject: [PATCH 111/170] =?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 112/170] =?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 113/170] =?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 114/170] =?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 115/170] =?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 7efdda5b45a0cb68ed7212fbe254fe980c12e8b7 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 31 Aug 2016 17:01:31 +0800 Subject: [PATCH 116/170] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E8=80=81=E5=B8=88?= =?UTF-8?q?=E4=B9=9F=E5=8F=AF=E4=BB=A5=E7=82=B9=E5=87=BB=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?logo=E8=BF=9B=E8=A1=8C=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_course_base_info.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index c2fe181fe..65c065672 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -31,7 +31,7 @@
        diff --git a/public/assets/wechat/edit_class_member.html b/public/assets/wechat/edit_class_member.html index ec8965caa..decb31efb 100644 --- a/public/assets/wechat/edit_class_member.html +++ b/public/assets/wechat/edit_class_member.html @@ -3,21 +3,22 @@
        成员管理
        {{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
        -
        角色变更
        +
        角色变更
        -
        删除成员
        +
        删除成员
        +
        diff --git a/public/assets/wechat/edit_project_member.html b/public/assets/wechat/edit_project_member.html index 5b9ea8bb1..5500766d5 100644 --- a/public/assets/wechat/edit_project_member.html +++ b/public/assets/wechat/edit_project_member.html @@ -3,23 +3,23 @@
        成员管理
        {{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
        -
        角色变更
        +
        角色变更
        -
        删除成员
        +
        删除成员
        - +
        diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 18e85fea9..8dfba3619 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -138,10 +138,11 @@
        - +
        diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 06e15f1d5..fdd5bcd71 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -177,6 +177,8 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1; vm.alertService = alertService.create(); + //双弹框 + vm.alertService_2 = alertService.create(); vm.invite = function(){ rms.save('course_activities_page',vm.course_activities_page); @@ -327,44 +329,27 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/homework").search({id: id}); }; - vm.deleteMember = function(user_id){ - $http({ - method: 'POST', - url: apiUrl + "courses/deletemember?id=" + courseid, - data:{token:auth.token(),user_id:user_id} - }).then(function successCallback(response) { - console.log(response.data); - - if(response.data.status == 0){ - vm.alertService.showMessage('提示', response.data.message,function(){ - //确定 - - }); - } - else{ - vm.alertService.showMessage('提示', response.data.message); - } - - }); - }; - vm.quit = function(){ - $http({ - method: 'POST', - url: apiUrl + "courses/quit?id=" + courseid, - data:{token:auth.token()} - }).then(function successCallback(response) { - console.log(response.data); - if(response.data.status == 0){ - vm.alertService.showMessage('提示', response.data.message,function(){ - //确定 - - }); - } - else{ - vm.alertService.showMessage('提示', response.data.message); - } + vm.alertService_2.showMessage('提示', "是否确认退出班级",function(){ + $http({ + method: 'POST', + url: apiUrl + "courses/" + courseid+"/quit", + data:{token:auth.token()} + }).then(function successCallback(response) { + console.log(response.data); + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + rms.save('syllabuses',[]); + $location.path("/class_list"); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); }); + }; diff --git a/public/javascripts/wechat/controllers/edit_class_member.js b/public/javascripts/wechat/controllers/edit_class_member.js index e00e36f20..d872dac09 100644 --- a/public/javascripts/wechat/controllers/edit_class_member.js +++ b/public/javascripts/wechat/controllers/edit_class_member.js @@ -9,6 +9,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config' vm.current_edit_member = null; vm.alertService = alertService.create(); + //双弹框 + vm.alertService_2 = alertService.create(); var course_id = $routeParams.id; var user_id = $routeParams.user_id; @@ -21,6 +23,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config' vm.tmpassistant = false; //教辅 vm.tmpstudent = false; //学生 + vm.buttongrey = true; + if(!vm.current_edit_member){ $http.post(config.apiUrl+'courses/get_member_info', { @@ -29,7 +33,9 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config' user_id:user_id }).then(function(response){ if(response.data.status!=0){ - vm.alertService.showMessage('提示', response.data.message); + vm.alertService.showMessage('提示', response.data.message,function(){ + $location.path("/class").search({id: course_id,tag:1}); + }); } else { console.log(response); course_id = response.data.course_id; @@ -62,36 +68,69 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config' window.history.back(); }; - vm.edit_member_role = function(){ - if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){ - vm.alertService.showMessage('提示', "该用户当前已是该角色"); - return; - } + vm.deleteMember = function(user_id){ + vm.alertService_2.showMessage('提示', "是否确认删除成员",function(){ + $http({ + method: 'POST', + url: apiUrl + "courses/" + course_id+"/deletemember", + data:{token:auth.token(),user_id:user_id} + }).then(function successCallback(response) { + console.log(response.data); - if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){ - vm.alertService.showMessage('提示', "请至少选择一种角色"); - return; - } + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + $location.path("/class").search({id: course_id,tag:1}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } - $http.post(config.apiUrl+'courses/edit_member_role', { - token: auth.token(), - id: course_id, - user_id:vm.current_edit_member.user.id, - teacher_flag:vm.teacher, - assistant_flag:vm.assistant, - student_flag:vm.student - }).then(function(response){ - if(response.data.status!=0){ - vm.alertService.showMessage('提示', response.data.message); - } else { - vm.alertService.showMessage('提示', '修改角色成功', function(){ -// window.history.back(); - $location.path("/class").search({id: course_id,tag:1}); - }); - } + }); }); }; + vm.edit_member_role = function(){ + if(vm.buttongrey == true){ + return; + } + + if(vm.current_edit_member.show){ + //删除成员 + vm.deleteMember(vm.current_edit_member.user.id); + } + else{ + if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){ + vm.alertService.showMessage('提示', "该用户当前已是该角色"); + return; + } + + if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){ + vm.alertService.showMessage('提示', "请至少选择一种角色"); + return; + } + + $http.post(config.apiUrl+'courses/edit_member_role', { + token: auth.token(), + id: course_id, + user_id:vm.current_edit_member.user.id, + teacher_flag:vm.teacher, + assistant_flag:vm.assistant, + student_flag:vm.student + }).then(function(response){ + if(response.data.status!=0){ + vm.alertService.showMessage('提示', response.data.message); + } else { + vm.alertService.showMessage('提示', '修改角色成功', function(){ +// window.history.back(); + $location.path("/class").search({id: course_id,tag:1}); + }); + } + }); + } + }; + vm.selectRole = function(role_id){ if (role_id == 7){ if(!vm.teacher){ @@ -106,6 +145,28 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config' else if (role_id == 10){ vm.student = !vm.student; } - } + + if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){ + vm.buttongrey = true; + } + else{ + vm.buttongrey = false; + } + + if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){ + vm.buttongrey = true; + } + + }; + + vm.clickChangeRole = function(){ + vm.current_edit_member.show = !vm.current_edit_member.show; + if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){ + vm.buttongrey = true; + } + else{ + vm.buttongrey = false; + } + }; }] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/edit_project_member.js b/public/javascripts/wechat/controllers/edit_project_member.js index 511db35bb..b8ecb447d 100644 --- a/public/javascripts/wechat/controllers/edit_project_member.js +++ b/public/javascripts/wechat/controllers/edit_project_member.js @@ -10,9 +10,14 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi vm.current_edit_member = null; vm.alertService = alertService.create(); + //双弹框 + vm.alertService_2 = alertService.create(); var project_id = $routeParams.id; var user_id = $routeParams.user_id; + + vm.buttongrey = true; + if(!vm.current_edit_member){ $http.post(config.apiUrl+'projects/get_member_info', { token: auth.token(), @@ -20,7 +25,20 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi user_id:user_id }).then(function(response){ if(response.data.status!=0){ - vm.alertService.showMessage('提示', response.data.message); + vm.alertService.showMessage('提示', response.data.message,function(){ + rms.save('project_activities_page',0); + rms.save("project_activities",[]); + rms.save("project_has_more",false); + rms.save("project",null); + rms.save("project_master_members",[]); + rms.save("project_develop_members",[]); + rms.save("project_report_members",[]); + rms.save("review_master_members",[]); + rms.save("review_develop_members",[]); + rms.save('tab_num',null); +// window.history.back(); + $location.path("/project").search({id: project_id,tag:1}); + }); } else { project_id = response.data.project_id; user_id = response.data.user_id; @@ -40,42 +58,104 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi window.history.back(); }; + vm.deleteMember = function(user_id){ + vm.alertService_2.showMessage('提示', "是否确认删除成员",function(){ + $http({ + method: 'POST', + url: apiUrl + "projects/" + project_id+"/deletemember", + data:{token:auth.token(),user_id:user_id} + }).then(function successCallback(response) { + console.log(response.data); + + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + rms.save('project_activities_page',0); + rms.save("project_activities",[]); + rms.save("project_has_more",false); + rms.save("project",null); + rms.save("project_master_members",[]); + rms.save("project_develop_members",[]); + rms.save("project_report_members",[]); + rms.save("review_master_members",[]); + rms.save("review_develop_members",[]); + rms.save('tab_num',null); +// window.history.back(); + $location.path("/project").search({id: project_id,tag:1}); + + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + + }); + + }); + }; + vm.edit_member_role = function(){ - if(vm.current_roles_id == vm.current_edit_member.roles_id){ - vm.alertService.showMessage('提示', "该用户当前已是该角色"); + if(vm.buttongrey == true){ return; } - $http.post(config.apiUrl+'projects/edit_member_role', { - token: auth.token(), - id: project_id, - user_id:vm.current_edit_member.user.id, - role_id:vm.current_edit_member.roles_id - }).then(function(response){ - if(response.data.status!=0){ - vm.alertService.showMessage('提示', response.data.message); - } else { - vm.alertService.showMessage('提示', '修改角色成功', function(){ - rms.save('project_activities_page',0); - rms.save("project_activities",[]); - rms.save("project_has_more",false); - rms.save("project",null); - rms.save("project_master_members",[]); - rms.save("project_develop_members",[]); - rms.save("project_report_members",[]); - rms.save("review_master_members",[]); - rms.save("review_develop_members",[]); - rms.save('tab_num',null); -// window.history.back(); - $location.path("/project").search({id: project_id,tag:1}); - }); + if(vm.current_edit_member.show){ + //删除成员 + vm.deleteMember(vm.current_edit_member.user.id); + } + else{ + if(vm.current_roles_id == vm.current_edit_member.roles_id){ + vm.alertService.showMessage('提示', "该用户当前已是该角色"); + return; } - }); + $http.post(config.apiUrl+'projects/edit_member_role', { + token: auth.token(), + id: project_id, + user_id:vm.current_edit_member.user.id, + role_id:vm.current_edit_member.roles_id + }).then(function(response){ + if(response.data.status!=0){ + vm.alertService.showMessage('提示', response.data.message); + } else { + vm.alertService.showMessage('提示', '修改角色成功', function(){ + rms.save('project_activities_page',0); + rms.save("project_activities",[]); + rms.save("project_has_more",false); + rms.save("project",null); + rms.save("project_master_members",[]); + rms.save("project_develop_members",[]); + rms.save("project_report_members",[]); + rms.save("review_master_members",[]); + rms.save("review_develop_members",[]); + rms.save('tab_num',null); +// window.history.back(); + $location.path("/project").search({id: project_id,tag:1}); + }); + } + }); + } }; vm.selectRole = function(role_id){ vm.current_edit_member.roles_id = role_id; - } + + if(vm.current_roles_id == vm.current_edit_member.roles_id){ + vm.buttongrey = true; + } + else{ + vm.buttongrey = false; + } + }; + + vm.clickChangeRole = function(){ + vm.current_edit_member.show = !vm.current_edit_member.show; + if(vm.current_roles_id == vm.current_edit_member.roles_id){ + vm.buttongrey = true; + } + else{ + vm.buttongrey = false; + } + }; }] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 298e9b96f..3f90917b4 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -30,6 +30,8 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut // vm.project_members_has_more = rms.get("project_members_has_more"); vm.alertService = alertService.create(); + //双弹框 + vm.alertService_2 = alertService.create(); //跳入邀请界面 vm.invite = function(){ @@ -253,44 +255,27 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut $location.path("/project_publishnote").search({id:projectid}); }; - vm.deleteMember = function(user_id){ - $http({ - method: 'POST', - url: apiUrl + "projects/deletemember?id=" + projectid, - data:{token:auth.token(),user_id:user_id} - }).then(function successCallback(response) { - console.log(response.data); - - if(response.data.status == 0){ - vm.alertService.showMessage('提示', response.data.message,function(){ - //确定 - - }); - } - else{ - vm.alertService.showMessage('提示', response.data.message); - } - - }); - }; - vm.quit = function(){ - $http({ - method: 'POST', - url: apiUrl + "projects/quit?id=" + projectid, - data:{token:auth.token()} - }).then(function successCallback(response) { - console.log(response.data); - if(response.data.status == 0){ - vm.alertService.showMessage('提示', response.data.message,function(){ - //确定 - - }); - } - else{ - vm.alertService.showMessage('提示', response.data.message); - } + vm.alertService_2.showMessage('提示', "是否确认退出项目",function(){ + $http({ + method: 'POST', + url: apiUrl + "projects/" + projectid+"/quit", + data:{token:auth.token()} + }).then(function successCallback(response) { + console.log(response.data); + if(response.data.status == 0){ + vm.alertService.showMessage('提示', response.data.message,function(){ + //确定 + rms.save('projects',[]); + $location.path("/project_list"); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); }); + }; }]); \ No newline at end of file From 8644ad178c6761c5376f6ce494c1f934f75af91e Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 1 Sep 2016 10:21:29 +0800 Subject: [PATCH 119/170] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E5=88=A0=E9=99=A4=E6=88=90=E5=91=98?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 +- app/services/courses_service.rb | 5 +++-- public/assets/wechat/class.html | 4 ++-- public/assets/wechat/project.html | 4 ++-- public/javascripts/wechat/controllers/class_publishissue.js | 2 +- public/javascripts/wechat/controllers/class_publishnotice.js | 2 +- public/javascripts/wechat/controllers/project_publishnote.js | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 6a4175706..c8b67448e 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -734,7 +734,7 @@ module Mobile out = {status: status} message = case status when 0; "退出班级成功" - when 1; "您不在课程中" + when 1; "您不是该班级成员" when 2; "您还未登录" when 3; "管理员不能退出班级" else; "未知错误,请稍后再试" diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index c5084f228..f23b59dcb 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -79,7 +79,8 @@ class CoursesService else c = Course.find(course) end - if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c))) + # if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c))) + if current_user.nil? raise '403' end #@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1' @@ -458,8 +459,8 @@ class CoursesService joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id]) joined.each do |join| join.delete - @state = 0 end + @state = 0 @state end diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 8208c3883..706cf5206 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -217,7 +217,7 @@
        更多
        -
        + @@ -259,7 +259,7 @@
        - diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 8dfba3619..89cbb1418 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -98,7 +98,7 @@
        更多
        - @@ -138,7 +138,7 @@
        - diff --git a/public/javascripts/wechat/controllers/class_publishissue.js b/public/javascripts/wechat/controllers/class_publishissue.js index 1cd7f1285..09b995bea 100644 --- a/public/javascripts/wechat/controllers/class_publishissue.js +++ b/public/javascripts/wechat/controllers/class_publishissue.js @@ -55,7 +55,7 @@ app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'confi ).then(function(response){ if(response.data.status == 0) { - vm.alertService.showMessage('提示', '您已成功发布问题',function(){ + vm.alertService.showMessage('提示', '发布成功',function(){ rms.save('course_activities_page',0); rms.save("course_activities",[]); rms.save("course_has_more",false); diff --git a/public/javascripts/wechat/controllers/class_publishnotice.js b/public/javascripts/wechat/controllers/class_publishnotice.js index a0b9ab676..b900305c1 100644 --- a/public/javascripts/wechat/controllers/class_publishnotice.js +++ b/public/javascripts/wechat/controllers/class_publishnotice.js @@ -55,7 +55,7 @@ app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'conf ).then(function(response){ if(response.data.status == 0) { - vm.alertService.showMessage('提示', '您已成功发布通知',function(){ + vm.alertService.showMessage('提示', '发布成功',function(){ rms.save('course_activities_page',0); rms.save("course_activities",[]); rms.save("course_has_more",false); diff --git a/public/javascripts/wechat/controllers/project_publishnote.js b/public/javascripts/wechat/controllers/project_publishnote.js index 231faaea6..f39b32827 100644 --- a/public/javascripts/wechat/controllers/project_publishnote.js +++ b/public/javascripts/wechat/controllers/project_publishnote.js @@ -56,7 +56,7 @@ app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'conf ).then(function(response){ if(response.data.status == 0) { - vm.alertService.showMessage('提示', '您已成功发布帖子',function(){ + vm.alertService.showMessage('提示', '发布成功',function(){ rms.save('project_activities_page',0); rms.save("project_activities",[]); rms.save("project_has_more",false); From 225186988160fa8c0535afc5220acba7bb072646 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 1 Sep 2016 10:40:57 +0800 Subject: [PATCH 120/170] =?UTF-8?q?iphone=E4=B8=8B=E8=A7=86=E8=A7=92?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/directives/iphone_recognize.js | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js index 46d4a4292..3f6acf7c3 100644 --- a/public/javascripts/wechat/directives/iphone_recognize.js +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -12,15 +12,48 @@ app.directive('iphoneRecognize',["$timeout",function(timer){ element.css({"position":"relative","padding":"1px 0"}); $(".post-wrapper").css("marginBottom","0"); $("#all_homework_reply").css("marginBottom","0"); - window.scrollTo(0,contentHeight); +// window.scrollTo(0,contentHeight); } if (/ipad|iphone|mac/i.test(navigator.userAgent)){ + //开始编辑输入框的时候,软键盘出现,执行此事件 + -(void)textFieldDidBeginEditing:(UITextField *)textlab + { + //获取当前输入框的位置信息 + CGRect frame = textlab.frame; + //获取键盘底部位置与键盘最高点之间的距离,键盘高度256 + int offset = frame.origin.y + frame.size.height - (self.view.frame.size.height - 256.0); + //设置视图上升的时间 + NSTimeInterval animaTime = 0.30f; + //字符串随意也行... + [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; + //添加视图上的上升时间0.3f + [UIView setAnimationDuration:animaTime]; + + //将视图的Y坐标向上移动offset个单位,以使下面腾出地方用于软键盘的显示 + if(offset > 0) + self.view.frame = CGRectMake(0.0f, -offset, self.view.frame.size.width, self.view.frame.size.height); + //提交动画 + [UIView commitAnimations]; + } + //当用户按下return键或者按回车键,keyboard消失 + -(BOOL)textFieldShouldReturn:(UITextField *)textField + { + //收回键盘第一响应者意思... + [textField resignFirstResponder]; + return YES; + } + +//输入框编辑完成以后,将视图恢复到原始状态 + -(void)textFieldDidEndEditing:(UITextField *)textField + { + self.view.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); + } $("#postInput1").bind('focus',function(){ toBottom(); }); - $("#postInput1,#replyBlock").bind("click",function(){ - toBottom(); - }); +// $("#postInput1,#replyBlock").bind("click",function(){ +// toBottom(); +// }); $("#postInput1").bind('blur',function(){ element.css("position","fixed"); $(".post-wrapper").css("marginBottom","10px"); From 52a8a64a691a03dfb1fd1de1df43e1e27959d787 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 10:48:13 +0800 Subject: [PATCH 121/170] =?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 122/170] =?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 123/170] =?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 124/170] =?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 125/170] =?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 d4f8bd29f418c80c339bcef7384c36bbd943f0f7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 1 Sep 2016 11:18:42 +0800 Subject: [PATCH 126/170] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/apis/projects.rb | 2 +- app/api/mobile/entities/project.rb | 1 + app/services/courses_service.rb | 1 - app/services/projects_service.rb | 2 +- public/assets/wechat/class.html | 4 ++-- public/javascripts/wechat/controllers/class.js | 5 +++++ public/javascripts/wechat/controllers/join_class.js | 5 ++++- public/javascripts/wechat/controllers/join_project.js | 5 ++++- public/javascripts/wechat/controllers/project.js | 11 +++++++++++ 10 files changed, 30 insertions(+), 8 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index c8b67448e..b5af07a09 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -685,7 +685,7 @@ module Mobile roles_ids << role.id end - if my_member && roles_ids.include?(3) + if my_member && (roles_ids.include?(3) || roles_ids.include?(7) || roles_ids.include?(9) ) #删除该成员 cs = CoursesService.new status = cs.delete_course_member(c,params[:user_id].to_i,current_user) diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb index 665d068ae..ecd850fd8 100644 --- a/app/api/mobile/apis/projects.rb +++ b/app/api/mobile/apis/projects.rb @@ -336,7 +336,7 @@ module Mobile out = {status: status} message = case status when 0; "退出项目成功" - when -3; "您不在项目中" + when -3; "您不是该项目成员" when -1; "您还未登录" when -2; "项目创建者不能退出项目" else; "未知错误,请稍后再试" diff --git a/app/api/mobile/entities/project.rb b/app/api/mobile/entities/project.rb index 8da151b42..eef7a9c92 100644 --- a/app/api/mobile/entities/project.rb +++ b/app/api/mobile/entities/project.rb @@ -3,6 +3,7 @@ module Mobile class Project < Grape::Entity expose :name expose :id + expose :is_public expose :user_id expose :invite_code expose :qrcode diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index f23b59dcb..f184fa923 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -1295,7 +1295,6 @@ class CoursesService member = course.members.where("user_id=?",user_id).first if member != nil - member.destroy user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, course.id) if user_admin.size > 0 diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index ea2350495..f3679aa22 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -404,7 +404,7 @@ class ProjectsService end members = Member.where(:user_id => user.id, :project_id=>project.id).first - if members != nil && members.roles.first.to_s != "Manager" + if members != nil members.destroy # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除 applied_projects = AppliedProject.where(:project_id => project.id, :user_id => members.user_id).first diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 706cf5206..f81b4f5f0 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -239,7 +239,7 @@
        {{teacher.name}} - + 管理员 助教
        @@ -255,7 +255,7 @@
        我的同学
        {{student.name}} - +
        diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index fdd5bcd71..2e3ab4b22 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -340,6 +340,11 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(response.data.status == 0){ vm.alertService.showMessage('提示', response.data.message,function(){ //确定 + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + rms.save("course",null); + rms.save("tab_num",null); rms.save('syllabuses',[]); $location.path("/class_list"); }); diff --git a/public/javascripts/wechat/controllers/join_class.js b/public/javascripts/wechat/controllers/join_class.js index 1a9710bc1..006fa0b59 100644 --- a/public/javascripts/wechat/controllers/join_class.js +++ b/public/javascripts/wechat/controllers/join_class.js @@ -21,7 +21,9 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale // window.history.back(); // }); if(tag){ - window.history.back(); + rms.save('syllabuses',[]); + $location.path("/class_list"); +// window.history.back(); } else{ wx.closeWindow(); @@ -55,6 +57,7 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale }).then(function(response){ if(response.data.status == 0){ vm.alertService.showMessage('提示', response.data.message,function(){ + rms.save('syllabuses',[]); $location.path("/class_list"); }); } else { diff --git a/public/javascripts/wechat/controllers/join_project.js b/public/javascripts/wechat/controllers/join_project.js index d942e8859..2e8f9a269 100644 --- a/public/javascripts/wechat/controllers/join_project.js +++ b/public/javascripts/wechat/controllers/join_project.js @@ -15,7 +15,9 @@ app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'a vm.cancel = function(){ if(tag){ - window.history.back(); +// window.history.back(); + rms.save('projects',[]); + $location.path("/project_list"); } else{ wx.closeWindow(); @@ -47,6 +49,7 @@ app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'a }).then(function(response){ if(response.data.status == 0){ vm.alertService.showMessage('提示', response.data.message,function(){ + rms.save('projects',[]); $location.path("/project_list"); }); } else { diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 3f90917b4..1bdb2f1e0 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -266,6 +266,17 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut if(response.data.status == 0){ vm.alertService.showMessage('提示', response.data.message,function(){ //确定 + rms.save('project_activities_page',0); + rms.save("project_activities",[]); + rms.save("project_has_more",false); + rms.save("project",null); + rms.save("project_master_members",[]); + rms.save("project_develop_members",[]); + rms.save("project_report_members",[]); + rms.save("review_master_members",[]); + rms.save("review_develop_members",[]); + + rms.save('tab_num',null); rms.save('projects',[]); $location.path("/project_list"); }); From c51f725a78c612c72d342a46fd966156077c46e8 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:24:16 +0800 Subject: [PATCH 127/170] =?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 128/170] =?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 129/170] =?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 个资源
        From a6241afe04814f169cf8e9b713114c156e009d5f Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 1 Sep 2016 13:36:27 +0800 Subject: [PATCH 130/170] . --- .../wechat/directives/iphone_recognize.js | 43 +++---------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js index 3f6acf7c3..f3b167b96 100644 --- a/public/javascripts/wechat/directives/iphone_recognize.js +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -12,48 +12,15 @@ app.directive('iphoneRecognize',["$timeout",function(timer){ element.css({"position":"relative","padding":"1px 0"}); $(".post-wrapper").css("marginBottom","0"); $("#all_homework_reply").css("marginBottom","0"); -// window.scrollTo(0,contentHeight); - } + window.scrollTo(0,contentHeight); + }; if (/ipad|iphone|mac/i.test(navigator.userAgent)){ - //开始编辑输入框的时候,软键盘出现,执行此事件 - -(void)textFieldDidBeginEditing:(UITextField *)textlab - { - //获取当前输入框的位置信息 - CGRect frame = textlab.frame; - //获取键盘底部位置与键盘最高点之间的距离,键盘高度256 - int offset = frame.origin.y + frame.size.height - (self.view.frame.size.height - 256.0); - //设置视图上升的时间 - NSTimeInterval animaTime = 0.30f; - //字符串随意也行... - [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; - //添加视图上的上升时间0.3f - [UIView setAnimationDuration:animaTime]; - - //将视图的Y坐标向上移动offset个单位,以使下面腾出地方用于软键盘的显示 - if(offset > 0) - self.view.frame = CGRectMake(0.0f, -offset, self.view.frame.size.width, self.view.frame.size.height); - //提交动画 - [UIView commitAnimations]; - } - //当用户按下return键或者按回车键,keyboard消失 - -(BOOL)textFieldShouldReturn:(UITextField *)textField - { - //收回键盘第一响应者意思... - [textField resignFirstResponder]; - return YES; - } - -//输入框编辑完成以后,将视图恢复到原始状态 - -(void)textFieldDidEndEditing:(UITextField *)textField - { - self.view.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); - } $("#postInput1").bind('focus',function(){ toBottom(); }); -// $("#postInput1,#replyBlock").bind("click",function(){ -// toBottom(); -// }); + $("#postInput1,#replyBlock").bind("click",function(){ + toBottom(); + }); $("#postInput1").bind('blur',function(){ element.css("position","fixed"); $(".post-wrapper").css("marginBottom","10px"); From 27a2da8b7b7daf5d6259cff23045a22e360a0108 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 1 Sep 2016 13:56:13 +0800 Subject: [PATCH 131/170] =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_new_feedback.html.erb | 1 + public/stylesheets/css/public.css | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index 19b930826..ea63f680f 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -3,6 +3,7 @@
        +
        diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 378fb3ba9..28f89a24f 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -116,6 +116,7 @@ a.resourcesTypeUser {background:url(../images/homepage_icon.png) -178px -453px n .softwareIcon {background:url(/images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} /*意见反馈*/ +.qr-code-border {border:2px solid #269ac9;} html{ overflow-x:hidden;} .scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; } .side_content{width:154px; height:auto; overflow:hidden; float:left; } From 76b7469f755c8cad798ea97af8a46cb2237200d3 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 1 Sep 2016 14:04:53 +0800 Subject: [PATCH 132/170] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8ico?= =?UTF-8?q?n=E7=BC=A9=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/syllabus/icons_syllabus.png | Bin 22951 -> 2260 bytes public/stylesheets/syllabus.css | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/images/syllabus/icons_syllabus.png b/public/images/syllabus/icons_syllabus.png index 4afdb729f96ffa021e9e40a271718a7ea3883b63..3b81336c492f9463e6a0c065b09207c8df248a6a 100644 GIT binary patch literal 2260 zcmc&$XH-*Z8jhlXGCJxiuA}0efGjAaQG_f}AfZGFLkdk$2+0K^q?iNfT7T|P3Yn$q;f-rF?2o%b7FEsK!C`mhk+E3&Wt@? z13JK9I&c=vPv}STz%saO1YL_kh}b-c4TCux5b@}Y2v7)wfMF~S4z4PH0S8!29NgE2 zgd*|qU^vS?jt^4fJZX%$2!=fqeqcY~Ai_cdY*0uCMC?e804u`5Kj~tjwe}bZ2R=cB z5jglCPWh3%06dou0yYRMO9l#!25fB+Xlol=TeJm$L7_276!h3yqOGwuwph$Q;PZe( z*7(d&EQR3u*%q|J!NY|@9u|p=iHSkPSRuIlFeKXE-d?ML!B|2FOF=A0NEcah1jb7W z1W>@>vv@)lmjh@O=^@-GAr20C`bP+C-WOSp;B%Uwgds(A9ukc}X+v59l1Tp>%4UB- z3xpK#Pk;Zbuz(iJ1CbO^z>VTFpu&Y3YfbU6cs@uMa``kaH*zV9Ug2CJR}jwS0eGq{ zVCKu>Fu5@T^G|pZ2}|S%gmexABoc6NNCClOF|qrcP)-;tSG#>Elsy{lV(W~zvUjp^ z#kk_}c(k3J{SueJWkj(-j&O;~{F7_HELYnKY#wBp0Px<|YG(zej%OXGtasN4BaTelfY*TY~d61_ZVF1a;> zy{g%!{we0IF5fHiXRjoSi;HH@BeS!!U)9uk=C#)~HqS3CI%c;HkE%2p4Jof(tyW8= zQm_1W_T6r|TrTMzS11(U<+s07j13NtRMynHTxfI4Y3otV9=)!Zn_sATH*vpN^|ey`B02Grtg>tT@Krgrpkrcoer|5gw@6;qHQqHcGpEsvO>1(h z2Zu&R7Zw(j{R8FgAL%zcWrNc-4UPM=TGg5b^5qVuQK>4o4xN&{6pHD>{O+Q?Z(_4SWK+`a- zSbfe1NUnR}llqiM#yCDae9D=;iJEL-{IfHeLQUS$`;#*{ox1tKq0=gfP4Y@De{CGlUd&NP`Zc0q{TJpDxI+Y$xp&x%ddcEn;s)7}ltE{l;&BT=~feu2> zuBhwYP*e3L7)(>IA9V`7q7!wiWi_Vfm*XzC&WerC%MD>k396m4+L-K<6W8w_OHaBtlZJ_oDit?`M9cO(F8+PT53?0#jvE9$ zHNAIQCrjpU&>FZ>f8fzKU-@uPTLwNg%^jXc@$!?UJB!^$=e|S*;(jsHWm|UZed!w$9+#iY)`;(yB&Lnm13jxx@3ovUu7FN z`tLNcdtm*qiC>>RQ^dz_$|a-+6+B5HhtUYk%nkM4q>(jx#2=5ICRZoCZ5SMQ) z|Hs%4y|GB+?!u%?N1op?==(ZdUb-lE!2VPxHQN3B?hFqgB=j5ri1{Zbtv`Z25?SAX zo1S5jMD+T6!aq%@HN@VD>Kj&%z)K!wJYb!Xsl+ePWiF%JAn3}*vnA2*Btafbx5oJ$ zq)>tpmg{;7UL2H0Rk?+$HT9Q*Z#tf9?IZY^Q7XK@b`je&KJhBbm|k`EE8Xc+@Rspn zXIk>w+5WV$$mA23KT3f$MR)G3Qudo?~u$5dE;5s$c!SAIW$TxLH3% z$%%JwM!64&e>l(I@QY}~{x?h8%DkkuRBJy$Q>ie`hO93M=VZtb@vgd?_IQid{8bqs z+LnKAr#QB0>an>A)-*qByE16+Sqt~cJO|I}pcT5X61;x&IqzSz|1U72iznfZbMW{7 E2D>*%ssI20 literal 22951 zcmeI42{_bU+ra;}ETtq;R0gGWnEB5>F`0#?BC=~WE0bk3GuAd*wV_4I7Ew~Dv`Jao zv=C7wsboo_NJ*le??0qWPd(H7Jn#E{*Y{mB7c+CteeV05^E>C<=RW6uU9-(@;aqh! zT{Qpz)aTJ@_RuF={I4<$diSf3c7#4u{pfB&02n?-{4WQ@#*YI4H5(q4YG>!k7x9Ij zd_UMcDi!7@;B$H28~_NaNpJ{s-P=8u^sJjR%9&E#aXQ933@|jxP`Rbyc35K%z}Tdr zX>nt7xSF$;_UL%J)AbFNYV?Hg`lM+&9^~!ei+4CJ#lO+7O*^+Xr2X~l-iN)Ho8z1N zN`uQrg^t!V-u>e6N`PR$*^F4NA8AX!emgHzUYlO02-A2`eAPqg1^{#@1P84Xoto1p zcajgt1AdhzlQnNX|6^mWov{l5+YQtiYBmp-i?Ro9nK<6k0&a~1PC1-ms{#7}z&m&i z#Sl2I4z#_WM^XZ+)A!cu0M&;lq^khCCbP zg}R*w=gNoXDFFcyu2G{b+=0-8lvyPJ3@;B*CylwQ0JBy|LR1vgrLXYYoI{rb3X7xf z#w@5nY2`%U(+%wGsH-=qzv_LO!qAzn!BuTEjE{*k8bfbZur3_|0J=TpSH9rqL^Z!? zeEx#l?A`wU#^Ens9ehKQ!P{qFF7K3A1T+?wwb!g@YN}H3yD4|dzrZVf2~gtz4NY9R7e4oXn#ALf$W)ml<4Iln`3Ntwm(XfN`2kJS$ZpXS0ko3#rkPcu~ zti{31!jz4lS2278vg{+8ixnwI-|l9kFE=-@{~R&BydHge=`8K-Z(X`f$BiU7Tdyw=atVDdl#;IBPYLOq-#Y0V6pBUe5da4-GGJ% z8Vv3RfV~Ahkrp%MfV(lN4FGWY<+!EC_UTv`sQ>^iDQw0mvhs*4S{a2Sk>8=slsSu$FMGMTR$S2~y?LDJyp`qZ@U? z1zLn%OD#S{J-!74xA$$oJQukyEPIi{19^Xoi^ueJw-+S|%SGr>%R=`b_A1vsJIOrs z{Nc3n1uy+Yz}oE*tk81gNbb%@jHNrbTDos@)iu63meu5nagM~WCc5GRwDk%T8SN^Q z<#&XRX;WFgN#m;bhN!5yuGX&9V^i9U&T8hWxTtR2guFV{aPKkOvr|Ged#(pDiKnAn ztul@TGvVH14&G{J4oF>I1hd|1~q~nY3rYAm7 zIUY_tw0NFRQh=SQ!`AdMX#dzLcjLxVi&Nn#mG@$K9=vW((-u*#>XVI=EMxA)RCv8q zZfS1W_&#ui`WE$#H|fl21@#~i%nhHy!#b;gGo zYqWRY(TpZWJ4dgJZa(hlBy^fn8GL-W;|ZrxCzd;}J!<82#;ze<^}*N^mFW|mE~R6$ zO6>#fBkjr-tw_mV@p;21mU{M<%~nZU=qZk@3q|918H_CgId5GlRRU*))>&Q$Y?w>3 zd)ll6lzR07OjlbwP=&|28Qk66gcqys%8e{KUDrW)6hFVzpj5qdHCzEc2Y$M0WhOUs zT_&z3q$as$F-w zMz%aDpWEg0KBY_NReM!?xjqhoR>4M%_eSDb9VJn$mtF^WIprOjo*x@s?3ug!x@SuH zyp*Xq#&5QIG+=^sNZbtm1ZD>MDW}%UjKSoAk5jLw-e}C9es`Z&EH}6O?0r#5$*ozn z8PyrL+ad^+@m`6H{707`_wCwz#4`TI{2kaGH}}`d-EpQo{2Y3tU~zQdVGCJU0(5OcOuE0^Qp8&fmB42 zKNNCkYyQ!E!)NCCM(e899bBi}m)JY|Q}O4>j|IYSCE-(JE2*tg4Jgw_cCD zh_{jHJ1@?Dyz;ytz$0U&x4k#3EiNZC=Xg$7(AJNZZ(}q?V9>3?J(K{PwTGi8x zvPY{P!3q1~_r<5!tMm4so%s-PVcG>-?#!8c)fMvk>MJvK9F$+#s!IrKdG;s>Z_+%K44vo|8GaeZvOb=&%6U=mvT#M^nyz4yknZzZ|%-j)vaOue_en)Fuq%zr9M4q4e1arf-qJ9iZ@49x2#CFe69cP3*~ zK7=H!Usmk=IrGGY{71$$RRvE1SHBy%aiaF@r|tXNE}xqjcQxwgx<;?0I9k-AL1 z+=3VDp5)98w7roSx%$Xz|Q39UaP%!_u0Yq7rInh>A^EAhz0%`@D!gU^W?ntmpfAuCN7^i zH~+#P>)MeGEdQIBNSDNLV zm$%r8emp;?(P49ZAR2)J9z}$A8 zqpQf(#+u0D`v$j1)~Ljk~SPLLmi<;4-fm>dtDueo9Sr2<13k8N(~g0Vr^ z_)$5YJbH+L;}EjYkrm>_BCrkTkkrhAh>!svj)(yZ^6~Z+5`)YQ`|T2;@8WDzLs)+i zk(aq4SzIB^)y57+m47&d2AcnnICf0Mvu8 zM1HC%bPV?6nA&rMe18FpV;KOo#OP;@7mDmT-{Jm-DX92Q4fzcoWPaYRZ{lBK6!Eyf zXoy(yOEpdq?-y!f$$(n_oEjKvGl)8oD&R0ge1RjM?@bz*uHTPg&?!tjJz>*ac)o0Y zpm4gG>5nSkC(d_k92!H!Awim0I06kvf{sWe5d{)agqa9D5rG(DWT4~^Hf*3p#Ab*X zL#*K7Akq;*AYvdxn4wlA%Km7F&*pK1f6L1El0$5;Swt>h;KLA+cs>jdj;Wuohnea3 z%poQFXD@M{uTaGBWpU=wNKl3ekH;o585k@Bi$=gPNE8>&!lT)61_6bH<4{Z%8&AOE z&VGm#py-`P2ER!Qa#3cPv!PRoxW5OTz8+T3t( zQGfGt-<+6Or{6aa87#58BeBF2ox?UWmB{_xtZ$lM)p&m%&fh~YV1J1Euj>f(7fZ1z5yJ;zp{v+rOJSUB91^v;tKdaFovI>H;=^-FG$k>U-s9i;+r3XiTJP~ z&US$N5F7u+zOp$2-oG+WhqUq=CfNV6KL6vD$s`bPAdZ8ABS2^`0?}v|oB*;Ja4rIc z<$!nw7vzG2^Y`yLNZHE#x=%@NZvTAbek)S>dp`B2(cAw6pE|HdN=7S#5zwEb8*zLL zg?Y3AzhWi!hT<(&dN2cxG<47)4p}dQ;pOjcgg>ZDc+s!cp@4EQ!u;0)zJbOKQU95B z{yz;X2Wt6=neVj?k{<$iNbq9zZI2;R`QChi4WG>+q0CHwmOaGgcQN!x%5LC^6iH}5 zmjat-NyQ=wSS%bgK@K%Dq})&K3`W*u=%gSHfQ3UEDc*{fN&6x zB@CEmf@m(BgW@nj44%WmanXO*^lzP;{#L8e1T=#S9gE-~3y1m&1Ph|zY%T+dMliVq z4i-9+{VmfN6c$ZjGVyQ}l8YZOO+XP)Z~_j`!eH5KkU+rxP19Hg9)(0=+5Z94I4&EF z#^F(L5C_HX{by7H^h5)W$Fe{y0fR#_K)lpe4>~6V3Xeb{acBe%L}2kqB%X>yThj0- z0>O%gL0Dma+Yl0Mg~VdXcq=jj>bNBuZ$*Pv1=Z4$ipG+WROxeeutgx!5>KX}@E}M* zSfZg8;VtnL3=O29XfzZ7`}RNA;??c$T&O|fx+X%j0j?91L7>HI23fdK#}fq z23v%~Q>-9gg$1!z7)uB@g-iyicmf5D25DC0e}NGd0V1quC`%+r5Vr`6C!?qkBs>O> zrDCCrkKgVZ6=O-EU};ne#)?L>f=0~}K_%eOmN*>b3^C;2pGPzdij2pRsc0k?Cmw!^ z70uELi^o}^Fj%w|0lMb-%~9hp7)&OP3Bs8OBm-I;Xb{d|GLX>iFbl`ULeVuE%lNsm zfn3SWW9ZiOS6h#n_+pU=-P=HS2>r)15;V{Lls9BY>zBET?_a$A`|nqvNd~=4k>dBS zszb#;s=EEP>QM2Is^2x8e0d@gbfV~Q%n#W^w8Xcc1KYj>bmPwvckRclA4}Wuf;ir; zG#+&8CKTTuLEZYQ^rPgbnr^?;93uIuIWTNPZsz;<{()TR-XD78VEXNu!=J)}ucv{3 z@5lEp{d?_7Sd&#EfkRqChD#bD3AqfH1P*Bl87^srB;+z&5;&wKWVoael90=AN#Kx{ zkl~U>NJ1{dC4oa)LWWBkAqlw*mjn)J2^lVFge2rLToO2>C1kjy5t5M0a7o~hmXP6+ zMo2;~!zF=3T0(|P8X*a}43`8BX$cuFX@n%?GF%ckq$Omyq!E&k%Wz5Hkd~0)l14~E zF2f~(Ls~+HOBx{wxeS*C4rvJ)E@^}$duzwZi2WZBCLa9ZvK=jG-N|&8GcT_tMu(q^xizC$+4CeFMm`=)cUl8S zT*d3V9d2J@a>%nPDyTwN#f+n+Sr{Hvu~<~sLJ`U%8ciu93a=A5ZeA+f!zZz zKGN1zUmBM)t$C)yw(3Vg6)PjAW||OUmF~@-Cmijn`(Um+T49+0U3@NyG(};Ld_d0o z={*q>*QrCLJ&N{z+?*1OjN4VV%go1e4elAqV#$%pD8YM!yj5jS-%r=2*Ov3IH&L5s zujxj;P3=1Mz$CP{$$zxp1iZ1)#8Bm(X2KmGee>6bUd&TZ#nnf3hmr;PGZN39Pt!aN z=kC<7UA!^OsWTvIgze)EAL+{ZH%9N+^nA=~{PpAzcNa5WrsDbA=N=X672TRTqO#cY z_ybb%LviIhQmLQIRI0I;QfE(-Te8^j)%>n)0TY;5+oA`zb?0UuF|bZJaMxk^q4}}I z^l%@Gx2csJt*37t4Y7x-S8E@bcDHlY`>CN>TcbSQkKr8hd>Dn$?$V|{x#)T&EO~y| zvHn>QrQ#K;$n{+xr(U9LtdMd#ZC-?2ZzO7hT70M_$bIcXP%B7JGW+EXYsk{FM1N^^cY-rVT>nj!Oy;_*Qp4 z_a42y2~oQhYHr(JtG@v0-bU$Iu58^oo$aTvd(t6(d0;L8FoTny44a-*EO)uMY0UJN{0udIHsn$UT*x#Hr}X+L1I>8M z_|d|tA0ibqj8{)FJvFO1S1D*>kSd<>1wM91SC1~Jj0Y}n&%-Ve|^Y>}#IN)xnKsdff?EKQ-w0&dWUUqI^rTwf+*6RRx-5yM9x$%c&S{`}L<9 zxMDYlPkX@KpWK5#-Mn1TtJpf*HrIH0wQF&G`nAI4$as}_)#Tfhl~&3h=GP~W*q2|+ z&IF3q2piWd90x#Uv)|ncewnB;V!>3!s|H~eVFeTSJ)96_9ID>CP`l*R>De|8w+`J< zZOY6akvh6=Y746KHvPWqhB8$68yi7GFQ`#A<9Tg|XWfD}o3UHdLsz_Lv4JH3UH+9y zsO!1+Mf)|1W@TSc?IOTt17p!zPy2jRAC0c?7?*+wk>|-pl#W|+?P^g?{5BnI70B|o z;Z{G^tnl!37-z0<4OKly_fdY(D+JTO(z|ATto{*&g1oF)C3Pwa5p~vs@@WLTx_6s? zODm$J@ZQd diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index d6e7c19e9..d28ab1037 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -74,8 +74,8 @@ input.syllabus_input_min{ /*课程大纲-课程列表*/ .icon_course{ background: url(../images/syllabus/icons_syllabus.png) 0 -35px no-repeat; width:18px; height:15px; display:block;} -.icons_sy_open{background: url(../images/syllabus/icons_syllabus.png) 0 -53px no-repeat; width:20px; height:23px; display:block; cursor:pointer; } -.icons_sy_close{background: url(../images/syllabus/icons_syllabus.png) -26px -53px no-repeat; width:20px; height:23px; display:block; } +.icons_sy_open{background: url(../images/syllabus/icons_syllabus.png) 0 -50px no-repeat; width:20px; height:23px; display:block; cursor:pointer; } +.icons_sy_close{background: url(../images/syllabus/icons_syllabus.png) -26px -52px no-repeat; width:20px; height:23px; display:block; } .syllabus_courses_box {position:relative;} .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; } From 7c928703b5c06a769d889ac89cd0acb5801ba6e7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 1 Sep 2016 14:10:27 +0800 Subject: [PATCH 133/170] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=81=E5=B8=88?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7=E6=88=90?= =?UTF-8?q?=E5=91=98=E8=A7=92=E8=89=B2=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b5af07a09..a42ebd470 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -569,14 +569,20 @@ module Mobile roles_id << 10 end - c = Course.find("#{params[:id]}") - #7教辅 9教师 10学生 - if c.tea_id == params[:user_id] || c.tea_id != current_user.id || roles_id.length <= 0 - present :status, -1 - else + my_member = c.member_principals.where("users.id=#{current_user.id}").first + rolesids = [] + my_member.roles.each do |role| + rolesids << role.id + end + + #7教辅 9教师 10学生 + if c.tea_id == params[:user_id] || roles_id.length <= 0 || rolesids.include?(10) + present :status, -1 + present :message,"修改失败" + else cs = CoursesService.new status = cs.modify_user_course_role params,roles_id present :status, status From 05e72dcc7b7f3996386a7c8c4a955dd39e62637a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 1 Sep 2016 14:17:14 +0800 Subject: [PATCH 134/170] =?UTF-8?q?=E6=95=99=E5=B8=88=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index a42ebd470..cbf8f4986 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -579,13 +579,16 @@ module Mobile end #7教辅 9教师 10学生 - if c.tea_id == params[:user_id] || roles_id.length <= 0 || rolesids.include?(10) + if c.tea_id == params[:user_id] || roles_id.length <= 0 present :status, -1 present :message,"修改失败" - else + elsif rolesids.include?(3) || rolesids.include?(7) || rolesids.include?(9) cs = CoursesService.new status = cs.modify_user_course_role params,roles_id present :status, status + else + present :status, -1 + present :message,"修改失败" end end From e61cf5dd4f7fb708cf5055d506cc0273bdcc71ee Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 1 Sep 2016 14:21:19 +0800 Subject: [PATCH 135/170] =?UTF-8?q?=E5=A4=9A=E9=87=8D=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E7=9A=84=E6=88=90=E5=91=98=EF=BC=9A=E6=95=99=E5=B8=88=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E7=AD=94=E9=A2=98=E5=92=8C=E5=AD=A6=E7=94=9F=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E4=BD=9C=E4=B8=BA=E4=B8=A4=E6=9D=A1=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 4 ++-- app/controllers/users_controller.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 5e13149df..64f85b5db 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -1402,7 +1402,7 @@ class StudentWorkController < ApplicationController end def find_or_save_student_work(is_test) - student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first if student_work.nil? @homework.student_works.build( name: params[:title], @@ -1413,7 +1413,7 @@ class StudentWorkController < ApplicationController unless @homework.save logger.debug @homework.errors.full_messages else - student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first end end student_work diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a44a3bc01..6d003b5d8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -983,7 +983,7 @@ class UsersController < ApplicationController @user = User.current @homework = HomeworkCommon.find(params[:homework_id]) @is_test = params[:is_test] == 'true' - @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: @is_test).first if @student_work.nil? @student_work = StudentWork.new end From 4c64e883eac0b75e21c0ddae71a42fc489e60221 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 1 Sep 2016 14:30:21 +0800 Subject: [PATCH 136/170] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E6=97=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=82=80=E8=AF=B7=E7=A0=81=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/join_class.html | 1 + public/assets/wechat/join_project.html | 1 + 2 files changed, 2 insertions(+) diff --git a/public/assets/wechat/join_class.html b/public/assets/wechat/join_class.html index b5733e584..ad43db3a7 100644 --- a/public/assets/wechat/join_class.html +++ b/public/assets/wechat/join_class.html @@ -13,6 +13,7 @@
        提示
          +
        • 邀请码在创建班级时产生,请向班级老师获取
        • 教师、助教角色需要班级管理员审批
        • 学生角色无需管理员审批
        diff --git a/public/assets/wechat/join_project.html b/public/assets/wechat/join_project.html index 61be93cfd..fe8600999 100644 --- a/public/assets/wechat/join_project.html +++ b/public/assets/wechat/join_project.html @@ -12,6 +12,7 @@
        提示
          +
        • 邀请码在创建项目时产生,请向项目管理员获取
        • 管理人员、开发人员角色需要项目管理员审批
        • 报告人员角色无需管理员审批
        From 742c84bb261e49b54994b0f5b4e98b02f9ef3afd Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 14:30:56 +0800 Subject: [PATCH 137/170] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20issue=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=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/news/_project_show.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 1e3a83c9a..26393f7cb 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -26,7 +26,11 @@
        diff --git a/public/assets/wechat/edit_project_member.html b/public/assets/wechat/edit_project_member.html index 5500766d5..eb15b074a 100644 --- a/public/assets/wechat/edit_project_member.html +++ b/public/assets/wechat/edit_project_member.html @@ -15,7 +15,7 @@
        From 79e30862e97e70ea54991966d0c6ca879cea60e4 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 15:58:53 +0800 Subject: [PATCH 140/170] change sonar method into restart and cancel push events --- .../quality_analysis_controller.rb | 158 +++++++++--------- app/views/quality_analysis/_show.html.erb | 6 +- app/views/repositories/show.html.erb | 8 +- 3 files changed, 87 insertions(+), 85 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 3a9eff0ce..365889640 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -16,8 +16,8 @@ class QualityAnalysisController < ApplicationController end # params 说明:{identifier:版本库名} + # type: 1 新的分析 2 重新分析 def create - logger.info("11111111111111111111111111111") begin user_name = User.find(params[:user_id]).try(:login) identifier = params[:identifier] @@ -30,98 +30,98 @@ class QualityAnalysisController < ApplicationController # 考虑到历史数据:有些用户创建类job但是build失败,即sonar没有结果,这个时候需要把job删除,并且删掉quality_analyses表数据 # 如果不要这句则需要迁移数据 @sonar_address = Redmine::Configuration['sonar_address'] - projects_date = open(@sonar_address + "/api/projects/index").read - arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] - quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first - if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? - aa = @client_jenkins.job.delete("#{job_name}") - quality_an.delete unless quality_an.blank? - end + # projects_date = open(@sonar_address + "/api/projects/index").read + # arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] + quality_an = QualityAnalysis.where(:sonar_name => sonar_name) + # if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? + # aa = @client_jenkins.job.delete("#{job_name}") + # quality_an.delete unless quality_an.blank? + # end + + # type 1的时候之所以判断job是否存在,为了防止特殊情况,正常情况是不会出现的 + # 重新分析的时候需要删除以前的分析结果 + @client_jenkins.job.delete("#{job_name}") if @client_jenkins.job.exists?(job_name) + quality_an.delete_all unless quality_an.blank? # Checks if the given job exists in Jenkins. - unless @client_jenkins.job.exists?(job_name) - @g = Gitlab.client - branch = params[:branch] - language = swith_language_type(params[:language]) - path = params[:path].blank? ? "./" : params[:path] - # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first - version = quality_an.nil? ? 1 : quality_an.sonar_version + 1 - properties = "sonar.projectKey=#{sonar_name} + @g = Gitlab.client + branch = params[:branch] + language = swith_language_type(params[:language]) + path = params[:path].blank? ? "./" : params[:path] + # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first + version = 1 + properties = "sonar.projectKey=#{sonar_name} sonar.projectName=#{sonar_name} sonar.projectVersion=#{version} sonar.sources=#{path} sonar.language=#{language.downcase} sonar.sourceEncoding=utf-8" - git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" + git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" - # 替换配置文件 - @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) - @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url - @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" - @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties + # 替换配置文件 + @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) + @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url + @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" + @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties - # jenkins job创建 - jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml) - logger.info("Jenkins status of create ==> #{jenkins_job}") + # jenkins job创建 + jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml) - # 将地址作为hook值添加到gitlab - @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}") - # job创建完成后自动运行job,如果运行成功则返回‘200’ - code = @client_jenkins.job.build("#{job_name}") - logger.error("build result ==> #{code}") + # 将地址作为hook值添加到gitlab + # @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}") + # job创建完成后自动运行job,如果运行成功则返回‘200’ + code = @client_jenkins.job.build("#{job_name}") - # 判断调用sonar分析是否成功 - # 等待启动时间处理, 最长时间为30分钟 - for i in 0..360 do - sleep(5) - @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}") - if (@current_build_status == "success" || @current_build_status == "failure") + # 判断调用sonar分析是否成功 + # 等待启动时间处理, 最长时间为30分钟 + for i in 0..360 do + sleep(5) + @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}") + if (@current_build_status == "success" || @current_build_status == "failure") + break + if i == 360 + @build_console_result = false break - if i == 360 - @build_console_result = false - break - end - end - end - - # sonar 缓冲,sonar生成数据 - sleep(10) - - # 获取sonar output结果 - console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"] - logger.info("@current_build_status is ==> #{@current_build_status}") - - # 两种情况需要删除job: - # 1/创建成功但是build失败则删除job - # 2/creat和build成功,调用sonar启动失败则删除job - # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息 - if jenkins_job == '200' && code != '201' - @client_jenkins.job.delete("#{job_name}") - else - if @current_build_status == "failure" - reg_console = /Exception:.*?\r/.match(console_build) - output = reg_console[0].gsub("\r", "") unless reg_console.nil? - se = SonarError.where(:jenkins_job_name => job_name).first - se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output) - @client_jenkins.job.delete("#{job_name}") - elsif @current_build_status == "success" - if quality_an.blank? - QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, - :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}") - else - qa.update_attribute(:sonar_version, version) - end - end - end - - respond_to do |format| - if @current_build_status == "success" - format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)} - elsif @current_build_status == "failure" - format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)} end end end + + # sonar 缓冲,sonar生成数据 + sleep(10) + + # 获取sonar output结果 + console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"] + logger.info("@current_build_status is ==> #{@current_build_status}") + + # 两种情况需要删除job: + # 1/创建成功但是build失败则删除job + # 2/creat和build成功,调用sonar启动失败则删除job + # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息 + if jenkins_job == '200' && code != '201' + @client_jenkins.job.delete("#{job_name}") + else + if @current_build_status == "failure" + reg_console = /Exception:.*?\r/.match(console_build) + output = reg_console[0].gsub("\r", "") unless reg_console.nil? + se = SonarError.where(:jenkins_job_name => job_name).first + se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output) + @client_jenkins.job.delete("#{job_name}") + elsif @current_build_status == "success" + if quality_an.blank? + QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, + :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}") + end + end + end + + respond_to do |format| + if @current_build_status == "success" + format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)} + elsif @current_build_status == "failure" + format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)} + end + end + rescue => e @message = e.message logger.error("######################====>#{e.message}") @@ -302,10 +302,8 @@ class QualityAnalysisController < ApplicationController @jenkins_address = Redmine::Configuration['jenkins_address'] jenkins_username = Redmine::Configuration['jenkins_username'] jenkins_password = Redmine::Configuration['jenkins_password'] - logger.info("22222222222222222222222222222222") # connect jenkins @client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password) - logger.info("333333333333333333333333333333") rescue => e logger.error("failed to connect Jenkins ==> #{e}") end diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index ff7863ce8..d6c8c0a56 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -127,7 +127,7 @@

        <%= @ha["functions"].to_i %>

        -<% unless @user_quality_infos.blank? %> +<% if !@user_quality_infos.blank? %>
        贡献统计
          @@ -141,7 +141,7 @@ <% @user_quality_infos.each do |author_info| %> <% user = get_user_by_mail(author_info[:email]) %> - <% unless author_info[:changes] == 0 %> + <%# unless author_info[:changes] == 0 %>
          • @@ -155,7 +155,7 @@
          • <%= author_info[:ratio] %>
          - <% end %> + <%# end %> <% end %>
        diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index b80d9ee5b..ec63a1c73 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -3,8 +3,12 @@

        <%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>

        <% unless @entries.nil? %> ZIP下载 - <% if quality_analysis(User.current.try(:login), @repository.id).nil? && User.current.member_of?(@project) && @project.is_public? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %> + <% if User.current.member_of?(@project) && @project.is_public? %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> + <% else %> + <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> + <% end %> <% end %> <% end %> From 40f5510195a360e2f35cd35f2f4f213f685208c8 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 1 Sep 2016 16:01:16 +0800 Subject: [PATCH 141/170] =?UTF-8?q?=E4=BE=A7=E5=AF=BC=E8=88=AA=E6=96=87?= =?UTF-8?q?=E5=AD=97=E5=92=8C=E6=8C=89=E9=92=AE=E4=B8=8D=E9=87=8D=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/structure.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 7004c0928..31464673e 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -499,7 +499,7 @@ a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;} .user_leftnav{ width:240px;} .users_accordion li > a { display: block; - padding: 0 10px 0 32px; + padding: 0 25px 0 32px; height:49px; line-height:49px; color: #333; From e798381feb81ffb52a16a530b219679cfa1b23cf Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 16:39:09 +0800 Subject: [PATCH 142/170] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=95=B0=E6=94=B9=E6=88=90=E5=AE=9E=E6=97=B6=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_development_group.html.erb | 5 +++-- app/views/projects/_friend_group.html.erb | 5 +++-- app/views/projects/_research_team.html.erb | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 52f4e002a..17742f023 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -1,3 +1,4 @@ +<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %> diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 85b3a901a..5c933aee2 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -72,7 +72,12 @@
        -
        +
        +
        +
        +
        {{homework.praise_count}}
        +
        {{homework.praise_count}}
        +
        diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 7fa8459c4..ba3dd6553 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -61,7 +61,12 @@ -
        +
        +
        +
        +
        {{homework.praise_count}}
        +
        {{homework.praise_count}}
        +
        diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index efc7ed64d..ed5e0cf09 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -78,7 +78,12 @@ -
        +
        +
        +
        +
        {{homework.praise_count}}
        +
        {{homework.praise_count}}
        +
        diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index e2e65ca58..922b6dbfb 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -56,7 +56,12 @@ -
        +
        +
        +
        +
        {{homework.praise_count}}
        +
        {{homework.praise_count}}
        +
        diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 30d464802..f1e492d8b 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -57,7 +57,12 @@ -
        +
        +
        +
        +
        {{homework.praise_count}}
        +
        {{homework.praise_count}}
        +
        From a6bb19eb60fdae025c81de26fa34bdb8572e8d74 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 2 Sep 2016 10:54:40 +0800 Subject: [PATCH 147/170] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=A2=9E=E5=8A=A0=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/issue.rb | 4 ++++ app/api/mobile/entities/news.rb | 4 ++++ public/assets/wechat/blog_detail.html | 6 +++--- public/assets/wechat/course_discussion.html | 6 +++--- public/assets/wechat/course_notice.html | 6 +++--- public/assets/wechat/homework_detail.html | 6 +++--- public/assets/wechat/issue_detail.html | 6 +++--- public/assets/wechat/jour_message_detail.html | 6 +++--- public/assets/wechat/project_discussion.html | 6 +++--- 9 files changed, 29 insertions(+), 21 deletions(-) diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb index e3dbb5023..a46e10da5 100644 --- a/app/api/mobile/entities/issue.rb +++ b/app/api/mobile/entities/issue.rb @@ -52,6 +52,10 @@ module Mobile time_from_now issue.created_on when :act_id issue.id + when :act_type + 'Journal' + when :praise_count + get_activity_praise_num(issue) end end end diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index a64081d8a..d8c4dcab3 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -36,6 +36,10 @@ module Mobile time_from_now f.created_on when :act_id f.id + when :praise_count + get_activity_praise_num(f) + when :act_type + 'Comment' end elsif f.is_a?(Hash) && !f.key?(field) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 3b082e7b4..54dda1568 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -61,9 +61,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 8e0c11c1f..0daf0e1bb 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -59,9 +59,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 5c933aee2..a24321b5e 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -74,9 +74,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index ba3dd6553..9ffdcea4a 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -63,9 +63,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index ed5e0cf09..8aefc8d17 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -80,9 +80,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 922b6dbfb..8062ccccc 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -58,9 +58,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index f1e492d8b..e29b062dc 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -59,9 +59,9 @@
        -
        -
        {{homework.praise_count}}
        -
        {{homework.praise_count}}
        +
        +
        {{journal.praise_count}}
        +
        {{journal.praise_count}}
        From fa25a78f6278086df01216a9efc5a13fb97eba51 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 2 Sep 2016 11:27:35 +0800 Subject: [PATCH 148/170] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=20=E6=B7=BB=E5=8A=A0=E7=A7=81=E6=9C=89=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=8F=90=E7=A4=BA=E5=8F=8A=E5=B1=80=E9=83=A8=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 44 +- app/controllers/files_controller.rb | 550 +++++++++--------- .../attachments/update_file_dense.js.erb | 10 +- app/views/files/_course_file.html.erb | 31 +- app/views/files/_project_file.html.erb | 23 +- app/views/files/_resource_detail.html.erb | 6 +- .../files/_tip_attachment_count.html.erb | 2 +- app/views/files/_tool_settings.html.erb | 13 +- app/views/files/search_tag_attachment.js.erb | 10 +- app/views/layouts/base_courses.html.erb | 4 +- 10 files changed, 371 insertions(+), 322 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 7ec532d79..f149ad9b2 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -203,16 +204,49 @@ class AttachmentsController < ApplicationController @attachment.save @newfiledense = filedense end - if @project + tip_attachment_update - elsif @course - - end respond_to do |format| format.js end end + def tip_attachment_update + if params[:course_id] + @tip_all_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id]) + @tip_all_public_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id], :is_public => 1) + @tip_all_private_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id], :is_public => 0) + @course = Course.find(params[:course_id]) + elsif params[:project_id] + @tip_all_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id]) + @tip_all_public_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 1) + @tip_all_private_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 0) + @project = Project.find(params[:project_id]) + end + @tag_name = params[:tag_name] + @other = params[:other] + unless @tag_name.blank? + if @other + if @project + @tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + elsif @course + @tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') } + @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') } + @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') } + end + else + @tip_all_attachments = @tip_all_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)} + @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)} + @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)} + end + end + @tip_all_attachments = @tip_all_attachments.count + @tip_all_public_attachments = @tip_all_public_attachments.count + @tip_all_private_attachments = @tip_all_private_attachments.count + end + def thumbnail if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) if stale?(:etag => thumbnail) @@ -281,6 +315,7 @@ class AttachmentsController < ApplicationController @attachment.delete @flag = true end + # tip_attachment_update respond_to do |format| format.js @@ -591,6 +626,7 @@ class AttachmentsController < ApplicationController def attachment_versions @attachment = Attachment.find(params[:id]) @attachment_histories = @attachment.attachment_histories + @container_tip = Project.find(params[:project_id]) respond_to do |format| format.js end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 988768414..2ed17a76f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -86,7 +86,7 @@ class FilesController < ApplicationController else @result = find_course_attache q,@course,sort @result = visable_attachemnts @result - # @searched_attach = paginateHelper @result,10 + # @searched_attach = paginateHelper @result,10 @tag_list = get_course_tag_list @course end @all_attachments = @result @@ -96,9 +96,9 @@ class FilesController < ApplicationController @offset ||= @feedback_pages.offset #@curse_attachments_all = @all_attachments[@offset, @limit] @obj_attachments = paginateHelper @all_attachments,10 - #rescue Exception => e - # #render 'stores' - # redirect_to search_course_files_url + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url end end @@ -176,52 +176,52 @@ class FilesController < ApplicationController end end - def search_files_in_subfield - sort = "" - @sort = "" - @order = "" - @is_remote = true - @q = params[:name].strip - if params[:sort] - order_by = params[:sort].split(":") - @sort = order_by[0] - if order_by.count > 1 - @order = order_by[1] - end - sort = "#{@sort} #{@order}" + def search_files_in_subfield + sort = "" + @sort = "" + @order = "" + @is_remote = true + @q = params[:name].strip + if params[:sort] + order_by = params[:sort].split(":") + @sort = order_by[0] + if order_by.count > 1 + @order = order_by[1] end - # show_attachments [@course] - begin - q = "%#{params[:name].strip}%" - #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? - if params[:insite] - if q == "%%" - @result = [] - @searched_attach = paginateHelper @result,10 - else - @result = find_public_attache q,sort - @result = visable_attachemnts_insite @result,@org_subfield - @searched_attach = paginateHelper @result,10 - end - else - @result = find_org_subfield_attache q,@org_subfield,sort - @result = visable_attachemnts @result - @searched_attach = paginateHelper @result,10 - @tag_list = attachment_tag_list @result - end - #rescue Exception => e - # #render 'stores' - # redirect_to search_course_files_url - end - @page = params[:page] || 1 + sort = "#{@sort} #{@order}" end + # show_attachments [@course] + begin + q = "%#{params[:name].strip}%" + #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? + if params[:insite] + if q == "%%" + @result = [] + @searched_attach = paginateHelper @result,10 + else + @result = find_public_attache q,sort + @result = visable_attachemnts_insite @result,@org_subfield + @searched_attach = paginateHelper @result,10 + end + else + @result = find_org_subfield_attache q,@org_subfield,sort + @result = visable_attachemnts @result + @searched_attach = paginateHelper @result,10 + @tag_list = attachment_tag_list @result + end + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url + end + @page = params[:page] || 1 + end def find_course_attache keywords,course,sort = "" if sort == "" sort = "created_on DESC" end if keywords != "%%" - resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort) + resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort) else resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort) end @@ -250,7 +250,7 @@ class FilesController < ApplicationController else resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' "). reorder(sort) end - end + end def find_public_attache keywords,sort = "" # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map @@ -260,7 +260,7 @@ class FilesController < ApplicationController sort = "created_on DESC" end resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%"). - reorder(sort) + reorder(sort) end def index @@ -325,7 +325,7 @@ class FilesController < ApplicationController @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] show_attachments @containers - # get_attachment_for_tip(@all_attachments) + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -355,7 +355,7 @@ class FilesController < ApplicationController when "quotes" attribute = "quotes" else - attribute = "created_on" + attribute = "created_on" end @sort = order_by[0] @order = order_by[1] @@ -378,7 +378,7 @@ class FilesController < ApplicationController @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers - # get_attachment_for_tip(@all_attachments) + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -501,228 +501,228 @@ class FilesController < ApplicationController end def create - if params[:add_tag] - @addTag=true - #render :back + if params[:add_tag] + @addTag=true + #render :back tag_saveEx #render :text =>"success" respond_to do |format| - format.js - end - else - #modify by nwb - if @project - @addTag=false - if params[:in_project_toolbar] - @in_project_toolbar = params[:in_project_toolbar] - end - attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type]) - if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - # 发送邮件 - Mailer.run.attachments_added(attachments[:files]) - # 生成动态 - attachments[:files].each do |file| - ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment") - end - # 更新资源总数, 根据上传的附件数累加 - @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil? - end - # end - if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array) - params[:project_attachment_type].each do |type| - tag_name = get_project_tag_name_by_type_nmuber type - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - else - if params[:project_attachment_type] && params[:project_attachment_type] != "6" - tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type] - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + format.js + end + else + #modify by nwb + if @project + @addTag=false + if params[:in_project_toolbar] + @in_project_toolbar = params[:in_project_toolbar] + end + attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type]) + if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + # 发送邮件 + Mailer.run.attachments_added(attachments[:files]) + # 生成动态 + attachments[:files].each do |file| + ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment") + end + # 更新资源总数, 根据上传的附件数累加 + @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil? + end + # end + if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array) + params[:project_attachment_type].each do |type| + tag_name = get_project_tag_name_by_type_nmuber type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + else + if params[:project_attachment_type] && params[:project_attachment_type] != "6" + tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 - respond_to do |format| - format.js - format.html { - redirect_to project_files_url(@project) - } - end - elsif @course - @addTag=false - if params[:in_course_toolbar] - @in_course_toolbar = params[:in_course_toolbar] - end - attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type]) + @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 + respond_to do |format| + format.js + format.html { + redirect_to project_files_url(@project) + } + end + elsif @course + @addTag=false + if params[:in_course_toolbar] + @in_course_toolbar = params[:in_course_toolbar] + end + attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type]) - if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - Mailer.run.attachments_added(attachments[:files]) - end - if !attachments.empty? && attachments[:files] - attachments[:files].each do |attachment| - if params[:publish_time] - if params[:publish_time] == "" - attachment.publish_time = Date.today - else - attachment.publish_time = params[:publish_time] - end - else - attachment.publish_time = Date.today - end - if attachment.publish_time > Date.today - attachment.is_publish = 0 - end - attachment.description = params[:description] - attachment.save - end - end - if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) - params[:course_attachment_type].each do |type| - tag_name = get_tag_name_by_type_number type - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.save - end - end - end - else - if params[:course_attachment_type] && params[:course_attachment_type] != "5" - tag_name = get_tag_name_by_type_number params[:course_attachment_type] - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.save - end - end - end - end - # 更新课程英雄榜得分 - course_member_score(@course.id, attachments[:files].first.author_id, "Attachment") - # end - # end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + Mailer.run.attachments_added(attachments[:files]) + end + if !attachments.empty? && attachments[:files] + attachments[:files].each do |attachment| + if params[:publish_time] + if params[:publish_time] == "" + attachment.publish_time = Date.today + else + attachment.publish_time = params[:publish_time] + end + else + attachment.publish_time = Date.today + end + if attachment.publish_time > Date.today + attachment.is_publish = 0 + end + attachment.description = params[:description] + attachment.save + end + end + if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) + params[:course_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + else + if params[:course_attachment_type] && params[:course_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:course_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + end + # 更新课程英雄榜得分 + course_member_score(@course.id, attachments[:files].first.author_id, "Attachment") + # end + # end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] + @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 + @attachtype = 0 + @contenttype = 0 - respond_to do |format| - format.js - format.html { - redirect_to course_files_url(@course) - } - end - elsif @org_subfield - @addTag=false - attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) + respond_to do |format| + format.js + format.html { + redirect_to course_files_url(@course) + } + end + elsif @org_subfield + @addTag=false + attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) - if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) - params[:org_subfield_attachment_type].each do |type| - tag_name = get_tag_name_by_type_number type - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - else - if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" - tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - end + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) + params[:org_subfield_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + else + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] + @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 - respond_to do |format| - format.js - # format.html { - # redirect_to org_subfield_files_url(@org_subfield) - # } - end - # 组织添加附件,为了修改图片 - elsif params[:organization_id] - @organization = Organization.find(params[:organization_id]) - @addTag=false - # atttchment_type = 0为logo 1为banner - if params[:logo] - attachments = Attachment.attach_filesex(@organization, params[:attachments], false) - else - attachments = Attachment.attach_filesex(@organization, params[:attachments], true) - end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + respond_to do |format| + format.js + # format.html { + # redirect_to org_subfield_files_url(@org_subfield) + # } + end + # 组织添加附件,为了修改图片 + elsif params[:organization_id] + @organization = Organization.find(params[:organization_id]) + @addTag=false + # atttchment_type = 0为logo 1为banner + if params[:logo] + attachments = Attachment.attach_filesex(@organization, params[:attachments], false) + else + attachments = Attachment.attach_filesex(@organization, params[:attachments], true) + end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)] + @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 - respond_to do |format| - format.js - # format.html { - # redirect_to org_subfield_files_url(@org_subfield) - # } - end - end - end + respond_to do |format| + format.js + # format.html { + # redirect_to org_subfield_files_url(@org_subfield) + # } + end + end + end end def get_project_tag_name_by_type_nmuber type @@ -798,13 +798,13 @@ class FilesController < ApplicationController else #捕获异常 end - end + end # 返回指定资源类型的资源列表 # added by nwb def getattachtype - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", 'filename' => "#{Attachment.table_name}.filename", 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" @@ -842,27 +842,27 @@ class FilesController < ApplicationController end end - if @project - @isproject = true - @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] - @containers += @project.versions.includes(:attachments).reorder(sort).all - show_attachments @containers - @attachtype = params[:type].to_i - @contenttype = params[:contentType].to_s + if @project + @isproject = true + @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] + @containers += @project.versions.includes(:attachments).reorder(sort).all + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s respond_to do |format| format.js - format.html { - render :layout => 'base_projects' - } + format.html { + render :layout => 'base_projects' + } end - elsif @course + elsif @course @isproject = false @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers @attachtype = params[:type].to_i @contenttype = params[:contentType].to_s - # render layout: 'base_courses' + # render layout: 'base_courses' @left_nav_type = 5 respond_to do |format| format.js @@ -870,19 +870,19 @@ class FilesController < ApplicationController render :layout => 'base_courses' } end - else - show_attachments @containers - @attachtype = params[:type].to_i - @contenttype = params[:contentType].to_s + else + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s - respond_to do |format| + respond_to do |format| format.js format.html - end - end + end + end end - #查找指定TAG的按条件过滤的资源列表,只有课程内搜索有此功能 + #查找指定TAG的按条件过滤的资源列表,只有课程内搜索有此功能 def search_tag_attachment @q,@tag_name,@order = params[:q],params[:tag_name] @is_remote = true diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index 7709ee288..635fbe8bf 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -1,16 +1,18 @@ <% if @attachment.container_type == 'Course' %> -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id, :course_id => @attachment.container_id, :tag_name => @tag_name, :other => @other,:newtype=>(@attachment.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post) %>"); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); <% elsif @attachment.container_type == 'Project' %> - $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :newtype => (@attachment.is_public? ? 0:1)), + $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :project_id => @attachment.container_id, :tag_name => @tag_name, :other => @other ,:newtype => (@attachment.is_public? ? 0:1)), :remote => true, :class => "postOptionLink", :method => :post) %>"); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); <% else %> -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post) %>"); <% end %> <% if @attachment.is_public? %> $("#image_private_<%= @attachment.id%>").html('') <%else%> -$("#image_private_<%= @attachment.id%>").html('私有') + $("#image_private_<%= @attachment.id%>").html('私有') <% end %> \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index b5a15bc1f..d3cc58c71 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,9 +1,9 @@ - - - - - -<% is_current_user = User.current.logged?%> - -
        - -
        -
        -
        - <%=render :partial => 'layouts/syllabus_info' %> -
        -
        - -
        -
        - <%= yield %> -
        -
        -
        - <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> -
        -
        - <%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %> -
        -
        -
        -
        - -
        -
        -<%= render :partial => 'layouts/footer' %> -
        - - - - - - + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + + + + + + + +<% is_current_user = User.current.logged?%> + +
        +
        +

        + 位置:   + <%= link_to "尹刚", :class => 'sy_cgrey' %> +  >  + <%=link_to "课程", :class => 'sy_cgrey' %> +  >  + <%=link_to "课程名称", :class => 'sy_cgrey' %> +

        +
        +
        +
        +
        + <%=render :partial => 'layouts/syllabus_info' %> +
        +
        + +
        +
        + <%= yield %> +
        +
        +
        + <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> +
        +
        + <%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %> +
        +
        +
        +
        + +
        +
        +<%= render :partial => 'layouts/footer' %> +
        + + + + + + diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index d28ab1037..f6a8e8e6e 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -113,12 +113,13 @@ a.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bott /* 课程大纲头部 */ .sy_top{ background:#f5f5f5; - width: 100%; + width: 1000px; height: 138px; + margin: 0 auto; } .sy_top_con{ background: url(../images/sy/bg_sy.jpg) no-repeat; - width: 1280px; + width: 1000px; margin: 0 auto; height: 108px; text-align:center; From 9e317c4a8f8fcc6b6c6ab1d88c147ad12a7deeef Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 2 Sep 2016 13:54:34 +0800 Subject: [PATCH 151/170] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=8D=95=E8=AF=8D=E8=BF=87=E9=95=BF=E4=B8=8D?= =?UTF-8?q?=E6=8A=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/public.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 28f89a24f..e08d9a1da 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1386,7 +1386,7 @@ a.content-username:hover{ color:#297fb8;} .orig_index{ float:right; color:#666; font-family:Arial; padding-right:5px;line-height:30px;} .orig_user{ margin:10px 15px 10px 5px;} .orig_user span{ color:#999; padding-right:5px;} -.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; } +.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; word-wrap:break-word; } .orig_content img {max-width:100%;} .orig_right{ width:80%; margin-top:5px;} a.comment_ding_link{ height:24px;line-height:24px;display:inline-block;padding-left:2px;vertical-align:middle; color:#333; } From ded6753ce15bfd9632366ce49887555516975135 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Sep 2016 14:23:02 +0800 Subject: [PATCH 152/170] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BB=96=E4=BA=BA?= =?UTF-8?q?=E7=9A=84=E4=B8=BB=E9=A1=B5=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=BB=96?= =?UTF-8?q?=E6=9C=AC=E4=BA=BA=E7=9A=84=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 128 +++++++++++++++++++++------- app/views/users/show.html.erb | 4 +- 2 files changed, 98 insertions(+), 34 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6d003b5d8..3afc784e7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1660,55 +1660,117 @@ class UsersController < ApplicationController course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" + container_type = '' + act_type = '' if params[:type].present? case params[:type] when "course_homework" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'HomeworkCommon' when "course_news" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'News' when "course_message" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'Message' when "course_poll" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'Poll' when "course_journals" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'JournalsForMessage' when "project_issue" - @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Project' + act_type = 'Issue' when "project_message" - @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'Message' when "user_journals" - @user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Principal' + act_type = 'JournalsForMessage' when "current_user" - @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) - else - if @user == User.current - blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" - else - blog_ids = "("+@user.blog.id.to_s+")" - end - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + - "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ - "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + - "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Principal' + act_type = 'Principal' + end + end + if container_type != '' && act_type != '' + if container_type == 'Course' + sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'" + elsif container_type == 'Project' + sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'" + elsif container_type == 'Principal' && act_type == 'JournalsForMessage' + sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}" + elsif container_type == 'Principal' && act_type == 'Principal' + sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))" + end + if User.current != @user + sql += "and user_id = #{@user.id}" end else - # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) - # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" - # 减少数据库交互 - if @user == User.current - watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) - user_ids = "(" + @user.id.to_s + watched_user_ids + ")" + if User.current != @user + blog_ids = "("+@user.blog.id.to_s+")" + sql = "user_id = #{@user.id} and((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids}))" else - user_ids = "(" + @user.id.to_s + ")" + blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})" end - watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}") - blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")" - - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + - "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ - "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + - "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) end + @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10) + # if params[:type].present? + # case params[:type] + # when "course_homework" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_news" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_message" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_poll" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_journals" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) + # when "project_issue" + # @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) + # when "project_message" + # @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + # when "user_journals" + # @user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10) + # when "current_user" + # @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) + # else + # if @user == User.current + # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # else + # blog_ids = "("+@user.blog.id.to_s+")" + # end + # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + # "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + # "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + # "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) + # end + # else + # # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) + # # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # # 减少数据库交互 + # if @user == User.current + # watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) + # user_ids = "(" + @user.id.to_s + watched_user_ids + ")" + # else + # user_ids = "(" + @user.id.to_s + ")" + # end + # watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}") + # blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")" + # + # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + # "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + # "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + # "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) + # end # @user_activities = paginateHelper @user_activities,500 @type = params[:type] respond_to do |format| diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 9acffce3d..30fc85dc0 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -36,7 +36,9 @@
        • 更多
        • <%= link_to "个人留言", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> -
        • <%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%> + <% if @user == User.current %> +
        • <%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%> + <% end %>
        • <%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
        From d0a2ea02f2fa193f91f9cebf31450909388e14f4 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 2 Sep 2016 14:27:49 +0800 Subject: [PATCH 153/170] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E5=AD=A6=E5=8F=B7=E8=BF=87=E9=95=BF=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA=EF=BC=9B=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=95=99=E5=B8=88=E5=9B=A2=E9=98=9F=E5=90=8D=E7=A7=B0=E8=BF=87?= =?UTF-8?q?=E9=95=BF=E7=9C=81=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_member_list.html.erb | 4 +- .../layouts/_syllabus_teacher_list.html.erb | 40 +++++++++---------- public/stylesheets/css/public.css | 1 + 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index 720dfceea..08df18175 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -54,11 +54,11 @@
        • - <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.show_name}".html_safe,user_path(member.user)) %> + <%= link_to("#{l(:label_bidding_user_studentname)}:".html_safe,user_path(member.user)) %>

        • <% unless member.user.user_extensions.student_id == ''%> -
        • <%= link_to("#{l(:label_bidding_user_studentcode)}:#{member.user.user_extensions.student_id}".html_safe,user_path(member.user)) %>
        • +
        • <%= link_to("#{l(:label_bidding_user_studentcode)}:".html_safe,user_path(member.user)) %>
        • <% end%>
        <% unless @course.course_groups.empty? %> diff --git a/app/views/layouts/_syllabus_teacher_list.html.erb b/app/views/layouts/_syllabus_teacher_list.html.erb index 71fd67a75..344036ccf 100644 --- a/app/views/layouts/_syllabus_teacher_list.html.erb +++ b/app/views/layouts/_syllabus_teacher_list.html.erb @@ -1,21 +1,21 @@ -

        教师团队 - 增加教师 -
        -

        -
          - <% teacher = syllabus.user %> - <%# teachers.each do |teacher| %> -
        • - <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %> -
          - <%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name", :target => "_blank" %> - - <% if teacher.user_extensions && teacher.user_extensions.identity %> - <%= get_user_roll teacher %> - <% end%> - -
          -
          -
        • - <%# end %> +

          教师团队 + 增加教师 +
          +

          +
            + <% teacher = syllabus.user %> + <%# teachers.each do |teacher| %> +
          • + <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %> +
            + <%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name hidden", :target => "_blank", :title => teacher.show_name %> + + <% if teacher.user_extensions && teacher.user_extensions.identity %> + <%= get_user_roll teacher %> + <% end%> + +
            +
            +
          • + <%# end %>
          \ No newline at end of file diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index e08d9a1da..9565a9e26 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -751,6 +751,7 @@ a:hover.st_add{ color:#ff8e15;} .classbox_on{ border:1px solid #f8df8c; background:#f6f098; padding:0 3px; float:left; margin-left:15px;} .classbox_on a{ color:#716cad;} .st_list_score {width:105px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; vertical-align:middle; font-size:12px; text-align:center;} +.st_info_block {width:150px; display:inline-block; vertical-align:bottom;} /* 创建作品 homework,项目配置 */ .hwork_new{ color:#4c4c4c;} From 11f3060ca511498ed813d601ad8e0cde95380af3 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 2 Sep 2016 14:40:40 +0800 Subject: [PATCH 154/170] =?UTF-8?q?=E8=87=AA=E5=B7=B1=E5=BB=BA=E7=9A=84iss?= =?UTF-8?q?ue=E6=8C=87=E5=90=91=E8=87=AA=E5=B7=B1=E4=B8=8D=E5=8F=91?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 4c9411538..b97699058 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -196,8 +196,9 @@ class IssuesController < ApplicationController priority_id = params[:issue][:priority_id] ps = ProjectsService.new - ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id - + if senduser.id != User.current.id + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + end call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| format.html { From 51ef4a96e6107902fd59756b1c2781d222ddac57 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Sep 2016 14:42:59 +0800 Subject: [PATCH 155/170] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_syllabus.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb index 8f71e2ec2..d470c8a40 100644 --- a/app/views/layouts/base_syllabus.html.erb +++ b/app/views/layouts/base_syllabus.html.erb @@ -41,11 +41,11 @@

          位置:   - <%= link_to "尹刚", :class => 'sy_cgrey' %> + <%= link_to User.current, user_path(User.current.id), :class => 'sy_cgrey', :target => '_blank' %>  >  - <%=link_to "课程", :class => 'sy_cgrey' %> -  >  - <%=link_to "课程名称", :class => 'sy_cgrey' %> + <%= link_to '课程', user_courselist_user_path(User.current.id), :class => "sy_cgrey", :target => '_blank' %> +  >  + <%= link_to @syllabus.title, syllabus_path(@syllabus.id), :class => "sy_cgrey" %>

          From 396664d4e7434de71b739091f2677ec817723908 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 2 Sep 2016 14:45:01 +0800 Subject: [PATCH 156/170] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8B=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_syllabus.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb index 8f71e2ec2..deddaa34f 100644 --- a/app/views/layouts/base_syllabus.html.erb +++ b/app/views/layouts/base_syllabus.html.erb @@ -59,7 +59,7 @@
          <%= yield %>
          -
          +
          <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
          From 3881e5c5c5fb11e6cf71b9142a0fe668d6fca8ef Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 2 Sep 2016 14:50:06 +0800 Subject: [PATCH 157/170] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=9A=84=E6=98=AF=E6=97=B6=E5=80=99tip=E5=B1=80=E9=83=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=20=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=85=AC=E5=BC=80=E7=A7=81=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 5 +++-- app/controllers/files_controller.rb | 2 ++ app/views/files/search.js.erb | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index cee08ffa9..5d1345f24 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -204,7 +204,9 @@ class AttachmentsController < ApplicationController @attachment.save @newfiledense = filedense end - tip_attachment_update + if @attachment.container_type == "Project" || @attachment.container_type == "Course" + tip_attachment_update + end respond_to do |format| format.js @@ -626,7 +628,6 @@ class AttachmentsController < ApplicationController def attachment_versions @attachment = Attachment.find(params[:id]) @attachment_histories = @attachment.attachment_histories - @container_tip = Project.find(params[:project_id]) respond_to do |format| format.js end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 2ed17a76f..7318a4dc2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -90,6 +90,7 @@ class FilesController < ApplicationController @tag_list = get_course_tag_list @course end @all_attachments = @result + get_attachment_for_tip(@all_attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @@ -164,6 +165,7 @@ class FilesController < ApplicationController end @all_attachments = @project_attachment_result + get_attachment_for_tip(@all_attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb index 011b3bb25..4c32a1044 100644 --- a/app/views/files/search.js.erb +++ b/app/views/files/search.js.erb @@ -1,3 +1,4 @@ $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); \ No newline at end of file From 613f974440db5486d872499bf07a3efb9a662220 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Sep 2016 15:22:09 +0800 Subject: [PATCH 158/170] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E5=92=8C=E8=AF=BE=E7=A8=8B=E7=9A=84=E8=80=81?= =?UTF-8?q?=E5=B8=88=E9=83=BD=E6=9C=89=E6=9D=83=E9=99=90=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=92=8C=E6=96=B0=E9=97=BB/=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=9A=84=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_project_show.html.erb | 23 ++++++++++------------- app/views/news/_course_show.html.erb | 2 +- app/views/news/_news_all_replies.html.erb | 2 +- app/views/news/_project_show.html.erb | 2 +- app/views/users/_message_replies.html.erb | 2 +- app/views/users/_news_replies.html.erb | 3 ++- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 41c2f7d1f..2769594c5 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -104,18 +104,15 @@
            • - -
            • - <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %> -
            • - <% if @topic.author.id == User.current.id %> -
            • - <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'postOptionLink' - ) if @message.destroyable_by?(User.current) %> -
            • - <% end %> +
            • + <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %> +
            • +
            • + <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if @message.destroyable_by?(User.current) %> +
            • <% if hidden_unproject_infos %>
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
            • <% else %> @@ -202,7 +199,7 @@ :class => 'fr mr20', :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if reply.course_destroyable_by?(User.current) %> + ) if reply.destroyable_by?(User.current) %>
              diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index c8068e425..7fb6bad7f 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -82,7 +82,7 @@
          - <%= render :partial => 'news/news_all_replies' %> + <%= render :partial => 'news/news_all_replies', :locals => {:object => @course} %>