From 348a4df8d8a71fd3d773cab87597e98f04848077 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 27 Oct 2015 14:31:46 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 131fdcd88..b388b660c 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -325,9 +325,6 @@ class CoursesService else @state = 1 end - else - @state = 1 - end else if params[:course_password] == course.password if params[:role] == "10" From e9a0334ab1c4f2fd0a946a315405030ce2d9f114 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 3 Nov 2015 17:41:25 +0800 Subject: [PATCH 02/13] Merge branch 'szzh' into dev_zanle --- app/services/courses_service.rb | 56 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index e3b81d6d5..e566a8f46 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -326,45 +326,49 @@ class CoursesService #如果加入的角色教辅并且当前为教辅 elsif params[:role] == "7" && roleName == "TeachingAsistant" @state = 9 + elsif roleName == "Manager" + @state = 10 + #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求 + elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" ) + #如果已经发送过消息了,那么就要给个提示 + if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0 + @state = 7 + else + Mailer.run.join_course_request(course, User.current, params[:role]) + CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) + @state = 6 + end #如果加入角色是学生,但是是当前课程的教师或者教辅 elsif params[:role] == "10" && roleName != "Student" member.role_ids = [params[:role]] member.save StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id]) @state = 0 - elsif roleName == "Manager" - @state = 10 - #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求 - elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" ) - Mailer.run.join_course_request(course, User.current, params[:role]) - #如果加入角色为教师或者教辅 - CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) - @state = 6 end else @state = 1 end else - if params[:course_password] == course.password - if params[:role] == "10" || params[:role] == nil - members = [] - members << Member.new(:role_ids => [10], :user_id => current_user.id) - course.members << members - StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id]) - @state = 0 - else - #如果已经发送过消息了,那么就要给个提示 - if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0 - @state = 7 - else - Mailer.run.join_course_request(course, User.current, params[:role]) - CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) - @state = 6 - end - end + if params[:course_password] == course.password + if params[:role] == "10" || params[:role] == nil + members = [] + members << Member.new(:role_ids => [10], :user_id => current_user.id) + course.members << members + StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id]) + @state = 0 else - @state = 1 + #如果已经发送过消息了,那么就要给个提示 + if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0 + @state = 7 + else + Mailer.run.join_course_request(course, User.current, params[:role]) + CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) + @state = 6 + end end + else + @state = 1 + end end end else From 43d9c5636ab27167e84c8a9f9271b2a34a911790 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 4 Nov 2015 10:13:25 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9A=84=E5=9C=A8ie11=E4=B8=8B=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index da24e2878..7a93ab3ef 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -282,7 +282,7 @@ function regexTitle() function regexDescription() { var name = news_description_editor.html(); - if(name.length ==0) + if(news_description_editor.isEmpty()) { $("#description_notice_span").text("描述不能为空"); $("#description_notice_span").css('color','#ff0000'); From 04ba73fb7acd19d6d0c71bb4d96d8af9950fb899 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 4 Nov 2015 10:19:27 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E5=8F=91=E5=B8=96=20?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/show.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 8314c3902..25a4fae46 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -58,15 +58,15 @@ if(!check_memo_name()){ return; } - if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.html().trim() != "" ){ + if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() ){ memo_content.sync(); $("#new_memo").submit(); - }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() == ""){ + }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){ $("#error").html("主题和内容不能为空").show(); } - else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() != "" ){ + else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){ $("#error").html("主题不能为空").show(); - }else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.html().val().trim() == ""){ + }else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){ $("#error").html("内容不能为空").show(); } } From ea6c4b09fe7542afb25c54e63e617f731464c208 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 4 Nov 2015 10:24:07 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=B8=96=20=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/memos/edit.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 7ab460555..d26ebdbf8 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -2,7 +2,7 @@