Sha256: 458ddf5e78516a5f0325fac395db959010b06edd0ceb1a19706153b20f5ba46a

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module Decidim
  module Pages
    # The data store for a Page in the Decidim::Pages component. It stores a
    # title, description and any other useful information to render a custom page.
    class Page < Pages::ApplicationRecord
      include Decidim::Resourceable
      include Decidim::HasFeature
      include Decidim::Comments::Commentable

      feature_manifest_name "pages"

      # Public: Pages doesn't have title so we assign the feature one to it.
      def title
        feature.name
      end

      # Public: Overrides the `commentable?` Commentable concern method.
      def commentable?
        feature.settings.comments_enabled?
      end

      # Public: Overrides the `accepts_new_comments?` Commentable concern method.
      def accepts_new_comments?
        commentable? && !feature.active_step_settings.comments_blocked
      end

      # Public: Overrides the `comments_have_alignment?` Commentable concern method.
      def comments_have_alignment?
        true
      end

      # Public: Overrides the `comments_have_votes?` Commentable concern method.
      def comments_have_votes?
        true
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-pages-0.3.2 app/models/decidim/pages/page.rb
decidim-0.3.2 decidim-pages/app/models/decidim/pages/page.rb
decidim-pages-0.3.1 app/models/decidim/pages/page.rb
decidim-0.3.1 decidim-pages/app/models/decidim/pages/page.rb
decidim-pages-0.3.0 app/models/decidim/pages/page.rb
decidim-0.3.0 decidim-pages/app/models/decidim/pages/page.rb
decidim-pages-0.2.0 app/models/decidim/pages/page.rb
decidim-0.2.0 decidim-pages/app/models/decidim/pages/page.rb