Class: Decidim::Budgets::Project

Inherits:
ApplicationRecord show all
Includes:
Comments::Commentable, Followable, HasAttachmentCollections, HasAttachments, HasCategory, HasFeature, HasReference, Resourceable, ScopableFeature
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.

Instance Method Summary collapse

Instance Method Details

#accepts_new_comments?Boolean

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

Returns:

  • (Boolean)


28
29
30
# File 'app/models/decidim/budgets/project.rb', line 28

def accepts_new_comments?
  commentable? && !feature.current_settings.comments_blocked
end

#commentable?Boolean

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

Returns:

  • (Boolean)


23
24
25
# File 'app/models/decidim/budgets/project.rb', line 23

def commentable?
  feature.settings.comments_enabled?
end

#comments_have_votes?Boolean

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

Returns:

  • (Boolean)


33
34
35
# File 'app/models/decidim/budgets/project.rb', line 33

def comments_have_votes?
  true
end

#confirmed_orders_countObject

Public: Returns the number of times an specific project have been checked out.



43
44
45
# File 'app/models/decidim/budgets/project.rb', line 43

def confirmed_orders_count
  orders.finished.count
end

#users_to_notify_on_comment_createdObject

Public: Overrides the ‘users_to_notify_on_comment_created` Commentable concern method.



38
39
40
# File 'app/models/decidim/budgets/project.rb', line 38

def users_to_notify_on_comment_created
  followers
end