Class: Public::StaticPagesController

Inherits:
Postnhost::PublicController
  • Object
show all
Includes:
Postnhost::LanguageSwitcher, Postnhost::PublicFooterData, Postnhost::PublicHttpCaching, Postnhost::PublicTemplateResolvable
Defined in:
app/controllers/postnhost/public/static_pages_controller.rb

Instance Method Summary collapse

Methods included from Postnhost::PublicTemplateResolvable

#default_url_options

Instance Method Details

#showObject

Raises:

  • (ActionController::RoutingError)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/postnhost/public/static_pages_controller.rb', line 10

def show
  raise ActionController::RoutingError, "Not Found" unless valid_slug?

  if page_resolution.present?
    apply_public_http_cache(page_resolution.record_id, template: resolve_public_template("static_pages/show"))
    return if performed?

    set_footer_data
    load_dynamic_page
    return render_public_template("static_pages/show")
  end

  template = resolved_template
  raise ActionController::RoutingError, "Not Found" unless template

  apply_public_http_cache(params[:slug], template:)
  return if performed?

  set_footer_data
  render template: template
end