Sha256: 963d9990a21cadb24350d83a99029d8b6a1bc767e446574aa92fadf2ea8ee0c2

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # This cell renders the meeting dates range and the map if enabled and
    # available
    class DatesAndMapCell < Decidim::ViewModel
      include Cell::ViewModel::Partial
      include Decidim::MapHelper

      alias meeting model

      delegate :start_time, :end_time, :maps_enabled?, :online?, to: :meeting
      delegate :snippets, to: :controller

      def static_map
        return render :static_map if display_map?
      end

      private

      def same_month?
        start_time.month == end_time.month
      end

      def same_day?
        start_time.day == end_time.day
      end

      def display_map?
        maps_enabled? && !online?
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-meetings-0.28.0 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.28.0.rc5 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.28.0.rc4 app/cells/decidim/meetings/dates_and_map_cell.rb