Sha256: 6521339b1b31e50f223da7df5af0fd04a9c99109e800ba507d0934c0aa0904e3

Contents?: true

Size: 716 Bytes

Versions: 7

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This cell is used to render the documents panel of a resource
  # inside a tab of a show view
  #
  # The `model` must be a resource to get the documents from.and is expected to
  # respond to documents method
  #
  # Example:
  #
  #   cell(
  #     "decidim/documents_panel",
  #     meeting
  #   )
  class DocumentsPanelCell < Decidim::ViewModel
    include Decidim::AttachmentsHelper
    include Cell::ViewModel::Partial
    include ActiveSupport::NumberHelper
    include ERB::Util

    alias resource model

    def show
      return if documents.blank?

      render
    end

    def documents
      @documents ||= resource.try(:documents)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/cells/decidim/documents_panel_cell.rb
decidim-core-0.28.3 app/cells/decidim/documents_panel_cell.rb
decidim-core-0.28.2 app/cells/decidim/documents_panel_cell.rb
decidim-core-0.28.1 app/cells/decidim/documents_panel_cell.rb
decidim-core-0.28.0 app/cells/decidim/documents_panel_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/documents_panel_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/documents_panel_cell.rb