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,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimElectionsVotings < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_votings_votings do |t|
|
6
|
+
t.string :slug, null: false, index: true
|
7
|
+
t.jsonb :title, null: false
|
8
|
+
t.jsonb :description, null: false
|
9
|
+
t.datetime :start_time
|
10
|
+
t.datetime :end_time
|
11
|
+
t.string :banner_image
|
12
|
+
t.string :introductory_image
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
|
16
|
+
t.references :decidim_scope, index: true
|
17
|
+
t.references :decidim_organization, foreign_key: true, index: true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimElectionsActions < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_elections_actions do |t|
|
6
|
+
t.belongs_to :decidim_elections_election, null: false, index: { name: "index_elections_actions_on_decidim_elections_election_id" }
|
7
|
+
t.integer :action, null: false
|
8
|
+
t.string :message_id, null: false
|
9
|
+
t.integer :status, null: false
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddVotingsPollingStations < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_votings_polling_stations do |t|
|
6
|
+
t.jsonb :title, null: false
|
7
|
+
t.text :address
|
8
|
+
t.float :latitude
|
9
|
+
t.float :longitude
|
10
|
+
t.jsonb :location
|
11
|
+
t.jsonb :location_hints
|
12
|
+
t.references :decidim_votings_voting,
|
13
|
+
null: false,
|
14
|
+
index: { name: "decidim_votings_votings_polling_stations" }
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddPollingOfficersToVotings < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_votings_polling_officers do |t|
|
6
|
+
t.references :decidim_votings_voting, index: { name: "decidim_votings_votings_polling_officers" }
|
7
|
+
t.references :decidim_user, index: true
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/db/migrate/20210210090738_add_votings_polling_station_references_to_votings_polling_officer.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddVotingsPollingStationReferencesToVotingsPollingOfficer < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_votings_polling_officers, :managed_polling_station_id, :integer
|
6
|
+
add_column :decidim_votings_polling_officers, :presided_polling_station_id, :integer
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddMonitoringCommitteeMember < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_votings_monitoring_committee_members do |t|
|
6
|
+
t.references :decidim_votings_voting, index: { name: "decidim_votings_votings_monitoring_committee_members" }
|
7
|
+
t.references :decidim_user, index: { name: "decidim_users_votings_monitoring_committee_members" }
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/db/seeds/city.jpeg
ADDED
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This type represents an answer to an election question.
|
6
|
+
# The name is different from the model because to enforce consistency with Question type name.
|
7
|
+
class ElectionAnswerType < Decidim::Api::Types::BaseObject
|
8
|
+
implements Decidim::Core::AttachableInterface
|
9
|
+
implements Decidim::Core::TraceableInterface
|
10
|
+
|
11
|
+
description "An answer for an election's question"
|
12
|
+
|
13
|
+
field :id, GraphQL::Types::ID, "The internal ID of this answer", null: false
|
14
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this answer", null: false
|
15
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this answer", null: true
|
16
|
+
field :weight, GraphQL::Types::Int, "The ordering weight for this answer", null: true
|
17
|
+
field :votes_count, GraphQL::Types::Int, "The votes for this answer", null: true, camelize: false
|
18
|
+
field :selected, GraphQL::Types::Boolean, "Is this answer selected?", null: true
|
19
|
+
|
20
|
+
field :proposals, [Decidim::Proposals::ProposalType, { null: true }], "The proposals related to this answer", null: true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This type represents an election Question.
|
6
|
+
# The name is different from the model because the Question type is already defined on the Forms module.
|
7
|
+
class ElectionQuestionType < Decidim::Api::Types::BaseObject
|
8
|
+
implements Decidim::Core::TraceableInterface
|
9
|
+
|
10
|
+
description "A question for an election"
|
11
|
+
|
12
|
+
field :id, GraphQL::Types::ID, "The internal ID of this question", null: false
|
13
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this question", null: false
|
14
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this question", null: false
|
15
|
+
field :max_selections, GraphQL::Types::Int, "The maximum number of possible selections for this question", null: false
|
16
|
+
field :weight, GraphQL::Types::Int, "The ordering weight for this question", null: true
|
17
|
+
field :random_answers_order, GraphQL::Types::Boolean, "Should this question order answers in random order?", null: true
|
18
|
+
field :min_selections, GraphQL::Types::Int, "The minimum number of possible selections for this question", null: false
|
19
|
+
field :answers, [Decidim::Elections::ElectionAnswerType, { null: true }], "The answers for this question", null: false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This type represents an Election.
|
6
|
+
class ElectionType < Decidim::Api::Types::BaseObject
|
7
|
+
implements Decidim::Core::AttachableInterface
|
8
|
+
implements Decidim::Core::TraceableInterface
|
9
|
+
|
10
|
+
description "An election"
|
11
|
+
|
12
|
+
field :id, GraphQL::Types::ID, "The internal ID of this election", null: false
|
13
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this election", null: false
|
14
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this election", null: false
|
15
|
+
field :start_time, Decidim::Core::DateTimeType, "The start time for this election", null: false
|
16
|
+
field :end_time, Decidim::Core::DateTimeType, "The end time for this election", null: false
|
17
|
+
field :created_at, Decidim::Core::DateTimeType, "When this election was created", null: true
|
18
|
+
field :updated_at, Decidim::Core::DateTimeType, "When this election was updated", null: true
|
19
|
+
field :published_at, Decidim::Core::DateTimeType, "When this election was published", null: true
|
20
|
+
field :blocked, GraphQL::Types::Boolean, "Whether this election has it's parameters blocked or not", method: :blocked?, null: true
|
21
|
+
field :bb_status, GraphQL::Types::String, "The status for this election in the bulletin board", null: true, camelize: false
|
22
|
+
|
23
|
+
field :questions, [Decidim::Elections::ElectionQuestionType, { null: true }], "The questions for this election", null: false
|
24
|
+
field :trustees, [Decidim::Elections::TrusteeType, { null: true }], "The trustees for this election", null: false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
class ElectionsType < Decidim::Api::Types::BaseObject
|
6
|
+
implements Decidim::Core::ComponentInterface
|
7
|
+
|
8
|
+
graphql_name "Elections"
|
9
|
+
description "An elections component of a participatory space."
|
10
|
+
|
11
|
+
field :elections, Decidim::Elections::ElectionType.connection_type, null: true, connection: true
|
12
|
+
|
13
|
+
def elections
|
14
|
+
ElectionsTypeHelper.base_scope(object).includes(:component)
|
15
|
+
end
|
16
|
+
|
17
|
+
field :election, Decidim::Elections::ElectionType, null: true do
|
18
|
+
argument :id, GraphQL::Types::ID, required: true
|
19
|
+
end
|
20
|
+
|
21
|
+
def election(**args)
|
22
|
+
ElectionsTypeHelper.base_scope(object).find_by(id: args[:id])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module ElectionsTypeHelper
|
27
|
+
def self.base_scope(component)
|
28
|
+
Election.where(component: component).where.not(published_at: nil)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This type represents an election trustee.
|
6
|
+
class TrusteeType < Decidim::Api::Types::BaseObject
|
7
|
+
implements Decidim::Core::TraceableInterface
|
8
|
+
|
9
|
+
description "A trustee for an election"
|
10
|
+
|
11
|
+
field :id, GraphQL::Types::ID, "The internal ID of this trustee", null: false
|
12
|
+
field :user, Decidim::Core::UserType, "The corresponding decidim user", null: true
|
13
|
+
field :public_key, GraphQL::Types::String, "The public key of a trustee", null: true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
# This type represents a voting space.
|
6
|
+
class VotingType < Decidim::Api::Types::BaseObject
|
7
|
+
implements Decidim::Core::ParticipatorySpaceInterface
|
8
|
+
implements Decidim::Core::ScopableInterface
|
9
|
+
|
10
|
+
description "A voting space"
|
11
|
+
|
12
|
+
field :slug, String, null: false
|
13
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description of this voting space.", null: true
|
14
|
+
field :start_time, Decidim::Core::DateTimeType, "The start time for this voting space.", null: false
|
15
|
+
field :end_time, Decidim::Core::DateTimeType, "The end time for this voting space", null: false
|
16
|
+
field :created_at, Decidim::Core::DateTimeType, "The time this voting was created", null: false
|
17
|
+
field :updated_at, Decidim::Core::DateTimeType, "The time this voting was updated", null: false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/decidim/elections.rb
CHANGED
@@ -1,18 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "decidim/elections/admin"
|
4
|
+
require "decidim/elections/api"
|
5
|
+
require "decidim/elections/trustee_zone"
|
4
6
|
require "decidim/elections/engine"
|
5
7
|
require "decidim/elections/admin_engine"
|
8
|
+
require "decidim/elections/trustee_zone_engine"
|
6
9
|
require "decidim/elections/component"
|
10
|
+
require "decidim/bulletin_board"
|
11
|
+
require "decidim/votings"
|
7
12
|
|
8
13
|
module Decidim
|
9
14
|
# This namespace holds the logic of the `Elections` component. This component
|
10
15
|
# allows users to create elections in a participatory space.
|
11
16
|
module Elections
|
12
|
-
autoload :
|
17
|
+
autoload :AnswerSerializer, "decidim/elections/answer_serializer"
|
18
|
+
|
19
|
+
include ActiveSupport::Configurable
|
13
20
|
|
14
21
|
def self.bulletin_board
|
15
|
-
@bulletin_board ||=
|
22
|
+
@bulletin_board ||= Decidim::BulletinBoard::Client.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public Setting that defines how many hours should the setup be run before the election starts
|
26
|
+
config_accessor :setup_minimum_hours_before_start do
|
27
|
+
3
|
28
|
+
end
|
29
|
+
|
30
|
+
# Public Setting that defines how many hours the ballot box can be opened before the election starts
|
31
|
+
config_accessor :start_vote_maximum_hours_before_start do
|
32
|
+
6
|
16
33
|
end
|
17
34
|
end
|
18
35
|
end
|
@@ -10,24 +10,65 @@ module Decidim
|
|
10
10
|
paths["lib/tasks"] = nil
|
11
11
|
|
12
12
|
routes do
|
13
|
+
get "/answer_options", to: "feedback_forms#answer_options", as: :answer_options_election_feedback, defaults: { format: "json" }
|
14
|
+
|
13
15
|
resources :elections do
|
16
|
+
resources :steps, only: [:index, :update] do
|
17
|
+
get :stats
|
18
|
+
end
|
14
19
|
member do
|
15
20
|
put :publish
|
16
21
|
put :unpublish
|
22
|
+
resource :feedback_form, only: [:edit, :update] do
|
23
|
+
collection do
|
24
|
+
get :answers, to: "feedback_forms#index"
|
25
|
+
get "/answer/:session_token", to: "feedback_forms#show", as: :answer
|
26
|
+
get "/answer/:session_token/export", to: "feedback_forms#export_response", as: :answer_export
|
27
|
+
end
|
28
|
+
end
|
17
29
|
end
|
18
30
|
resources :questions do
|
19
31
|
resources :answers do
|
20
|
-
get :proposals_picker, on: :collection
|
21
32
|
collection do
|
33
|
+
get :proposals_picker
|
22
34
|
resource :proposals_import, only: [:new, :create]
|
23
35
|
end
|
36
|
+
member do
|
37
|
+
put :select
|
38
|
+
put :unselect
|
39
|
+
end
|
24
40
|
end
|
25
41
|
end
|
26
42
|
end
|
27
43
|
|
44
|
+
resources :trustees, only: [:index, :new, :edit, :create, :destroy], controller: "trustees_participatory_spaces"
|
45
|
+
|
28
46
|
root to: "elections#index"
|
29
47
|
end
|
30
48
|
|
49
|
+
def self.participatory_space_endpoints
|
50
|
+
[:trustees]
|
51
|
+
end
|
52
|
+
|
53
|
+
initializer "decidim_admin_elections.view_hooks" do
|
54
|
+
Decidim::Admin.view_hooks.register(:admin_secondary_nav, priority: Decidim::ViewHooks::MEDIUM_PRIORITY) do |view_context|
|
55
|
+
component = view_context.current_participatory_space.components.find_by(manifest_name: :elections)
|
56
|
+
if component
|
57
|
+
view_context.render(
|
58
|
+
partial: "decidim/elections/admin/shared/trustees_secondary_nav",
|
59
|
+
locals: {
|
60
|
+
current_component: component,
|
61
|
+
engine_router: Decidim::EngineRouter.admin_proxy(component)
|
62
|
+
}
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
initializer "decidim_elections.assets" do |app|
|
69
|
+
app.config.assets.precompile += %w(decidim_elections_manifest.js decidim_elections_manifest.css)
|
70
|
+
end
|
71
|
+
|
31
72
|
def load_seed
|
32
73
|
nil
|
33
74
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This class serializes an Answer so it can be exported to CSV, JSON or other
|
6
|
+
# formats.
|
7
|
+
class AnswerSerializer < Decidim::Exporters::Serializer
|
8
|
+
include Decidim::ApplicationHelper
|
9
|
+
include Decidim::ResourceHelper
|
10
|
+
include Decidim::TranslationsHelper
|
11
|
+
|
12
|
+
# Public: Initializes the serializer with an answer.
|
13
|
+
def initialize(answer)
|
14
|
+
@answer = answer
|
15
|
+
end
|
16
|
+
|
17
|
+
# Public: Exports a hash with the serialized data for this answer.
|
18
|
+
def serialize
|
19
|
+
{
|
20
|
+
participatory_space: {
|
21
|
+
id: election.participatory_space.id,
|
22
|
+
title: election.participatory_space.title
|
23
|
+
},
|
24
|
+
id: answer.id,
|
25
|
+
election_id: election.id,
|
26
|
+
election_title: election.title,
|
27
|
+
question_id: question.id,
|
28
|
+
question_title: question.title,
|
29
|
+
answer_id: answer.id,
|
30
|
+
answer_title: answer.title,
|
31
|
+
answer_votes: answer.votes_count
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :answer
|
38
|
+
|
39
|
+
def election
|
40
|
+
answer.question.election
|
41
|
+
end
|
42
|
+
|
43
|
+
def question
|
44
|
+
answer.question
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|