Class: Decidim::Proposals::CollaborativeDraftPresenter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ActionView::Helpers::UrlHelper
Defined in:
app/presenters/decidim/proposals/collaborative_draft_presenter.rb

Overview

Decorator for collaborative drafts

Instance Method Summary collapse

Instance Method Details

#authorObject



12
13
14
15
16
17
18
19
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 12

def author
  coauthorship = __getobj__.coauthorships.first
  @author ||= if coauthorship.user_group
                Decidim::UserGroupPresenter.new(coauthorship.user_group)
              else
                Decidim::UserPresenter.new(coauthorship.author)
              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: strip_tags).html_safe
end

#collaborative_draftObject



21
22
23
# File 'app/presenters/decidim/proposals/collaborative_draft_presenter.rb', line 21

def collaborative_draft
  __getobj__
end

#collaborative_draft_pathObject



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