Class: Decidim::PagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/decidim/pages_controller.rb

Overview

This controller serves static pages using HighVoltage.

Instance Method Summary collapse

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#indexObject



13
14
15
16
# File 'app/controllers/decidim/pages_controller.rb', line 13

def index
  enforce_permission_to :read, :public_page
  @pages = current_organization.static_pages.sorted_by_i18n_title
end

#pageObject



29
30
31
# File 'app/controllers/decidim/pages_controller.rb', line 29

def page
  @page ||= current_organization.static_pages.find_by(slug: params[:id])
end

#showObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/decidim/pages_controller.rb', line 18

def show
  enforce_permission_to :read, :public_page, page: page
  if params[:id] == "home"
    render :home
  elsif page
    render :decidim_page
  else
    raise ActionController::RoutingError, "Not Found"
  end
end