Sha256: 1bcb701c9cff47fbb4ce9c3bfbedcf4d79c6f06095c1a8663d090c9ed927e076
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
# frozen_string_literal: true module Decidim module Proposals # # Decorator for collaborative drafts # class CollaborativeDraftPresenter < SimpleDelegator include Rails.application.routes.mounted_helpers include ActionView::Helpers::UrlHelper include ActionView::Helpers::SanitizeHelper include Decidim::SanitizeHelper 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 def collaborative_draft __getobj__ end def collaborative_draft_path Decidim::ResourceLocatorPresenter.new(collaborative_draft).path end def title(links: false, extras: true, html_escape: false) text = collaborative_draft.title text = decidim_html_escape(text) if html_escape renderer = Decidim::ContentRenderers::HashtagRenderer.new(text) renderer.render(links: links, extras: extras).html_safe end def body(links: false, extras: true, strip_tags: false) text = collaborative_draft.body text = strip_tags(text) if strip_tags renderer = Decidim::ContentRenderers::HashtagRenderer.new(text) text = renderer.render(links: links, extras: extras).html_safe text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links text end end end end
Version data entries
4 entries across 4 versions & 1 rubygems