Class: Decidim::Pages::Page

Inherits:
ApplicationRecord show all
Includes:
Comments::Commentable, HasFeature, Resourceable
Defined in:
decidim-pages/app/models/decidim/pages/page.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#accepts_new_comments?Boolean

Public: Overrides the ‘accepts_new_comments?` Commentable concern method.

Returns:

  • (Boolean)


25
26
27
# File 'decidim-pages/app/models/decidim/pages/page.rb', line 25

def accepts_new_comments?
  commentable? && !feature.active_step_settings.comments_blocked
end

#commentable?Boolean

Public: Overrides the ‘commentable?` Commentable concern method.

Returns:

  • (Boolean)


20
21
22
# File 'decidim-pages/app/models/decidim/pages/page.rb', line 20

def commentable?
  feature.settings.comments_enabled?
end

#comments_have_alignment?Boolean

Public: Overrides the ‘comments_have_alignment?` Commentable concern method.

Returns:

  • (Boolean)


30
31
32
# File 'decidim-pages/app/models/decidim/pages/page.rb', line 30

def comments_have_alignment?
  true
end

#comments_have_votes?Boolean

Public: Overrides the ‘comments_have_votes?` Commentable concern method.

Returns:

  • (Boolean)


35
36
37
# File 'decidim-pages/app/models/decidim/pages/page.rb', line 35

def comments_have_votes?
  true
end

#titleObject

Public: Pages doesn’t have title so we assign the feature one to it.



15
16
17
# File 'decidim-pages/app/models/decidim/pages/page.rb', line 15

def title
  feature.name
end