Sha256: 8128fb0b69f96e178fb56e09eed0397f688e9d3b968bb0f4271830254a755e11

Contents?: true

Size: 882 Bytes

Versions: 10

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module ContentBlocks
      class HighlightedAssembliesCell < Decidim::ViewModel
        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

10 entries across 10 versions & 1 rubygems

Version Path
decidim-assemblies-0.21.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.20.1 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.20.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.19.1 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.18.1 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.19.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.17.2 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.18.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.17.1 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb
decidim-assemblies-0.17.0 app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb