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, Traceable
- Defined in:
- decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb
Class Method Summary collapse
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
Methods included from Followable
Methods included from HasAttachments
Class Method Details
.ransackable_scopes(_auth_object = nil) ⇒ Object
78 79 80 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 78 def self.ransackable_scopes(_auth_object = nil) [:with_any_state, :related_to, :with_any_scope, :with_any_category] end |
Instance Method Details
#editable_by?(user) ⇒ Boolean
Checks whether the user can edit the given proposal.
user - the user to check for authorship
44 45 46 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 44 def editable_by?(user) (user) end |
#open? ⇒ Boolean
48 49 50 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 48 def open? state == "open" end |
#published? ⇒ Boolean
56 57 58 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 56 def published? state == "published" end |
#reported_attributes ⇒ Object
Public: Overrides the ‘reported_attributes` Reportable concern method.
66 67 68 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 66 def reported_attributes [:body] end |
#reported_content_url ⇒ Object
Public: Overrides the ‘reported_content_url` Reportable concern method.
61 62 63 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 61 def reported_content_url ResourceLocatorPresenter.new(self).url end |
#reported_searchable_content_extras ⇒ Object
Public: Overrides the ‘reported_searchable_content_extras` Reportable concern method.
71 72 73 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 71 def reported_searchable_content_extras [.map(&:name).join("\n")] end |
#withdrawn? ⇒ Boolean
52 53 54 |
# File 'decidim-proposals/app/models/decidim/proposals/collaborative_draft.rb', line 52 def withdrawn? state == "withdrawn" end |