Class: Decidim::Blogs::Post

Inherits:
ApplicationRecord show all
Includes:
Authorable, Comments::CommentableWithComponent, Endorsable, Followable, HasAttachmentCollections, HasAttachments, HasComponent, Resourceable, Searchable, TranslatableResource, 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

#allow_resource_permissions?Boolean

Public: Overrides the ‘allow_resource_permissions?` Resourceable concern method.

Returns:

  • (Boolean)


53
54
55
# File 'app/models/decidim/blogs/post.rb', line 53

def allow_resource_permissions?
  true
end

#attachment_contextObject



65
66
67
# File 'app/models/decidim/blogs/post.rb', line 65

def attachment_context
  :admin
end

#comments_have_alignment?Boolean

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

Returns:

  • (Boolean)


43
44
45
# File 'app/models/decidim/blogs/post.rb', line 43

def comments_have_alignment?
  true
end

#comments_have_votes?Boolean

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

Returns:

  • (Boolean)


48
49
50
# File 'app/models/decidim/blogs/post.rb', line 48

def comments_have_votes?
  true
end

#official?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'app/models/decidim/blogs/post.rb', line 57

def official?
  author.nil?
end

#users_to_notify_on_comment_createdObject



61
62
63
# File 'app/models/decidim/blogs/post.rb', line 61

def users_to_notify_on_comment_created
  followers
end

#visible?Boolean

Returns:

  • (Boolean)


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

def visible?
  participatory_space.try(:visible?) && component.try(:published?)
end