Sha256: 4367acd75329b5b312286e23ac0e474c87c6c124c9425d5b3fa555147a0c1b2d

Contents?: true

Size: 690 Bytes

Versions: 24

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

require "cell/partial"

module Decidim
  # This cell renders the list of endorsers.
  #
  # Example:
  #
  #    cell("decidim/endorsers_list", my_component)
  class EndorsersListCell < Decidim::ViewModel
    include ApplicationHelper

    def show
      return unless endorsers.any?

      render
    end

    private

    # Finds the correct author for each endorsement.
    #
    # Returns an Array of presented Users/UserGroups
    def endorsers
      @endorsers ||= model.endorsements.for_listing
                          .includes(:author, :user_group)
                          .map { |identity| present(identity.normalized_author) }
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.8 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.7 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.6 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.10 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.9 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.5 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.8 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.4 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.3 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.7 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.5 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.2 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.1 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.4 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.0 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.3 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.0.rc2 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.27.0.rc1 app/cells/decidim/endorsers_list_cell.rb
decidim-core-0.26.2 app/cells/decidim/endorsers_list_cell.rb