[ADD]org team search, project teams add\remove, org can create field

[FIX]
This commit is contained in:
2021-02-04 17:03:56 +08:00
parent 4f6f257b37
commit 54204d4db8
12 changed files with 150 additions and 80 deletions

View File

@@ -15,6 +15,18 @@ class Organizations::TeamsController < Organizations::BaseController
@teams = kaminari_paginate(@teams)
end
def search
tip_exception("请输入搜索关键词") if params[:search].nil?
if @organization.is_owner?(current_user) || current_user.admin?
@teams = @organization.teams
else
@teams = @organization.teams.joins(:team_users).where(team_users: {user_id: current_user.id})
end
@is_admin = can_edit_org?
@teams = @teams.ransack(name_cont: params[:search]).result if params[:search].present?
@teams = @teams.includes(:team_units, :team_users)
end
def show
@is_admin = can_edit_org?
@is_member = @team.is_member?(current_user.id)