decidim-elections 0.23.3 → 0.24.0.rc1
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/_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 +39 -6
- data/config/locales/cs.yml +640 -6
- data/config/locales/de.yml +635 -6
- data/config/locales/el.yml +0 -2
- data/config/locales/en.yml +636 -6
- data/config/locales/es-MX.yml +6 -10
- data/config/locales/es-PY.yml +6 -10
- data/config/locales/es.yml +6 -10
- data/config/locales/fi-plain.yml +635 -6
- data/config/locales/fi.yml +635 -6
- data/config/locales/fr-CA.yml +422 -6
- data/config/locales/fr.yml +422 -6
- data/config/locales/gl.yml +63 -6
- data/config/locales/it.yml +97 -6
- data/config/locales/ja.yml +8 -6
- data/config/locales/lv.yml +0 -2
- data/config/locales/nl.yml +498 -6
- data/config/locales/no.yml +0 -5
- data/config/locales/pl.yml +579 -9
- data/config/locales/pt.yml +0 -6
- data/config/locales/ro-RO.yml +0 -6
- data/config/locales/sv.yml +7 -6
- data/config/locales/tr-TR.yml +114 -6
- data/config/locales/zh-CN.yml +0 -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/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 +304 -21
- 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
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
autoload :ElectionAnswerType, "decidim/api/election_answer_type"
|
6
|
+
autoload :ElectionQuestionType, "decidim/api/election_question_type"
|
7
|
+
autoload :ElectionType, "decidim/api/election_type"
|
8
|
+
autoload :ElectionsType, "decidim/api/elections_type"
|
9
|
+
autoload :TrusteeType, "decidim/api/trustee_type"
|
10
|
+
end
|
11
|
+
end
|
@@ -9,9 +9,10 @@ Decidim.register_component(:elections) do |component|
|
|
9
9
|
component.stylesheet = "decidim/elections/elections"
|
10
10
|
component.permissions_class_name = "Decidim::Elections::Permissions"
|
11
11
|
component.query_type = "Decidim::Elections::ElectionsType"
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
component.on(:before_destroy) do |instance|
|
14
|
+
raise StandardError, "Can't remove this component" if Decidim::Elections::Election.where(component: instance).any?
|
15
|
+
end
|
15
16
|
|
16
17
|
# These actions permissions can be configured in the admin panel
|
17
18
|
component.actions = %w(vote)
|
@@ -43,6 +44,26 @@ Decidim.register_component(:elections) do |component|
|
|
43
44
|
resource.model_class_name = "Decidim::Elections::Answer"
|
44
45
|
end
|
45
46
|
|
47
|
+
component.exports :feedback_form_answers do |exports|
|
48
|
+
exports.collection do |_component, _user, resource_id|
|
49
|
+
Decidim::Forms::QuestionnaireUserAnswers.for(resource_id)
|
50
|
+
end
|
51
|
+
|
52
|
+
exports.formats %w(CSV JSON Excel FormPDF)
|
53
|
+
|
54
|
+
exports.serializer Decidim::Forms::UserAnswersSerializer
|
55
|
+
end
|
56
|
+
|
57
|
+
component.exports :elections do |exports|
|
58
|
+
exports.collection do |component_instance|
|
59
|
+
Decidim::Elections::Question.where(election: Decidim::Elections::Election.where(component: component_instance).bb_results_published).collect(&:answers).flatten
|
60
|
+
end
|
61
|
+
|
62
|
+
exports.include_in_open_data = true
|
63
|
+
|
64
|
+
exports.serializer Decidim::Elections::AnswerSerializer
|
65
|
+
end
|
66
|
+
|
46
67
|
component.seeds do |participatory_space|
|
47
68
|
admin_user = Decidim::User.find_by(
|
48
69
|
organization: participatory_space.organization,
|
@@ -65,64 +86,386 @@ Decidim.register_component(:elections) do |component|
|
|
65
86
|
Decidim::Component.create!(params)
|
66
87
|
end
|
67
88
|
|
68
|
-
|
69
|
-
|
89
|
+
# upcoming elections that may be published
|
90
|
+
2.times do
|
91
|
+
upcoming_election = Decidim.traceability.create!(
|
70
92
|
Decidim::Elections::Election,
|
71
93
|
admin_user,
|
72
94
|
{
|
73
95
|
component: component,
|
74
|
-
title: Decidim::Faker::Localized.sentence(2),
|
96
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
75
97
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
76
|
-
Decidim::Faker::Localized.paragraph(3)
|
98
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
77
99
|
end,
|
78
100
|
start_time: 3.weeks.from_now,
|
79
101
|
end_time: 3.weeks.from_now + 4.hours,
|
80
|
-
published_at: Faker::Boolean.boolean(0.5) ? 1.week.ago : nil
|
102
|
+
published_at: Faker::Boolean.boolean(true_ratio: 0.5) ? 1.week.ago : nil
|
103
|
+
},
|
104
|
+
visibility: "all"
|
105
|
+
)
|
106
|
+
|
107
|
+
rand(1...4).times do
|
108
|
+
upcoming_question = Decidim.traceability.create!(
|
109
|
+
Decidim::Elections::Question,
|
110
|
+
admin_user,
|
111
|
+
{
|
112
|
+
election: upcoming_election,
|
113
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
114
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
115
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
116
|
+
end,
|
117
|
+
max_selections: Faker::Number.between(from: 1, to: 3),
|
118
|
+
weight: Faker::Number.number(digits: 1),
|
119
|
+
random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
|
120
|
+
min_selections: Faker::Number.between(from: 0, to: 1)
|
121
|
+
},
|
122
|
+
visibility: "all"
|
123
|
+
)
|
124
|
+
|
125
|
+
rand(upcoming_question.max_selections...5).times do
|
126
|
+
answer = Decidim.traceability.create!(
|
127
|
+
Decidim::Elections::Answer,
|
128
|
+
admin_user,
|
129
|
+
{
|
130
|
+
question: upcoming_question,
|
131
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
132
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
133
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
134
|
+
end,
|
135
|
+
weight: Faker::Number.number(digits: 1),
|
136
|
+
selected: Faker::Boolean.boolean(true_ratio: 0.2), # false
|
137
|
+
votes_count: 0
|
138
|
+
},
|
139
|
+
visibility: "all"
|
140
|
+
)
|
141
|
+
|
142
|
+
Decidim::Attachment.create!(
|
143
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
144
|
+
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
145
|
+
attached_to: answer,
|
146
|
+
file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
|
147
|
+
)
|
148
|
+
end
|
149
|
+
|
150
|
+
questionnaire = Decidim::Forms::Questionnaire.create!(
|
151
|
+
title: Decidim::Faker::Localized.paragraph,
|
152
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
153
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
154
|
+
end,
|
155
|
+
tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
156
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 2)
|
157
|
+
end,
|
158
|
+
questionnaire_for: upcoming_election
|
159
|
+
)
|
160
|
+
|
161
|
+
%w(short_answer long_answer).each do |text_question_type|
|
162
|
+
Decidim::Forms::Question.create!(
|
163
|
+
questionnaire: questionnaire,
|
164
|
+
body: Decidim::Faker::Localized.paragraph,
|
165
|
+
question_type: text_question_type
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
%w(single_option multiple_option).each do |multiple_choice_question_type|
|
170
|
+
question = Decidim::Forms::Question.create!(
|
171
|
+
questionnaire: questionnaire,
|
172
|
+
body: Decidim::Faker::Localized.paragraph,
|
173
|
+
question_type: multiple_choice_question_type
|
174
|
+
)
|
175
|
+
|
176
|
+
3.times do
|
177
|
+
question.answer_options.create!(body: Decidim::Faker::Localized.sentence)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# finished elections that may be published, with questionnaire
|
184
|
+
2.times do
|
185
|
+
finished_election = Decidim.traceability.create!(
|
186
|
+
Decidim::Elections::Election,
|
187
|
+
admin_user,
|
188
|
+
{
|
189
|
+
component: component,
|
190
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
191
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
192
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
193
|
+
end,
|
194
|
+
start_time: 4.weeks.ago,
|
195
|
+
end_time: 3.weeks.ago,
|
196
|
+
published_at: 4.weeks.ago
|
197
|
+
},
|
198
|
+
visibility: "all"
|
199
|
+
)
|
200
|
+
|
201
|
+
rand(1...4).times do
|
202
|
+
finished_question = Decidim.traceability.create!(
|
203
|
+
Decidim::Elections::Question,
|
204
|
+
admin_user,
|
205
|
+
{
|
206
|
+
election: finished_election,
|
207
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
208
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
209
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
210
|
+
end,
|
211
|
+
max_selections: 2,
|
212
|
+
weight: Faker::Number.number(digits: 1),
|
213
|
+
random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
|
214
|
+
min_selections: Faker::Number.between(from: 0, to: 1)
|
215
|
+
},
|
216
|
+
visibility: "all"
|
217
|
+
)
|
218
|
+
|
219
|
+
rand(2...5).times do
|
220
|
+
answer = Decidim.traceability.create!(
|
221
|
+
Decidim::Elections::Answer,
|
222
|
+
admin_user,
|
223
|
+
{
|
224
|
+
question: finished_question,
|
225
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
226
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
227
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
228
|
+
end,
|
229
|
+
weight: Faker::Number.number(digits: 1),
|
230
|
+
selected: Faker::Boolean.boolean(true_ratio: 0.2), # false
|
231
|
+
votes_count: 0
|
232
|
+
},
|
233
|
+
visibility: "all"
|
234
|
+
)
|
235
|
+
|
236
|
+
Decidim::Attachment.create!(
|
237
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
238
|
+
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
239
|
+
attached_to: answer,
|
240
|
+
file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
|
241
|
+
)
|
242
|
+
end
|
243
|
+
|
244
|
+
questionnaire = Decidim::Forms::Questionnaire.create!(
|
245
|
+
title: Decidim::Faker::Localized.paragraph,
|
246
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
247
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
248
|
+
end,
|
249
|
+
tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
250
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 2)
|
251
|
+
end,
|
252
|
+
questionnaire_for: finished_election
|
253
|
+
)
|
254
|
+
|
255
|
+
%w(short_answer long_answer).each do |text_question_type|
|
256
|
+
Decidim::Forms::Question.create!(
|
257
|
+
questionnaire: questionnaire,
|
258
|
+
body: Decidim::Faker::Localized.paragraph,
|
259
|
+
question_type: text_question_type
|
260
|
+
)
|
261
|
+
end
|
262
|
+
|
263
|
+
%w(single_option multiple_option).each do |multiple_choice_question_type|
|
264
|
+
question = Decidim::Forms::Question.create!(
|
265
|
+
questionnaire: questionnaire,
|
266
|
+
body: Decidim::Faker::Localized.paragraph,
|
267
|
+
question_type: multiple_choice_question_type
|
268
|
+
)
|
269
|
+
|
270
|
+
3.times do
|
271
|
+
question.answer_options.create!(body: Decidim::Faker::Localized.sentence)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# finished, published elections with results and with questionnaire
|
278
|
+
2.times do
|
279
|
+
election_with_results = Decidim.traceability.create!(
|
280
|
+
Decidim::Elections::Election,
|
281
|
+
admin_user,
|
282
|
+
{
|
283
|
+
component: component,
|
284
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
285
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
286
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
287
|
+
end,
|
288
|
+
start_time: 4.weeks.ago,
|
289
|
+
end_time: 3.weeks.ago,
|
290
|
+
published_at: 3.weeks.ago,
|
291
|
+
bb_status: "results_published"
|
292
|
+
|
81
293
|
},
|
82
294
|
visibility: "all"
|
83
295
|
)
|
84
296
|
|
85
|
-
|
86
|
-
|
297
|
+
rand(1...4).times do
|
298
|
+
result_question = Decidim.traceability.create!(
|
87
299
|
Decidim::Elections::Question,
|
88
300
|
admin_user,
|
89
301
|
{
|
90
|
-
election:
|
91
|
-
title: Decidim::Faker::Localized.sentence(2),
|
302
|
+
election: election_with_results,
|
303
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
92
304
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
93
|
-
Decidim::Faker::Localized.paragraph(3)
|
305
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
94
306
|
end,
|
95
|
-
max_selections:
|
96
|
-
weight: Faker::Number.number(1),
|
97
|
-
random_answers_order: Faker::Boolean.boolean(0.5),
|
98
|
-
min_selections: Faker::Number.between(0, 1)
|
307
|
+
max_selections: 2,
|
308
|
+
weight: Faker::Number.number(digits: 1),
|
309
|
+
random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
|
310
|
+
min_selections: Faker::Number.between(from: 0, to: 1)
|
99
311
|
},
|
100
312
|
visibility: "all"
|
101
313
|
)
|
102
314
|
|
103
|
-
|
315
|
+
rand(2...5).times do
|
104
316
|
answer = Decidim.traceability.create!(
|
105
317
|
Decidim::Elections::Answer,
|
106
318
|
admin_user,
|
107
319
|
{
|
108
|
-
question:
|
109
|
-
title: Decidim::Faker::Localized.sentence(2),
|
320
|
+
question: result_question,
|
321
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
110
322
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
111
|
-
Decidim::Faker::Localized.paragraph(3)
|
323
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
112
324
|
end,
|
113
|
-
weight: Faker::Number.number(1)
|
325
|
+
weight: Faker::Number.number(digits: 1),
|
326
|
+
selected: Faker::Boolean.boolean(true_ratio: 0.5),
|
327
|
+
votes_count: Faker::Number.number(digits: 3)
|
114
328
|
},
|
115
329
|
visibility: "all"
|
116
330
|
)
|
117
331
|
|
118
332
|
Decidim::Attachment.create!(
|
119
|
-
title: Decidim::Faker::Localized.sentence(2),
|
120
|
-
description: Decidim::Faker::Localized.sentence(5),
|
333
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
334
|
+
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
121
335
|
attached_to: answer,
|
122
336
|
file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
|
123
337
|
)
|
124
338
|
end
|
339
|
+
|
340
|
+
questionnaire = Decidim::Forms::Questionnaire.create!(
|
341
|
+
title: Decidim::Faker::Localized.paragraph,
|
342
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
343
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
344
|
+
end,
|
345
|
+
tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
346
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 2)
|
347
|
+
end,
|
348
|
+
questionnaire_for: election_with_results
|
349
|
+
)
|
350
|
+
|
351
|
+
%w(short_answer long_answer).each do |text_question_type|
|
352
|
+
Decidim::Forms::Question.create!(
|
353
|
+
questionnaire: questionnaire,
|
354
|
+
body: Decidim::Faker::Localized.paragraph,
|
355
|
+
question_type: text_question_type
|
356
|
+
)
|
357
|
+
end
|
358
|
+
|
359
|
+
%w(single_option multiple_option).each do |multiple_choice_question_type|
|
360
|
+
question = Decidim::Forms::Question.create!(
|
361
|
+
questionnaire: questionnaire,
|
362
|
+
body: Decidim::Faker::Localized.paragraph,
|
363
|
+
question_type: multiple_choice_question_type
|
364
|
+
)
|
365
|
+
|
366
|
+
3.times do
|
367
|
+
question.answer_options.create!(body: Decidim::Faker::Localized.sentence)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
# ongoing election that is published
|
374
|
+
ongoing_election = Decidim.traceability.create!(
|
375
|
+
Decidim::Elections::Election,
|
376
|
+
admin_user,
|
377
|
+
{
|
378
|
+
component: component,
|
379
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
380
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
381
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
382
|
+
end,
|
383
|
+
start_time: 2.weeks.ago,
|
384
|
+
end_time: 2.weeks.from_now + 4.hours,
|
385
|
+
published_at: 3.weeks.ago
|
386
|
+
},
|
387
|
+
visibility: "all"
|
388
|
+
)
|
389
|
+
|
390
|
+
rand(1...4).times do
|
391
|
+
ongoing_question = Decidim.traceability.create!(
|
392
|
+
Decidim::Elections::Question,
|
393
|
+
admin_user,
|
394
|
+
{
|
395
|
+
election: ongoing_election,
|
396
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
397
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
398
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
399
|
+
end,
|
400
|
+
max_selections: 2,
|
401
|
+
weight: Faker::Number.number(digits: 1),
|
402
|
+
random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
|
403
|
+
min_selections: Faker::Number.between(from: 0, to: 1)
|
404
|
+
},
|
405
|
+
visibility: "all"
|
406
|
+
)
|
407
|
+
|
408
|
+
rand(3...5).times do
|
409
|
+
answer = Decidim.traceability.create!(
|
410
|
+
Decidim::Elections::Answer,
|
411
|
+
admin_user,
|
412
|
+
{
|
413
|
+
question: ongoing_question,
|
414
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
415
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
416
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
417
|
+
end,
|
418
|
+
weight: Faker::Number.number(digits: 1),
|
419
|
+
selected: Faker::Boolean.boolean(true_ratio: 0.2), # false
|
420
|
+
votes_count: 0
|
421
|
+
},
|
422
|
+
visibility: "all"
|
423
|
+
)
|
424
|
+
|
425
|
+
Decidim::Attachment.create!(
|
426
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
427
|
+
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
428
|
+
attached_to: answer,
|
429
|
+
file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
|
430
|
+
)
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
questionnaire = Decidim::Forms::Questionnaire.create!(
|
435
|
+
title: Decidim::Faker::Localized.paragraph,
|
436
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
437
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
438
|
+
end,
|
439
|
+
tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
440
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 2)
|
441
|
+
end,
|
442
|
+
questionnaire_for: ongoing_election
|
443
|
+
)
|
444
|
+
|
445
|
+
%w(short_answer long_answer).each do |text_question_type|
|
446
|
+
Decidim::Forms::Question.create!(
|
447
|
+
questionnaire: questionnaire,
|
448
|
+
body: Decidim::Faker::Localized.paragraph,
|
449
|
+
question_type: text_question_type
|
450
|
+
)
|
451
|
+
end
|
452
|
+
|
453
|
+
%w(single_option multiple_option).each do |multiple_choice_question_type|
|
454
|
+
question = Decidim::Forms::Question.create!(
|
455
|
+
questionnaire: questionnaire,
|
456
|
+
body: Decidim::Faker::Localized.paragraph,
|
457
|
+
question_type: multiple_choice_question_type
|
458
|
+
)
|
459
|
+
|
460
|
+
3.times do
|
461
|
+
question.answer_options.create!(body: Decidim::Faker::Localized.sentence)
|
125
462
|
end
|
126
463
|
end
|
127
464
|
end
|
128
465
|
end
|
466
|
+
|
467
|
+
Decidim.register_global_engine(
|
468
|
+
:decidim_elections_trustee_zone,
|
469
|
+
Decidim::Elections::TrusteeZoneEngine,
|
470
|
+
at: "/trustee"
|
471
|
+
)
|