2022-07-05 11:45:38 +00:00
|
|
|
class Public::Api::V1::PortalsController < PublicController
|
2022-09-07 06:52:24 +00:00
|
|
|
before_action :ensure_custom_domain_request, only: [:show]
|
2022-09-20 17:31:39 +00:00
|
|
|
before_action :redirect_to_portal_with_locale, only: [:show]
|
2022-09-20 00:36:01 +00:00
|
|
|
before_action :portal
|
2022-09-12 18:06:24 +00:00
|
|
|
layout 'portal'
|
2022-07-05 11:45:38 +00:00
|
|
|
|
|
|
|
def show; end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-09-20 00:36:01 +00:00
|
|
|
def portal
|
|
|
|
@portal ||= Portal.find_by!(slug: params[:slug], archived: false)
|
2022-09-20 17:31:39 +00:00
|
|
|
@locale = params[:locale] || @portal.default_locale
|
|
|
|
end
|
|
|
|
|
|
|
|
def redirect_to_portal_with_locale
|
|
|
|
return if params[:locale].present?
|
|
|
|
|
|
|
|
redirect_to "/hc/#{@portal.slug}/#{@portal.default_locale}"
|
2022-07-05 11:45:38 +00:00
|
|
|
end
|
|
|
|
end
|