update response for cla
This commit is contained in:
parent
6b772ea889
commit
fccf36e1eb
|
@ -1,11 +1,15 @@
|
|||
class Organizations::ClasController < Organizations::BaseController
|
||||
before_action :load_organization
|
||||
before_action :load_cla, only: [:show, :update, :destroy]
|
||||
|
||||
def index
|
||||
@cla = @organization.cla
|
||||
end
|
||||
|
||||
def show
|
||||
def show
|
||||
@is_admin = can_edit_org?
|
||||
@is_member = @organization.is_member?(current_user.id)
|
||||
@is_sign = @organization.is_sign?(current_user.id)
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -107,6 +107,11 @@ class Organization < Owner
|
|||
organization_users.where(user_id: user_id).present?
|
||||
end
|
||||
|
||||
def is_sign?(user_id)
|
||||
return false if cla.nil?
|
||||
cla.user_clas.where(user_id: user_id).present?
|
||||
end
|
||||
|
||||
def is_owner?(user_id)
|
||||
team_users.joins(:team).where(user_id: user_id, teams: {authorize: %w(owner)}).present?
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
json.partial! "detail", cla: @cla, organization: @organization
|
||||
json.is_admin @is_admin
|
||||
json.is_sign @is_sign
|
||||
json.is_member @is_member
|
||||
json.organization do
|
||||
json.partial! "organizations/organizations/simple", organization: @organization
|
||||
|
|
Loading…
Reference in New Issue