Class: Decidim::Blogs::Post
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Blogs::Post
- Includes:
- Authorable, Comments::CommentableWithComponent, Endorsable, Followable, HasAttachmentCollections, HasAttachments, HasComponent, Reportable, 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.
Class Method Summary collapse
Instance Method Summary collapse
-
#allow_resource_permissions? ⇒ Boolean
Public: Overrides the ‘allow_resource_permissions?` Resourceable concern method.
- #attachment_context ⇒ Object
-
#comments_have_alignment? ⇒ Boolean
Public: Overrides the ‘comments_have_alignment?` Commentable concern method.
-
#comments_have_votes? ⇒ Boolean
Public: Overrides the ‘comments_have_votes?` Commentable concern method.
- #official? ⇒ Boolean
-
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
-
#reported_content_url ⇒ Object
Public: Overrides the ‘reported_content_url` Reportable concern method.
-
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
- #user_group? ⇒ Boolean
- #users_to_notify_on_comment_created ⇒ Object
- #visible? ⇒ Boolean
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
43 44 45 |
# File 'app/models/decidim/blogs/post.rb', line 43 def self.log_presenter_class_for(_log) Decidim::Blogs::AdminLog::PostPresenter end |
Instance Method Details
#allow_resource_permissions? ⇒ Boolean
Public: Overrides the ‘allow_resource_permissions?` Resourceable concern method.
58 59 60 |
# File 'app/models/decidim/blogs/post.rb', line 58 def true end |
#attachment_context ⇒ Object
74 75 76 |
# File 'app/models/decidim/blogs/post.rb', line 74 def :admin end |
#comments_have_alignment? ⇒ Boolean
Public: Overrides the ‘comments_have_alignment?` Commentable concern method.
48 49 50 |
# File 'app/models/decidim/blogs/post.rb', line 48 def comments_have_alignment? true end |
#comments_have_votes? ⇒ Boolean
Public: Overrides the ‘comments_have_votes?` Commentable concern method.
53 54 55 |
# File 'app/models/decidim/blogs/post.rb', line 53 def comments_have_votes? true end |
#official? ⇒ Boolean
62 63 64 |
# File 'app/models/decidim/blogs/post.rb', line 62 def official? .is_a?(Decidim::Organization) end |
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
84 85 86 |
# File 'app/models/decidim/blogs/post.rb', line 84 def reported_attributes [:title, :body] end |
#reported_content_url ⇒ Object
Public: Overrides the ‘reported_content_url` Reportable concern method.
79 80 81 |
# File 'app/models/decidim/blogs/post.rb', line 79 def reported_content_url ResourceLocatorPresenter.new(self).url end |
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
89 90 91 |
# File 'app/models/decidim/blogs/post.rb', line 89 def reported_searchable_content_extras [.name] end |
#user_group? ⇒ Boolean
66 67 68 |
# File 'app/models/decidim/blogs/post.rb', line 66 def user_group? .is_a?(Decidim::UserGroup) end |
#users_to_notify_on_comment_created ⇒ Object
70 71 72 |
# File 'app/models/decidim/blogs/post.rb', line 70 def users_to_notify_on_comment_created followers end |
#visible? ⇒ Boolean
39 40 41 |
# File 'app/models/decidim/blogs/post.rb', line 39 def visible? participatory_space.try(:visible?) && component.try(:published?) end |