Sha256: 35009e7556acddfc7a72715bec3b264176aa8e5c1c9fa12193ca73b07b75e99e

Contents?: true

Size: 889 Bytes

Versions: 10

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    module ContentBlocks
      class HighlightedInitiativesCell < Decidim::ViewModel
        delegate :current_organization, to: :controller

        def show
          render if highlighted_initiatives.any?
        end

        def max_results
          model.settings.max_results
        end

        def highlighted_initiatives
          @highlighted_initiatives ||= OrganizationPrioritizedInitiatives
                                       .new(current_organization)
                                       .query
                                       .limit(max_results)
        end

        def i18n_scope
          "decidim.initiatives.pages.home.highlighted_initiatives"
        end

        def decidim_initiatives
          Decidim::Initiatives::Engine.routes.url_helpers
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-initiatives-0.18.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.17.2 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.18.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.17.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.16.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.17.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.16.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.15.2 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.15.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.15.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb