Sha256: 4449d6c2f9d975db5e8c4bd7f838a249df24d131a4763c99145dee11d9640a12

Contents?: true

Size: 603 Bytes

Versions: 3

Compression:

Stored size: 603 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This cell renders the card of the given instance of a Component
  # delegated to the components' cell if specified in the manifest
  # otherwise a primary cell wil be shown.
  class CardCell < Decidim::ViewModel
    property :body
    property :title

    def show
      if resource_cell?
        cell(resource_cell, model, options)
      else
        render :show
      end
    end

    private

    def resource_cell?
      resource_cell.present?
    end

    def resource_cell
      @resource_cell ||= model.component.manifest.card
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.11.2 app/cells/decidim/card_cell.rb
decidim-core-0.11.1 app/cells/decidim/card_cell.rb
decidim-core-0.11.0.pre1 app/cells/decidim/card_cell.rb