Class: Decidim::Proposals::CollaborativeDraftPresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Decidim::Proposals::CollaborativeDraftPresenter
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- app/presenters/decidim/proposals/collaborative_draft_presenter.rb
Overview
Decorator for collaborative drafts
Instance Method Summary collapse
- #author ⇒ Object
- #body(links: false, extras: true, strip_tags: false) ⇒ Object
- #collaborative_draft ⇒ Object
- #collaborative_draft_path ⇒ Object
- #title(links: false, extras: true, html_escape: false) ⇒ Object
Instance Method Details
#author ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 12 def = __getobj__..first @author ||= if .user_group Decidim::UserGroupPresenter.new(.user_group) else Decidim::UserPresenter.new(.) end end |
#body(links: false, extras: true, strip_tags: false) ⇒ Object
34 35 36 37 |
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 34 def body(links: false, extras: true, strip_tags: false) renderer = Decidim::ContentRenderers::HashtagRenderer.new(collaborative_draft.body) renderer.render(links: links, extras: extras, strip_tags: ).html_safe end |
#collaborative_draft ⇒ Object
21 22 23 |
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 21 def collaborative_draft __getobj__ end |
#collaborative_draft_path ⇒ Object
25 26 27 |
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 25 def collaborative_draft_path Decidim::ResourceLocatorPresenter.new(collaborative_draft).path end |
#title(links: false, extras: true, html_escape: false) ⇒ Object
29 30 31 32 |
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 29 def title(links: false, extras: true, html_escape: false) renderer = Decidim::ContentRenderers::HashtagRenderer.new(collaborative_draft.title) renderer.render(links: links, extras: extras, html_escape: html_escape).html_safe end |