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, Searchable, 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
34 35 36 |
# File 'app/models/decidim/budgets/project.rb', line 34 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.
44 45 46 |
# File 'app/models/decidim/budgets/project.rb', line 44 def accepts_new_comments? commentable? && !component.current_settings.comments_blocked end |
#allow_resource_permissions? ⇒ Boolean
Public: Overrides the ‘allow_resource_permissions?` Resourceable concern method.
64 65 66 |
# File 'app/models/decidim/budgets/project.rb', line 64 def component.settings. end |
#commentable? ⇒ Boolean
Public: Overrides the ‘commentable?` Commentable concern method.
39 40 41 |
# File 'app/models/decidim/budgets/project.rb', line 39 def commentable? component.settings.comments_enabled? end |
#comments_have_votes? ⇒ Boolean
Public: Overrides the ‘comments_have_votes?` Commentable concern method.
49 50 51 |
# File 'app/models/decidim/budgets/project.rb', line 49 def comments_have_votes? true end |
#confirmed_orders_count ⇒ Object
Public: Returns the number of times an specific project have been checked out.
59 60 61 |
# File 'app/models/decidim/budgets/project.rb', line 59 def confirmed_orders_count orders.finished.count end |
#user_allowed_to_comment?(user) ⇒ Boolean
Public: Whether the object can have new comments or not.
69 70 71 |
# File 'app/models/decidim/budgets/project.rb', line 69 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.
54 55 56 |
# File 'app/models/decidim/budgets/project.rb', line 54 def users_to_notify_on_comment_created followers end |