Class: Decidim::Blogs::Post

Inherits:
ApplicationRecord show all
Includes:
Authorable, Comments::Commentable, HasComponent, Resourceable, Loggable, Traceable
Defined in:
app/models/decidim/blogs/post.rb

Overview

The data store for a Blog in the Decidim::Blogs component. It stores a title, description and any other useful information to render a blog.

Instance Method Summary collapse

Instance Method Details

#accepts_new_comments?Boolean

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

Returns:

  • (Boolean)


27
28
29
# File 'app/models/decidim/blogs/post.rb', line 27

def accepts_new_comments?
  commentable? && !component.current_settings.comments_blocked
end

#commentable?Boolean

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

Returns:

  • (Boolean)


22
23
24
# File 'app/models/decidim/blogs/post.rb', line 22

def commentable?
  component.settings.comments_enabled?
end

#comments_have_alignment?Boolean

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

Returns:

  • (Boolean)


32
33
34
# File 'app/models/decidim/blogs/post.rb', line 32

def comments_have_alignment?
  true
end

#comments_have_votes?Boolean

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

Returns:

  • (Boolean)


37
38
39
# File 'app/models/decidim/blogs/post.rb', line 37

def comments_have_votes?
  true
end

#official?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/decidim/blogs/post.rb', line 41

def official?
  author.nil?
end