From 0cafebb3a24ad9007f59996e982d40f12902842e Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 27 May 2016 17:14:37 +0800 Subject: [PATCH 01/75] =?UTF-8?q?=E6=96=B0=E9=97=BB=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_news.html.erb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 55e2182b5..b354bc668 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -66,11 +66,7 @@
回复 <%= count>0 ? "(#{count})" : "" %> - <% if activity.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - <% end %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<%#= format_date(activity.updated_on) %>
@@ -108,11 +104,7 @@ <% end %> <%= format_time(comment.created_on) %> - <% if comment.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - <% end %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
From 622d71c47654b12f310a85231fe350b14ed2a4c5 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 27 May 2016 22:14:41 +0800 Subject: [PATCH 02/75] =?UTF-8?q?=E5=B7=B2=E7=BB=91=E5=AE=9A=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E7=9A=84=EF=BC=8C=E7=9B=B4=E6=8E=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 4 +++- app/views/wechats/login.html.erb | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 43bab082a..30a39e86e 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -162,7 +162,6 @@ class WechatsController < ActionController::Base code = params[:code] || session[:wechat_code] openid = get_openid_from_code(code) - raise "无法获取到微信openid" unless openid render :json => {status:0, openid: openid} rescue Exception=>e @@ -197,6 +196,9 @@ class WechatsController < ActionController::Base def login session[:wechat_code] = params[:code] if params[:code] + openid = get_openid_from_code(code) + @wechat_user = user_binded?(openid) + render 'wechats/login', layout: 'base_wechat' end diff --git a/app/views/wechats/login.html.erb b/app/views/wechats/login.html.erb index dc39b9f23..6de7b9bd8 100644 --- a/app/views/wechats/login.html.erb +++ b/app/views/wechats/login.html.erb @@ -1,4 +1,22 @@ +<% if @wechat_user %> +
+
+
+
+

操作成功

+

您已经绑定过微信了,用户名: (<%= @wechat_user.user.login %>)

+
+
+

+ 确定 +

+
+ +
+
+ +<% else %>

@@ -63,4 +81,7 @@ }) }); - \ No newline at end of file + + + +<% end %> \ No newline at end of file From 4561bdfd0deae1eb761a8455b9f9ad831daffff5 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 27 May 2016 22:18:03 +0800 Subject: [PATCH 03/75] code=>params[:code] --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 30a39e86e..8570d3140 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -196,7 +196,7 @@ class WechatsController < ActionController::Base def login session[:wechat_code] = params[:code] if params[:code] - openid = get_openid_from_code(code) + openid = get_openid_from_code(params[:code]) @wechat_user = user_binded?(openid) render 'wechats/login', layout: 'base_wechat' From be94d445a947aec1054a15c40e7742643d81a8f1 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 27 May 2016 22:19:49 +0800 Subject: [PATCH 04/75] window close --- app/views/wechats/login.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/wechats/login.html.erb b/app/views/wechats/login.html.erb index 6de7b9bd8..65a8b1857 100644 --- a/app/views/wechats/login.html.erb +++ b/app/views/wechats/login.html.erb @@ -9,7 +9,7 @@

From 63b9aaefe2c38424bba40a6eec81b164a948126d Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 27 May 2016 22:22:09 +0800 Subject: [PATCH 05/75] window close --- app/views/wechats/login.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/wechats/login.html.erb b/app/views/wechats/login.html.erb index 65a8b1857..39e188664 100644 --- a/app/views/wechats/login.html.erb +++ b/app/views/wechats/login.html.erb @@ -1,5 +1,11 @@ <% if @wechat_user %> + +
@@ -9,7 +15,7 @@
From bb30709fa110dd96e787c15482e6bed159b67d14 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 27 May 2016 22:54:57 +0800 Subject: [PATCH 06/75] window close --- app/views/wechats/login.html.erb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/views/wechats/login.html.erb b/app/views/wechats/login.html.erb index 39e188664..17878e318 100644 --- a/app/views/wechats/login.html.erb +++ b/app/views/wechats/login.html.erb @@ -1,11 +1,5 @@ <% if @wechat_user %> - -
@@ -15,7 +9,7 @@
From d4c0e9754ac6332a5af1fd5d2c7e5d8b0f153ff8 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 30 May 2016 14:51:54 +0800 Subject: [PATCH 07/75] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E5=B1=95=E5=BC=80=E5=90=8E=E5=BA=94=E6=98=BE=E7=A4=BA=E2=80=9C?= =?UTF-8?q?=E6=94=B6=E8=B5=B7=E6=8F=8F=E8=BF=B0=E4=BF=A1=E6=81=AF=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 4 ++-- public/javascripts/course.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index a9e859448..c3f3a4a60 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -157,9 +157,9 @@
- <%= l(:label_expend_information)%> + - +
diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 7cfad6005..73ab065ea 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -475,6 +475,19 @@ function submitMemberSerch(content) function show_more_msg() { $("#course_description").toggleClass("course_description_none"); + var information = $("#expend_more_information"); + var arrow = $("#arrow"); + var val = information.attr("value"); + if (val == "show_more") { + $("#expend_more_information").text("收起描述信息"); + information.attr("value", "hide_more"); + arrow.attr("src", "/images/jiantouup.jpg") + } + else { + $("#expend_more_information").text("展开更多信息"); + information.attr("value", "show_more"); + arrow.attr("src", "/images/jiantou.jpg") + } } //作业描述显示更多信息 function news_show_more_des(id) From f024764e29b32d5cd5ac22588aea4bfb8dbf0644 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 30 May 2016 14:59:05 +0800 Subject: [PATCH 08/75] =?UTF-8?q?=E8=AF=BE=E5=86=85=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E7=9C=8B=E5=88=B0=E7=9A=84=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E5=AD=A6=E7=94=9F=E2=80=9C=E5=A7=93=E5=90=8D=E2=80=9D?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E6=98=BE=E7=A4=BA=E6=98=B5=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_member_list.html.erb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index bff16e053..d8a2c6ed8 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -51,17 +51,9 @@ <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
    - <% if @canShowCode %> -
  • - <% if member.user.show_name == ''%> - <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.name}".html_safe,user_path(member.user)) %> - <% else%> - <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.show_name}".html_safe,user_path(member.user)) %> - <%end%> -
  • - <% else %> -
  • <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.name}".html_safe, user_path(member.user)) %>
  • - <% end %> +
  • + <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.show_name}".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)) %>
  • From acc323e46df6aa156e077f9e13519995945804f5 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 30 May 2016 18:35:47 +0800 Subject: [PATCH 09/75] =?UTF-8?q?issue7890=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 386e5733d..1ce834f61 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -10,14 +10,14 @@ class ZipdownController < ApplicationController #勿删 before_filter :authorize, :only => [:assort,:download_user_homework] SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" + MAX_PATH = 250 #统一下载功能 def download if User.current.logged? begin if params[:base64file] - file = Base64.decode64(params[:base64file]) - file = file.sub('*', '+') + file = decode64(params[:base64file]) send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file) else send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file]) @@ -125,7 +125,11 @@ class ZipdownController < ApplicationController end def encode64(str) - Base64.encode64(str).sub('+', '*') + Base64.urlsafe_encode64(str) + end + + def decode64(str) + Base64.urlsafe_decode64(str) end def zip_homework_common homework_common @@ -242,6 +246,12 @@ class ZipdownController < ApplicationController def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip" + # 文件名过长 + + if rename_zipfile.size > MAX_PATH + rename_zipfile = rename_zipfile[0,rename_zipfile.size-4][0,MAX_PATH-4] + rename_zipfile[-4,4] + end + zipfile_name = "#{output_path}/#{rename_zipfile}" Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name)) From 858ad47338e1b9d16dcf981f9c8eeb736c4121a4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 30 May 2016 18:40:22 +0800 Subject: [PATCH 10/75] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E5=AE=9A=E4=B8=BA50?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 1ce834f61..d9a9e1def 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -10,7 +10,7 @@ class ZipdownController < ApplicationController #勿删 before_filter :authorize, :only => [:assort,:download_user_homework] SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" - MAX_PATH = 250 + MAX_PATH = 50 #统一下载功能 def download From c421933cf61748ccb166ce972503aa6b2070db55 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 31 May 2016 08:57:08 +0800 Subject: [PATCH 11/75] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=9C=80=E6=96=B0?= =?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/activities.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index cbd43bb79..2275a550e 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -33,14 +33,14 @@ module Mobile shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) page = params[:page] ? params[:page] : 0 - user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.map{|course| course.id}-shield_course_ids).join(",") + ")" + user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" + user_course_ids = (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" course_types = "('Message','News','HomeworkCommon','Poll','Course')" project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" 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 + ")" - watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") + watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") blog_ids = "(" + watched_user_blog_ids + ")" activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + From 19de82359a7db0686cbea05a16a0418860885a3b Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 31 May 2016 10:53:11 +0800 Subject: [PATCH 12/75] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 1 + public/assets/wechat/course_discussion.html | 1 + public/assets/wechat/course_notice.html | 1 + public/assets/wechat/homework_detail.html | 1 + public/assets/wechat/issue_detail.html | 1 + public/assets/wechat/jour_message_detail.html | 1 + public/assets/wechat/project_discussion.html | 1 + 7 files changed, 7 insertions(+) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index fa3a9f341..bd398c988 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -1,5 +1,6 @@ +
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index d1b65e629..46ef95cfa 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -1,5 +1,6 @@ +
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index c10763bf8..a4bca9809 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -1,5 +1,6 @@ +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 2783bd317..0671da049 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -1,5 +1,6 @@ +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 035a7c98d..0be7ba5ac 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -1,5 +1,6 @@ +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 5ccbf6248..9b1494abe 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -1,4 +1,5 @@ +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index be639c1a0..69625c0c5 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -1,5 +1,6 @@ +
    From 79c106a1c6bd5f0e3d9e698304749d58a0315f16 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 31 May 2016 11:04:20 +0800 Subject: [PATCH 13/75] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/activities.rb | 20 ++------------------ public/assets/wechat/activities.html | 2 +- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 2275a550e..af17e0f44 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -13,28 +13,12 @@ module Mobile end post do user = UserWechat.find_by_openid(params[:openid]).user -=begin - shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) - page = params[:page] ? params[:page] : 0 - user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course')" - project_types = "('Message','Issue','ProjectCreateInfo')" - principal_types = "JournalsForMessage" - - 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(','))+")" - 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') -=end shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) page = params[:page] ? params[:page] : 0 - user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" + user_project_ids = (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).join(",") + ")" + 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')" project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 1bab8dfb4..30b4dafaa 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -175,7 +175,7 @@
    -
    +
    From f166a951f3665c7edbdaed54927f341f258a1ba8 Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 31 May 2016 13:49:39 +0800 Subject: [PATCH 14/75] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 4 +--- public/assets/wechat/course_discussion.html | 4 +--- public/assets/wechat/course_notice.html | 4 +--- public/assets/wechat/homework_detail.html | 12 +++++------- public/assets/wechat/issue_detail.html | 12 +++++------- public/assets/wechat/jour_message_detail.html | 4 +--- public/assets/wechat/project_discussion.html | 4 +--- 7 files changed, 15 insertions(+), 29 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index bd398c988..4e0fb3577 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -8,9 +8,7 @@
    {{blog.title}}
    {{blog.user.realname}}发表博客
    -
    -
    -
    +
    {{blog.created_at}}
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 46ef95cfa..0d7beb9e6 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -15,9 +15,7 @@ 来   源: {{discussion.course_project_name}}  |  课程问答区 -
    -
    -
    +
    {{discussion.created_on}}
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index a4bca9809..22906af39 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -14,9 +14,7 @@ 来   源: {{news.course_name}}  |  课程通知 -
    -
    -
    +
    {{news.created_on}}
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 0671da049..b822f9866 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -16,13 +16,11 @@ 来   源: {{homework.course_name}}  |  课程作业 -
    -
    - 迟交扣分:{{homework.late_penalty}}分
    - 缺评扣分:{{homework.absence_penalty}}分/作品
    - 匿评开启时间:{{homework.evaluation_start}}
    - 匿评关闭时间:{{homework.evaluation_end}} -
    +
    + 迟交扣分:{{homework.late_penalty}}分
    + 缺评扣分:{{homework.absence_penalty}}分/作品
    + 匿评开启时间:{{homework.evaluation_start}}
    + 匿评关闭时间:{{homework.evaluation_end}}
    {{homework.publish_time}}
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 0be7ba5ac..28b02c5aa 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -14,13 +14,11 @@ 来   源: {{issue.project_name}}  |  项目问题 -
    -
    - 状   态:{{issue.issue_status}}
    - 优先级:{{issue.issue_priority}}
    - 指派给:{{issue.issue_assigned_to}}
    - 完成度:{{issue.done_ratio}}%
    -
    +
    + 状   态:{{issue.issue_status}}
    + 优先级:{{issue.issue_priority}}
    + 指派给:{{issue.issue_assigned_to}}
    + 完成度:{{issue.done_ratio}}%
    {{issue.created_on}}
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 9b1494abe..a4ad7a0dd 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -7,9 +7,7 @@
    {{message.user.realname}}给您留言了
    {{message.created_on}}
    -
    -
    -
    +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 69625c0c5..4b86eaf28 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -14,9 +14,7 @@ 来   源: {{discussion.course_project_name}}  |  项目讨论区 -
    -
    -
    +
    {{discussion.created_on}}
    From 796125bd1c70813f194eeb2f95eba76fe38b78ff Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 31 May 2016 14:18:40 +0800 Subject: [PATCH 15/75] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E7=AB=AF=E7=9A=84=E6=97=B6=E9=97=B4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/api_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index 49640d889..3f7adcfa6 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -182,7 +182,7 @@ module ApiHelper timeIntoFormat = 0 updateAtValue = "" if timePassed < 0 - updateAtValue = "时间有问题" + updateAtValue = "1分钟前" elsif timePassed < ONE_MINUTE updateAtValue = "1分钟前" elsif timePassed < ONE_HOUR From 91be3b9f85c8c2df8ee68b8f11dddff4dc32c02a Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 31 May 2016 14:37:45 +0800 Subject: [PATCH 16/75] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=E6=8C=89=E9=92=AE=E5=8F=98=E7=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 3 ++- public/assets/wechat/course_discussion.html | 3 ++- public/assets/wechat/course_notice.html | 3 ++- public/assets/wechat/homework_detail.html | 3 ++- public/assets/wechat/issue_detail.html | 5 +++-- public/assets/wechat/jour_message_detail.html | 3 ++- public/assets/wechat/project_discussion.html | 3 ++- public/javascripts/wechat/app.js | 6 +++--- public/stylesheets/weui/weixin.css | 2 ++ 9 files changed, 20 insertions(+), 11 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 4e0fb3577..b820ed591 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -39,7 +39,8 @@
    - + +
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 0d7beb9e6..f02c01ff6 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -46,7 +46,8 @@
    - + +
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 22906af39..0a85ed089 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -45,7 +45,8 @@
    - + +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index b822f9866..e416b7313 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -51,7 +51,8 @@
    - + +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 28b02c5aa..7b5db0afa 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -49,8 +49,9 @@
    - -
    + + +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index a4ad7a0dd..fada796f8 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -37,7 +37,8 @@
    - + +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 4b86eaf28..bd863f5ed 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -45,7 +45,8 @@
    - + +
    diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 8f00a2b96..267fefb43 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,10 +1,10 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = '/api/v1/'; -var debug = false; //调试标志,如果在本地请置为true +var debug = true; //调试标志,如果在本地请置为true if(debug===true){ - //apiUrl = 'http://localhost:3000/api/v1/'; - apiUrl = 'https://www.trustie.net/api/v1/'; + apiUrl = 'http://localhost:3000/api/v1/'; + //apiUrl = 'https://www.trustie.net/api/v1/'; } app.factory('auth', function($http,$routeParams, $cookies, $q){ diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index ba3eac3df..b09c54109 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -84,3 +84,5 @@ a.underline {text-decoration:underline;} /*帖子锁定样式*/ .locked_btn_cir {background: url("/images/locked.png") 0 0 no-repeat; cursor: default;} + +.bg-grey {background-color:#c1c1c1;} From 80452ceef92553d98fbaf6cc288e7fb29a2ec701 Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 31 May 2016 14:38:55 +0800 Subject: [PATCH 17/75] =?UTF-8?q?app.js=E6=96=87=E4=BB=B6=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 267fefb43..8f00a2b96 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,10 +1,10 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = '/api/v1/'; -var debug = true; //调试标志,如果在本地请置为true +var debug = false; //调试标志,如果在本地请置为true if(debug===true){ - apiUrl = 'http://localhost:3000/api/v1/'; - //apiUrl = 'https://www.trustie.net/api/v1/'; + //apiUrl = 'http://localhost:3000/api/v1/'; + apiUrl = 'https://www.trustie.net/api/v1/'; } app.factory('auth', function($http,$routeParams, $cookies, $q){ From e121d7d9270cdffefab90a1b154e0da97e280cfe Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 31 May 2016 14:55:25 +0800 Subject: [PATCH 18/75] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=BE=B9=E6=A1=86=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 6 +++--- public/stylesheets/weui/weixin.css | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 8f00a2b96..267fefb43 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,10 +1,10 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = '/api/v1/'; -var debug = false; //调试标志,如果在本地请置为true +var debug = true; //调试标志,如果在本地请置为true if(debug===true){ - //apiUrl = 'http://localhost:3000/api/v1/'; - apiUrl = 'https://www.trustie.net/api/v1/'; + apiUrl = 'http://localhost:3000/api/v1/'; + //apiUrl = 'https://www.trustie.net/api/v1/'; } app.factory('auth', function($http,$routeParams, $cookies, $q){ diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index b09c54109..4a88f9705 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -4,6 +4,16 @@ /*基本样式*/ body,table,input,textarea,select,button { font-family: "微软雅黑","宋体";} h1,h2,h3,h4,h5,p,pre {padding:0px; margin:0px;} +blockquote { + border:1px solid #d4d4d4; + padding: 0.6em; + margin-left: 1.4em; + margin-right: 0.4em; + border-radius: 4px; + font-family: "Microsoft YaHei"; + background-size: 100% 100%; + margin-top:5px; +} .f12 {font-size:12px;} .f13 {font-size:13px;} .f15 {font-size:15px;} From 7e93518d4149548b49663dbc6e23bb96f4948c14 Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 31 May 2016 14:56:24 +0800 Subject: [PATCH 19/75] =?UTF-8?q?app.js=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 267fefb43..8f00a2b96 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,10 +1,10 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = '/api/v1/'; -var debug = true; //调试标志,如果在本地请置为true +var debug = false; //调试标志,如果在本地请置为true if(debug===true){ - apiUrl = 'http://localhost:3000/api/v1/'; - //apiUrl = 'https://www.trustie.net/api/v1/'; + //apiUrl = 'http://localhost:3000/api/v1/'; + apiUrl = 'https://www.trustie.net/api/v1/'; } app.factory('auth', function($http,$routeParams, $cookies, $q){ From ed84783f260306c7f97ef0b57e33412c806cd73b Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 31 May 2016 17:03:50 +0800 Subject: [PATCH 20/75] =?UTF-8?q?=E7=A7=81=E6=9C=89=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E5=85=AC=E5=BC=80=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 4 ++-- .../_alert_open_student_works.html.erb | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd178a1ce..10431f01a 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -390,7 +390,7 @@ class StudentWorkController < ApplicationController student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end #开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 - if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) + if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) if @order == 'lastname' @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name elsif @order == 'student_id' @@ -456,7 +456,7 @@ class StudentWorkController < ApplicationController @student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count else - if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) + if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) if @order == 'lastname' @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name elsif @order == 'student_id' diff --git a/app/views/homework_common/_alert_open_student_works.html.erb b/app/views/homework_common/_alert_open_student_works.html.erb index ef8fe3d08..73c7f0b47 100644 --- a/app/views/homework_common/_alert_open_student_works.html.erb +++ b/app/views/homework_common/_alert_open_student_works.html.erb @@ -1,10 +1,20 @@
    - <% if @homework.is_open == 0 %> + <% if @homework.is_open == 0 && @homework.course.is_public == 1 %>

    公开作品

    本次作业的所有作品将对Trustie平台所有注册用户开放,请问是否确定公开作品?

    + <% elsif @homework.is_open == 0 && @homework.course.is_public == 0 %> +

    公开作品

    +

    + 该作业是私有课程的作业,公开作品后本次作业的所有作品将对课程内的所有学生开放,请问是否确定公开作品? +

    + <% elsif @homework.is_open == 1 && @homework.course.is_public == 0 %> +

    取消公开作品

    +

    + 您将取消“公开作品”的功能,该私有作业的作品将只在作业截止后对已提交作品的学生开放,请问是否确定? +

    <% else %>

    取消公开作品

    From 8540b48091997f29509e2ca9da2bea3adaccf9d8 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 31 May 2016 17:34:56 +0800 Subject: [PATCH 21/75] =?UTF-8?q?=E6=9C=AA=E7=BB=91=E5=AE=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E8=B4=A6=E5=8F=B7=E6=97=B6=E7=82=B9=E5=87=BB=E2=80=9C?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E5=8A=A8=E6=80=81=E2=80=9D=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 8f00a2b96..1149ea131 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,10 +1,10 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = '/api/v1/'; -var debug = false; //调试标志,如果在本地请置为true +var debug = true; //调试标志,如果在本地请置为true if(debug===true){ - //apiUrl = 'http://localhost:3000/api/v1/'; - apiUrl = 'https://www.trustie.net/api/v1/'; + apiUrl = 'http://localhost:3000/api/v1/'; + //apiUrl = 'https://www.trustie.net/api/v1/'; } app.factory('auth', function($http,$routeParams, $cookies, $q){ @@ -78,6 +78,9 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ url: apiUrl+ "activities", data: {openid: auth.openid(), page: page} }).then(function successCallback(response) { + if(response.data.message == "undefined method `user' for nil:NilClass"){ + alert("请先绑定确实的用户账号"); + } $scope.current_page = 0; console.log($scope.current_page); console.log(response.data.page); From 7f811d7551b2be4660021e9fbcd40f7a4ea6edc0 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:20:15 +0800 Subject: [PATCH 22/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 43 +++++++-------------------- config/menu.yml | 2 +- config/routes.rb | 1 + 3 files changed, 12 insertions(+), 34 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 4bf95fdbd..d4758283a 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -154,12 +154,7 @@ class WechatsController < ActionController::Base end end - - - ### controller method - - module Controllers def get_open_id begin @@ -228,37 +223,19 @@ class WechatsController < ActionController::Base uw = UserWechat.where(openid: openid).first end - def user_activity(user) - @user = user - shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) - @page = params[:page] ? params[:page].to_i + 1 : 0 - user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course')" - project_types = "('Message','Issue','Project')" - principal_types = "JournalsForMessage" - - 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(','))+")" - @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) - + def user_activities + session[:wechat_code] = params[:code] if params[:code] + code = params[:code] || session[:wechat_code] + openid = get_openid_from_code(code) + @wechat_user = user_binded?(openid) + unless @wechat_user + redirect_to :login + return + end + render File.join(Rails.root, "public/wechat/app.html"), layout: nil end - def process_activity(user_activity) - act= user_activity.act - case user_activity.container_type.to_s - when 'Course' - when 'Project' - case user_activity.act_type.to_s - when 'Issue' - [act.project.name.to_s+" | 项目问题", act.subject.to_s, url_to_avatar(act.author),"http://wechat.trustie.net/app.html#/issue/#{act.id}"] - end - end - end end diff --git a/config/menu.yml b/config/menu.yml index de1952503..ab6ae89ac 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -2,7 +2,7 @@ button: - type: "view" name: "最新动态" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.course.trustie.net/assets/wechat/app.html#/activities?response_type=code&scope=snsapi_base&state=123#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://wechat.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect" - type: "click" name: "意见反馈" diff --git a/config/routes.rb b/config/routes.rb index 2863d49a4..9abaef0ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1237,6 +1237,7 @@ RedmineApp::Application.routes.draw do resource :wechat, only:[:show, :create] do collection do get :login + get :user_activities post :bind post :get_open_id end From 7b5a7a93f535555d72b83a475a7228f62a182cee Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:40:54 +0800 Subject: [PATCH 23/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 24 +++++++++++++----------- config/menu.yml | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index d4758283a..1e87c7b96 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -202,6 +202,19 @@ class WechatsController < ActionController::Base render 'wechats/login', layout: 'base_wechat' end + def user_activities + session[:wechat_code] = params[:code] if params[:code] + code = params[:code] || session[:wechat_code] + openid = get_openid_from_code(code) + @wechat_user = user_binded?(openid) + unless @wechat_user + redirect_to :login + return + end + + render File.join(Rails.root, "public/wechat/app.html"), layout: nil + end + private def get_openid_from_code(code) openid = session[:wechat_openid] @@ -223,18 +236,7 @@ class WechatsController < ActionController::Base uw = UserWechat.where(openid: openid).first end - def user_activities - session[:wechat_code] = params[:code] if params[:code] - code = params[:code] || session[:wechat_code] - openid = get_openid_from_code(code) - @wechat_user = user_binded?(openid) - unless @wechat_user - redirect_to :login - return - end - render File.join(Rails.root, "public/wechat/app.html"), layout: nil - end end diff --git a/config/menu.yml b/config/menu.yml index ab6ae89ac..3671ebb1b 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -2,7 +2,7 @@ button: - type: "view" name: "最新动态" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://wechat.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://wechat.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect" - type: "click" name: "意见反馈" From e73c94680660701db79ea2059d290432b40bf957 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:43:27 +0800 Subject: [PATCH 24/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 1e87c7b96..b0901efd4 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -208,7 +208,7 @@ class WechatsController < ActionController::Base openid = get_openid_from_code(code) @wechat_user = user_binded?(openid) unless @wechat_user - redirect_to :login + redirect_to login_wechat_path return end From 49a1a9de325b679579d9d01f3c12af6d27e37d63 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:46:30 +0800 Subject: [PATCH 25/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index b0901efd4..1074ebc3f 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -212,7 +212,7 @@ class WechatsController < ActionController::Base return end - render File.join(Rails.root, "public/wechat/app.html"), layout: nil + render template: File.join(Rails.root, "public/wechat/app.html"), layout: nil end private From 1c5a31e8f1a1970619f3b2974f7d74543514363d Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:49:57 +0800 Subject: [PATCH 26/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 1074ebc3f..d5dfb88f7 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -212,7 +212,7 @@ class WechatsController < ActionController::Base return end - render template: File.join(Rails.root, "public/wechat/app.html"), layout: nil + render file: File.join(Rails.root, "public/wechat/app.html") end private From ac5d91a428981e7bd2ad5381bf8336585726993e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:51:38 +0800 Subject: [PATCH 27/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index d5dfb88f7..9c6ab33f6 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -212,7 +212,7 @@ class WechatsController < ActionController::Base return end - render file: File.join(Rails.root, "public/wechat/app.html") + render template: File.join(Rails.root, "public/assets/wechat/app.html"), layout: nil end private From e01da32c75a64f58a5b921366a7ae53d76e55a6a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:54:45 +0800 Subject: [PATCH 28/75] tempate=>file --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 9c6ab33f6..e47c99cbd 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -212,7 +212,7 @@ class WechatsController < ActionController::Base return end - render template: File.join(Rails.root, "public/assets/wechat/app.html"), layout: nil + render file: File.join(Rails.root, "public/assets/wechat/app.html"), layout: nil end private From 4815dc3c7b3c6dc3e5ce2f804f8a4d5c7e163bae Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 19:59:34 +0800 Subject: [PATCH 29/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 8f00a2b96..f0881486e 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -482,7 +482,7 @@ app.directive('loadingSpinner', function ($http) { app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProvider) { $routeProvider .when('/activities', { - templateUrl: 'activities.html', + templateUrl: '/public/assets/wechat/activities.html', controller: 'ActivityController' }) .when('/issues/:id', { From 13d11e223934bac22a7b38975dc8a91f3d276a13 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 20:01:41 +0800 Subject: [PATCH 30/75] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index f0881486e..d18719cfe 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -480,37 +480,39 @@ app.directive('loadingSpinner', function ($http) { }); app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProvider) { + var rootPath = '/assets/wechat/' + $routeProvider .when('/activities', { - templateUrl: '/public/assets/wechat/activities.html', + templateUrl: rootPath + 'activities.html', controller: 'ActivityController' }) .when('/issues/:id', { - templateUrl: 'issue_detail.html', + templateUrl: rootPath + 'issue_detail.html', controller: 'IssueController' }) .when('/project_discussion/:id', { - templateUrl: 'project_discussion.html', + templateUrl: rootPath + 'project_discussion.html', controller: 'DiscussionController' }) .when('/homework/:id', { - templateUrl: 'homework_detail.html', + templateUrl: rootPath + 'homework_detail.html', controller: 'HomeworkController' }) .when('/course_notice/:id', { - templateUrl: 'course_notice.html', + templateUrl: rootPath + 'course_notice.html', controller: 'CourseNoticeController' }) .when('/course_discussion/:id', { - templateUrl: 'course_discussion.html', + templateUrl: rootPath + 'course_discussion.html', controller: 'DiscussionController' }) .when('/journal_for_message/:id', { - templateUrl: 'jour_message_detail.html', + templateUrl: rootPath + 'jour_message_detail.html', controller: 'JournalsController' }) .when('/blog_comment/:id', { - templateUrl: 'blog_detail.html', + templateUrl: rootPath + 'blog_detail.html', controller: 'BlogController' }) .otherwise({ From 814fde878e5743013963e9111eb232cf85ea9000 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 20:19:45 +0800 Subject: [PATCH 31/75] =?UTF-8?q?=E4=BB=8E=E5=90=8E=E5=8F=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96openid=E5=8D=B3=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 2 +- app/views/wechats/user_activities.html.erb | 30 ++++++++++++++++++++++ config/menu.yml | 2 +- public/javascripts/wechat/app.js | 4 +++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 app/views/wechats/user_activities.html.erb diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index e47c99cbd..ea230abe5 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -212,7 +212,7 @@ class WechatsController < ActionController::Base return end - render file: File.join(Rails.root, "public/assets/wechat/app.html"), layout: nil + render 'wechats/user_activities', layout: nil end private diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb new file mode 100644 index 000000000..b45587ae0 --- /dev/null +++ b/app/views/wechats/user_activities.html.erb @@ -0,0 +1,30 @@ + + + + 最新动态 + + + + + + + + + + + +

    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/config/menu.yml b/config/menu.yml index 3671ebb1b..83b892037 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -2,7 +2,7 @@ button: - type: "view" name: "最新动态" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://wechat.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf694495398c7d470&redirect_uri=http://wechat.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect" - type: "click" name: "意见反馈" diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index d18719cfe..59605271c 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -10,6 +10,10 @@ if(debug===true){ app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; + if(typeof g_openid !== 'undefined'){ + _openid = g_openid; + } + if(debug===true){ _openid = "1"; } From 48b36e5d169e1ca519df54bccc7482c47a8a7351 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 20:46:46 +0800 Subject: [PATCH 32/75] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 2 +- public/javascripts/wechat/app.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 30b4dafaa..ab0e85faf 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -118,7 +118,7 @@
    -
    +
    diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 59605271c..4c17027e0 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -7,6 +7,7 @@ if(debug===true){ apiUrl = 'https://www.trustie.net/api/v1/'; } + app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; @@ -66,7 +67,7 @@ app.factory('rms', function(){ return {save: save, get: get}; }); -app.controller('ActivityController',function($scope, $http, auth, rms, common){ +app.controller('ActivityController',function($anchorScroll, $location,$scope, $http, auth, rms, common){ $scope.replaceUrl = function(url){ return url; }; @@ -76,6 +77,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ $scope.page = 0; var loadActData = function(page){ + if (page <= 0 && $scope.activities.length >0){ + var yOffset = rms.get("yoffset"); + $location.hash(yOffset); + return; + } + $scope.page = page; $http({ method: 'POST', @@ -109,6 +116,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ $scope.loadActData = loadActData; + //跳到详情页 + $scope.goDetail = function(type, id){ + rms.save("yoffset", id); + $location.path('/'+type+'/'+id); + } + $scope.addPraise = function(act){ common.addCommonPraise(act); }; @@ -117,6 +130,8 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ common.decreaseCommonPraise(act); }; + + }); app.factory('common', function($http, auth, $routeParams){ From 32ffd2a5b5372aab6c8d8802b63e0f1763de5ae7 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 20:55:46 +0800 Subject: [PATCH 33/75] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/activity.rb | 1 + public/assets/wechat/activities.html | 2 +- public/javascripts/wechat/app.js | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index a90ff323d..9e2a39a5a 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -98,6 +98,7 @@ module Mobile end expose :act_type #缺陷/作业/讨论区/留言等类型 expose :act_id + expose :id expose :container_type #课程/项目/博客/个人 expose :author, using: Mobile::Entities::User do |a, opt| #用户信息 if a.is_a? ::UserActivity diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index ab0e85faf..85cfad7e4 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -118,7 +118,7 @@
    -
    +
    diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 4c17027e0..51c91d152 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -117,9 +117,9 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h $scope.loadActData = loadActData; //跳到详情页 - $scope.goDetail = function(type, id){ - rms.save("yoffset", id); - $location.path('/'+type+'/'+id); + $scope.goDetail = function(type, act_id,id){ + rms.save("yoffset", 'act_'+id); + $location.path('/'+type+'/'+act_id); } $scope.addPraise = function(act){ From c9eddad45d8b3036e9dec1be6ec0ffa222132f9c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 21:09:47 +0800 Subject: [PATCH 34/75] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 4 ++-- public/javascripts/wechat/app.js | 36 ++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 85cfad7e4..c610a9839 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -249,8 +249,8 @@
    -
    -
    更多
    +
    +
    更多
    diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 51c91d152..a129a795c 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -73,11 +73,35 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h }; console.log("ActivityController load"); - $scope.activities = rms.get("activities") || []; + $scope.page = 0; + $scope.activities = rms.get("activities") || []; + + var savePageConfig = function(){ + rms.save('current_page', $scope.current_page); + rms.save('has_more', $scope.has_more); + rms.save('activities', $scope.activities); + } + + var loadPageConfig = function(){ + var current_page = rms.get('current_page'); + var has_more = rms.get('has_more'); + var activities = rms.get('activities'); + + if(typeof current_page !== 'undefined'){ + $scope.page = current_page; + } + if(typeof has_more !== 'undefined'){ + $scope.has_more = has_more; + } + if(typeof activities !== 'undefined'){ + $scope.activities = activities; + } + } var loadActData = function(page){ - if (page <= 0 && $scope.activities.length >0){ + if (page <= 0 && $scope.activities.length >0){ //应该是返回过来的 + loadPageConfig(); var yOffset = rms.get("yoffset"); $location.hash(yOffset); return; @@ -97,10 +121,12 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h } else { $scope.activities = response.data.data; } - $scope.current_page = response.data.page; - $scope.all_count = response.data.all_count; - $scope.count = response.data.count; + $scope.has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + console.log(response.data); + + rms.save('current_page', $scope.page); + rms.save('has_more', $scope.has_more); rms.save('activities', $scope.activities); }, function errorCallback(response) { }); From c26d544772370e6b18b8e29830b99909d73764a3 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 21:15:31 +0800 Subject: [PATCH 35/75] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index a129a795c..82c41a53c 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -103,7 +103,7 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h if (page <= 0 && $scope.activities.length >0){ //应该是返回过来的 loadPageConfig(); var yOffset = rms.get("yoffset"); - $location.hash(yOffset); + $location.yOffset = yOffset; return; } @@ -144,7 +144,9 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h //跳到详情页 $scope.goDetail = function(type, act_id,id){ - rms.save("yoffset", 'act_'+id); + console.log($anchorScroll.yOffset); + rms.save("yoffset", $anchorScroll.yOffset); + $location.path('/'+type+'/'+act_id); } From 553a02c89dbbba10ce7cb69cb5c9a269eb5961cc Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 21:22:44 +0800 Subject: [PATCH 36/75] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 82c41a53c..5232b91c4 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -103,7 +103,7 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h if (page <= 0 && $scope.activities.length >0){ //应该是返回过来的 loadPageConfig(); var yOffset = rms.get("yoffset"); - $location.yOffset = yOffset; + $location.hash(yOffset); return; } @@ -144,8 +144,8 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h //跳到详情页 $scope.goDetail = function(type, act_id,id){ - console.log($anchorScroll.yOffset); - rms.save("yoffset", $anchorScroll.yOffset); + console.log($anchorScroll()); + rms.save("yoffset", $anchorScroll()); $location.path('/'+type+'/'+act_id); } From 03357388bdda524c1951eb661af3c0586191e74c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 21:26:31 +0800 Subject: [PATCH 37/75] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 5232b91c4..e0e436fda 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -103,7 +103,7 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h if (page <= 0 && $scope.activities.length >0){ //应该是返回过来的 loadPageConfig(); var yOffset = rms.get("yoffset"); - $location.hash(yOffset); + $location.yOffset = yOffset; return; } @@ -144,9 +144,7 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h //跳到详情页 $scope.goDetail = function(type, act_id,id){ - console.log($anchorScroll()); - rms.save("yoffset", $anchorScroll()); - + rms.save("yoffset",'act_'+id); $location.path('/'+type+'/'+act_id); } From ceffa6c2c82c74e60982838041ffb5863abdb8ca Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 21:27:00 +0800 Subject: [PATCH 38/75] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index e0e436fda..8cc3d053a 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -103,7 +103,7 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h if (page <= 0 && $scope.activities.length >0){ //应该是返回过来的 loadPageConfig(); var yOffset = rms.get("yoffset"); - $location.yOffset = yOffset; + $location.hash(yOffset); return; } From 51d3fc3aad760b2113b78f7d1b0aa9aad1311bd8 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 31 May 2016 21:31:36 +0800 Subject: [PATCH 39/75] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 8cc3d053a..641e95bed 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -94,9 +94,7 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h if(typeof has_more !== 'undefined'){ $scope.has_more = has_more; } - if(typeof activities !== 'undefined'){ - $scope.activities = activities; - } + } var loadActData = function(page){ From 0cc8cb9928a1ade5d069a2ca7897901160e2769c Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 1 Jun 2016 08:57:27 +0800 Subject: [PATCH 40/75] =?UTF-8?q?=E5=88=9A=E6=8F=90=E4=BA=A4=E7=9A=84?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?=E2=80=9C=E5=88=9A=E5=88=9A=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/api_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index 3f7adcfa6..fb1231287 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -182,7 +182,7 @@ module ApiHelper timeIntoFormat = 0 updateAtValue = "" if timePassed < 0 - updateAtValue = "1分钟前" + updateAtValue = "刚刚" elsif timePassed < ONE_MINUTE updateAtValue = "1分钟前" elsif timePassed < ONE_HOUR From cba5b246bcbe9ed691611877076f8d18efdd556f Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 1 Jun 2016 14:14:24 +0800 Subject: [PATCH 41/75] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=9A=84=E8=BF=94=E5=9B=9E=E4=B8=8D=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index c610a9839..d7f48c4b2 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -8,7 +8,7 @@
    -
    +
保存 <% end %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index c0bb15ab4..30c15c03d 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -29,13 +29,16 @@
- <% unless @project.gpid.nil? || @project.project_score.changeset_num == 0 || @project.rep_statics.blank? %> -
-
- <%= render :partial => "rep_static" %> -
-
-
+ <%# 时间紧,权限待优化 %> + <% unless @project.hidden_repo && !User.current.member_of?(@project) && !User.current.admin? %> + <% unless @project.gpid.nil? || @project.project_score.changeset_num == 0 || @project.rep_statics.blank? %> +
+
+ <%= render :partial => "rep_static" %> +
+
+
+ <% end %> <% end %> <%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %> From 5d880db18e7fd71ab5f6ee290f32dae4e1fcae5b Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 2 Jun 2016 17:54:12 +0800 Subject: [PATCH 61/75] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B2=A1=E7=99=BB=E9=99=86=E5=8F=AF=E4=BB=A5=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 4fc9482d4..3d9527b8b 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -124,7 +124,7 @@
<%# end %> - <% if User.current.logged?%> + <%# if User.current.logged?%>
@@ -137,7 +137,7 @@
- <% end %> + <%# end %> From e05e6ba53d03029239217e23970036f59aee3e40 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 2 Jun 2016 18:04:00 +0800 Subject: [PATCH 62/75] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/_new.html.erb | 2 +- app/views/org_document_comments/show.html.erb | 2 +- app/views/sub_document_comments/_new.html.erb | 2 +- app/views/sub_document_comments/show.html.erb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/org_document_comments/_new.html.erb b/app/views/org_document_comments/_new.html.erb index f462df2c9..aacd8f00a 100644 --- a/app/views/org_document_comments/_new.html.erb +++ b/app/views/org_document_comments/_new.html.erb @@ -36,7 +36,7 @@ $('#doc_title_hint').hide(); } -
+
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 3d9527b8b..c7adc39fb 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -5,7 +5,7 @@ showNormalImage('message_description_<%= @document.id %>'); }); -
+
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> diff --git a/app/views/sub_document_comments/_new.html.erb b/app/views/sub_document_comments/_new.html.erb index c6cc13164..aec91c878 100644 --- a/app/views/sub_document_comments/_new.html.erb +++ b/app/views/sub_document_comments/_new.html.erb @@ -36,7 +36,7 @@ $('#doc_title_hint').hide(); } -
+
<%= form_tag org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id), :id => 'new_sub_document_form' do |f| %>
diff --git a/app/views/sub_document_comments/show.html.erb b/app/views/sub_document_comments/show.html.erb index 7050c1c66..f85f3ed25 100644 --- a/app/views/sub_document_comments/show.html.erb +++ b/app/views/sub_document_comments/show.html.erb @@ -8,7 +8,7 @@ showNormalImage('message_description_<%= @document.id %>'); }); -
+
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> @@ -138,7 +138,7 @@
<%# end %> - <% if User.current.logged?%> + <%# if User.current.logged?%>
@@ -151,7 +151,7 @@
- <% end %> + <%# end %>
From 0b869aaaed518c76b8345cba232ba270a3aa9159 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 15:40:11 +0800 Subject: [PATCH 63/75] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AE=9A=E5=88=B6?= =?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/org_document_comments/_form.html.erb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/org_document_comments/_form.html.erb b/app/views/org_document_comments/_form.html.erb index 502da97ad..51400f3cd 100644 --- a/app/views/org_document_comments/_form.html.erb +++ b/app/views/org_document_comments/_form.html.erb @@ -14,10 +14,6 @@

-
置顶显示 : - (仅限模式二) -
-
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %> From 43e586aa90b864d73c26a02f721e984d23887e0e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 15:50:52 +0800 Subject: [PATCH 64/75] =?UTF-8?q?=E6=A0=87=E9=A2=98=E8=BF=87=E9=95=BF?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_custom_left1.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb index 2d97fdbe2..335ed1b2c 100644 --- a/app/views/organizations/_org_custom_left1.html.erb +++ b/app/views/organizations/_org_custom_left1.html.erb @@ -114,7 +114,7 @@ <% else %> <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(document.content)}", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> <% end %> - <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :class => 'por_hot_title link-black_r', :target => "_blank", :title => document.title %> + <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => document.title %>

<%= time_from_now(document.created_at) %><%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %>

<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
@@ -131,8 +131,8 @@ <% else %> <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %> <% end %> - <%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title link-black_r', :target => "_blank", :title => title %> -

<%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>

+ <%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %> +

<%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_title_r link-blue", :target => "_blank" %>

<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
<% else %> @@ -142,7 +142,7 @@ <% else %> <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_path(message.board.id, message.id), :target => "_blank" %> <% end %> - <%= link_to title, board_message_path(message.board.id, message.id), :class => 'por_hot_title link-black_r', :target => "_blank", :title => title %> + <%= link_to title, board_message_path(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>

<%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>

<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
@@ -157,7 +157,7 @@ <% else %> <%= link_to image_tag("/files/uploads/image#{path}", :width => "299", :height => "246"), news_path(news), :target => "_blank" %> <% end %> - <%= link_to news.title, news_path(news), :class => 'por_hot_title link-black_r', :target => "_blank", :title => news.title %> + <%= link_to news.title, news_path(news), :class => 'por_hot_title_r link-black', :target => "_blank", :title => news.title %>

<%= time_from_now(news.created_on) %><%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>

<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
From edbe882cc9dfd7828b702290ecea33a3a7570b02 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 15:56:04 +0800 Subject: [PATCH 65/75] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E5=85=B6=E5=AE=83=E6=88=90=E5=91=98=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index e6fd7591f..fa0d33f6e 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -181,7 +181,7 @@ module OrganizationsHelper if User.current.admin? @organization.org_subfields.order("priority") else - @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu") }.sort_by {|os| os.priority} + @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority} end end From c7866af1e86420f970a865488f8261f1e9fe41bb Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 16:14:45 +0800 Subject: [PATCH 66/75] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=88=90=E5=91=98=E7=9A=84=E6=97=B6=E5=80=99=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_member_list.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/organizations/_org_member_list.html.erb b/app/views/organizations/_org_member_list.html.erb index 0059a2be5..8e8a23b60 100644 --- a/app/views/organizations/_org_member_list.html.erb +++ b/app/views/organizations/_org_member_list.html.erb @@ -31,8 +31,9 @@ <% end %> <% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%> - 编辑 + 编辑 <%= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
+
<% end %> \ No newline at end of file From ea19f199734318ccc62e32812b2863409b1b4041 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 16:30:20 +0800 Subject: [PATCH 67/75] =?UTF-8?q?500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_custom_left2.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_org_custom_left2.html.erb b/app/views/organizations/_org_custom_left2.html.erb index 53169506e..f07053566 100644 --- a/app/views/organizations/_org_custom_left2.html.erb +++ b/app/views/organizations/_org_custom_left2.html.erb @@ -30,7 +30,7 @@ <% else %> <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %> <% end %> - <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> <%= time_from_now activity.updated_on %>
<% elsif act.org_act_type == "News" %> From 65bf816ea4ea9abafde502cce55af54b014a5a41 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 17:03:35 +0800 Subject: [PATCH 68/75] =?UTF-8?q?=E5=B8=96=E5=AD=90=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=90=8E=EF=BC=8C=E4=B8=8D=E5=9C=A8=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=BA=8C=E4=B8=AD=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_custom_left1.html.erb | 6 +++--- app/views/organizations/_org_custom_left2.html.erb | 2 +- app/views/organizations/_org_custom_left3.html.erb | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb index 335ed1b2c..91c0e320e 100644 --- a/app/views/organizations/_org_custom_left1.html.erb +++ b/app/views/organizations/_org_custom_left1.html.erb @@ -9,7 +9,7 @@
    <% if acts.count > 1 %> <% acts[1..2].each do |activity| %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %>
  • <%= link_to "热门推荐#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %> @@ -57,7 +57,7 @@ <% if acts.count > 3 %> <% activity = acts[3] %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %>
  • <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %> @@ -106,7 +106,7 @@ <%# if acts.count > 3 %> <% activity = acts.first %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %>
    <% if get_image_path_from_content(document.content).nil? %> diff --git a/app/views/organizations/_org_custom_left2.html.erb b/app/views/organizations/_org_custom_left2.html.erb index f07053566..2c389766f 100644 --- a/app/views/organizations/_org_custom_left2.html.erb +++ b/app/views/organizations/_org_custom_left2.html.erb @@ -131,7 +131,7 @@ <%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %> <% org_acts.first(4).each do |activity| %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %> <% org_subfield_id = params[:org_subfield_id] %> <% iamge_path = get_image_path_from_content(document.content) %> diff --git a/app/views/organizations/_org_custom_left3.html.erb b/app/views/organizations/_org_custom_left3.html.erb index bcfac4933..cdd683944 100644 --- a/app/views/organizations/_org_custom_left3.html.erb +++ b/app/views/organizations/_org_custom_left3.html.erb @@ -9,7 +9,7 @@
    <% activity = acts.first %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %> <% if get_image_path_from_content(document.content).nil? %> <%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> @@ -73,7 +73,7 @@ <% unless acts[1..5].nil? %> <% acts[1..5].each do |activity| %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %>
    • <%= link_to "#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • @@ -115,7 +115,7 @@
        <% acts[6..19].each do |activity| %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> <% document = activity.org_act %>
      • <%= link_to "#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w270 link-black', :target => "_blank" %>
      • <% else activity.container_type == 'OrgSubfield' %> From 07941233d8f6793895341994599a371034b808bb Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 3 Jun 2016 17:03:53 +0800 Subject: [PATCH 69/75] =?UTF-8?q?=E9=A2=98=E5=BA=93=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=88=B0=E5=90=8E=EF=BC=8C=E5=85=88=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E4=B8=80=E4=B8=AA=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E8=AF=BE=E7=A8=8BID=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=EF=BC=8C=E5=9C=A8=E5=87=BA=E7=8E=B0=E8=AF=B7=E5=85=88?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=90=8E=E5=88=A0=E9=99=A4=E8=BE=93=E5=85=A5=E7=9A=84ID?= =?UTF-8?q?=EF=BC=8C=E6=AD=A4=E6=97=B6=E4=BC=9A=E6=98=BE=E7=A4=BA=E5=87=BA?= =?UTF-8?q?=E8=AF=A5=E7=94=A8=E6=88=B7=E6=89=80=E6=9C=89=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=EF=BC=8C=E5=8C=85=E6=8B=AC=E5=B7=B2=E7=BB=8F=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4cb838b8c..009d5c4d6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -575,7 +575,7 @@ class UsersController < ApplicationController end if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" - @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} + @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} else @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)} end From 429deefadf78f669f3a1975c495b3c9ab965bb51 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 17:14:28 +0800 Subject: [PATCH 70/75] =?UTF-8?q?=E5=8F=B3=E4=B8=80=E7=BA=BF=E6=9D=A1?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_custom_right2.html.erb | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/views/organizations/_org_custom_right2.html.erb b/app/views/organizations/_org_custom_right2.html.erb index 2555372df..9d206ff93 100644 --- a/app/views/organizations/_org_custom_right2.html.erb +++ b/app/views/organizations/_org_custom_right2.html.erb @@ -3,20 +3,22 @@ <% if containers.blank? %>

        该模块暂时没有相关内容

        <% else %> - <% container = containers.first %> -
      • - <%= link_to "#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %> -

        活跃度<%= static_project_score(container.project_score) %>

        -
        - <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => container.id, :content=> container.description, :maxheight => 40, :maxwordsnum => 48, :maxwidth => 0, :cl => "por_project_p"} %> -
      • +
          + <% container = containers.first %> +
        • + <%= link_to "#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %> +

          活跃度<%= static_project_score(container.project_score) %>

          +
          + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => container.id, :content=> container.description, :maxheight => 40, :maxwordsnum => 55, :maxwidth => 0, :cl => "por_project_p"} %> +
        • - <% containers[1..4].each do |container| %> -
        • - <%= link_to "#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %> -

          活跃度<%= static_project_score(container.project_score) %>

          -
          -
        • - <% end %> + <% containers[1..4].each do |container| %> +
        • + <%= link_to "#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %> +

          活跃度<%= static_project_score(container.project_score) %>

          +
          +
        • + <% end %> +
        <% end %>
      From dab24567f2aa9947ce21d3f69a52c5d2b0cedff7 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 3 Jun 2016 17:21:36 +0800 Subject: [PATCH 71/75] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= 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 f9a59e080..3169763c4 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -115,7 +115,7 @@ class WechatService data = { touser:openid, template_id:template_id, - url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", + url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}", topcolor:"#FF0000", data:{ first: { @@ -143,7 +143,7 @@ class WechatService data = { touser:openid, template_id:template_id, - url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", + url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}", topcolor:"#FF0000", data:{ first: { @@ -181,7 +181,7 @@ class WechatService data = { touser:uw.openid, template_id:Wechat.config.binding_succ_notice, - url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect", + url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities", topcolor:"#FF0000", data:{ first: { From acc808f0037b36990b091f18bf92cbb97967e2dd Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 17:24:45 +0800 Subject: [PATCH 72/75] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_custom_left3.html.erb | 77 +++++++++---------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/app/views/organizations/_org_custom_left3.html.erb b/app/views/organizations/_org_custom_left3.html.erb index cdd683944..3d5d01dee 100644 --- a/app/views/organizations/_org_custom_left3.html.erb +++ b/app/views/organizations/_org_custom_left3.html.erb @@ -70,46 +70,45 @@ <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %> <% end %> <% end %> - - <% unless acts[1..5].nil? %> - <% acts[1..5].each do |activity| %> - <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> - <% document = activity.org_act %> -
        -
      • <%= link_to "#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
      • -
      - <% else activity.container_type == 'OrgSubfield' %> - <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %> - <% message = Message.find(activity.org_act_id) %> - <% if message.board.org_subfield_id %> -
        - <% if message.parent_id.nil? %> -
      • <%= link_to "#{message.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
      • - <% else %> -
      • <%= link_to "#{message.parent.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
      • - <% end %> -
      - <% else %> -
        - <% if message.parent_id.nil? %> -
      • <%= link_to "#{message.subject}".html_safe, board_message_path(message.board,message), class: 'por_hidden_w390 link-black', :target => "_blank" %>
      • - <% else %> -
      • <%= link_to "#{message.parent.subject}".html_safe, board_message_path(message.board, message), class: 'por_hidden_w390 link-black', :target => "_blank" %>
      • - <% end %> -
      - <% end %> - <% end %> - <% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %> - <% news = News.find(activity.org_act_id) %> - <% iamge_path = get_image_path_from_content(news.description) %> -
        -
      • <%= link_to "#{news.title}".html_safe, news_path(news), class: 'por_hidden_w390 link-black', :target => "_blank" %>
      • -
      - <% end %> - <% end %> - <% end %> - <% end %>
    + <% unless acts[1..5].nil? %> + <% acts[1..5].each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> + <% document = activity.org_act %> +
      +
    • <%= link_to "#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • +
    + <% else activity.container_type == 'OrgSubfield' %> + <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %> + <% message = Message.find(activity.org_act_id) %> + <% if message.board.org_subfield_id %> +
      + <% if message.parent_id.nil? %> +
    • <%= link_to "#{message.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • + <% else %> +
    • <%= link_to "#{message.parent.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • + <% end %> +
    + <% else %> +
      + <% if message.parent_id.nil? %> +
    • <%= link_to "#{message.subject}".html_safe, board_message_path(message.board,message), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • + <% else %> +
    • <%= link_to "#{message.parent.subject}".html_safe, board_message_path(message.board, message), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • + <% end %> +
    + <% end %> + <% end %> + <% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %> + <% news = News.find(activity.org_act_id) %> + <% iamge_path = get_image_path_from_content(news.description) %> +
      +
    • <%= link_to "#{news.title}".html_safe, news_path(news), class: 'por_hidden_w390 link-black', :target => "_blank" %>
    • +
    + <% end %> + <% end %> + <% end %> + <% end %>
    <% unless acts[6..19].nil? %>
    From 57f3cf713caf1b8a58b60231384737987a77feeb Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 17:50:40 +0800 Subject: [PATCH 73/75] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 14 ++++++++++++-- .../organizations/_org_custom_header.html.erb | 8 ++++---- .../organizations/_org_students_list.html.erb | 4 ++-- .../organizations/reset_excellent_student.js.erb | 1 + .../organizations/reset_excellent_teacher.js.erb | 2 +- .../organizations/set_excellent_student.js.erb | 1 + 6 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 app/views/organizations/reset_excellent_student.js.erb create mode 100644 app/views/organizations/set_excellent_student.js.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3cbfc8466..a0ef84798 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -563,13 +563,23 @@ class OrganizationsController < ApplicationController # 设置为名师 def set_excellent_teacher @ex_teacher = User.find(params[:user]) - params[:type] == "student" ? @ex_teacher.update_column(:excellent_student, 1) : @ex_teacher.update_column(:excellent_teacher, 1) + @ex_teacher.update_column(:excellent_teacher, 1) end # 取消名师 def reset_excellent_teacher @ex_teacher = User.find(params[:user]) - params[:type] == "student" ? @ex_teacher.update_column(:excellent_student, 0) : @ex_teacher.update_column(:excellent_teacher, 0) + @ex_teacher.update_column(:excellent_teacher, 0) + end + + def set_excellent_student + @ex_student = User.find(params[:user]) + @ex_student.update_column(:excellent_student, 1) + end + + def reset_excellent_student + @ex_student = User.find(params[:user]) + @ex_student.update_column(:excellent_student, 0) end def hide_org_subfield diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index cc6920f33..e05d52747 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -21,10 +21,10 @@
  • 注册
<% end %> - + + + +
diff --git a/app/views/organizations/_org_students_list.html.erb b/app/views/organizations/_org_students_list.html.erb index 4f768d29f..d3db6fbf6 100644 --- a/app/views/organizations/_org_students_list.html.erb +++ b/app/views/organizations/_org_students_list.html.erb @@ -33,12 +33,12 @@ function hide(content, id){ if (content.text() == '设为学霸') $.ajax({ - url: "/organizations/set_excellent_teacher?user=" + id + "&type=student", + url: "/organizations/set_excellent_student?user=" + id , type: "post" }); else $.ajax({ - url: "/organizations/reset_excellent_teacher?user=" + id + "&type=student", + url: "/organizations/reset_excellent_student?user=" + id , type: "post" }); } diff --git a/app/views/organizations/reset_excellent_student.js.erb b/app/views/organizations/reset_excellent_student.js.erb new file mode 100644 index 000000000..29684c7e4 --- /dev/null +++ b/app/views/organizations/reset_excellent_student.js.erb @@ -0,0 +1 @@ +$("#hide_<%= @ex_student.id %>").text("设为学霸"); \ No newline at end of file diff --git a/app/views/organizations/reset_excellent_teacher.js.erb b/app/views/organizations/reset_excellent_teacher.js.erb index 8b7c6cc71..fdf160bc4 100644 --- a/app/views/organizations/reset_excellent_teacher.js.erb +++ b/app/views/organizations/reset_excellent_teacher.js.erb @@ -1 +1 @@ -$("#hide_<%= @ex_teacher.id %>").text(<%= params[:type]== "student" ? "设为学霸" : "设为名师"%>); \ No newline at end of file +$("#hide_<%= @ex_teacher.id %>").text("设为名师"); \ No newline at end of file diff --git a/app/views/organizations/set_excellent_student.js.erb b/app/views/organizations/set_excellent_student.js.erb new file mode 100644 index 000000000..a8bb963c8 --- /dev/null +++ b/app/views/organizations/set_excellent_student.js.erb @@ -0,0 +1 @@ +$("#hide_<%= @ex_student.id %>").text("取消设置"); \ No newline at end of file From 7cce01872d7bf9ef0daaa56ade4770b1344f496b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 3 Jun 2016 18:11:42 +0800 Subject: [PATCH 74/75] =?UTF-8?q?=E5=90=8D=E5=AD=97=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_custom_left1.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb index 91c0e320e..4c1271ab8 100644 --- a/app/views/organizations/_org_custom_left1.html.erb +++ b/app/views/organizations/_org_custom_left1.html.erb @@ -132,7 +132,7 @@ <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %> <% end %> <%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %> -

<%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_title_r link-blue", :target => "_blank" %>

+

<%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>

<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
<% else %> From c6d36bd73890e8da7c1d2425e4b3272c82fff1bf Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 6 Jun 2016 14:21:58 +0800 Subject: [PATCH 75/75] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=95=99?= =?UTF-8?q?=E8=A8=80=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org_document_comments_controller.rb | 2 +- .../organizations/_show_org_document.html.erb | 24 +++++++++++-------- app/views/users/_show_unlogged.html.erb | 0 3 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 app/views/users/_show_unlogged.html.erb diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index c938a2d4b..dd237de17 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -1,6 +1,6 @@ class OrgDocumentCommentsController < ApplicationController before_filter :find_organization, :only => [:new, :create, :show, :index] - before_filter :authorize_allowed, :only => [:create] + before_filter :authorize_allowed, :only => [:create, :add_reply] helper :attachments,:organizations layout 'base_org' diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 3042ca9ae..594063629 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -115,17 +115,21 @@ <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
-
- <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> - -
- - + <% if User.current.logged? %> +
+ <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> + +
+ + -
-

- <% end %> -
+
+

+ <% end %> +
+ <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %>
diff --git a/app/views/users/_show_unlogged.html.erb b/app/views/users/_show_unlogged.html.erb new file mode 100644 index 000000000..e69de29bb