Sha256: a836d904441f6f7ce86d65ee6a23aef3520f1c5af514307540cfcfcc5831d681

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

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 Medium Card (:m)
    class ProposalCell < Decidim::ViewModel
      include ProposalCellsHelper
      include Cell::ViewModel::Partial
      include Messaging::ConversationHelper

      delegate :user_signed_in?, to: :parent_controller

      def show
        cell card_size, model, @options
      end

      private

      def current_user
        context[:current_user]
      end

      def card_size
        "decidim/proposals/proposal_m"
      end

      def resource_path
        resource_locator(model).path
      end

      def current_participatory_space
        model.component.participatory_space
      end

      def component_name
        translated_attribute current_component.name
      end

      def component_type_name
        model.class.model_name.human
      end

      def participatory_space_name
        translated_attribute current_participatory_space.title
      end

      def participatory_space_type_name
        translated_attribute current_participatory_space.model_name.human
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-proposals-0.12.0.pre app/cells/decidim/proposals/proposal_cell.rb