Sha256: 5aa8628ad48845c2c34faaca429761303d85350932f5de07f15fe3ea6c2c40e5

Contents?: true

Size: 999 Bytes

Versions: 37

Compression:

Stored size: 999 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    module ContentBlocks
      class HighlightedInitiativesCell < Decidim::ViewModel
        include Decidim::SanitizeHelper

        delegate :current_organization, to: :controller

        def show
          render if highlighted_initiatives.any?
        end

        def max_results
          model.settings.max_results
        end

        def order
          model.settings.order
        end

        def highlighted_initiatives
          @highlighted_initiatives ||= OrganizationPrioritizedInitiatives
                                       .new(current_organization, order)
                                       .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

37 entries across 37 versions & 1 rubygems

Version Path
decidim-initiatives-0.27.9 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.8 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.7 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.6 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.10 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.9 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.5 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.8 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.4 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.3 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.7 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.5 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.2 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.4 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.3 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.0.rc2 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.27.0.rc1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.26.2 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb