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 UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#indexObject



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

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



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

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