Sha256: 7fe0d0d090cae3c2282d4e11f05cffde3da399dab8e663d914aca39b17aaad13

Contents?: true

Size: 817 Bytes

Versions: 6

Compression:

Stored size: 817 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    module Ballot
      # This class holds the data to verify a vote.
      class VerifyVoteForm < Decidim::Form
        attribute :vote_identifier, String

        validates :vote_identifier, :election, presence: true

        delegate :id, to: :election, prefix: true

        def election_unique_id
          @election_unique_id ||= Decidim::BulletinBoard::MessageIdentifier.unique_election_id(bulletin_board.authority_slug, election_id)
        end

        # Public: returns the associated election for the vote.
        def election
          @election ||= context.election
        end

        def bulletin_board
          @bulletin_board ||= context[:bulletin_board] || Decidim::Elections.bulletin_board
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-elections-0.24.3 app/forms/decidim/elections/ballot/verify_vote_form.rb
decidim-elections-0.24.2 app/forms/decidim/elections/ballot/verify_vote_form.rb
decidim-elections-0.24.1 app/forms/decidim/elections/ballot/verify_vote_form.rb
decidim-elections-0.24.0 app/forms/decidim/elections/ballot/verify_vote_form.rb
decidim-elections-0.24.0.rc2 app/forms/decidim/elections/ballot/verify_vote_form.rb
decidim-elections-0.24.0.rc1 app/forms/decidim/elections/ballot/verify_vote_form.rb