Sha256: 65608c1c3d7901a40f046d4043e582f9d68a29b2e515f25dbf72d7f953c1afc7

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

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

      def show
        cell card_size, model, options
      end

      private

      def card_size
        case @options[:size]
        when :s
          "decidim/proposals/proposal_s"
        when :g
          "decidim/proposals/proposal_g"
        else
          "decidim/proposals/proposal_l"
        end
      end

      def resource_path
        resource_locator(model).path
      end

      def current_participatory_space
        model.component.participatory_space
      end

      def current_component
        model.component
      end

      def component_name
        translated_attribute model.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

6 entries across 6 versions & 1 rubygems

Version Path
decidim-proposals-0.29.1 app/cells/decidim/proposals/proposal_cell.rb
decidim-proposals-0.29.0 app/cells/decidim/proposals/proposal_cell.rb
decidim-proposals-0.29.0.rc4 app/cells/decidim/proposals/proposal_cell.rb
decidim-proposals-0.29.0.rc3 app/cells/decidim/proposals/proposal_cell.rb
decidim-proposals-0.29.0.rc2 app/cells/decidim/proposals/proposal_cell.rb
decidim-proposals-0.29.0.rc1 app/cells/decidim/proposals/proposal_cell.rb