Sha256: 8054fa4f7cd12598377a8f54809468bcfbbedcfea2e5f937c1a31ba829abb7a7

Contents?: true

Size: 888 Bytes

Versions: 58

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This controller serves static pages using HighVoltage.
  class PagesController < Decidim::ApplicationController
    layout "layouts/decidim/application"

    helper_method :page, :pages
    helper CtaButtonHelper
    helper Decidim::SanitizeHelper

    before_action :set_default_request_format

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

    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

    private

    def set_default_request_format
      request.format = :html
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
decidim-core-0.23.3 app/controllers/decidim/pages_controller.rb
decidim-core-0.23.2 app/controllers/decidim/pages_controller.rb
decidim-core-0.23.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.23.1.rc1 app/controllers/decidim/pages_controller.rb
decidim-core-0.23.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.22.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.21.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.20.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.20.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.19.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.18.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.19.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.17.2 app/controllers/decidim/pages_controller.rb
decidim-core-0.18.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.17.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.16.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.17.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.16.0 app/controllers/decidim/pages_controller.rb