增加组织动态的过滤功能,组织动态包括项目动态和组织的动态
This commit is contained in:
parent
fba461f94a
commit
6f5cb8f142
|
@ -56,13 +56,17 @@ class OrganizationsController < ApplicationController
|
||||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||||
@organization = Organization.find(params[:id])
|
@organization = Organization.find(params[:id])
|
||||||
project_ids = @organization.projects.map(&:id) << 0
|
project_ids = @organization.projects.map(&:id) << 0
|
||||||
|
case params[:type]
|
||||||
|
when nil
|
||||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')}))",
|
@org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')}))",
|
||||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||||
# @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" ,
|
when 'project_issue'
|
||||||
# @organization.id, 'Organization ').count
|
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||||
# @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10)
|
when 'project_message'
|
||||||
# @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count
|
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||||
#@org_activities = paginateHelper @org_activities, 10
|
when 'org'
|
||||||
|
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||||
|
end
|
||||||
@page = params[:page]
|
@page = params[:page]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
|
@ -16,10 +16,22 @@
|
||||||
<div class="NewsBannerName">最新动态</div>
|
<div class="NewsBannerName">最新动态</div>
|
||||||
<ul class="resourcesSelect">
|
<ul class="resourcesSelect">
|
||||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||||
<ul class="resourcesType">
|
<ul class="homepagePostType">
|
||||||
<li class="mt-4"><a href="javascript:void(0);" class="homepagePostTypeAll postTypeGrey">全部动态</a></li>
|
<li>
|
||||||
<li class="mt-4">
|
<ul class="homepagePostTypeProject fl">
|
||||||
<a href="/users/8523/user_activities?type=current_user" class="homepagePostTypeMine postTypeGrey">我的动态</a>
|
<li class="f14">项目动态</li>
|
||||||
|
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
|
||||||
|
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||||
|
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
|
||||||
|
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ul class="homepagePostTypeProject fl">
|
||||||
|
<li class="f14">更多</li>
|
||||||
|
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
|
||||||
|
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue