Class: Decidim::Budgets::Project
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Budgets::Project
- Includes:
- Comments::Commentable, Followable, HasAttachmentCollections, HasAttachments, HasCategory, HasComponent, HasReference, Loggable, Randomable, Resourceable, ScopableComponent, Traceable
- Defined in:
- app/models/decidim/budgets/project.rb
Overview
The data store for a Project in the Decidim::Budgets component. It stores a title, description and any other useful information to render a custom project.
Class Method Summary collapse
Instance Method Summary collapse
-
#accepts_new_comments? ⇒ Boolean
Public: Overrides the ‘accepts_new_comments?` Commentable concern method.
-
#allow_resource_permissions? ⇒ Boolean
Public: Overrides the ‘allow_resource_permissions?` Resourceable concern method.
-
#commentable? ⇒ Boolean
Public: Overrides the ‘commentable?` Commentable concern method.
-
#comments_have_votes? ⇒ Boolean
Public: Overrides the ‘comments_have_votes?` Commentable concern method.
-
#confirmed_orders_count ⇒ Object
Public: Returns the number of times an specific project have been checked out.
-
#user_allowed_to_comment?(user) ⇒ Boolean
Public: Whether the object can have new comments or not.
-
#users_to_notify_on_comment_created ⇒ Object
Public: Overrides the ‘users_to_notify_on_comment_created` Commentable concern method.
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
25 26 27 |
# File 'app/models/decidim/budgets/project.rb', line 25 def self.log_presenter_class_for(_log) Decidim::Budgets::AdminLog::ProjectPresenter end |
Instance Method Details
#accepts_new_comments? ⇒ Boolean
Public: Overrides the ‘accepts_new_comments?` Commentable concern method.
35 36 37 |
# File 'app/models/decidim/budgets/project.rb', line 35 def accepts_new_comments? commentable? && !component.current_settings.comments_blocked end |
#allow_resource_permissions? ⇒ Boolean
Public: Overrides the ‘allow_resource_permissions?` Resourceable concern method.
55 56 57 |
# File 'app/models/decidim/budgets/project.rb', line 55 def component.settings. end |
#commentable? ⇒ Boolean
Public: Overrides the ‘commentable?` Commentable concern method.
30 31 32 |
# File 'app/models/decidim/budgets/project.rb', line 30 def commentable? component.settings.comments_enabled? end |
#comments_have_votes? ⇒ Boolean
Public: Overrides the ‘comments_have_votes?` Commentable concern method.
40 41 42 |
# File 'app/models/decidim/budgets/project.rb', line 40 def comments_have_votes? true end |
#confirmed_orders_count ⇒ Object
Public: Returns the number of times an specific project have been checked out.
50 51 52 |
# File 'app/models/decidim/budgets/project.rb', line 50 def confirmed_orders_count orders.finished.count end |
#user_allowed_to_comment?(user) ⇒ Boolean
Public: Whether the object can have new comments or not.
60 61 62 |
# File 'app/models/decidim/budgets/project.rb', line 60 def user_allowed_to_comment?(user) can_participate_in_space?(user) end |
#users_to_notify_on_comment_created ⇒ Object
Public: Overrides the ‘users_to_notify_on_comment_created` Commentable concern method.
45 46 47 |
# File 'app/models/decidim/budgets/project.rb', line 45 def users_to_notify_on_comment_created followers end |