Sha256: 0a15e3ec68dd6afd223002dfa92e37fc187b4b78da6eeb4a54c94851339977e8

Contents?: true

Size: 917 Bytes

Versions: 3

Compression:

Stored size: 917 Bytes

Contents

# frozen_string_literal: true

require "cell/partial"

module Decidim
  module Proposals
    # This cell renders the proposal card for an instance of a Proposal
    # the default size is the Grid Card (:g)
    class ProposalGCell < Decidim::CardGCell
      include Decidim::Proposals::ApplicationHelper
      include Decidim::LayoutHelper

      delegate :state_item, to: :metadata_cell_instance

      def show
        render
      end

      def title
        present(model).title(html_escape: true)
      end

      def metadata_cell
        "decidim/proposals/proposal_metadata"
      end

      def metadata_cell_instance
        @metadata_cell_instance ||= cell("decidim/proposals/proposal_metadata", model)
      end

      def resource_image_path
        model.attachments.first&.url
      end

      private

      def classes
        super.merge(metadata: "card__list-metadata")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-proposals-0.29.1 app/cells/decidim/proposals/proposal_g_cell.rb
decidim-proposals-0.29.0 app/cells/decidim/proposals/proposal_g_cell.rb
decidim-proposals-0.29.0.rc4 app/cells/decidim/proposals/proposal_g_cell.rb