Class: Decidim::Proposals::CollaborativeDraft
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Proposals::CollaborativeDraft
- Includes:
- Coauthorable, FilterableResource, Followable, HasAttachments, HasCategory, HasComponent, HasReference, Loggable, CommentableCollaborativeDraft, Randomable, Reportable, Resourceable, ScopableResource, Taxonomizable, Traceable
- Defined in:
- decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb
Constant Summary collapse
- STATES =
{ open: 0, published: 10, withdrawn: -1 }.freeze
Class Method Summary collapse
- .ransackable_associations(_auth_object = nil) ⇒ Object
- .ransackable_attributes(_auth_object = nil) ⇒ Object
- .ransackable_scopes(_auth_object = nil) ⇒ Object
Instance Method Summary collapse
-
#editable_by?(user) ⇒ Boolean
Checks whether the user can edit the given proposal.
- #presenter ⇒ Object
-
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
-
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
Methods included from Followable
Methods included from HasAttachments
Class Method Details
.ransackable_associations(_auth_object = nil) ⇒ Object
74 75 76 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 74 def self.ransackable_associations(_auth_object = nil) %w(taxonomies) end |
.ransackable_attributes(_auth_object = nil) ⇒ Object
70 71 72 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 70 def self.ransackable_attributes(_auth_object = nil) %w(id_string search_text title body) end |
.ransackable_scopes(_auth_object = nil) ⇒ Object
66 67 68 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 66 def self.ransackable_scopes(_auth_object = nil) [:with_any_state, :related_to, :with_any_taxonomies] end |
Instance Method Details
#editable_by?(user) ⇒ Boolean
Checks whether the user can edit the given proposal.
user - the user to check for authorship
45 46 47 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 45 def editable_by?(user) (user) end |
#presenter ⇒ Object
49 50 51 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 49 def presenter Decidim::Proposals::CollaborativeDraftPresenter.new(self) end |
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
54 55 56 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 54 def reported_attributes [:body] end |
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
59 60 61 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 59 def reported_searchable_content_extras [.map(&:name).join("\n")] end |