|
|
|
@@ -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 |
|
|
|
@@ -15,7 +19,7 @@ class Organizations::ClasController < Organizations::BaseController |
|
|
|
return tip_exception("组织已存在CLA!") |
|
|
|
else |
|
|
|
Organizations::CreateClaForm.new(cla_params).validate! |
|
|
|
@cla = Cla.build(cla_params) |
|
|
|
@cla = Cla.build(cla_params,@organization.id) |
|
|
|
end |
|
|
|
end |
|
|
|
rescue Exception => e |
|
|
|
@@ -47,7 +51,7 @@ class Organizations::ClasController < Organizations::BaseController |
|
|
|
|
|
|
|
private |
|
|
|
def cla_params |
|
|
|
params.permit(:name, :key, :content, :organization_id, :pr_need) |
|
|
|
params.permit(:name, :key, :content, :pr_need) |
|
|
|
end |
|
|
|
|
|
|
|
def load_organization |
|
|
|
@@ -57,7 +61,7 @@ class Organizations::ClasController < Organizations::BaseController |
|
|
|
end |
|
|
|
|
|
|
|
def load_cla |
|
|
|
@cla = Cla.find_by!(organization:params[:organization_id], key: params[:id]) |
|
|
|
@cla = Cla.find_by!(organization:@organization, key: params[:id]) |
|
|
|
end |
|
|
|
|
|
|
|
end |