Sha256: 78cbbc9b402f112df3858dfaaf51e9266009506af6f6f1ff3a189eaa568ac786

Contents?: true

Size: 930 Bytes

Versions: 14

Compression:

Stored size: 930 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 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

14 entries across 14 versions & 1 rubygems

Version Path
decidim-initiatives-0.23.6 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.5 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.4 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.3 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.2 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.1.rc1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.23.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.22.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.21.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.20.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.20.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.19.1 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb
decidim-initiatives-0.19.0 app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb