decidim-elections 0.23.3 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/assets/config/admin/decidim_votings_manifest.css +0 -0
- data/app/assets/config/admin/decidim_votings_manifest.js +4 -0
- data/app/assets/config/decidim_elections_manifest.css +3 -0
- data/app/assets/config/decidim_elections_manifest.js +6 -0
- data/app/assets/config/decidim_votings_manifest.css +3 -0
- data/app/assets/config/decidim_votings_manifest.js +0 -0
- data/app/assets/images/decidim/votings/icon.svg +1 -0
- data/app/assets/javascripts/decidim/elections/admin/pending_action.js.es6 +16 -0
- data/app/assets/javascripts/decidim/elections/admin/vote_statistics.js.es6 +11 -0
- data/app/assets/javascripts/decidim/elections/trustee_zone.js.es6 +54 -0
- data/app/assets/javascripts/decidim/elections/trustee_zone/key_ceremony.js.es6 +126 -0
- data/app/assets/javascripts/decidim/elections/trustee_zone/tally.js.es6 +104 -0
- data/app/assets/javascripts/decidim/elections/vote.js.es6 +107 -160
- data/app/assets/javascripts/decidim/elections/vote_questions.component.js.es6 +129 -0
- data/app/assets/javascripts/decidim/elections/vote_verify.js.es6 +71 -0
- data/app/assets/javascripts/decidim/votings/admin/monitoring_committee_members_form.js.es6 +35 -0
- data/app/assets/javascripts/decidim/votings/admin/polling_officers_form.js.es6 +35 -0
- data/app/assets/javascripts/decidim/votings/admin/polling_officers_picker.js.es6 +35 -0
- data/app/assets/javascripts/decidim/votings/admin/polling_stations_form.js.es6 +5 -0
- data/app/assets/stylesheets/decidim/elections/elections.scss +0 -4
- data/app/assets/stylesheets/decidim/elections/focus/_accordion.scss +36 -0
- data/app/assets/stylesheets/decidim/elections/focus/_evote.scss +58 -0
- data/app/assets/stylesheets/decidim/elections/trustee_zone.scss +24 -0
- data/app/assets/stylesheets/decidim/votings/votings.scss +1 -0
- data/app/assets/stylesheets/decidim/votings/votings/_votings-header.scss +99 -0
- data/app/assets/stylesheets/decidim/votings/votings/_votings-home-banner.scss +11 -0
- data/app/cells/decidim/votings/content_block_cell.rb +17 -0
- data/app/cells/decidim/votings/content_blocks/highlighted_votings/show.erb +30 -0
- data/app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb +33 -0
- data/app/cells/decidim/votings/content_blocks/highlighted_votings_settings_form/show.erb +3 -0
- data/app/cells/decidim/votings/content_blocks/highlighted_votings_settings_form_cell.rb +19 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/attachments_and_folders_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/description_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/elections_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/header_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/metrics_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/stats_cell.rb +15 -0
- data/app/cells/decidim/votings/content_blocks/landing_page/timeline_cell.rb +15 -0
- data/app/cells/decidim/votings/polling_officers/polling_officers_picker/polling_officers.erb +12 -0
- data/app/cells/decidim/votings/polling_officers/polling_officers_picker/show.erb +14 -0
- data/app/cells/decidim/votings/polling_officers/polling_officers_picker_cell.rb +73 -0
- data/app/cells/decidim/votings/voting_cell.rb +19 -0
- data/app/cells/decidim/votings/voting_m/data.erb +21 -0
- data/app/cells/decidim/votings/voting_m/footer.erb +5 -0
- data/app/cells/decidim/votings/voting_m_cell.rb +94 -0
- data/app/commands/decidim/elections/admin/add_user_as_trustee.rb +81 -0
- data/app/commands/decidim/elections/admin/create_election.rb +2 -1
- data/app/commands/decidim/elections/admin/end_vote.rb +63 -0
- data/app/commands/decidim/elections/admin/publish_results.rb +59 -0
- data/app/commands/decidim/elections/admin/remove_trustee_from_participatory_space.rb +37 -0
- data/app/commands/decidim/elections/admin/setup_election.rb +160 -0
- data/app/commands/decidim/elections/admin/start_key_ceremony.rb +63 -0
- data/app/commands/decidim/elections/admin/start_tally.rb +63 -0
- data/app/commands/decidim/elections/admin/start_vote.rb +63 -0
- data/app/commands/decidim/elections/admin/update_action_status.rb +47 -0
- data/app/commands/decidim/elections/admin/update_answer_selection.rb +41 -0
- data/app/commands/decidim/elections/admin/update_trustee_participatory_space.rb +40 -0
- data/app/commands/decidim/elections/trustee_zone/update_election_bulletin_board_status.rb +39 -0
- data/app/commands/decidim/elections/trustee_zone/update_trustee.rb +41 -0
- data/app/commands/decidim/elections/voter/cast_vote.rb +59 -0
- data/app/commands/decidim/elections/voter/update_vote_status.rb +70 -0
- data/app/commands/decidim/votings/admin/create_monitoring_committee_member.rb +99 -0
- data/app/commands/decidim/votings/admin/create_polling_officer.rb +99 -0
- data/app/commands/decidim/votings/admin/create_polling_station.rb +59 -0
- data/app/commands/decidim/votings/admin/create_voting.rb +59 -0
- data/app/commands/decidim/votings/admin/destroy_monitoring_committee_member.rb +51 -0
- data/app/commands/decidim/votings/admin/destroy_polling_officer.rb +52 -0
- data/app/commands/decidim/votings/admin/destroy_polling_station.rb +40 -0
- data/app/commands/decidim/votings/admin/manage_polling_station.rb +64 -0
- data/app/commands/decidim/votings/admin/publish_voting.rb +40 -0
- data/app/commands/decidim/votings/admin/unpublish_voting.rb +40 -0
- data/app/commands/decidim/votings/admin/update_polling_station.rb +50 -0
- data/app/commands/decidim/votings/admin/update_voting.rb +85 -0
- data/app/constraints/decidim/votings/current_component.rb +28 -0
- data/app/constraints/decidim/votings/current_voting.rb +43 -0
- data/app/controllers/concerns/decidim/elections/orderable.rb +2 -2
- data/app/controllers/concerns/decidim/polling_officers/admin/filterable.rb +58 -0
- data/app/controllers/concerns/decidim/polling_stations/admin/filterable.rb +57 -0
- data/app/controllers/concerns/decidim/votings/admin/filterable.rb +27 -0
- data/app/controllers/concerns/decidim/votings/admin/voting_admin.rb +48 -0
- data/app/controllers/concerns/decidim/votings/needs_voting.rb +44 -0
- data/app/controllers/concerns/decidim/votings/orderable.rb +32 -0
- data/app/controllers/decidim/elections/admin/answers_controller.rb +32 -0
- data/app/controllers/decidim/elections/admin/elections_controller.rb +2 -2
- data/app/controllers/decidim/elections/admin/feedback_forms_controller.rb +55 -0
- data/app/controllers/decidim/elections/admin/steps_controller.rb +96 -0
- data/app/controllers/decidim/elections/admin/trustees_participatory_spaces_controller.rb +89 -0
- data/app/controllers/decidim/elections/elections_controller.rb +5 -1
- data/app/controllers/decidim/elections/feedbacks_controller.rb +38 -0
- data/app/controllers/decidim/elections/trustee_zone/application_controller.rb +45 -0
- data/app/controllers/decidim/elections/trustee_zone/elections_controller.rb +35 -0
- data/app/controllers/decidim/elections/trustee_zone/trustees_controller.rb +36 -0
- data/app/controllers/decidim/elections/votes_controller.rb +54 -2
- data/app/controllers/decidim/votings/admin/application_controller.rb +26 -0
- data/app/controllers/decidim/votings/admin/component_permissions_controller.rb +13 -0
- data/app/controllers/decidim/votings/admin/components_controller.rb +15 -0
- data/app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb +62 -0
- data/app/controllers/decidim/votings/admin/polling_officers_controller.rb +66 -0
- data/app/controllers/decidim/votings/admin/polling_stations_controller.rb +92 -0
- data/app/controllers/decidim/votings/admin/voting_attachment_collections_controller.rb +22 -0
- data/app/controllers/decidim/votings/admin/voting_attachments_controller.rb +21 -0
- data/app/controllers/decidim/votings/admin/votings_controller.rb +124 -0
- data/app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb +44 -0
- data/app/controllers/decidim/votings/admin/votings_landing_page_controller.rb +46 -0
- data/app/controllers/decidim/votings/application_controller.rb +26 -0
- data/app/controllers/decidim/votings/polling_officer_zone/application_controller.rb +33 -0
- data/app/controllers/decidim/votings/polling_officer_zone/polling_officers_controller.rb +17 -0
- data/app/controllers/decidim/votings/polling_officer_zone/polling_stations_controller.rb +22 -0
- data/app/controllers/decidim/votings/votings_controller.rb +98 -0
- data/app/events/decidim/elections/trustees/notify_new_trustee_event.rb +28 -0
- data/app/events/decidim/elections/trustees/notify_trustee_new_election_event.rb +14 -0
- data/app/events/decidim/elections/votes/vote_accepted_event.rb +24 -0
- data/app/events/decidim/votings/polling_officers/polling_station_assigned_event.rb +44 -0
- data/app/forms/decidim/elections/admin/action_form.rb +34 -0
- data/app/forms/decidim/elections/admin/answer_form.rb +3 -2
- data/app/forms/decidim/elections/admin/election_form.rb +3 -2
- data/app/forms/decidim/elections/admin/setup_form.rb +79 -0
- data/app/forms/decidim/elections/admin/trustees_participatory_space_form.rb +22 -0
- data/app/forms/decidim/elections/admin/vote_period_form.rb +37 -0
- data/app/forms/decidim/elections/ballot/verify_vote_form.rb +29 -0
- data/app/forms/decidim/elections/trustee_zone/trustee_form.rb +26 -0
- data/app/forms/decidim/elections/voter/encrypted_vote_form.rb +49 -0
- data/app/forms/decidim/votings/admin/monitoring_committee_member_form.rb +27 -0
- data/app/forms/decidim/votings/admin/polling_officer_form.rb +27 -0
- data/app/forms/decidim/votings/admin/polling_station_form.rb +58 -0
- data/app/forms/decidim/votings/admin/voting_form.rb +71 -0
- data/app/helpers/decidim/elections/admin/answers_helper.rb +19 -0
- data/app/helpers/decidim/elections/admin/steps_helper.rb +23 -0
- data/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb +31 -0
- data/app/helpers/decidim/elections/elections_helper.rb +29 -0
- data/app/helpers/decidim/votings/admin/polling_officers_picker_helper.rb +29 -0
- data/app/helpers/decidim/votings/votings_helper.rb +20 -0
- data/app/models/decidim/elections/action.rb +13 -0
- data/app/models/decidim/elections/election.rb +54 -3
- data/app/models/decidim/elections/elections_trustee.rb +11 -0
- data/app/models/decidim/elections/question.rb +19 -0
- data/app/models/decidim/elections/trustee.rb +26 -0
- data/app/models/decidim/elections/trustees_participatory_space.rb +13 -0
- data/app/models/decidim/elections/vote.rb +15 -0
- data/app/models/decidim/votings/monitoring_committee_member.rb +24 -0
- data/app/models/decidim/votings/polling_officer.rb +76 -0
- data/app/models/decidim/votings/polling_station.rb +64 -0
- data/app/models/decidim/votings/voting.rb +138 -0
- data/app/permissions/decidim/elections/admin/permissions.rb +50 -10
- data/app/permissions/decidim/elections/permissions.rb +20 -2
- data/app/permissions/decidim/elections/trustee_zone/permissions.rb +32 -0
- data/app/permissions/decidim/votings/admin/permissions.rb +127 -0
- data/app/permissions/decidim/votings/permissions.rb +40 -0
- data/app/permissions/decidim/votings/polling_officer_zone/permissions.rb +32 -0
- data/app/presenters/decidim/elections/admin_log/election_presenter.rb +1 -1
- data/app/presenters/decidim/elections/trustee_presenter.rb +24 -0
- data/app/presenters/decidim/votings/admin_log/voting_presenter.rb +45 -0
- data/app/presenters/decidim/votings/polling_station_presenter.rb +27 -0
- data/app/presenters/decidim/votings/voting_presenter.rb +36 -0
- data/app/queries/decidim/elections/admin/pending_actions.rb +20 -0
- data/app/queries/decidim/elections/admin/votes_for_statistics.rb +24 -0
- data/app/queries/decidim/elections/elections_finished_to_end.rb +19 -0
- data/app/queries/decidim/elections/elections_ready_to_start.rb +25 -0
- data/app/queries/decidim/elections/trustees/by_participatory_space.rb +24 -0
- data/app/queries/decidim/elections/trustees/by_participatory_space_trustee_ids.rb +24 -0
- data/app/queries/decidim/elections/votes/election_votes.rb +19 -0
- data/app/queries/decidim/elections/votes/pending_votes.rb +20 -0
- data/app/queries/decidim/elections/votes/user_election_last_vote.rb +26 -0
- data/app/queries/decidim/elections/votes/user_votes.rb +19 -0
- data/app/queries/decidim/votings/admin/admin_users.rb +39 -0
- data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations.rb +33 -0
- data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations_and_user.rb +34 -0
- data/app/queries/decidim/votings/admin/polling_officers_join_user.rb +32 -0
- data/app/queries/decidim/votings/organization_prioritized_votings.rb +21 -0
- data/app/queries/decidim/votings/organization_promoted_votings.rb +16 -0
- data/app/queries/decidim/votings/organization_published_votings.rb +19 -0
- data/app/queries/decidim/votings/organization_votings.rb +16 -0
- data/app/queries/decidim/votings/prioritized_votings.rb +13 -0
- data/app/queries/decidim/votings/published_votings.rb +12 -0
- data/app/services/decidim/votings/voting_search.rb +46 -0
- data/app/views/decidim/elections/admin/answers/index.html.erb +12 -0
- data/app/views/decidim/elections/admin/elections/index.html.erb +13 -1
- data/app/views/decidim/elections/admin/proposals_imports/new.html.erb +1 -1
- data/app/views/decidim/elections/admin/questions/index.html.erb +5 -1
- data/app/views/decidim/elections/admin/shared/_trustees_secondary_nav.html.erb +3 -0
- data/app/views/decidim/elections/admin/steps/_create_election.html.erb +38 -0
- data/app/views/decidim/elections/admin/steps/_created.html.erb +16 -0
- data/app/views/decidim/elections/admin/steps/_key_ceremony.html.erb +16 -0
- data/app/views/decidim/elections/admin/steps/_key_ceremony_ended.html.erb +15 -0
- data/app/views/decidim/elections/admin/steps/_tally.html.erb +17 -0
- data/app/views/decidim/elections/admin/steps/_tally_ended.html.erb +9 -0
- data/app/views/decidim/elections/admin/steps/_vote.html.erb +21 -0
- data/app/views/decidim/elections/admin/steps/_vote_ended.html.erb +15 -0
- data/app/views/decidim/elections/admin/steps/_vote_stats.html.erb +31 -0
- data/app/views/decidim/elections/admin/steps/index.html.erb +43 -0
- data/app/views/decidim/elections/admin/trustees_participatory_spaces/_form.html.erb +19 -0
- data/app/views/decidim/elections/admin/trustees_participatory_spaces/index.html.erb +64 -0
- data/app/views/decidim/elections/admin/trustees_participatory_spaces/new.html.erb +7 -0
- data/app/views/decidim/elections/elections/_filters_small_view.html.erb +1 -1
- data/app/views/decidim/elections/elections/_preview.html.erb +26 -0
- data/app/views/decidim/elections/elections/_results.html.erb +47 -0
- data/app/views/decidim/elections/elections/show.html.erb +43 -18
- data/app/views/decidim/elections/trustee_zone/elections/_backup_modal.html.erb +24 -0
- data/app/views/decidim/elections/trustee_zone/elections/_key_ceremony_steps.html.erb +44 -0
- data/app/views/decidim/elections/trustee_zone/elections/_restore_modal.html.erb +25 -0
- data/app/views/decidim/elections/trustee_zone/elections/_tally_steps.html.erb +43 -0
- data/app/views/decidim/elections/trustee_zone/elections/show.html.erb +38 -0
- data/app/views/decidim/elections/trustee_zone/elections/update.js.erb +5 -0
- data/app/views/decidim/elections/trustee_zone/trustees/show.html.erb +102 -0
- data/app/views/decidim/elections/votes/_election_votes_confirmed.html.erb +38 -17
- data/app/views/decidim/elections/votes/_election_votes_failed.html.erb +21 -0
- data/app/views/decidim/elections/votes/_election_votes_question.html.erb +4 -4
- data/app/views/decidim/elections/votes/cast_failed.js.erb +1 -0
- data/app/views/decidim/elections/votes/cast_success.js.erb +1 -0
- data/app/views/decidim/elections/votes/new.html.erb +41 -33
- data/app/views/decidim/elections/votes/verify.html.erb +78 -0
- data/app/views/decidim/votings/admin/monitoring_committee_members/_form.html.erb +27 -0
- data/app/views/decidim/votings/admin/monitoring_committee_members/index.html.erb +41 -0
- data/app/views/decidim/votings/admin/monitoring_committee_members/new.html.erb +7 -0
- data/app/views/decidim/votings/admin/polling_officers/_form.html.erb +27 -0
- data/app/views/decidim/votings/admin/polling_officers/index.html.erb +50 -0
- data/app/views/decidim/votings/admin/polling_officers/new.html.erb +7 -0
- data/app/views/decidim/votings/admin/polling_stations/_form.html.erb +40 -0
- data/app/views/decidim/votings/admin/polling_stations/edit.html.erb +7 -0
- data/app/views/decidim/votings/admin/polling_stations/index.html.erb +55 -0
- data/app/views/decidim/votings/admin/polling_stations/new.html.erb +7 -0
- data/app/views/decidim/votings/admin/votings/_form.html.erb +63 -0
- data/app/views/decidim/votings/admin/votings/edit.html.erb +31 -0
- data/app/views/decidim/votings/admin/votings/index.html.erb +87 -0
- data/app/views/decidim/votings/admin/votings/new.html.erb +13 -0
- data/app/views/decidim/votings/admin/votings/polling_officers_picker.html.erb +2 -0
- data/app/views/decidim/votings/polling_officer_zone/polling_officers/show.html.erb +42 -0
- data/app/views/decidim/votings/polling_officer_zone/polling_stations/show.html.erb +1 -0
- data/app/views/decidim/votings/votings/_count.html.erb +1 -0
- data/app/views/decidim/votings/votings/_filters.html.erb +25 -0
- data/app/views/decidim/votings/votings/_filters_small_view.html.erb +23 -0
- data/app/views/decidim/votings/votings/_promoted_voting.html.erb +27 -0
- data/app/views/decidim/votings/votings/_voting_details.html.erb +7 -0
- data/app/views/decidim/votings/votings/_votings.html.erb +25 -0
- data/app/views/decidim/votings/votings/index.html.erb +42 -0
- data/app/views/decidim/votings/votings/index.js.erb +10 -0
- data/app/views/decidim/votings/votings/show.html.erb +20 -0
- data/app/views/layouts/decidim/_voting_header.html.erb +16 -0
- data/app/views/layouts/decidim/admin/voting.html.erb +101 -0
- data/app/views/layouts/decidim/voting.html.erb +16 -0
- data/config/initializers/decidim_bulletin_board.rb +23 -0
- data/config/locales/ca.yml +636 -6
- data/config/locales/cs.yml +645 -7
- data/config/locales/de.yml +636 -6
- data/config/locales/el.yml +4 -2
- data/config/locales/en.yml +636 -6
- data/config/locales/es-MX.yml +637 -7
- data/config/locales/es-PY.yml +637 -7
- data/config/locales/es.yml +637 -7
- data/config/locales/fi-plain.yml +637 -7
- data/config/locales/fi.yml +638 -8
- data/config/locales/fr-CA.yml +423 -6
- data/config/locales/fr.yml +423 -6
- data/config/locales/gl.yml +85 -5
- data/config/locales/it.yml +98 -6
- data/config/locales/ja.yml +12 -6
- data/config/locales/lv.yml +4 -2
- data/config/locales/nl.yml +503 -6
- data/config/locales/no.yml +2 -5
- data/config/locales/pl.yml +655 -10
- data/config/locales/pt.yml +4 -6
- data/config/locales/ro-RO.yml +214 -6
- data/config/locales/sv.yml +258 -7
- data/config/locales/tr-TR.yml +111 -6
- data/config/locales/zh-CN.yml +4 -6
- data/db/migrate/20200915142713_add_questionnaire_to_existing_elections.rb +29 -0
- data/db/migrate/20200918153813_create_decidim_elections_trustees_participatory_spaces.rb +13 -0
- data/db/migrate/20200918153824_create_decidim_elections_elections_trustees.rb +10 -0
- data/db/migrate/20200918153835_create_decidim_elections_trustees.rb +12 -0
- data/db/migrate/20201026163334_add_blocked_at_and_bb_status_to_elections.rb +8 -0
- data/db/migrate/20201028090110_add_votes_to_decidim_elections_answers.rb +7 -0
- data/db/migrate/20201028135614_add_selected_to_decidim_elections_answers.rb +7 -0
- data/db/migrate/20201209110653_create_decidim_elections_votes.rb +14 -0
- data/db/migrate/20201216091123_add_name_to_trustees.rb +7 -0
- data/db/migrate/20210113113818_add_message_id_to_decidim_elections_votes.rb +7 -0
- data/db/migrate/20210113120115_create_decidim_elections_votings.rb +20 -0
- data/db/migrate/20210114100749_add_published_at_to_decidim_votings_votings.rb +7 -0
- data/db/migrate/20210114111850_add_user_to_decidim_elections_votes.rb +7 -0
- data/db/migrate/20210120164634_add_promoted_to_voting.rb +7 -0
- data/db/migrate/20210125124801_add_voting_type_to_voting_voting.rb +7 -0
- data/db/migrate/20210129124956_create_decidim_elections_actions.rb +14 -0
- data/db/migrate/20210204132111_add_votings_polling_stations.rb +19 -0
- data/db/migrate/20210208090441_add_polling_officers_to_votings.rb +12 -0
- data/db/migrate/20210210090738_add_votings_polling_station_references_to_votings_polling_officer.rb +8 -0
- data/db/migrate/20210216074707_add_monitoring_committee_member.rb +12 -0
- data/db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb +16 -0
- data/db/seeds/city.jpeg +0 -0
- data/lib/decidim/api/election_answer_type.rb +23 -0
- data/lib/decidim/api/election_question_type.rb +22 -0
- data/lib/decidim/api/election_type.rb +27 -0
- data/lib/decidim/api/elections_type.rb +32 -0
- data/lib/decidim/api/trustee_type.rb +16 -0
- data/lib/decidim/api/voting_type.rb +20 -0
- data/lib/decidim/elections.rb +19 -2
- data/lib/decidim/elections/admin_engine.rb +42 -1
- data/lib/decidim/elections/answer_serializer.rb +48 -0
- data/lib/decidim/elections/api.rb +11 -0
- data/lib/decidim/elections/component.rb +367 -24
- data/lib/decidim/elections/engine.rb +8 -1
- data/lib/decidim/elections/test/factories.rb +201 -4
- data/lib/decidim/elections/trustee_zone.rb +10 -0
- data/lib/decidim/elections/trustee_zone_engine.rb +35 -0
- data/lib/decidim/elections/version.rb +1 -1
- data/lib/decidim/votings.rb +16 -0
- data/lib/decidim/votings/admin.rb +10 -0
- data/lib/decidim/votings/admin_engine.rb +71 -0
- data/lib/decidim/votings/api.rb +7 -0
- data/lib/decidim/votings/engine.rb +147 -0
- data/lib/decidim/votings/participatory_space.rb +92 -0
- data/lib/decidim/votings/polling_officer_zone.rb +10 -0
- data/lib/decidim/votings/polling_officer_zone_engine.rb +33 -0
- data/lib/decidim/votings/query_extensions.rb +43 -0
- data/lib/decidim/votings/test/capybara_polling_officers_picker.rb +49 -0
- data/lib/decidim/votings/test/factories.rb +83 -0
- data/lib/decidim/votings/voting_serializer.rb +54 -0
- data/lib/tasks/decidim_elections.rake +68 -5
- metadata +303 -19
- data/app/types/decidim/elections/election_answer_type.rb +0 -24
- data/app/types/decidim/elections/election_question_type.rb +0 -25
- data/app/types/decidim/elections/election_type.rb +0 -27
- data/app/types/decidim/elections/elections_type.rb +0 -32
- data/config/i18n-tasks.yml +0 -10
- data/lib/decidim/elections/bulletin_board_client.rb +0 -35
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
include Paginable
|
9
9
|
include Decidim::Elections::Orderable
|
10
10
|
|
11
|
-
helper_method :elections, :election, :paginated_elections, :scheduled_elections, :single
|
11
|
+
helper_method :elections, :election, :paginated_elections, :scheduled_elections, :single?, :last_vote
|
12
12
|
|
13
13
|
def index
|
14
14
|
redirect_to election_path(single, single: true) if single?
|
@@ -39,6 +39,10 @@ module Decidim
|
|
39
39
|
elections.first if single?
|
40
40
|
end
|
41
41
|
|
42
|
+
def last_vote
|
43
|
+
@last_vote ||= Decidim::Elections::Votes::UserElectionLastVote.new(current_user, election).query
|
44
|
+
end
|
45
|
+
|
42
46
|
def paginated_elections
|
43
47
|
@paginated_elections ||= paginate(search.results.published)
|
44
48
|
@paginated_elections = reorder(@paginated_elections)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This controller allows a user to give feedback once finished voting
|
6
|
+
class FeedbacksController < Decidim::Elections::ApplicationController
|
7
|
+
include Decidim::Forms::Concerns::HasQuestionnaire
|
8
|
+
helper_method :election
|
9
|
+
|
10
|
+
def questionnaire_for
|
11
|
+
election
|
12
|
+
end
|
13
|
+
|
14
|
+
# where the questionnaire will be submitted.
|
15
|
+
def update_url
|
16
|
+
answer_election_feedback_path(election)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def election
|
22
|
+
@election ||= Election.where(component: current_component).includes(:questionnaire).find(params[:election_id])
|
23
|
+
end
|
24
|
+
|
25
|
+
def allow_answers?
|
26
|
+
current_user.present? && election.ongoing?
|
27
|
+
end
|
28
|
+
|
29
|
+
def i18n_flashes_scope
|
30
|
+
"decidim.elections.feedback"
|
31
|
+
end
|
32
|
+
|
33
|
+
def enforce_permission_to_answer_questionnaire
|
34
|
+
enforce_permission_to :answer, :questionnaire, election: election
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
module TrusteeZone
|
6
|
+
# This controller is the abstract class from which all trustee_zone
|
7
|
+
# controllers in their public engines should inherit from.
|
8
|
+
|
9
|
+
class ApplicationController < ::Decidim::ApplicationController
|
10
|
+
include Decidim::UserProfile
|
11
|
+
|
12
|
+
helper_method :trustee
|
13
|
+
|
14
|
+
before_action :ensure_configured_bulletin_board!
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def ensure_configured_bulletin_board!
|
19
|
+
return if Decidim::Elections.bulletin_board.configured?
|
20
|
+
|
21
|
+
announcement = {
|
22
|
+
title: "<strong>#{t("no_bulletin_board.title", scope: "decidim.elections.trustee_zone")}</strong>",
|
23
|
+
body: t("no_bulletin_board.body", scope: "decidim.elections.trustee_zone")
|
24
|
+
}
|
25
|
+
render html: cell("decidim/announcement", announcement, callout_class: "alert"), layout: true
|
26
|
+
end
|
27
|
+
|
28
|
+
def trustee
|
29
|
+
@trustee ||= Decidim::Elections::Trustee.for(current_user)
|
30
|
+
end
|
31
|
+
|
32
|
+
def permission_scope
|
33
|
+
:trustee_zone
|
34
|
+
end
|
35
|
+
|
36
|
+
def permission_class_chain
|
37
|
+
[
|
38
|
+
Decidim::Elections::Permissions,
|
39
|
+
Decidim::Permissions
|
40
|
+
]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
module TrusteeZone
|
6
|
+
# Handles the KeyCeremony for trustee users
|
7
|
+
class ElectionsController < Decidim::Elections::TrusteeZone::ApplicationController
|
8
|
+
helper_method :election
|
9
|
+
|
10
|
+
def show
|
11
|
+
enforce_permission_to :view, :election, trustee: trustee
|
12
|
+
end
|
13
|
+
|
14
|
+
def update
|
15
|
+
enforce_permission_to :update, :election, trustee: trustee
|
16
|
+
|
17
|
+
UpdateElectionBulletinBoardStatus.call(election, params[:status]) do
|
18
|
+
on(:ok) do
|
19
|
+
render :update
|
20
|
+
end
|
21
|
+
on(:invalid) do
|
22
|
+
flash[:alert] = I18n.t("elections.update.error", scope: "decidim.elections.trustee_zone")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def election
|
30
|
+
@election ||= Decidim::Elections::Election.find(params[:election_id])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
module TrusteeZone
|
6
|
+
# Exposes the trustee zone for trustee users
|
7
|
+
class TrusteesController < Decidim::Elections::TrusteeZone::ApplicationController
|
8
|
+
include Decidim::FormFactory
|
9
|
+
|
10
|
+
def show
|
11
|
+
enforce_permission_to :view, :trustee, trustee: trustee
|
12
|
+
|
13
|
+
trustee.name ||= current_user.name
|
14
|
+
end
|
15
|
+
|
16
|
+
def update
|
17
|
+
enforce_permission_to :update, :trustee, trustee: trustee
|
18
|
+
|
19
|
+
form = form(TrusteeForm).from_params(params, trustee: trustee)
|
20
|
+
|
21
|
+
UpdateTrustee.call(form) do
|
22
|
+
on(:ok) do
|
23
|
+
flash[:notice] = I18n.t("trustees.update.success", scope: "decidim.elections.trustee_zone")
|
24
|
+
end
|
25
|
+
|
26
|
+
on(:invalid) do
|
27
|
+
flash[:alert] = form.errors.full_messages.to_sentence
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
redirect_to trustee_path
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -8,16 +8,56 @@ module Decidim
|
|
8
8
|
include FormFactory
|
9
9
|
|
10
10
|
helper VotesHelper
|
11
|
-
helper_method :elections, :election, :questions, :questions_count, :booth_mode
|
11
|
+
helper_method :elections, :election, :questions, :questions_count, :booth_mode, :vote
|
12
12
|
|
13
13
|
delegate :count, to: :questions, prefix: true
|
14
14
|
|
15
15
|
def new
|
16
|
-
redirect_to(return_path, alert: t("votes.messages.not_allowed", scope: "decidim.elections"))
|
16
|
+
return redirect_to(return_path, alert: t("votes.messages.not_allowed", scope: "decidim.elections")) if booth_mode.nil?
|
17
|
+
return redirect_to(pending_vote_path) if pending_vote?
|
18
|
+
|
19
|
+
@form = form(Voter::EncryptedVoteForm).instance(election: election)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update
|
23
|
+
Voter::UpdateVoteStatus.call(vote) do
|
24
|
+
on(:ok) do
|
25
|
+
flash[:notice] = I18n.t("votes.update.success", scope: "decidim.elections")
|
26
|
+
end
|
27
|
+
on(:invalid) do
|
28
|
+
flash[:alert] = I18n.t("votes.update.error", scope: "decidim.elections")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def cast
|
34
|
+
@form = form(Voter::EncryptedVoteForm).from_params(params, election: election)
|
35
|
+
return render :cast_success, locals: { message_id: "PreviewMessageId", vote_id: nil } if preview?
|
36
|
+
|
37
|
+
Voter::CastVote.call(@form) do
|
38
|
+
on(:ok) do |vote|
|
39
|
+
render :cast_success, locals: { message_id: vote.message_id, vote_id: vote.id }
|
40
|
+
end
|
41
|
+
on(:invalid) do
|
42
|
+
render :cast_failed
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def verify
|
48
|
+
@form = form(Ballot::VerifyVoteForm).instance(election: election)
|
17
49
|
end
|
18
50
|
|
19
51
|
private
|
20
52
|
|
53
|
+
def vote
|
54
|
+
@vote ||= Decidim::Elections::Vote.find_by(id: params[:vote_id])
|
55
|
+
end
|
56
|
+
|
57
|
+
def pending_vote?
|
58
|
+
Decidim::Elections::Votes::PendingVotes.for.exists?(user: current_user, election: election)
|
59
|
+
end
|
60
|
+
|
21
61
|
def booth_mode
|
22
62
|
@booth_mode ||= if allowed_to? :vote, :election, election: election
|
23
63
|
:vote
|
@@ -34,6 +74,14 @@ module Decidim
|
|
34
74
|
end
|
35
75
|
end
|
36
76
|
|
77
|
+
def pending_vote_path
|
78
|
+
@pending_vote_path ||= if allowed_to? :view, :election, election: election
|
79
|
+
verify_election_vote_path(election)
|
80
|
+
else
|
81
|
+
elections_path
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
37
85
|
def elections
|
38
86
|
@elections ||= Election.where(component: current_component)
|
39
87
|
end
|
@@ -45,6 +93,10 @@ module Decidim
|
|
45
93
|
def questions
|
46
94
|
@questions ||= election.questions.includes(:answers).order(weight: :asc, id: :asc)
|
47
95
|
end
|
96
|
+
|
97
|
+
def preview?
|
98
|
+
booth_mode == :preview
|
99
|
+
end
|
48
100
|
end
|
49
101
|
end
|
50
102
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
module Admin
|
6
|
+
# The main admin application controller for the voting space
|
7
|
+
class ApplicationController < Decidim::Admin::ApplicationController
|
8
|
+
register_permissions(::Decidim::Votings::Admin::ApplicationController,
|
9
|
+
Decidim::Votings::Admin::Permissions,
|
10
|
+
Decidim::Admin::Permissions)
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def permissions_context
|
15
|
+
super.merge(
|
16
|
+
current_participatory_space: try(:current_participatory_space)
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def permission_class_chain
|
21
|
+
::Decidim.permissions_registry.chain_for(::Decidim::Votings::Admin::ApplicationController)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing the Voting's Component
|
7
|
+
# permissions in the admin panel.
|
8
|
+
class ComponentPermissionsController < Decidim::Admin::ComponentPermissionsController
|
9
|
+
include VotingAdmin
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing the Voting's Components in the
|
7
|
+
# admin panel.
|
8
|
+
class ComponentsController < Decidim::Admin::ComponentsController
|
9
|
+
layout "decidim/admin/voting"
|
10
|
+
|
11
|
+
include VotingAdmin
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
module Admin
|
6
|
+
# This controller allows to create or delete a monitoring committee member.
|
7
|
+
class MonitoringCommitteeMembersController < Admin::ApplicationController
|
8
|
+
include VotingAdmin
|
9
|
+
|
10
|
+
helper_method :current_voting, :monitoring_committee_members, :monitoring_committee_member
|
11
|
+
|
12
|
+
def new
|
13
|
+
enforce_permission_to :create, :monitoring_committee_member, voting: current_voting
|
14
|
+
@form = form(MonitoringCommitteeMemberForm).instance
|
15
|
+
end
|
16
|
+
|
17
|
+
def create
|
18
|
+
enforce_permission_to :create, :monitoring_committee_member, voting: current_voting
|
19
|
+
@form = form(MonitoringCommitteeMemberForm).from_params(params, voting: current_voting)
|
20
|
+
|
21
|
+
CreateMonitoringCommitteeMember.call(@form, current_user, current_voting) do
|
22
|
+
on(:ok) do
|
23
|
+
flash[:notice] = I18n.t("monitoring_committee_members.create.success", scope: "decidim.votings.admin")
|
24
|
+
redirect_to voting_monitoring_committee_members_path(current_voting)
|
25
|
+
end
|
26
|
+
|
27
|
+
on(:invalid) do
|
28
|
+
flash.now[:alert] = I18n.t("monitoring_committee_members.create.invalid", scope: "decidim.votings.admin")
|
29
|
+
render action: "new"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy
|
35
|
+
enforce_permission_to :delete, :monitoring_committee_member, voting: current_voting, monitoring_committee_member: monitoring_committee_member
|
36
|
+
|
37
|
+
DestroyMonitoringCommitteeMember.call(monitoring_committee_member, current_user) do
|
38
|
+
on(:ok) do
|
39
|
+
flash[:notice] = I18n.t("monitoring_committee_members.destroy.success", scope: "decidim.votings.admin")
|
40
|
+
end
|
41
|
+
|
42
|
+
on(:invalid) do
|
43
|
+
flash.now[:alert] = I18n.t("monitoring_committee_members.destroy.invalid", scope: "decidim.votings.admin")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
redirect_to voting_monitoring_committee_members_path(current_voting)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def monitoring_committee_members
|
53
|
+
@monitoring_committee_members ||= current_voting.monitoring_committee_members
|
54
|
+
end
|
55
|
+
|
56
|
+
def monitoring_committee_member
|
57
|
+
@monitoring_committee_member ||= monitoring_committee_members.find(params[:id])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
module Admin
|
6
|
+
# This controller allows to create or update a polling officer.
|
7
|
+
class PollingOfficersController < Admin::ApplicationController
|
8
|
+
include Decidim::PollingOfficers::Admin::Filterable
|
9
|
+
include VotingAdmin
|
10
|
+
|
11
|
+
helper_method :current_voting, :polling_officers, :polling_officer, :filtered_polling_officers
|
12
|
+
|
13
|
+
def new
|
14
|
+
enforce_permission_to :create, :polling_officer, voting: current_voting
|
15
|
+
@form = form(PollingOfficerForm).instance
|
16
|
+
end
|
17
|
+
|
18
|
+
def create
|
19
|
+
enforce_permission_to :create, :polling_officer, voting: current_voting
|
20
|
+
@form = form(PollingOfficerForm).from_params(params, voting: current_voting)
|
21
|
+
|
22
|
+
CreatePollingOfficer.call(@form, current_user, current_voting) do
|
23
|
+
on(:ok) do
|
24
|
+
flash[:notice] = I18n.t("polling_officers.create.success", scope: "decidim.votings.admin")
|
25
|
+
redirect_to voting_polling_officers_path(current_voting)
|
26
|
+
end
|
27
|
+
|
28
|
+
on(:invalid) do
|
29
|
+
flash.now[:alert] = I18n.t("polling_officers.create.invalid", scope: "decidim.votings.admin")
|
30
|
+
render action: "new"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy
|
36
|
+
enforce_permission_to :delete, :polling_officer, voting: current_voting, polling_officer: polling_officer
|
37
|
+
|
38
|
+
DestroyPollingOfficer.call(polling_officer, current_user) do
|
39
|
+
on(:ok) do
|
40
|
+
flash[:notice] = I18n.t("polling_officers.destroy.success", scope: "decidim.votings.admin")
|
41
|
+
end
|
42
|
+
|
43
|
+
on(:invalid) do
|
44
|
+
flash.now[:alert] = I18n.t("polling_officers.destroy.invalid", scope: "decidim.votings.admin")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
redirect_to voting_polling_officers_path(current_voting)
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def polling_officers
|
54
|
+
@polling_officers ||= current_voting.polling_officers
|
55
|
+
end
|
56
|
+
|
57
|
+
def polling_officer
|
58
|
+
@polling_officer ||= polling_officers.find(params[:id])
|
59
|
+
end
|
60
|
+
|
61
|
+
alias collection polling_officers
|
62
|
+
alias filtered_polling_officers filtered_collection
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|