Sha256: bc0d942965a9b9a7a8a58b534f98e573012ecbbc25f780a86e751c5a2e796403

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    #
    # Decorator for meetings
    #
    class MeetingPresenter < SimpleDelegator
      include Decidim::TranslationsHelper

      def meeting
        __getobj__
      end

      def title
        return unless meeting
        renderer = Decidim::ContentRenderers::HashtagRenderer.new(translated_attribute(meeting.title))
        renderer.render_without_link.html_safe
      end

      def html_title
        return unless meeting
        renderer = Decidim::ContentRenderers::HashtagRenderer.new(translated_attribute(meeting.title))
        renderer.render.html_safe
      end

      def description
        return unless meeting
        renderer = Decidim::ContentRenderers::HashtagRenderer.new(translated_attribute(meeting.description))
        renderer.render_without_link.html_safe
      end

      def html_description
        return unless meeting
        renderer = Decidim::ContentRenderers::HashtagRenderer.new(translated_attribute(meeting.description))
        renderer.render.html_safe
      end

      def title_with_locales
        return unless meeting
        renderer = Decidim::ContentRenderers::HashtagRenderer.new(meeting.title)
        renderer.render_without_link
      end

      def description_with_locales
        return unless meeting
        renderer = Decidim::ContentRenderers::HashtagRenderer.new(meeting.description)
        renderer.render_without_link
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-meetings-0.15.2 app/presenters/decidim/meetings/meeting_presenter.rb
decidim-meetings-0.15.1 app/presenters/decidim/meetings/meeting_presenter.rb