2020-09-25 21:02:34 +00:00
|
|
|
class Api::V1::Accounts::Kbase::PortalsController < Api::V1::Accounts::Kbase::BaseController
|
|
|
|
before_action :fetch_portal, except: [:index, :create]
|
|
|
|
|
|
|
|
def index
|
|
|
|
@portals = Current.account.kbase_portals
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@portal = Current.account.kbase_portals.create!(portal_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@portal.update!(portal_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2022-03-24 07:58:25 +00:00
|
|
|
@portal.destroy!
|
2020-09-25 21:02:34 +00:00
|
|
|
head :ok
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def fetch_portal
|
|
|
|
@portal = current_account.kbase_portals.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def portal_params
|
|
|
|
params.require(:portal).permit(
|
|
|
|
:account_id, :color, :custom_domain, :header_text, :homepage_link, :name, :page_title, :slug
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|