Class: Decidim::ParticipatoryProcess

Inherits:
ApplicationRecord
  • Object
show all
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

Instance Method Summary collapse

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_processesObject



86
87
88
# File 'app/models/decidim/participatory_process.rb', line 86

def self.private_processes
  where(private_space: true)
end

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

Returns:

  • (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

#hashtagObject



78
79
80
# File 'app/models/decidim/participatory_process.rb', line 78

def hashtag
  attributes["hashtag"].to_s.delete("#")
end

#moderatorsObject

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

Returns:

  • (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_paramObject



82
83
84
# File 'app/models/decidim/participatory_process.rb', line 82

def to_param
  slug
end