Sha256: 9ef84917e202f8a9a667f18cd24c4e78e6977f21b9d2966add5a216d8d188264

Contents?: true

Size: 891 Bytes

Versions: 7

Compression:

Stored size: 891 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, :stats
    helper CtaButtonHelper
    helper Decidim::SanitizeHelper
    skip_before_action :store_current_location

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

    def show
      enforce_permission_to :read, :public_page, page: page
      if params[:id] == "home"
        render :home
      else
        render :decidim_page
      end
    end

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

    private

    def stats
      @stats ||= HomeStatsPresenter.new(organization: current_organization)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.13.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.12.2 app/controllers/decidim/pages_controller.rb
decidim-core-0.13.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.12.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.13.0.pre1 app/controllers/decidim/pages_controller.rb
decidim-core-0.12.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.12.0.pre app/controllers/decidim/pages_controller.rb