Sha256: d9a8aaef8c1349c495b4e13cd996de5501f2a480ac6e2033f2dd324fb32b90f9

Contents?: true

Size: 981 Bytes

Versions: 7

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module ContentBlocks
      class HighlightedConferencesCell < Decidim::ViewModel
        delegate :current_user, to: :controller

        cache :show, expires_in: 10.minutes, if: :perform_caching? do
          cache_hash
        end

        def show
          render if highlighted_conferences.any?
        end

        def highlighted_conferences
          OrganizationPrioritizedConferences.new(current_organization, current_user)
        end

        def i18n_scope
          "decidim.conferences.pages.home.highlighted_conferences"
        end

        def decidim_conferences
          Decidim::Conferences::Engine.routes.url_helpers
        end

        private

        def cache_hash
          hash = []
          hash.push(I18n.locale)
          hash.push(highlighted_conferences.map(&:cache_key_with_version))
          hash.join(Decidim.cache_key_separator)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-conferences-0.26.10 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb
decidim-conferences-0.26.9 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb
decidim-conferences-0.26.8 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb
decidim-conferences-0.26.7 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb
decidim-conferences-0.26.5 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb
decidim-conferences-0.26.4 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb
decidim-conferences-0.26.3 app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb