Class: Decidim::PagesController

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

Overview

This controller serves static pages using HighVoltage.

Instance Method Summary collapse

Instance Method Details

#indexObject



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

def index
  enforce_permission_to :read, :public_page
  @topics = StaticPageTopic.where(organization: current_organization)
  @orphan_pages = StaticPage.where(topic: nil, organization: current_organization)
end

#showObject



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

def show
  @page = current_organization.static_pages.find_by!(slug: params[:id])
  enforce_permission_to :read, :public_page, page: @page
  @topic = @page.topic
  @pages = @topic&.pages
end