修改列表页的左侧数据
This commit is contained in:
parent
842f4776e0
commit
098c520501
|
@ -4,8 +4,16 @@ class ProjectCategoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_list
|
def group_list
|
||||||
|
is_admin = current_user && current_user&.admin?
|
||||||
|
if is_admin
|
||||||
|
projects = Project.all
|
||||||
|
elsif current_user&.logged?
|
||||||
|
projects = Project.joins(:members).where.not("projects.is_public = ? and (projects.user_id != ? or members.user_id != ?)", false, current_user.id,current_user.id )
|
||||||
|
else
|
||||||
|
projects = Project.visible
|
||||||
|
end
|
||||||
@category_group_list =
|
@category_group_list =
|
||||||
Project.visible.joins(:project_category).group(:project_category_id)
|
projects.joins(:project_category).group(:project_category_id)
|
||||||
.select("project_category_id, count(*) AS projects_count, project_categories.name")
|
.select("project_category_id, count(*) AS projects_count, project_categories.name")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,15 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_type_list
|
def group_type_list
|
||||||
@project_group_list = Project.visible.group(:project_type).select('project_type, count(project_type) AS projects_count').having("count(project_type) > ?", 0)
|
is_admin = current_user && current_user&.admin?
|
||||||
|
if is_admin
|
||||||
|
projects = Project.all
|
||||||
|
elsif current_user&.logged?
|
||||||
|
projects = Project.joins(:members).where.not("projects.is_public = ? and (projects.user_id != ? or members.user_id != ?)", false, current_user.id,current_user.id )
|
||||||
|
else
|
||||||
|
projects = Project.visible
|
||||||
|
end
|
||||||
|
@project_group_list = projects.group(:project_type).select('project_type, count(project_type) AS projects_count').having("count(project_type) > ?", 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
Loading…
Reference in New Issue