Sha256: 3bcf3212514cdd322f8613e275f0b1dd649399ba52dd5d29ca5de64976fa3c83

Contents?: true

Size: 878 Bytes

Versions: 6

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # This cell defines methods required for other cells to render
    # online meeting urls
    class OnlineMeetingCell < Decidim::ViewModel
      protected

      def embedder
        @embedder ||= MeetingIframeEmbedder.new(model.online_meeting_url)
      end

      delegate :embeddable?, to: :embedder

      def live_event_url
        if embeddable?
          Decidim::EngineRouter.main_proxy(model.component).meeting_live_event_path(meeting_id: model.id)
        else
          model.online_meeting_url
        end
      end

      def live?
        model.start_time &&
          model.end_time &&
          Time.current >= (model.start_time - 10.minutes) &&
          Time.current <= model.end_time
      end

      def future?
        Time.current <= model.start_time && !live?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-meetings-0.25.2 app/cells/decidim/meetings/online_meeting_cell.rb
decidim-meetings-0.25.1 app/cells/decidim/meetings/online_meeting_cell.rb
decidim-meetings-0.25.0 app/cells/decidim/meetings/online_meeting_cell.rb
decidim-meetings-0.25.0.rc4 app/cells/decidim/meetings/online_meeting_cell.rb
decidim-meetings-0.25.0.rc3 app/cells/decidim/meetings/online_meeting_cell.rb
decidim-meetings-0.25.0.rc2 app/cells/decidim/meetings/online_meeting_cell.rb