Sha256: 6dec2065e8f4157c2ed0245b35259dab2c8a0784485daa961d87830037d434c8

Contents?: true

Size: 764 Bytes

Versions: 10

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module ContentBlocks
      class HighlightedMeetingsCell < Decidim::ContentBlocks::HighlightedElementsCell
        def base_relation
          Decidim::Meetings::Meeting
            .except_withdrawn
            .published
            .not_hidden
            .upcoming
            .visible_meeting_for(current_user)
            .where(component: published_components)
        end

        def elements
          @elements ||= base_relation.order(start_time: :asc).limit(limit)
        end

        def geolocation_enabled?
          Decidim::Map.available?(:geocoding)
        end

        private

        def limit
          geolocation_enabled? ? 4 : 8
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-meetings-0.26.10 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.9 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.8 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.7 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.5 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.4 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.3 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.2 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.1 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb
decidim-meetings-0.26.0 app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb