decidim-elections 0.24.3 → 0.25.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/cells/decidim/elections/election_m/tags.erb +3 -0
- data/app/cells/decidim/elections/election_m_cell.rb +1 -8
- data/app/cells/decidim/elections/election_preview/show.erb +28 -0
- data/app/cells/decidim/elections/election_preview_cell.rb +13 -0
- data/app/cells/decidim/elections/election_results/blank_votes.erb +7 -0
- data/app/cells/decidim/elections/election_results/progress_bar.erb +16 -0
- data/app/cells/decidim/elections/election_results/show.erb +40 -0
- data/app/cells/decidim/elections/election_results_cell.rb +13 -0
- data/app/cells/decidim/elections/election_vote_cta/show.erb +35 -0
- data/app/cells/decidim/elections/election_vote_cta_cell.rb +83 -0
- data/app/cells/decidim/elections/remaining_time_callout/show.erb +5 -0
- data/app/cells/decidim/elections/remaining_time_callout_cell.rb +28 -0
- data/app/cells/decidim/elections/voting_step_navigation/show.erb +1 -1
- data/app/cells/decidim/elections/voting_step_navigation_cell.rb +1 -1
- data/app/cells/decidim/votings/content_blocks/highlighted_votings/show.erb +1 -1
- data/app/cells/decidim/votings/content_blocks/landing_page/attachments_and_folders_cell.rb +8 -1
- data/app/cells/decidim/votings/content_blocks/landing_page/description/show.erb +25 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/description_cell.rb +20 -2
- data/app/cells/decidim/votings/content_blocks/landing_page/elections/show.erb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/elections/single.erb +11 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/elections_cell.rb +33 -1
- data/app/cells/decidim/votings/content_blocks/landing_page/header/show.erb +29 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/header_cell.rb +95 -2
- data/app/cells/decidim/votings/content_blocks/landing_page/header_settings_form/show.erb +4 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/{stats_cell.rb → header_settings_form_cell.rb} +5 -3
- data/app/cells/decidim/votings/content_blocks/landing_page/metrics/show.erb +12 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/metrics_cell.rb +6 -2
- data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations/address.erb +14 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations/map.erb +18 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations/show.erb +25 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations_cell.rb +42 -1
- data/app/cells/decidim/votings/content_blocks/landing_page/statistics_cell.rb +24 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/timeline/show.erb +7 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/timeline_cell.rb +4 -2
- data/app/cells/decidim/votings/polling_officers/polling_officers_picker/show.erb +1 -1
- data/app/cells/decidim/votings/polling_station_closure_certificate/show.erb +9 -0
- data/app/cells/decidim/votings/polling_station_closure_certificate_cell.rb +12 -0
- data/app/cells/decidim/votings/polling_station_closure_recount/show.erb +74 -0
- data/app/cells/decidim/votings/polling_station_closure_recount_cell.rb +9 -0
- data/app/cells/decidim/votings/voting_m_cell.rb +2 -2
- data/app/commands/decidim/elections/admin/add_user_as_trustee.rb +2 -1
- data/app/commands/decidim/elections/admin/create_election.rb +2 -1
- data/app/commands/decidim/elections/admin/publish_results.rb +10 -6
- data/app/commands/decidim/elections/admin/setup_election.rb +73 -67
- data/app/commands/decidim/elections/admin/update_answer_selection.rb +1 -1
- data/app/commands/decidim/elections/trustee_zone/update_election_bulletin_board_status.rb +61 -2
- data/app/commands/decidim/elections/trustee_zone/update_trustee.rb +3 -0
- data/app/commands/decidim/elections/voter/cast_vote.rb +4 -7
- data/app/commands/decidim/elections/voter/update_vote_status.rb +23 -7
- data/app/commands/decidim/votings/admin/create_ballot_style.rb +58 -0
- data/app/commands/decidim/votings/admin/create_voting.rb +2 -1
- data/app/commands/decidim/votings/admin/destroy_ballot_style.rb +33 -0
- data/app/commands/decidim/votings/admin/monitoring_committee_validate_polling_station_closure.rb +37 -0
- data/app/commands/decidim/votings/admin/update_ballot_style.rb +70 -0
- data/app/commands/decidim/votings/admin/update_voting.rb +5 -14
- data/app/commands/decidim/votings/census/admin/create_dataset.rb +82 -0
- data/app/commands/decidim/votings/census/admin/create_datum.rb +55 -0
- data/app/commands/decidim/votings/census/admin/destroy_dataset.rb +45 -0
- data/app/commands/decidim/votings/census/admin/increment_dataset_processed_rows.rb +43 -0
- data/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb +38 -0
- data/app/commands/decidim/votings/census/admin/launch_access_codes_generation.rb +44 -0
- data/app/commands/decidim/votings/census/admin/update_dataset.rb +51 -0
- data/app/commands/decidim/votings/certify_polling_station_closure.rb +46 -0
- data/app/commands/decidim/votings/check_census.rb +35 -0
- data/app/commands/decidim/votings/create_polling_station_closure.rb +53 -0
- data/app/commands/decidim/votings/create_polling_station_results.rb +83 -0
- data/app/commands/decidim/votings/send_access_code.rb +48 -0
- data/app/commands/decidim/votings/sign_polling_station_closure.rb +41 -0
- data/app/commands/decidim/votings/voter/in_person_vote.rb +55 -0
- data/app/commands/decidim/votings/voter/update_in_person_vote_status.rb +52 -0
- data/app/controllers/concerns/decidim/elections/has_vote_flow.rb +43 -0
- data/app/controllers/concerns/decidim/monitoring_committee_polling_station_closures/admin/filterable.rb +72 -0
- data/app/controllers/concerns/decidim/votings/needs_voting.rb +5 -5
- data/app/controllers/decidim/elections/admin/steps_controller.rb +5 -2
- data/app/controllers/decidim/elections/elections_controller.rb +18 -5
- data/app/controllers/decidim/elections/feedbacks_controller.rb +37 -3
- data/app/controllers/decidim/elections/trustee_zone/elections_controller.rb +15 -1
- data/app/controllers/decidim/elections/votes_controller.rb +101 -41
- data/app/controllers/decidim/votings/admin/ballot_styles_controller.rb +93 -0
- data/app/controllers/decidim/votings/admin/monitoring_committee_election_results_controller.rb +69 -0
- data/app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb +4 -0
- data/app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_controller.rb +73 -0
- data/app/controllers/decidim/votings/admin/monitoring_committee_verify_elections_controller.rb +24 -0
- data/app/controllers/decidim/votings/admin/polling_stations_controller.rb +4 -0
- data/app/controllers/decidim/votings/admin/votings_controller.rb +1 -1
- data/app/controllers/decidim/votings/census/admin/application_controller.rb +19 -0
- data/app/controllers/decidim/votings/census/admin/census_controller.rb +191 -0
- data/app/controllers/decidim/votings/polling_officer_zone/closures_controller.rb +131 -0
- data/app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb +149 -0
- data/app/controllers/decidim/votings/polling_officer_zone/polling_officers_controller.rb +10 -2
- data/app/controllers/decidim/votings/votings_controller.rb +91 -4
- data/app/events/decidim/elections/votes/vote_accepted_event.rb +1 -1
- data/app/forms/decidim/elections/admin/action_form.rb +5 -0
- data/app/forms/decidim/elections/admin/question_form.rb +1 -1
- data/app/forms/decidim/elections/admin/trustees_participatory_space_form.rb +1 -1
- data/app/forms/decidim/elections/{ballot → voter}/verify_vote_form.rb +1 -5
- data/app/forms/decidim/elections/voter/vote_form.rb +50 -0
- data/app/forms/decidim/votings/admin/ballot_style_form.rb +19 -0
- data/app/forms/decidim/votings/admin/monitoring_committee_polling_station_closure_form.rb +11 -0
- data/app/forms/decidim/votings/admin/publish_results_form.rb +64 -0
- data/app/forms/decidim/votings/admin/voting_form.rb +3 -2
- data/app/forms/decidim/votings/answer_result_form.rb +24 -0
- data/app/forms/decidim/votings/ballot_result_form.rb +28 -0
- data/app/forms/decidim/votings/census/admin/dataset_form.rb +25 -0
- data/app/forms/decidim/votings/census/admin/datum_form.rb +30 -0
- data/app/forms/decidim/votings/census/check_fields.rb +28 -0
- data/app/forms/decidim/votings/census/check_form.rb +13 -0
- data/app/forms/decidim/votings/census/frontend_fields.rb +42 -0
- data/app/forms/decidim/votings/census/in_person_fields.rb +48 -0
- data/app/forms/decidim/votings/census/in_person_form.rb +13 -0
- data/app/forms/decidim/votings/census/login_form.rb +13 -0
- data/app/forms/decidim/votings/census/online_fields.rb +28 -0
- data/app/forms/decidim/votings/closure_certify_form.rb +20 -0
- data/app/forms/decidim/votings/closure_result_form.rb +37 -0
- data/app/forms/decidim/votings/closure_sign_form.rb +11 -0
- data/app/forms/decidim/votings/envelopes_result_form.rb +34 -0
- data/app/forms/decidim/votings/question_result_form.rb +24 -0
- data/app/forms/decidim/votings/voter/in_person_vote_form.rb +40 -0
- data/app/jobs/decidim/votings/census/admin/create_datum_job.rb +41 -0
- data/app/jobs/decidim/votings/census/admin/export_access_codes_job.rb +39 -0
- data/app/jobs/decidim/votings/census/admin/generate_access_codes_job.rb +44 -0
- data/app/mailers/decidim/elections/vote_accepted_mailer.rb +29 -0
- data/app/mailers/decidim/votings/access_code_mailer.rb +34 -0
- data/app/mailers/decidim/votings/census/export_mailer.rb +44 -0
- data/app/models/decidim/elections/action.rb +1 -1
- data/app/models/decidim/elections/answer.rb +21 -0
- data/app/models/decidim/elections/bulletin_board_closure.rb +19 -0
- data/app/models/decidim/elections/election.rb +5 -4
- data/app/models/decidim/elections/question.rb +24 -13
- data/app/models/decidim/elections/result.rb +22 -0
- data/app/models/decidim/elections/trustee.rb +10 -1
- data/app/models/decidim/elections/vote.rb +2 -2
- data/app/models/decidim/votings/ballot_style.rb +29 -0
- data/app/models/decidim/votings/ballot_style_question.rb +11 -0
- data/app/models/decidim/votings/census/dataset.rb +32 -0
- data/app/models/decidim/votings/census/datum.rb +34 -0
- data/app/models/decidim/votings/in_person_vote.rb +22 -0
- data/app/models/decidim/votings/polling_station.rb +18 -1
- data/app/models/decidim/votings/polling_station_closure.rb +43 -0
- data/app/models/decidim/votings/voting.rb +38 -15
- data/app/packs/entrypoints/decidim_elections.js +2 -0
- data/app/packs/entrypoints/decidim_elections_admin_pending_action.js +1 -0
- data/app/packs/entrypoints/decidim_elections_admin_vote_statistics.js +1 -0
- data/app/packs/entrypoints/decidim_elections_election_log.js +1 -0
- data/app/packs/entrypoints/decidim_elections_onboarding.js +1 -0
- data/app/packs/entrypoints/decidim_elections_trustee_key_ceremony.js +1 -0
- data/app/packs/entrypoints/decidim_elections_trustee_tally.js +1 -0
- data/app/packs/entrypoints/decidim_elections_trustee_trustee_zone.js +1 -0
- data/app/packs/entrypoints/decidim_elections_trustee_zone.js +1 -0
- data/app/packs/entrypoints/decidim_elections_trustee_zone.scss +1 -0
- data/app/packs/entrypoints/decidim_elections_voter_casting-vote.js +1 -0
- data/app/packs/entrypoints/decidim_elections_voter_new-vote.js +1 -0
- data/app/packs/entrypoints/decidim_elections_voter_setup-preview.js +1 -0
- data/app/packs/entrypoints/decidim_elections_voter_setup-vote.js +1 -0
- data/app/packs/entrypoints/decidim_elections_voter_verify-vote.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_monitoring_committee_members_form.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_polling_officers_form.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_polling_officers_picker.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_polling_stations_form.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_update_census_dataset_status.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_votings.js +1 -0
- data/app/packs/entrypoints/decidim_votings_admin_votings.scss +1 -0
- data/app/packs/entrypoints/decidim_votings_in-person-vote.js +1 -0
- data/app/packs/entrypoints/decidim_votings_voting-description-cell.js +1 -0
- data/app/packs/entrypoints/decidim_votings_voting_polling_officer_zone-edit-closure.js +1 -0
- data/app/packs/entrypoints/decidim_votings_voting_polling_officer_zone-in-person-vote.js +1 -0
- data/app/packs/entrypoints/decidim_votings_voting_polling_officer_zone-new-closure.js +1 -0
- data/app/packs/entrypoints/decidim_votings_voting_polling_officer_zone-sign-closure.js +1 -0
- data/app/{assets/images/decidim/elections/icon.svg → packs/images/decidim/elections/decidim_elections.svg} +0 -0
- data/app/{assets/images/decidim/votings/icon.svg → packs/images/decidim/votings/decidim_votings.svg} +0 -0
- data/app/{assets/javascripts/decidim/elections/admin/pending_action.js.es6 → packs/src/decidim/elections/admin/pending_action.js} +4 -6
- data/app/{assets/javascripts/decidim/elections/admin/vote_statistics.js.es6 → packs/src/decidim/elections/admin/vote_statistics.js} +0 -0
- data/app/packs/src/decidim/elections/election_log.js +145 -0
- data/app/packs/src/decidim/elections/onboarding.js +5 -0
- data/app/{assets/javascripts/decidim/elections/trustee_zone/key_ceremony.js.es6 → packs/src/decidim/elections/trustee/key_ceremony.js} +59 -22
- data/app/{assets/javascripts/decidim/elections/trustee_zone/tally.js.es6 → packs/src/decidim/elections/trustee/tally.js} +48 -12
- data/app/{assets/javascripts/decidim/elections/trustee_zone.js.es6 → packs/src/decidim/elections/trustee/trustee_zone.js} +3 -6
- data/app/packs/src/decidim/elections/voter/casting-vote.js +14 -0
- data/app/packs/src/decidim/elections/voter/new-vote.js +83 -0
- data/app/packs/src/decidim/elections/voter/setup-preview.js +79 -0
- data/app/packs/src/decidim/elections/voter/setup-vote.js +50 -0
- data/app/{assets/javascripts/decidim/elections/vote_verify.js.es6 → packs/src/decidim/elections/voter/verify-vote.js} +22 -21
- data/app/packs/src/decidim/elections/voter/vote_questions.component.js +124 -0
- data/app/{assets/javascripts/decidim/votings/admin/monitoring_committee_members_form.js.es6 → packs/src/decidim/votings/admin/monitoring_committee_members_form.js} +3 -3
- data/app/{assets/javascripts/decidim/votings/admin/polling_officers_form.js.es6 → packs/src/decidim/votings/admin/polling_officers_form.js} +3 -3
- data/app/{assets/javascripts/decidim/votings/admin/polling_officers_picker.js.es6 → packs/src/decidim/votings/admin/polling_officers_picker.js} +0 -0
- data/app/{assets/javascripts/decidim/votings/admin/polling_stations_form.js.es6 → packs/src/decidim/votings/admin/polling_stations_form.js} +4 -3
- data/app/packs/src/decidim/votings/admin/update_census_dataset_status.js +13 -0
- data/app/packs/src/decidim/votings/in-person-vote.js +20 -0
- data/app/packs/src/decidim/votings/polling_officer_zone/edit-closure.js +26 -0
- data/app/packs/src/decidim/votings/polling_officer_zone/in-person-vote.js +5 -0
- data/app/packs/src/decidim/votings/polling_officer_zone/new-closure.js +35 -0
- data/app/packs/src/decidim/votings/polling_officer_zone/sign-closure.js +13 -0
- data/app/packs/src/decidim/votings/voting-description-cell.js +41 -0
- data/app/packs/stylesheets/decidim/elections/elections.scss +8 -0
- data/app/{assets → packs}/stylesheets/decidim/elections/focus/_accordion.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/elections/focus/_evote.scss +8 -1
- data/app/{assets → packs}/stylesheets/decidim/elections/focus/_focus.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/elections/trustee_zone.scss +0 -0
- data/app/packs/stylesheets/decidim/votings/admin/votings/_ballot-styles.scss +16 -0
- data/app/packs/stylesheets/decidim/votings/admin/votings/_monitoring-committee-polling-station-closures.scss +9 -0
- data/app/packs/stylesheets/decidim/votings/admin/votings/_results.scss +3 -0
- data/app/packs/stylesheets/decidim/votings/admin/votings.scss +3 -0
- data/app/packs/stylesheets/decidim/votings/votings/_polling-stations-cell.scss +6 -0
- data/app/packs/stylesheets/decidim/votings/votings/_voting-description-cell.scss +29 -0
- data/app/packs/stylesheets/decidim/votings/votings.scss +2 -0
- data/app/permissions/decidim/elections/admin/permissions.rb +5 -0
- data/app/permissions/decidim/elections/permissions.rb +18 -33
- data/app/permissions/decidim/votings/admin/permissions.rb +87 -27
- data/app/permissions/decidim/votings/permissions.rb +5 -1
- data/app/permissions/decidim/votings/polling_officer_zone/permissions.rb +8 -2
- data/app/presenters/decidim/votings/census/admin_log/dataset_presenter.rb +30 -0
- data/app/presenters/decidim/votings/voting_presenter.rb +2 -11
- data/app/presenters/decidim/votings/voting_stats_presenter.rb +52 -0
- data/app/queries/decidim/elections/admin/votes_for_statistics.rb +1 -1
- data/app/queries/decidim/elections/votes/last_vote_for_voter.rb +29 -0
- data/app/queries/decidim/votings/admin/admin_users.rb +15 -10
- data/app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb +31 -0
- data/app/queries/decidim/votings/votes/in_person_vote_for_voter.rb +27 -0
- data/app/queries/decidim/votings/votes/pending_in_person_votes.rb +20 -0
- data/app/serializers/decidim/votings/census/datum_serializer.rb +29 -0
- data/app/services/decidim/elections/current_user_vote_flow.rb +68 -0
- data/app/services/decidim/elections/vote_flow.rb +109 -0
- data/app/services/decidim/votings/census/access_codes_exporter.rb +50 -0
- data/app/services/decidim/votings/census_vote_flow.rb +106 -0
- data/app/uploaders/decidim/cw/votings/census/voting_census_uploader.rb +19 -0
- data/app/views/decidim/elections/admin/answers/index.html.erb +23 -4
- data/app/views/decidim/elections/admin/elections/index.html.erb +5 -5
- data/app/views/decidim/elections/admin/questions/index.html.erb +2 -2
- data/app/views/decidim/elections/admin/steps/_results_published.html.erb +62 -0
- data/app/views/decidim/elections/admin/steps/_tally_ended.html.erb +49 -3
- data/app/views/decidim/elections/admin/steps/_vote.html.erb +1 -1
- data/app/views/decidim/elections/admin/steps/_vote_ended.html.erb +4 -0
- data/app/views/decidim/elections/admin/steps/index.html.erb +2 -2
- data/app/views/decidim/elections/admin/trustees_participatory_spaces/index.html.erb +7 -3
- data/app/views/decidim/elections/elections/_filters.html.erb +1 -0
- data/app/views/decidim/elections/elections/election_log.html.erb +182 -0
- data/app/views/decidim/elections/elections/index.html.erb +0 -2
- data/app/views/decidim/elections/elections/show.html.erb +11 -37
- data/app/views/decidim/elections/trustee_zone/elections/_key_ceremony_steps.html.erb +41 -39
- data/app/views/decidim/elections/trustee_zone/elections/show.html.erb +11 -27
- data/app/views/decidim/elections/trustee_zone/elections/update.js.erb +1 -1
- data/app/views/decidim/elections/trustee_zone/trustees/show.html.erb +7 -7
- data/app/views/decidim/elections/vote_accepted_mailer/notification.html.erb +3 -0
- data/app/views/decidim/elections/votes/{_election_votes_header.html.erb → _focus_header.html.erb} +0 -0
- data/app/views/decidim/elections/votes/_new_ballot_decision_step.html.erb +30 -0
- data/app/views/decidim/elections/votes/{_election_votes_confirm.html.erb → _new_confirm_step.html.erb} +5 -5
- data/app/views/decidim/elections/votes/{_election_votes_confirm_footer.html.erb → _new_confirm_step_footer.html.erb} +2 -3
- data/app/views/decidim/elections/votes/{_election_votes_encrypting.html.erb → _new_encrypting_step.html.erb} +1 -1
- data/app/views/decidim/elections/votes/{_election_votes_question.html.erb → _new_question.html.erb} +7 -7
- data/app/views/decidim/elections/votes/{_election_votes_modal.html.erb → _new_question_modal.html.erb} +1 -1
- data/app/views/decidim/elections/votes/_onboarding_modal.html.erb +23 -0
- data/app/views/decidim/elections/votes/_show_casted.html.erb +36 -0
- data/app/views/decidim/elections/votes/_show_casting.html.erb +25 -0
- data/app/views/decidim/elections/votes/{_election_votes_failed.html.erb → _show_failed.html.erb} +6 -4
- data/app/views/decidim/elections/votes/new.html.erb +29 -16
- data/app/views/decidim/elections/votes/show.html.erb +11 -0
- data/app/views/decidim/elections/votes/verify.html.erb +6 -9
- data/app/views/decidim/votings/access_code_mailer/send_access_code.html.erb +5 -0
- data/app/views/decidim/votings/admin/ballot_styles/_form.html.erb +24 -0
- data/app/views/decidim/votings/admin/ballot_styles/edit.html.erb +7 -0
- data/app/views/decidim/votings/admin/ballot_styles/index.html.erb +68 -0
- data/app/views/decidim/votings/admin/ballot_styles/new.html.erb +7 -0
- data/app/views/decidim/votings/admin/monitoring_committee_election_results/_results.html.erb +53 -0
- data/app/views/decidim/votings/admin/monitoring_committee_election_results/index.html.erb +32 -0
- data/app/views/decidim/votings/admin/monitoring_committee_election_results/show.html.erb +24 -0
- data/app/views/decidim/votings/admin/monitoring_committee_members/_form.html.erb +1 -1
- data/app/views/decidim/votings/admin/monitoring_committee_members/index.html.erb +1 -1
- data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closure_certificate_results.erb +9 -0
- data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closures.html.erb +71 -0
- data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_elections.html.erb +32 -0
- data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/edit.html.erb +29 -0
- data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/index.html.erb +5 -0
- data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/show.html.erb +10 -0
- data/app/views/decidim/votings/admin/monitoring_committee_verify_elections/index.html.erb +59 -0
- data/app/views/decidim/votings/admin/polling_officers/_form.html.erb +1 -1
- data/app/views/decidim/votings/admin/polling_officers/index.html.erb +1 -1
- data/app/views/decidim/votings/admin/polling_stations/_form.html.erb +1 -1
- data/app/views/decidim/votings/admin/polling_stations/index.html.erb +2 -2
- data/app/views/decidim/votings/admin/votings/_form.html.erb +9 -2
- data/app/views/decidim/votings/admin/votings/edit.html.erb +1 -1
- data/app/views/decidim/votings/admin/votings/index.html.erb +3 -2
- data/app/views/decidim/votings/census/admin/census/_creating_data.html.erb +10 -0
- data/app/views/decidim/votings/census/admin/census/_export_codes.html.erb +8 -0
- data/app/views/decidim/votings/census/admin/census/_exporting_codes.html.erb +3 -0
- data/app/views/decidim/votings/census/admin/census/_freeze.html.erb +3 -0
- data/app/views/decidim/votings/census/admin/census/_generate_codes.html.erb +25 -0
- data/app/views/decidim/votings/census/admin/census/_generating_codes.html.erb +3 -0
- data/app/views/decidim/votings/census/admin/census/_new_census.html.erb +22 -0
- data/app/views/decidim/votings/census/admin/census/_upload_info.html.erb +17 -0
- data/app/views/decidim/votings/census/admin/census/show.html.erb +23 -0
- data/app/views/decidim/votings/census/admin/census/status.js.erb +1 -0
- data/app/views/decidim/votings/census/export_mailer/access_codes_export.erb +7 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_answer_results_form_fields.html.erb +12 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_ballot_results_form_fields.html.erb +40 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_certify_form.html.erb +15 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_modal_ballots_count_error.html.erb +60 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_modal_ballots_results_count_error.html.erb +19 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_question_results_form_fields.html.erb +22 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/_sign_form.html.erb +55 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/edit.html.erb +48 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/new.html.erb +62 -0
- data/app/views/decidim/votings/polling_officer_zone/closures/show.html.erb +35 -0
- data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_complete_voting.html.erb +59 -0
- data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_in_person_form.html.erb +50 -0
- data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_verify_document.html.erb +23 -0
- data/app/views/decidim/votings/polling_officer_zone/in_person_votes/new.html.erb +21 -0
- data/app/views/decidim/votings/polling_officer_zone/in_person_votes/show.html.erb +25 -0
- data/app/views/decidim/votings/polling_officer_zone/polling_officers/_polling_station.html.erb +60 -0
- data/app/views/decidim/votings/polling_officer_zone/polling_officers/index.html.erb +15 -0
- data/app/views/decidim/votings/votings/_access_code_modal.html.erb +33 -0
- data/app/views/decidim/votings/votings/_check_fields.html.erb +31 -0
- data/app/views/decidim/votings/votings/_filters.html.erb +1 -0
- data/app/views/decidim/votings/votings/_promoted_voting.html.erb +1 -1
- data/app/views/decidim/votings/votings/check_census.html.erb +64 -0
- data/app/views/decidim/votings/votings/elections_log.html.erb +34 -0
- data/app/views/decidim/votings/votings/index.html.erb +0 -2
- data/app/views/decidim/votings/votings/login.html.erb +50 -0
- data/app/views/decidim/votings/votings/show.html.erb +11 -11
- data/app/views/layouts/decidim/_election_votes_header.html.erb +3 -3
- data/app/views/layouts/decidim/admin/voting.html.erb +5 -83
- data/app/views/layouts/decidim/election_votes.html.erb +1 -0
- data/app/views/layouts/decidim/voting_landing.html.erb +13 -0
- data/app/views/layouts/decidim/{voting.html.erb → votings.html.erb} +3 -1
- data/config/assets.rb +35 -0
- data/config/initializers/decidim_bulletin_board.rb +17 -11
- data/config/initializers/rack_attack.rb +15 -0
- data/config/locales/ca.yml +496 -49
- data/config/locales/cs.yml +498 -43
- data/config/locales/de.yml +469 -44
- data/config/locales/el.yml +0 -14
- data/config/locales/en.yml +491 -42
- data/config/locales/es-MX.yml +338 -42
- data/config/locales/es-PY.yml +338 -42
- data/config/locales/es.yml +338 -42
- data/config/locales/fi-plain.yml +489 -42
- data/config/locales/fi.yml +489 -42
- data/config/locales/fr-CA.yml +241 -39
- data/config/locales/fr-LU.yml +890 -0
- data/config/locales/fr.yml +241 -39
- data/config/locales/gl.yml +418 -34
- data/config/locales/hu.yml +29 -0
- data/config/locales/it.yml +1027 -17
- data/config/locales/ja.yml +578 -17
- data/config/locales/lb-LU.yml +1 -0
- data/config/locales/lv.yml +0 -14
- data/config/locales/nl.yml +308 -42
- data/config/locales/no.yml +12 -36
- data/config/locales/pl.yml +670 -215
- data/config/locales/pt-BR.yml +1338 -0
- data/config/locales/pt.yml +0 -19
- data/config/locales/ro-RO.yml +99 -19
- data/config/locales/sv.yml +49 -22
- data/config/locales/tr-TR.yml +3 -24
- data/config/locales/zh-CN.yml +0 -19
- data/db/migrate/20210308104024_add_decidim_votings_census_datasets.rb +17 -0
- data/db/migrate/20210308104154_add_decidim_votings_census_data.rb +23 -0
- data/db/migrate/20210326090435_create_elections_results.rb +16 -0
- data/db/migrate/20210330102348_remove_votes_count_from_answer.rb +7 -0
- data/db/migrate/20210330123606_add_voting_ballot_style.rb +19 -0
- data/db/migrate/20210330183204_add_email_to_votes.rb +10 -0
- data/db/migrate/20210331152729_add_census_contact_information_to_votings.rb +7 -0
- data/db/migrate/20210401095507_add_organization_to_decidim_elections_trustee.rb +11 -0
- data/db/migrate/20210402102215_add_ballot_style_to_decidim_votings_census_data.rb +7 -0
- data/db/migrate/20210402140402_add_salt_to_elections.rb +22 -0
- data/db/migrate/20210412144721_change_elections_results.rb +24 -0
- data/db/migrate/20210412144740_create_elections_bulletin_board_closures.rb +13 -0
- data/db/migrate/20210412144741_create_votings_polling_station_closures.rb +22 -0
- data/db/migrate/20210420112721_create_decidim_votings_in_person_votes.rb +21 -0
- data/db/migrate/20210422124826_add_verifiable_results_to_decidim_elections_election.rb +8 -0
- data/db/migrate/20210426072845_add_signed_at_to_polling_station_closure.rb +7 -0
- data/db/migrate/20210427131742_add_validated_at_to_votings_polling_station_closures.rb +8 -0
- data/db/seeds/Exampledocument.pdf +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/lib/decidim/api/bulletin_board_closure_type.rb +16 -0
- data/lib/decidim/api/election_answer_type.rb +3 -2
- data/lib/decidim/api/election_result_type.rb +19 -0
- data/lib/decidim/api/polling_station_closure_type.rb +19 -0
- data/lib/decidim/api/polling_station_type.rb +24 -0
- data/lib/decidim/elections/admin_engine.rb +14 -15
- data/lib/decidim/elections/answer_serializer.rb +2 -1
- data/lib/decidim/elections/api.rb +2 -0
- data/lib/decidim/elections/component.rb +85 -19
- data/lib/decidim/elections/engine.rb +4 -6
- data/lib/decidim/elections/test/factories.rb +76 -11
- data/lib/decidim/elections/trustee_zone_engine.rb +5 -4
- data/lib/decidim/elections/version.rb +1 -1
- data/lib/decidim/elections.rb +8 -0
- data/lib/decidim/votings/admin_engine.rb +134 -8
- data/lib/decidim/votings/api.rb +2 -0
- data/lib/decidim/votings/census.rb +16 -0
- data/lib/decidim/votings/census_admin.rb +12 -0
- data/lib/decidim/votings/census_admin_engine.rb +22 -0
- data/lib/decidim/votings/census_engine.rb +19 -0
- data/lib/decidim/votings/engine.rb +25 -20
- data/lib/decidim/votings/participatory_space.rb +149 -2
- data/lib/decidim/votings/polling_officer_zone_engine.rb +15 -6
- data/lib/decidim/votings/test/factories.rb +163 -0
- data/lib/decidim/votings/voting_serializer.rb +1 -0
- data/lib/decidim/votings.rb +17 -0
- data/lib/tasks/decidim_voting_census.rake +26 -0
- metadata +325 -71
- data/app/assets/config/admin/decidim_votings_manifest.css +0 -0
- data/app/assets/config/admin/decidim_votings_manifest.js +0 -4
- data/app/assets/config/decidim_elections_manifest.css +0 -3
- data/app/assets/config/decidim_elections_manifest.js +0 -8
- data/app/assets/config/decidim_votings_manifest.css +0 -3
- data/app/assets/config/decidim_votings_manifest.js +0 -0
- data/app/assets/javascripts/decidim/elections/vote.js.es6 +0 -117
- data/app/assets/javascripts/decidim/elections/vote_questions.component.js.es6 +0 -129
- data/app/assets/stylesheets/decidim/elections/elections.scss +0 -6
- data/app/assets/stylesheets/decidim/votings/votings/_votings-header.scss +0 -99
- data/app/assets/stylesheets/decidim/votings/votings/_votings-home-banner.scss +0 -11
- data/app/assets/stylesheets/decidim/votings/votings.scss +0 -1
- data/app/controllers/decidim/votings/polling_officer_zone/polling_stations_controller.rb +0 -22
- data/app/forms/decidim/elections/voter/encrypted_vote_form.rb +0 -49
- data/app/helpers/decidim/elections/elections_helper.rb +0 -29
- data/app/queries/decidim/elections/votes/election_votes.rb +0 -19
- data/app/queries/decidim/elections/votes/user_election_last_vote.rb +0 -26
- data/app/queries/decidim/elections/votes/user_votes.rb +0 -19
- data/app/views/decidim/elections/elections/_preview.html.erb +0 -26
- data/app/views/decidim/elections/elections/_results.html.erb +0 -47
- data/app/views/decidim/elections/votes/_election_votes_confirmed.html.erb +0 -47
- data/app/views/decidim/elections/votes/_election_votes_steps_header.html.erb +0 -12
- data/app/views/decidim/elections/votes/cast_failed.js.erb +0 -1
- data/app/views/decidim/elections/votes/cast_success.js.erb +0 -1
- data/app/views/decidim/votings/polling_officer_zone/polling_officers/show.html.erb +0 -42
- data/app/views/decidim/votings/polling_officer_zone/polling_stations/show.html.erb +0 -1
- data/app/views/decidim/votings/votings/_voting_details.html.erb +0 -7
- data/app/views/layouts/decidim/_voting_header.html.erb +0 -16
- data/config/locales/ja-JP.yml +0 -216
@@ -0,0 +1,83 @@
|
|
1
|
+
/* eslint-disable no-console */
|
2
|
+
import VoteQuestionsComponent from "src/decidim/elections/voter/vote_questions.component";
|
3
|
+
// The voting component might come from set-preview.js or setup-vote.js, it depends if it's a preview
|
4
|
+
// so in the view template we load the component and attach it to window
|
5
|
+
const { setupVoteComponent } = window.Decidim;
|
6
|
+
|
7
|
+
$(async () => {
|
8
|
+
// UI Elements
|
9
|
+
const $voteWrapper = $(".vote-wrapper");
|
10
|
+
const $ballotHash = $voteWrapper.find(".ballot-hash");
|
11
|
+
const ballotStyleId = $voteWrapper.data("ballotStyleId");
|
12
|
+
|
13
|
+
// Use the questions component
|
14
|
+
const questionsComponent = new VoteQuestionsComponent($voteWrapper);
|
15
|
+
questionsComponent.init();
|
16
|
+
$(document).on("on.zf.toggler", () => {
|
17
|
+
// continue and back btn
|
18
|
+
questionsComponent.init();
|
19
|
+
});
|
20
|
+
|
21
|
+
// Get the vote component and bind it to all UI events
|
22
|
+
const voteComponent = setupVoteComponent($voteWrapper);
|
23
|
+
await voteComponent.bindEvents({
|
24
|
+
onBindEncryptButton(onEventTriggered) {
|
25
|
+
$(".button.confirm").on("click", onEventTriggered);
|
26
|
+
},
|
27
|
+
onStart() {},
|
28
|
+
onVoteEncryption(validVoteFn) {
|
29
|
+
const getFormData = (formData) => {
|
30
|
+
return formData.serializeArray().reduce((acc, { name, value }) => {
|
31
|
+
if (!acc[name]) {
|
32
|
+
acc[name] = [];
|
33
|
+
}
|
34
|
+
acc[name] = [...acc[name], `${name}_${value}`];
|
35
|
+
return acc;
|
36
|
+
}, {});
|
37
|
+
};
|
38
|
+
const formData = getFormData($voteWrapper.find(".answer_input"));
|
39
|
+
validVoteFn(formData, ballotStyleId);
|
40
|
+
},
|
41
|
+
castOrAuditBallot({ encryptedData, encryptedDataHash }) {
|
42
|
+
$voteWrapper.find("#encrypting").addClass("hide");
|
43
|
+
$ballotHash.text(encryptedDataHash);
|
44
|
+
$voteWrapper.find("#ballot_decision").removeClass("hide");
|
45
|
+
|
46
|
+
const $form = $("form.new_vote");
|
47
|
+
$("#vote_encrypted_data", $form).val(encryptedData);
|
48
|
+
$("#vote_encrypted_data_hash", $form).val(encryptedDataHash);
|
49
|
+
},
|
50
|
+
onBindAuditBallotButton(onEventTriggered) {
|
51
|
+
$(".audit_ballot").on("click", onEventTriggered);
|
52
|
+
},
|
53
|
+
onBindCastBallotButton(onEventTriggered) {
|
54
|
+
$(".cast_ballot").on("click", onEventTriggered);
|
55
|
+
},
|
56
|
+
onAuditBallot(auditedData, auditedDataFileName) {
|
57
|
+
const vote = JSON.stringify(auditedData);
|
58
|
+
const link = document.createElement("a");
|
59
|
+
$voteWrapper.find(".button.cast_ballot").addClass("hide");
|
60
|
+
$voteWrapper.find(".button.back").removeClass("hide");
|
61
|
+
questionsComponent.voteCasted = true;
|
62
|
+
|
63
|
+
link.setAttribute("href", `data:text/plain;charset=utf-8,${vote}`);
|
64
|
+
link.setAttribute("download", auditedDataFileName);
|
65
|
+
document.body.appendChild(link);
|
66
|
+
link.click();
|
67
|
+
document.body.removeChild(link);
|
68
|
+
},
|
69
|
+
onAuditComplete() {
|
70
|
+
console.log("Audit completed");
|
71
|
+
},
|
72
|
+
onCastBallot() {
|
73
|
+
questionsComponent.voteCasted = true;
|
74
|
+
$(".cast_ballot").prop("disabled", true);
|
75
|
+
},
|
76
|
+
onCastComplete() {
|
77
|
+
console.log("Cast completed");
|
78
|
+
},
|
79
|
+
onInvalid() {
|
80
|
+
console.log("Something went wrong.");
|
81
|
+
}
|
82
|
+
});
|
83
|
+
});
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
2
|
+
// The wait time used to simulate the encryption of the vote during the preview
|
3
|
+
const FAKE_ENCRYPTION_TIME = 1000;
|
4
|
+
|
5
|
+
class PreviewVoteComponent {
|
6
|
+
constructor({ electionUniqueId, voterUniqueId }) {
|
7
|
+
this.electionUniqueId = electionUniqueId;
|
8
|
+
this.voterUniqueId = voterUniqueId;
|
9
|
+
}
|
10
|
+
|
11
|
+
async bindEvents({
|
12
|
+
onBindEncryptButton,
|
13
|
+
onStart,
|
14
|
+
onVoteEncryption,
|
15
|
+
castOrAuditBallot,
|
16
|
+
onBindAuditBallotButton,
|
17
|
+
onBindCastBallotButton,
|
18
|
+
onAuditBallot,
|
19
|
+
onCastBallot,
|
20
|
+
onAuditComplete,
|
21
|
+
onCastComplete,
|
22
|
+
onInvalid
|
23
|
+
}) {
|
24
|
+
onBindEncryptButton(async () => {
|
25
|
+
onStart();
|
26
|
+
onVoteEncryption(
|
27
|
+
(plainVote) => {
|
28
|
+
this.fakeEncrypt(plainVote).then((ballot) => {
|
29
|
+
castOrAuditBallot(ballot);
|
30
|
+
onBindAuditBallotButton(() => {
|
31
|
+
onAuditBallot(
|
32
|
+
ballot,
|
33
|
+
`${this.voterUniqueId}-election-${this.electionUniqueId}.txt`
|
34
|
+
);
|
35
|
+
onAuditComplete();
|
36
|
+
});
|
37
|
+
|
38
|
+
onBindCastBallotButton(async () => {
|
39
|
+
await onCastBallot(ballot);
|
40
|
+
onCastComplete();
|
41
|
+
});
|
42
|
+
});
|
43
|
+
},
|
44
|
+
() => {
|
45
|
+
onInvalid();
|
46
|
+
}
|
47
|
+
);
|
48
|
+
});
|
49
|
+
}
|
50
|
+
async fakeEncrypt(plainVote) {
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, FAKE_ENCRYPTION_TIME));
|
52
|
+
|
53
|
+
return {
|
54
|
+
encryptedData: plainVote,
|
55
|
+
encryptedDataHash: this.generateHexString(64),
|
56
|
+
auditableData: plainVote
|
57
|
+
};
|
58
|
+
}
|
59
|
+
generateHexString(length) {
|
60
|
+
return Array(length).
|
61
|
+
fill("").
|
62
|
+
map(() => Math.random().toString(16).charAt(2)).
|
63
|
+
join("");
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
export default function setupVoteComponent($voteWrapper) {
|
68
|
+
const voterUniqueId = $voteWrapper.data("voterId");
|
69
|
+
const electionUniqueId = $voteWrapper.data("electionUniqueId");
|
70
|
+
|
71
|
+
return new PreviewVoteComponent({
|
72
|
+
electionUniqueId,
|
73
|
+
voterUniqueId
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
window.Decidim = window.Decidim || {};
|
78
|
+
window.Decidim.setupVoteComponent = setupVoteComponent;
|
79
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
2
|
+
|
3
|
+
import { VoteComponent } from "@codegram/decidim-bulletin_board";
|
4
|
+
|
5
|
+
import * as VotingSchemesDummy from "@codegram/voting_schemes-dummy";
|
6
|
+
const DummyVoterWrapperAdapter = VotingSchemesDummy.VoterWrapperAdapter;
|
7
|
+
import * as VotingSchemesElectionGuard from "@codegram/voting_schemes-electionguard";
|
8
|
+
const ElectionGuardVoterWrapperAdapter = VotingSchemesElectionGuard.VoterWrapperAdapter;
|
9
|
+
|
10
|
+
export default function setupVoteComponent($voteWrapper) {
|
11
|
+
// Data
|
12
|
+
const bulletinBoardClientParams = {
|
13
|
+
apiEndpointUrl: $voteWrapper.data("apiEndpointUrl")
|
14
|
+
};
|
15
|
+
const electionUniqueId = $voteWrapper.data("electionUniqueId");
|
16
|
+
const authorityPublicKeyJSON = JSON.stringify(
|
17
|
+
$voteWrapper.data("authorityPublicKey")
|
18
|
+
);
|
19
|
+
const voterUniqueId = $voteWrapper.data("voterId");
|
20
|
+
const schemeName = $voteWrapper.data("schemeName");
|
21
|
+
|
22
|
+
// Use the correct voter wrapper adapter
|
23
|
+
let voterWrapperAdapter = null;
|
24
|
+
|
25
|
+
if (schemeName === "dummy") {
|
26
|
+
voterWrapperAdapter = new DummyVoterWrapperAdapter({
|
27
|
+
voterId: voterUniqueId
|
28
|
+
});
|
29
|
+
} else if (schemeName === "electionguard") {
|
30
|
+
voterWrapperAdapter = new ElectionGuardVoterWrapperAdapter({
|
31
|
+
voterId: voterUniqueId,
|
32
|
+
workerUrl: "/assets/electionguard/webworker.js"
|
33
|
+
});
|
34
|
+
} else {
|
35
|
+
throw new Error(`Voting scheme ${schemeName} not supported.`);
|
36
|
+
}
|
37
|
+
|
38
|
+
// Returns the vote component
|
39
|
+
return new VoteComponent({
|
40
|
+
bulletinBoardClientParams,
|
41
|
+
authorityPublicKeyJSON,
|
42
|
+
electionUniqueId,
|
43
|
+
voterUniqueId,
|
44
|
+
voterWrapperAdapter
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
48
|
+
window.Decidim = window.Decidim || {};
|
49
|
+
window.Decidim.setupVoteComponent = setupVoteComponent;
|
50
|
+
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/* eslint-disable require-jsdoc, prefer-template, func-style, id-length, no-use-before-define, init-declarations, no-invalid-this */
|
2
2
|
/* eslint no-unused-vars: ["error", { "args": "none" }] */
|
3
|
-
|
3
|
+
|
4
|
+
import { Client } from "@codegram/decidim-bulletin_board";
|
4
5
|
|
5
6
|
$(() => {
|
6
|
-
const
|
7
|
-
const $voteVerifyWrapper = $(".vote-verify-wrapper");
|
7
|
+
const $voteVerifyWrapper = $(".verify-vote-wrapper");
|
8
8
|
const $verifySubmitButton = $voteVerifyWrapper.find("a.focus__next.confirm");
|
9
9
|
|
10
10
|
let $formData = $voteVerifyWrapper.find(".vote-identifier");
|
@@ -14,7 +14,7 @@ $(() => {
|
|
14
14
|
onVoteIdentifierChange();
|
15
15
|
}
|
16
16
|
|
17
|
-
initStep()
|
17
|
+
initStep();
|
18
18
|
|
19
19
|
function onVoteIdentifierChange() {
|
20
20
|
$formData.on("keyup input", (event) => {
|
@@ -26,9 +26,9 @@ $(() => {
|
|
26
26
|
|
27
27
|
function toggleVerifyButton() {
|
28
28
|
if ($formData.val().length > 5) {
|
29
|
-
$($verifySubmitButton).removeClass("disabled")
|
29
|
+
$($verifySubmitButton).removeClass("disabled");
|
30
30
|
} else {
|
31
|
-
$($verifySubmitButton).addClass("disabled")
|
31
|
+
$($verifySubmitButton).addClass("disabled");
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
@@ -47,25 +47,26 @@ $(() => {
|
|
47
47
|
|
48
48
|
function verifyVoteIdentifier() {
|
49
49
|
const bulletinBoardClient = new Client({
|
50
|
-
apiEndpointUrl: $voteVerifyWrapper.data("apiEndpointUrl")
|
51
|
-
wsEndpointUrl: $voteVerifyWrapper.data("websocketUrl")
|
50
|
+
apiEndpointUrl: $voteVerifyWrapper.data("apiEndpointUrl")
|
52
51
|
});
|
53
52
|
|
54
|
-
bulletinBoardClient.
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
53
|
+
bulletinBoardClient.
|
54
|
+
getLogEntry({
|
55
|
+
electionUniqueId: $voteVerifyWrapper.data("electionUniqueId"),
|
56
|
+
contentHash: $formData.val()
|
57
|
+
}).
|
58
|
+
then((result) => {
|
59
|
+
if (result) {
|
60
|
+
hideErrorCallout();
|
61
|
+
$voteVerifyWrapper.find(".verify-vote-success").removeClass("hide");
|
62
|
+
} else {
|
63
|
+
hideSuccessCallout();
|
64
|
+
$voteVerifyWrapper.find(".verify-vote-error").removeClass("hide");
|
65
|
+
}
|
66
|
+
});
|
66
67
|
}
|
67
68
|
|
68
69
|
$(document).on("on.zf.toggler", (event) => {
|
69
|
-
initStep()
|
70
|
+
initStep();
|
70
71
|
});
|
71
72
|
});
|
@@ -0,0 +1,124 @@
|
|
1
|
+
/**
|
2
|
+
* Vote Questions component.
|
3
|
+
*/
|
4
|
+
|
5
|
+
export default class VoteQuestionsComponent {
|
6
|
+
constructor($voteWrapper) {
|
7
|
+
this.$voteWrapper = $voteWrapper;
|
8
|
+
this.$continueButton = this.$voteWrapper.find("a.focus__next");
|
9
|
+
this.$confirmButton = this.$voteWrapper.find("a.focus__next.confirm");
|
10
|
+
this.$continueSpan = this.$voteWrapper.find("span.disabled-continue");
|
11
|
+
this.$currentStep = "";
|
12
|
+
this.$currentStepMaxSelection = "";
|
13
|
+
this.$answerCounter = 0;
|
14
|
+
this.voteCasted = false;
|
15
|
+
window.onbeforeunload = () => {
|
16
|
+
if (this.voteCasted) {
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
return "";
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
init() {
|
24
|
+
this.setCurrentStep();
|
25
|
+
this.toggleContinueButton();
|
26
|
+
this.$confirmButton.addClass("show").removeClass("hide");
|
27
|
+
$(".evote__counter-min").text(this.$answerCounter);
|
28
|
+
this.answerCounter();
|
29
|
+
this.disableCheckbox();
|
30
|
+
}
|
31
|
+
|
32
|
+
setCurrentStep() {
|
33
|
+
this.$currentStep = this.$voteWrapper.find(".focus__step:visible")
|
34
|
+
this.setSelections();
|
35
|
+
this.onSelectionChange();
|
36
|
+
}
|
37
|
+
|
38
|
+
toggleContinueButton() {
|
39
|
+
if (this.checkAnswers()) {
|
40
|
+
// next step enabled
|
41
|
+
this.$continueButton.addClass("show").removeClass("hide")
|
42
|
+
this.$continueSpan.addClass("hide").removeClass("show")
|
43
|
+
} else {
|
44
|
+
// next step disabled
|
45
|
+
this.$continueButton.addClass("hide").removeClass("show")
|
46
|
+
this.$continueSpan.addClass("show").removeClass("hide")
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
// check if answers are correctly checked
|
51
|
+
checkAnswers() {
|
52
|
+
const currentAnswersChecked = $(`#${this.$currentStep.attr("id")} .answer_input:checked`).length
|
53
|
+
const notaAnswerChecked = $(`#${this.$currentStep.attr("id")} .nota_input:checked`).length
|
54
|
+
|
55
|
+
return ((currentAnswersChecked >= 1 || notaAnswerChecked > 0) && (currentAnswersChecked <= this.$currentStepMaxSelection));
|
56
|
+
}
|
57
|
+
|
58
|
+
answerCounter() {
|
59
|
+
let checked = $(`#${this.$currentStep.attr("id")} .answer_input:checked`).length
|
60
|
+
$(".evote__counter-min").text(checked);
|
61
|
+
}
|
62
|
+
|
63
|
+
// disable checkboxes if NOTA option is selected
|
64
|
+
disableCheckbox() {
|
65
|
+
$("[data-disabled-by]").on("click", (event) => {
|
66
|
+
if ($(event.target).attr("aria-disabled") || $(event.target).hasClass("is-disabled")) {
|
67
|
+
event.preventDefault();
|
68
|
+
}
|
69
|
+
});
|
70
|
+
|
71
|
+
$("[data-disable-check]").on("change", (event) => {
|
72
|
+
let checkId = $(event.target).attr("id");
|
73
|
+
let checkStatus = event.target.checked;
|
74
|
+
|
75
|
+
this.$currentStep.find(`[data-disabled-by='#${checkId}']`).each((_index, element) => {
|
76
|
+
if (checkStatus) {
|
77
|
+
$(element).addClass("is-disabled");
|
78
|
+
$(element).find("input[type=checkbox]").prop("checked", false);
|
79
|
+
$(element).find("input[type=checkbox]").attr("aria-disabled", "");
|
80
|
+
} else {
|
81
|
+
$(element).removeClass("is-disabled");
|
82
|
+
$(element).find("input[type=checkbox]").removeAttr("aria-disabled");
|
83
|
+
}
|
84
|
+
});
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
setSelections() {
|
89
|
+
this.$currentStepMaxSelection = this.$currentStep.find(".evote__options").data("max-selection")
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
onSelectionChange() {
|
94
|
+
let $voteOptions = this.$currentStep.find(".evote__options");
|
95
|
+
$voteOptions.on("change", () => {
|
96
|
+
this.toggleContinueButton();
|
97
|
+
this.toggleConfirmAnswers();
|
98
|
+
this.answerCounter();
|
99
|
+
});
|
100
|
+
}
|
101
|
+
|
102
|
+
// receive confirmed answers
|
103
|
+
toggleConfirmAnswers() {
|
104
|
+
$(".answer_input:checked").each((_index, element) => {
|
105
|
+
const confirmedAnswer = $(".evote__confirm").find(`#${element.value}`);
|
106
|
+
$(confirmedAnswer).removeClass("hide")
|
107
|
+
})
|
108
|
+
|
109
|
+
$(".answer_input").not(":checked").each((_index, element) => {
|
110
|
+
const confirmedAnswer = $(".evote__confirm").find(`#${element.value}`);
|
111
|
+
$(confirmedAnswer).addClass("hide")
|
112
|
+
})
|
113
|
+
|
114
|
+
$(".nota_input:checked").each((_index, element) => {
|
115
|
+
const confirmedAnswer = $(".evote__confirm").find(`.${element.value}`);
|
116
|
+
$(confirmedAnswer).removeClass("hide")
|
117
|
+
})
|
118
|
+
|
119
|
+
$(".nota_input").not(":checked").each((_index, element) => {
|
120
|
+
const confirmedAnswer = $(".evote__confirm").find(`.${element.value}`);
|
121
|
+
$(confirmedAnswer).addClass("hide")
|
122
|
+
})
|
123
|
+
}
|
124
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
const { createFieldDependentInputs } = exports.DecidimAdmin;
|
1
|
+
import createFieldDependentInputs from "src/decidim/admin/field_dependent_inputs.component"
|
3
2
|
|
3
|
+
$(() => {
|
4
4
|
const $participantType = $("#monitoring_committee_member_existing_user");
|
5
5
|
|
6
6
|
createFieldDependentInputs({
|
@@ -32,4 +32,4 @@
|
|
32
32
|
return $field.val() === "true"
|
33
33
|
}
|
34
34
|
});
|
35
|
-
})
|
35
|
+
})
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
const { createFieldDependentInputs } = exports.DecidimAdmin;
|
1
|
+
import createFieldDependentInputs from "src/decidim/admin/field_dependent_inputs.component"
|
3
2
|
|
3
|
+
$(() => {
|
4
4
|
const $participantType = $("#polling_officer_existing_user");
|
5
5
|
|
6
6
|
createFieldDependentInputs({
|
@@ -32,4 +32,4 @@
|
|
32
32
|
return $field.val() === "true"
|
33
33
|
}
|
34
34
|
});
|
35
|
-
})
|
35
|
+
})
|
File without changes
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import attachGeocoding from "src/decidim/geocoding/attach_input"
|
2
|
+
|
3
|
+
$(() => {
|
3
4
|
const $form = $(".edit_polling_station, .new_polling_station");
|
4
5
|
attachGeocoding($form.find("#polling_station_address"));
|
5
|
-
})
|
6
|
+
})
|
@@ -0,0 +1,13 @@
|
|
1
|
+
$(() => {
|
2
|
+
const updateCensusDatasetStatus = () => {
|
3
|
+
const $wrapper = $("#census-creating-data-wrapper");
|
4
|
+
const updateStatusUrl = $wrapper.data("updateStatusUrl")
|
5
|
+
|
6
|
+
if ($wrapper.length > 0) {
|
7
|
+
$.get(updateStatusUrl);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
// 1 minute
|
12
|
+
setInterval(updateCensusDatasetStatus, 60000);
|
13
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Client } from "@codegram/decidim-bulletin_board";
|
2
|
+
|
3
|
+
$(async () => {
|
4
|
+
const $inPersonVoteWrapper = $(".in-person-vote-wrapper");
|
5
|
+
if ($inPersonVoteWrapper.length > 0) {
|
6
|
+
const bulletinBoardClient = new Client({
|
7
|
+
apiEndpointUrl: $inPersonVoteWrapper.data("apiEndpointUrl")
|
8
|
+
});
|
9
|
+
const messageId = $inPersonVoteWrapper.data("messageId");
|
10
|
+
|
11
|
+
await bulletinBoardClient.waitForPendingMessageToBeProcessed(messageId);
|
12
|
+
|
13
|
+
$("form.update_vote_status").trigger("submit");
|
14
|
+
}
|
15
|
+
|
16
|
+
$(".js-verify-document").on("click", () => {
|
17
|
+
$("#verify-document").hide();
|
18
|
+
$("#complete-voting").removeClass("hide");
|
19
|
+
});
|
20
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $validBallotsInput = $("#closure_result__ballot_results__valid_ballots_count");
|
3
|
+
const $blankBallotsInput = $("#closure_result__ballot_results__blank_ballots_count");
|
4
|
+
const $nullBallotsInput = $("#closure_result__ballot_results__null_ballots_count");
|
5
|
+
|
6
|
+
const checkTotals = () => {
|
7
|
+
const totalBallots = $("#closure_result-total-ballots").data("total-ballots");
|
8
|
+
const validBallotsCount = parseInt($validBallotsInput.val(), 10);
|
9
|
+
const blankBallotsCount = parseInt($blankBallotsInput.val(), 10);
|
10
|
+
const nullBallotsCount = parseInt($nullBallotsInput.val(), 10);
|
11
|
+
|
12
|
+
let recount = validBallotsCount + blankBallotsCount + nullBallotsCount
|
13
|
+
|
14
|
+
if (recount === totalBallots) {
|
15
|
+
$("#submit-ballot-recount").removeClass("hide");
|
16
|
+
$("#btn-modal-closure-results-count-error").addClass("hide");
|
17
|
+
} else {
|
18
|
+
$("#submit-ballot-recount").addClass("hide");
|
19
|
+
$("#btn-modal-closure-results-count-error").removeClass("hide");
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
$validBallotsInput.on("blur", checkTotals);
|
24
|
+
$blankBallotsInput.on("blur", checkTotals);
|
25
|
+
$nullBallotsInput.on("blur", checkTotals);
|
26
|
+
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $submitBtn = $("#submit-verify-votes");
|
3
|
+
const $modalBtn = $("#btn-modal-closure-count-error");
|
4
|
+
const $totalBallotsInput = $("#envelopes_result_total_ballots_count");
|
5
|
+
const $electionVotesInput = $("#envelopes_result_election_votes_count");
|
6
|
+
|
7
|
+
const checkValues = () => {
|
8
|
+
const totalBallotsInputValue = parseInt($totalBallotsInput.val(), 10);
|
9
|
+
const electionVotesInputValue = parseInt($electionVotesInput.val(), 10);
|
10
|
+
|
11
|
+
|
12
|
+
if (totalBallotsInputValue === electionVotesInputValue) {
|
13
|
+
$submitBtn.removeClass("disabled hide");
|
14
|
+
$modalBtn.addClass("hide");
|
15
|
+
} else {
|
16
|
+
$submitBtn.addClass("hide");
|
17
|
+
$modalBtn.removeClass("hide");
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
$totalBallotsInput.on("blur", checkValues);
|
22
|
+
|
23
|
+
$("#submit-verify-votes").addClass("disabled");
|
24
|
+
|
25
|
+
$totalBallotsInput.on("keyup", function() {
|
26
|
+
$("#modal-total-ballots-value").html(parseInt($totalBallotsInput.val(), 10));
|
27
|
+
$("#envelopes_result_polling_officer_notes").val("")
|
28
|
+
});
|
29
|
+
|
30
|
+
$("#envelopes_result_polling_officer_notes").on("keyup", function() {
|
31
|
+
let modalPollingOfficerNotes = $("#envelopes_result_polling_officer_notes").val()
|
32
|
+
|
33
|
+
$("#btn-submit-from-modal").toggleClass("disabled", !modalPollingOfficerNotes.trim());
|
34
|
+
});
|
35
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $submitBtn = $("#btn-submit-from-modal");
|
3
|
+
const $modalBtn = $("#btn-modal-closure-sign");
|
4
|
+
const $signCheckbox = $("#closure_sign_signed");
|
5
|
+
|
6
|
+
const changeButtonProps = (event) => {
|
7
|
+
const notSigned = !$(event.target).is(":checked");
|
8
|
+
$modalBtn.prop("disabled", notSigned);
|
9
|
+
$submitBtn.prop("disabled", notSigned);
|
10
|
+
};
|
11
|
+
|
12
|
+
$signCheckbox.on("change", changeButtonProps);
|
13
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$(() => {
|
2
|
+
const isShowMoreButton = ($button) => $button.hasClass("show-more-content");
|
3
|
+
|
4
|
+
const remToPx = (count) => {
|
5
|
+
const unit = $("html").css("font-size");
|
6
|
+
|
7
|
+
if (typeof count !== "undefined" && count > 0) {
|
8
|
+
return (parseInt(unit, 10) || 0) * count;
|
9
|
+
}
|
10
|
+
return parseInt(unit, 10) || 0;
|
11
|
+
};
|
12
|
+
|
13
|
+
const $button = $(".voting-description-cell .content-height-toggler .button");
|
14
|
+
const $content = $button.closest(".voting-description-cell").find(".content");
|
15
|
+
const contentHeight = $content.height();
|
16
|
+
|
17
|
+
let contentMaxHeight = remToPx(7.8);
|
18
|
+
if ($("#introductory-image").length) {
|
19
|
+
contentMaxHeight = $("#introductory-image").height();
|
20
|
+
}
|
21
|
+
|
22
|
+
if (contentHeight < contentMaxHeight) {
|
23
|
+
$button.hide();
|
24
|
+
} else {
|
25
|
+
$content.css("max-height", contentMaxHeight);
|
26
|
+
}
|
27
|
+
|
28
|
+
$button.on("click", (event) => {
|
29
|
+
const $buttonTextMore = $button.find(".button-text.show-more-content");
|
30
|
+
const $buttonTextLess = $button.find(".button-text.show-less-content");
|
31
|
+
|
32
|
+
let newHeight = contentMaxHeight;
|
33
|
+
if (isShowMoreButton($(event.target))) {
|
34
|
+
newHeight = contentHeight;
|
35
|
+
}
|
36
|
+
|
37
|
+
$content.css("max-height", newHeight);
|
38
|
+
$buttonTextLess.toggleClass("hide");
|
39
|
+
$buttonTextMore.toggleClass("hide");
|
40
|
+
});
|
41
|
+
});
|
@@ -0,0 +1,8 @@
|
|
1
|
+
@import "stylesheets/decidim/elections/focus/accordion";
|
2
|
+
@import "stylesheets/decidim/elections/focus/evote";
|
3
|
+
@import "stylesheets/decidim/elections/focus/focus";
|
4
|
+
|
5
|
+
.card__icondata ul li:not(:first-child) strong,
|
6
|
+
.card__block ul li:not(:first-child) strong{
|
7
|
+
font-size: 100%;
|
8
|
+
}
|
File without changes
|
@@ -22,6 +22,11 @@
|
|
22
22
|
text-align: center;
|
23
23
|
}
|
24
24
|
|
25
|
+
&__grid .row{
|
26
|
+
display: block;
|
27
|
+
text-align: left;
|
28
|
+
}
|
29
|
+
|
25
30
|
&__content{
|
26
31
|
margin: 1rem auto;
|
27
32
|
|
@@ -223,7 +228,9 @@
|
|
223
228
|
letter-spacing: normal;
|
224
229
|
}
|
225
230
|
|
226
|
-
&__encrypting
|
231
|
+
&__encrypting,
|
232
|
+
&__casting,
|
233
|
+
&__confirming{
|
227
234
|
width: 200px;
|
228
235
|
height: 40px;
|
229
236
|
display: flex;
|
File without changes
|
File without changes
|