Sha256: 5d29f03cd737130c3dff6bbc9cd42a5a51db742dc7b6b33830e4ec3a917fd979

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # This cell renders the Medium (:m) meeting card
    # for an given instance of a Meeting
    class MeetingMCell < Decidim::CardMCell
      include MeetingCellsHelper

      def has_authors?
        true
      end

      def render_authorship
        cell "decidim/author", author_presenter_for(model.normalized_author)
      end

      def date
        render
      end

      def address
        decidim_html_escape(render)
      end

      def title
        present(model).title
      end

      delegate :online_meeting?, to: :model

      private

      def spans_multiple_dates?
        start_date != end_date
      end

      def meeting_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

      def can_join?
        model.can_be_joined_by?(current_user)
      end

      def show_footer_actions?
        options[:show_footer_actions]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-meetings-0.24.3 app/cells/decidim/meetings/meeting_m_cell.rb
decidim-meetings-0.24.2 app/cells/decidim/meetings/meeting_m_cell.rb
decidim-meetings-0.24.1 app/cells/decidim/meetings/meeting_m_cell.rb
decidim-meetings-0.24.0 app/cells/decidim/meetings/meeting_m_cell.rb
decidim-meetings-0.24.0.rc2 app/cells/decidim/meetings/meeting_m_cell.rb
decidim-meetings-0.24.0.rc1 app/cells/decidim/meetings/meeting_m_cell.rb