Class: Decidim::Proposals::CollaborativeDraft
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Proposals::CollaborativeDraft
- Includes:
- Coauthorable, Followable, HasAttachments, HasCategory, HasComponent, HasReference, Loggable, CommentableCollaborativeDraft, Randomable, Reportable, Resourceable, ScopableResource, Traceable
- Defined in:
- app/models/decidim/proposals/collaborative_draft.rb
Instance Method Summary collapse
-
#editable_by?(user) ⇒ Boolean
Checks whether the user can edit the given proposal.
- #open? ⇒ Boolean
- #published? ⇒ Boolean
-
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
-
#reported_content_url ⇒ Object
Public: Overrides the ‘reported_content_url` Reportable concern method.
-
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
- #withdrawn? ⇒ Boolean
Instance Method Details
#editable_by?(user) ⇒ Boolean
Checks whether the user can edit the given proposal.
user - the user to check for authorship
41 42 43 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 41 def editable_by?(user) (user) end |
#open? ⇒ Boolean
45 46 47 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 45 def open? state == "open" end |
#published? ⇒ Boolean
53 54 55 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 53 def published? state == "published" end |
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
63 64 65 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 63 def reported_attributes [:body] end |
#reported_content_url ⇒ Object
Public: Overrides the ‘reported_content_url` Reportable concern method.
58 59 60 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 58 def reported_content_url ResourceLocatorPresenter.new(self).url end |
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
68 69 70 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 68 def reported_searchable_content_extras [.map(&:name).join("\n")] end |
#withdrawn? ⇒ Boolean
49 50 51 |
# File 'app/models/decidim/proposals/collaborative_draft.rb', line 49 def withdrawn? state == "withdrawn" end |