Sha256: 3aca526234185e9be53a608d4a6e858de5c3ffc2ea38c4080e8258b4cfc1d4db

Contents?: true

Size: 792 Bytes

Versions: 13

Compression:

Stored size: 792 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Votings
    module ContentBlocks
      class HighlightedVotingsCell < Decidim::ViewModel
        delegate :current_user, to: :controller

        def show
          render if highlighted_votings.any?
        end

        def max_results
          model.settings.max_results
        end

        def highlighted_votings
          OrganizationPrioritizedVotings.new(current_organization, current_user)
                                        .query
                                        .limit(max_results)
        end

        def i18n_scope
          "decidim.votings.pages.home.highlighted_votings"
        end

        def decidim_votings
          Decidim::Votings::Engine.routes.url_helpers
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-elections-0.25.2 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.25.1 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.25.0 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.25.0.rc4 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.25.0.rc3 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.25.0.rc2 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.25.0.rc1 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.24.3 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.24.2 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.24.1 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.24.0 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.24.0.rc2 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb
decidim-elections-0.24.0.rc1 app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb