diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index bc1a6a003..f7adb13dc 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -70,11 +70,16 @@ class OrganizationsController < ApplicationController
def show
# 组织新类型 show_mode:判断标准 1为新类型,0为旧
- if @organization.show_mode == 1 && params[:org_subfield_id].nil?
+ if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:type] .nil?
@subfield_content = @organization.org_subfields.order("priority")
- @project_acts = get_project_activities_org @organization
+ # 项目两种动态
+ @project_issue_acts = get_project_issue_activities_org @organization
+ @project_message_acts = get_project_message_activities_org @organization
+ # 磕碜动态
+ #@project_acts_issues = get_project_activities_org @organization
@course_acts_homework = get_course_homework_activities_org @organization
@course_acts_message = get_course_message_activities_org @organization
+ @course_acts_news = get_course_news_activities_org @organization
render :layout => 'base_org_newstyle'
else
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@@ -125,20 +130,30 @@ class OrganizationsController < ApplicationController
end
- def get_project_activities_org org
+ def get_project_message_activities_org org
project_ids = org.projects.map{|project| project.id}.join(",")
- project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' order by updated_at desc limit 3;")
+ project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'Message' order by updated_at desc limit 2;")
+ end
+
+ def get_project_issue_activities_org org
+ project_ids = org.projects.map{|project| project.id}.join(",")
+ project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;")
end
def get_course_homework_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;")
- project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 4;")
+ project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;")
end
def get_course_message_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
- project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'Message' order by updated_at desc limit 4;")
+ project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'Message' order by updated_at desc limit 1;")
+ end
+
+ def get_course_news_activities_org org
+ course_ids = org.courses.map{|course| course.id}.join(",")
+ project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;")
end
def update
diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb
index 4834cdb9b..19ae17015 100644
--- a/app/helpers/organizations_helper.rb
+++ b/app/helpers/organizations_helper.rb
@@ -30,7 +30,12 @@ module OrganizationsHelper
end
def get_message_org(org_id, field_id)
- OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} order by updated_at desc limit 3;")
+ OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 2;")
+ end
+
+ def get_message_reply_org(org_id, ids)
+ # OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id is not null order by updated_at desc limit 1;")
+ OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id in (#{ids}) order by updated_at desc limit 1;")
end
def get_attach_org(field_id)
diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb
index 315d53e9d..c796934df 100644
--- a/app/views/layouts/base_org_newstyle.html.erb
+++ b/app/views/layouts/base_org_newstyle.html.erb
@@ -27,242 +27,227 @@
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
+
-