Sha256: 2c4eda2022e1f8238a94862dfc460652013750ff0bcc0e78b3431e1e9be2c583

Contents?: true

Size: 833 Bytes

Versions: 15

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Debates
    # This cell renders the Medium (:m) debate card
    # for an given instance of a Debate
    class DebateMCell < Decidim::CardMCell
      include DebateCellsHelper

      private

      def resource_icon
        icon "debates", class: "icon--big"
      end

      def spans_multiple_dates?
        start_date != end_date
      end

      def debate_date
        return render(:multiple_dates) if spans_multiple_dates?
        render(:single_date)
      end

      def formatted_start_time
        model.start_time.strftime("%H:%M")
      end

      def formatted_end_time
        model.end_time.strftime("%H:%M")
      end

      def start_date
        model.start_time.to_date
      end

      def end_date
        model.end_time.to_date
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
decidim-debates-0.16.0 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.15.2 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.15.1 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.15.0 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.14.4 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.14.3 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.14.2 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.14.1 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.13.1 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.12.2 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.13.0 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.12.1 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.13.0.pre1 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.12.0 app/cells/decidim/debates/debate_m_cell.rb
decidim-debates-0.12.0.pre app/cells/decidim/debates/debate_m_cell.rb