Class: Decidim::ParticipatoryProcess
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Decidim::ParticipatoryProcess
- Includes:
- Followable, HasAttachmentCollections, HasAttachments, HasPrivateUsers, HasReference, Loggable, Participable, ParticipatorySpaceResourceable, Publicable, Scopable, Traceable
- Defined in:
- app/models/decidim/participatory_process.rb
Overview
Interaction between a user and an organization is done via a ParticipatoryProcess. It’s a unit of action from the Organization point of view that groups several components (proposals, debates…) distributed in steps that get enabled or disabled depending on which step is currently active.
Class Method Summary collapse
- .log_presenter_class_for(_log) ⇒ Object
- .private_processes ⇒ Object
-
.promoted ⇒ Object
Scope to return only the promoted processes.
Instance Method Summary collapse
- #can_participate?(user) ⇒ Boolean
- #hashtag ⇒ Object
-
#moderators ⇒ Object
Overrides the method from ‘Participable`.
- #past? ⇒ Boolean
- #to_param ⇒ Object
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
69 70 71 |
# File 'app/models/decidim/participatory_process.rb', line 69 def self.log_presenter_class_for(_log) Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessPresenter end |
.private_processes ⇒ Object
86 87 88 |
# File 'app/models/decidim/participatory_process.rb', line 86 def self.private_processes where(private_space: true) end |
.promoted ⇒ Object
Scope to return only the promoted processes.
Returns an ActiveRecord::Relation.
65 66 67 |
# File 'app/models/decidim/participatory_process.rb', line 65 def self.promoted where(promoted: true) end |
Instance Method Details
#can_participate?(user) ⇒ Boolean
90 91 92 93 94 |
# File 'app/models/decidim/participatory_process.rb', line 90 def can_participate?(user) return true unless private_space? return true if private_space? && users.include?(user) false end |
#hashtag ⇒ Object
78 79 80 |
# File 'app/models/decidim/participatory_process.rb', line 78 def hashtag attributes["hashtag"].to_s.delete("#") end |
#moderators ⇒ Object
Overrides the method from ‘Participable`.
97 98 99 |
# File 'app/models/decidim/participatory_process.rb', line 97 def moderators "#{admin_module_name}::Moderators".constantize.for(self) end |
#past? ⇒ Boolean
73 74 75 76 |
# File 'app/models/decidim/participatory_process.rb', line 73 def past? return false if end_date.blank? end_date < Date.current end |
#to_param ⇒ Object
82 83 84 |
# File 'app/models/decidim/participatory_process.rb', line 82 def to_param slug end |