Sha256: 038350b21efe3103200a66bc9ed8f29f0a0fa7175fd31d67097e7ec52f8c0ff0

Contents?: true

Size: 845 Bytes

Versions: 13

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

require "cell/partial"

module Decidim
  module ParticipatoryProcesses
    class ProcessMetadataCell < Decidim::CardMetadataCell
      delegate :active_step, to: :model

      def initialize(*)
        super

        @items.prepend(*process_items)
      end

      private

      def process_items
        [progress_item, active_step_item].compact
      end

      def active_step_item
        return if active_step.blank?

        {
          text: translated_attribute(active_step.title),
          icon: "direction-line"
        }
      end

      def start_date
        return if model.try(:start_date).blank?

        @start_date ||= model.start_date.to_time
      end

      def end_date
        return if model.try(:end_date).blank?

        @end_date ||= model.end_date.to_time
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.29.1 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.4 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.29.0 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.3 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.29.0.rc4 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.29.0.rc3 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.29.0.rc2 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.29.0.rc1 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.2 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.1 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.0 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.0.rc5 app/cells/decidim/participatory_processes/process_metadata_cell.rb
decidim-participatory_processes-0.28.0.rc4 app/cells/decidim/participatory_processes/process_metadata_cell.rb