Sha256: aad4bec6498efe4abe34289162c9f0aa380b700e2f536e8bf5a5e117865270f8

Contents?: true

Size: 818 Bytes

Versions: 10

Compression:

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

      def year
        l model.start_time, format: "%Y"
      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

10 entries across 10 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.28.4 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.29.0 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.28.3 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.29.0.rc4 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.29.0.rc3 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.29.0.rc2 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.29.0.rc1 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.28.2 app/cells/decidim/meetings/dates_and_map_cell.rb
decidim-meetings-0.28.1 app/cells/decidim/meetings/dates_and_map_cell.rb