Sha256: 413a121f03c0a1fc1f9dc271a94ac3c4e353cbcd3a7de89a0e02f47b0a95d343

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module EnhancedTextwork
    #
    # Decorator for collaborative drafts
    #
    class CollaborativeDraftPresenter < ParagraphPresenter
      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

      alias collaborative_draft paragraph

      def collaborative_draft_path
        Decidim::ResourceLocatorPresenter.new(collaborative_draft).path
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-enhanced_textwork-1.0.5 app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb
decidim-enhanced_textwork-1.0.4 app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb
decidim-enhanced_textwork-1.0.3 app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb
decidim-enhanced_textwork-1.0.2 app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb
decidim-enhanced_textwork-1.0.1 app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb
decidim-enhanced_textwork-1.0.0 app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb