Sha256: 6e7db6c5c8a52db34557c370e065abab1715724bd75cfb0bb1650d39d031fcbd

Contents?: true

Size: 708 Bytes

Versions: 51

Compression:

Stored size: 708 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

    def visible_amendments
      amendable.visible_amendments_for(current_user).where.not(state: "draft")
    end

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

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

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
decidim-core-0.23.3 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.23.2 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.23.1 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.23.1.rc1 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.23.0 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.22.0 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.21.0 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.20.1 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.20.0 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.19.1 app/cells/decidim/amendable/amenders_list_cell.rb
decidim-core-0.19.0 app/cells/decidim/amendable/amenders_list_cell.rb