Sha256: 4c0ef54fc437ed3970a4fbfba8746f27f9c3cba7e618ae022bde6d664d98f09b

Contents?: true

Size: 915 Bytes

Versions: 9

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true

require_dependency "decidim/page_finder"

module Decidim
  # This controller serves static pages using HighVoltage.
  class PagesController < Decidim::ApplicationController
    include HighVoltage::StaticPage

    layout "layouts/decidim/application"

    authorize_resource :public_pages, class: false
    delegate :page, to: :page_finder
    helper_method :page, :stats
    helper CtaButtonHelper
    helper Decidim::SanitizeHelper
    skip_before_action :store_current_location

    def index
      @pages = current_organization.static_pages.all.to_a.sort do |a, b|
        a.title[I18n.locale.to_s] <=> b.title[I18n.locale.to_s]
      end
    end

    def page_finder
      @page_finder ||= Decidim::PageFinder.new(params[:id], current_organization)
    end

    private

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.11.2 app/controllers/decidim/pages_controller.rb
decidim-core-0.11.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.11.0.pre1 app/controllers/decidim/pages_controller.rb
decidim-core-0.10.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.10.0 app/controllers/decidim/pages_controller.rb
decidim-core-0.9.3 app/controllers/decidim/pages_controller.rb
decidim-core-0.9.2 app/controllers/decidim/pages_controller.rb
decidim-core-0.9.1 app/controllers/decidim/pages_controller.rb
decidim-core-0.9.0 app/controllers/decidim/pages_controller.rb