Sha256: 4960501dbe805d5e95fbd1e23767bfe73723ce7b05f768bca5a1d5f93f5b8a41

Contents?: true

Size: 938 Bytes

Versions: 5

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module ContentBlocks
      class HighlightedAssembliesCell < Decidim::ViewModel
        delegate :current_organization, to: :controller
        delegate :current_user, to: :controller

        def show
          render if highlighted_assemblies.any?
        end

        def max_results
          model.settings.max_results
        end

        def highlighted_assemblies
          @highlighted_assemblies ||= OrganizationPrioritizedAssemblies
                                      .new(current_organization, current_user)
                                      .query
                                      .limit(max_results)
        end

        def i18n_scope
          "decidim.assemblies.pages.home.highlighted_assemblies"
        end

        def decidim_assemblies
          Decidim::Assemblies::Engine.routes.url_helpers
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-assemblies-0.16.1 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.16.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.15.2 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.15.1 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.15.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb