Sha256: 4b90352743691cbdeedac7ecffdb1da2c20e286527e872d74f58d6ddeb17c5ce

Contents?: true

Size: 1.13 KB

Versions: 38

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Decidim
  module Votings
    module Voter
      # This class holds the data to register an in person vote.
      class InPersonVoteForm < Decidim::Form
        mimic :in_person_vote

        attribute :voter_id, String
        attribute :voter_token, String
        attribute :voted, Boolean

        validates :polling_station, :election, :voted, presence: true

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

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

        # Public: returns the polling station for the in person vote.
        def polling_station
          @polling_station ||= context.polling_station
        end

        # Public: returns the polling_officer registering the in person vote.
        def polling_officer
          @polling_officer ||= context.polling_officer
        end

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

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
decidim-elections-0.27.1 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.4 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.27.0 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.3 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.27.0.rc2 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.27.0.rc1 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.2 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.1 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.0 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.0.rc2 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.26.0.rc1 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.2 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.1 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.0 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.0.rc4 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.0.rc3 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.0.rc2 app/forms/decidim/votings/voter/in_person_vote_form.rb
decidim-elections-0.25.0.rc1 app/forms/decidim/votings/voter/in_person_vote_form.rb