Sha256: fe3bc06ea03956b2c0753ee81ef16eca890d67d19eafddc3c0a617a5519f54ab

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

module Decidim::Amendable
  # This cell renders a list with amenders of the given amendable resource.
  class AmendersListCell < Decidim::ViewModel
    include Decidim::ApplicationHelper

    private

    def show
      return unless amenders.count.positive?

      render :show
    end

    def amendable
      model
    end

    # Returns a UserPresenter array
    def amenders
      @amenders ||= amendable.amendments.map { |amendment| present(amendment.amender) }.uniq
    end

    def options
      { extra_classes: ["author-data--small"] }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-core-0.18.1 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.18.0 app/cells/decidim/amendable/amenders_list_cell.rb