Sha256: 354a9b1c3d612cdd1f72cba7df00572a0d7b84bec69340c6e8df25150e04785b
Contents?: true
Size: 1.31 KB
Versions: 31
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true module Decidim module Votings module ContentBlocks module LandingPage class ElectionsCell < Decidim::ViewModel delegate :current_participatory_space, to: :controller def show if single? render :single else render :show end end private def published_election_component_ids @published_election_component_ids ||= Decidim::Component .where( participatory_space: current_participatory_space, manifest_name: :elections ) .published .pluck(:id) end def elections @elections ||= Decidim::Elections::Election .where(component: published_election_component_ids) .published end def elections_count @elections_count ||= elections.count end def single? elections.one? end end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems