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
- #published? ⇒ 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
.all_timestamp_attributes_in_model ⇒ Object
41 42 43 |
# File 'app/models/decidim/blogs/post.rb', line 41 def super + ["published_at"] end |
.log_presenter_class_for(_log) ⇒ Object
45 46 47 |
# File 'app/models/decidim/blogs/post.rb', line 45 def 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.
69 70 71 |
# File 'app/models/decidim/blogs/post.rb', line 69 def true end |
#attachment_context ⇒ Object
85 86 87 |
# File 'app/models/decidim/blogs/post.rb', line 85 def :admin end |
#comments_have_alignment? ⇒ Boolean
Public: Overrides the ‘comments_have_alignment?` Commentable concern method.
59 60 61 |
# File 'app/models/decidim/blogs/post.rb', line 59 def comments_have_alignment? true end |
#comments_have_votes? ⇒ Boolean
Public: Overrides the ‘comments_have_votes?` Commentable concern method.
64 65 66 |
# File 'app/models/decidim/blogs/post.rb', line 64 def comments_have_votes? true end |
#official? ⇒ Boolean
73 74 75 |
# File 'app/models/decidim/blogs/post.rb', line 73 def official? .is_a?(Decidim::Organization) end |
#published? ⇒ Boolean
54 55 56 |
# File 'app/models/decidim/blogs/post.rb', line 54 def published? published_at <= Time.current end |
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
95 96 97 |
# File 'app/models/decidim/blogs/post.rb', line 95 def reported_attributes [:title, :body] end |
#reported_content_url ⇒ Object
Public: Overrides the ‘reported_content_url` Reportable concern method.
90 91 92 |
# File 'app/models/decidim/blogs/post.rb', line 90 def reported_content_url ResourceLocatorPresenter.new(self).url end |
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
100 101 102 |
# File 'app/models/decidim/blogs/post.rb', line 100 def reported_searchable_content_extras [.name] end |
#user_group? ⇒ Boolean
77 78 79 |
# File 'app/models/decidim/blogs/post.rb', line 77 def user_group? .is_a?(Decidim::UserGroup) end |
#users_to_notify_on_comment_created ⇒ Object
81 82 83 |
# File 'app/models/decidim/blogs/post.rb', line 81 def users_to_notify_on_comment_created followers end |
#visible? ⇒ Boolean
50 51 52 |
# File 'app/models/decidim/blogs/post.rb', line 50 def visible? participatory_space.try(:visible?) && component.try(:published?) && published? end |