decidim-elections 0.23.2 → 0.24.0
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 +635 -6
- data/config/locales/cs.yml +635 -6
- data/config/locales/de.yml +635 -6
- data/config/locales/el.yml +4 -2
- data/config/locales/en.yml +636 -6
- data/config/locales/es-MX.yml +636 -7
- data/config/locales/es-PY.yml +636 -7
- data/config/locales/es.yml +636 -7
- data/config/locales/fi-plain.yml +636 -7
- data/config/locales/fi.yml +636 -7
- data/config/locales/fr-CA.yml +419 -6
- data/config/locales/fr.yml +419 -6
- data/config/locales/gl.yml +81 -4
- 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 +502 -6
- data/config/locales/no.yml +0 -6
- data/config/locales/pl.yml +656 -10
- data/config/locales/pt.yml +4 -6
- data/config/locales/ro-RO.yml +214 -6
- data/config/locales/sv.yml +12 -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
@@ -11,7 +11,14 @@ module Decidim
|
|
11
11
|
|
12
12
|
routes do
|
13
13
|
resources :elections, only: [:index, :show] do
|
14
|
-
resource :
|
14
|
+
resource :feedback, only: [:show] do
|
15
|
+
post :answer
|
16
|
+
end
|
17
|
+
|
18
|
+
resource :vote, only: [:new, :update] do
|
19
|
+
post :cast
|
20
|
+
get :verify
|
21
|
+
end
|
15
22
|
end
|
16
23
|
|
17
24
|
root to: "elections#index"
|
@@ -1,21 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "decidim/core/test/factories"
|
4
|
+
require "decidim/forms/test/factories"
|
4
5
|
|
5
6
|
FactoryBot.define do
|
7
|
+
sequence(:private_key) do
|
8
|
+
JWT::JWK.new(OpenSSL::PKey::RSA.new(4096))
|
9
|
+
end
|
10
|
+
|
6
11
|
factory :elections_component, parent: :component do
|
7
12
|
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :elections).i18n_name }
|
8
13
|
manifest_name { :elections }
|
9
|
-
participatory_space { create(:participatory_process, :with_steps) }
|
14
|
+
participatory_space { create(:participatory_process, :with_steps, organization: organization) }
|
10
15
|
end
|
11
16
|
|
12
17
|
factory :election, class: "Decidim::Elections::Election" do
|
18
|
+
transient do
|
19
|
+
organization { build(:organization) }
|
20
|
+
end
|
21
|
+
|
13
22
|
upcoming
|
14
23
|
title { generate_localized_title }
|
15
24
|
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
16
25
|
end_time { 3.days.from_now }
|
17
26
|
published_at { nil }
|
18
|
-
|
27
|
+
blocked_at { nil }
|
28
|
+
bb_status { nil }
|
29
|
+
questionnaire
|
30
|
+
component { create(:elections_component, organization: organization) }
|
31
|
+
|
32
|
+
trait :bb_test do
|
33
|
+
bb_status { "key_ceremony" }
|
34
|
+
id { (10_000 + Decidim::Elections::Election.bb_statuses.keys.index(bb_status)) }
|
35
|
+
end
|
19
36
|
|
20
37
|
trait :upcoming do
|
21
38
|
start_time { 1.day.from_now }
|
@@ -32,6 +49,7 @@ FactoryBot.define do
|
|
32
49
|
trait :finished do
|
33
50
|
started
|
34
51
|
end_time { 1.day.ago }
|
52
|
+
blocked_at { Time.current }
|
35
53
|
end
|
36
54
|
|
37
55
|
trait :published do
|
@@ -46,6 +64,97 @@ FactoryBot.define do
|
|
46
64
|
election.questions << build(:question, :nota, election: election, weight: 4)
|
47
65
|
end
|
48
66
|
end
|
67
|
+
|
68
|
+
trait :ready_for_setup do
|
69
|
+
transient do
|
70
|
+
trustee_keys { 2.times.map { [Faker::Name.name, generate(:private_key).export.to_json] }.to_h }
|
71
|
+
end
|
72
|
+
|
73
|
+
upcoming
|
74
|
+
published
|
75
|
+
complete
|
76
|
+
|
77
|
+
after(:create) do |election, evaluator|
|
78
|
+
evaluator.trustee_keys.each do |name, key|
|
79
|
+
create(:trustee, :with_public_key, name: name, election: election, public_key: key)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
trait :created do
|
85
|
+
ready_for_setup
|
86
|
+
blocked_at { start_time - 1.day }
|
87
|
+
|
88
|
+
start_time { 1.hour.from_now }
|
89
|
+
bb_status { "created" }
|
90
|
+
|
91
|
+
after(:create) do |election|
|
92
|
+
trustees_participatory_spaces = Decidim::Elections::TrusteesParticipatorySpace.where(participatory_space: election.component.participatory_space)
|
93
|
+
election.trustees << trustees_participatory_spaces.map(&:trustee)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
trait :key_ceremony do
|
98
|
+
created
|
99
|
+
bb_status { "key_ceremony" }
|
100
|
+
end
|
101
|
+
|
102
|
+
trait :key_ceremony_ended do
|
103
|
+
key_ceremony
|
104
|
+
bb_status { "key_ceremony_ended" }
|
105
|
+
end
|
106
|
+
|
107
|
+
trait :vote do
|
108
|
+
key_ceremony_ended
|
109
|
+
ongoing
|
110
|
+
bb_status { "vote" }
|
111
|
+
end
|
112
|
+
|
113
|
+
trait :vote_ended do
|
114
|
+
key_ceremony_ended
|
115
|
+
ongoing
|
116
|
+
finished
|
117
|
+
bb_status { "vote_ended" }
|
118
|
+
|
119
|
+
after(:build) do |election|
|
120
|
+
election.questions.each do |question|
|
121
|
+
question.answers.each do |answer|
|
122
|
+
answer.votes_count = Faker::Number.number(digits: 1)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
trait :tally do
|
129
|
+
vote_ended
|
130
|
+
bb_status { "tally" }
|
131
|
+
end
|
132
|
+
|
133
|
+
trait :tally_ended do
|
134
|
+
tally
|
135
|
+
bb_status { "tally_ended" }
|
136
|
+
end
|
137
|
+
|
138
|
+
trait :results_published do
|
139
|
+
tally_ended
|
140
|
+
bb_status { "results_published" }
|
141
|
+
end
|
142
|
+
|
143
|
+
trait :with_photos do
|
144
|
+
transient do
|
145
|
+
photos_number { 2 }
|
146
|
+
end
|
147
|
+
|
148
|
+
after :create do |election, evaluator|
|
149
|
+
evaluator.photos_number.times do
|
150
|
+
election.attachments << create(
|
151
|
+
:attachment,
|
152
|
+
:with_image,
|
153
|
+
attached_to: election
|
154
|
+
)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
49
158
|
end
|
50
159
|
|
51
160
|
factory :question, class: "Decidim::Elections::Question" do
|
@@ -59,7 +168,7 @@ FactoryBot.define do
|
|
59
168
|
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
60
169
|
min_selections { 1 }
|
61
170
|
max_selections { 1 }
|
62
|
-
weight { Faker::Number.number(1) }
|
171
|
+
weight { Faker::Number.number(digits: 1) }
|
63
172
|
random_answers_order { true }
|
64
173
|
|
65
174
|
trait :complete do
|
@@ -94,12 +203,100 @@ FactoryBot.define do
|
|
94
203
|
answers { 8 }
|
95
204
|
min_selections { 0 }
|
96
205
|
end
|
206
|
+
|
207
|
+
trait :with_votes do
|
208
|
+
after(:build) do |question, evaluator|
|
209
|
+
overrides = { question: question }
|
210
|
+
overrides[:description] = nil unless evaluator.more_information
|
211
|
+
question.answers = build_list(:election_answer, evaluator.answers, :with_votes, overrides)
|
212
|
+
end
|
213
|
+
end
|
97
214
|
end
|
98
215
|
|
99
216
|
factory :election_answer, class: "Decidim::Elections::Answer" do
|
100
217
|
question
|
101
218
|
title { generate_localized_title }
|
102
219
|
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
103
|
-
weight { Faker::Number.number(1) }
|
220
|
+
weight { Faker::Number.number(digits: 1) }
|
221
|
+
selected { false }
|
222
|
+
votes_count { 0 }
|
223
|
+
|
224
|
+
trait :with_votes do
|
225
|
+
votes_count { Faker::Number.number(digits: 1) }
|
226
|
+
end
|
227
|
+
|
228
|
+
trait :with_photos do
|
229
|
+
transient do
|
230
|
+
photos_number { 2 }
|
231
|
+
end
|
232
|
+
|
233
|
+
after :create do |election, evaluator|
|
234
|
+
evaluator.photos_number.times do
|
235
|
+
election.attachments << create(
|
236
|
+
:attachment,
|
237
|
+
:with_image,
|
238
|
+
attached_to: election
|
239
|
+
)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
factory :action, class: "Decidim::Elections::Action" do
|
246
|
+
election
|
247
|
+
message_id { "a.message+id" }
|
248
|
+
status { :pending }
|
249
|
+
action { :start_key_ceremony }
|
250
|
+
end
|
251
|
+
|
252
|
+
factory :trustee, class: "Decidim::Elections::Trustee" do
|
253
|
+
transient do
|
254
|
+
election { nil }
|
255
|
+
organization { election&.component&.participatory_space&.organization || create(:organization) }
|
256
|
+
end
|
257
|
+
|
258
|
+
public_key { nil }
|
259
|
+
user { build(:user, organization: organization) }
|
260
|
+
|
261
|
+
trait :considered do
|
262
|
+
after(:build) do |trustee, evaluator|
|
263
|
+
trustee.trustees_participatory_spaces << build(:trustees_participatory_space, trustee: trustee, election: evaluator.election, organization: evaluator.organization)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
trait :with_elections do
|
268
|
+
after(:build) do |trustee, evaluator|
|
269
|
+
trustee.elections << build(:election, :upcoming, organization: evaluator.organization)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
trait :with_public_key do
|
274
|
+
considered
|
275
|
+
name { Faker::Name.name }
|
276
|
+
public_key { generate(:private_key).export.to_json }
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
factory :trustees_participatory_space, class: "Decidim::Elections::TrusteesParticipatorySpace" do
|
281
|
+
transient do
|
282
|
+
organization { election&.component&.participatory_space&.organization || create(:organization) }
|
283
|
+
election { nil }
|
284
|
+
end
|
285
|
+
participatory_space { election&.component&.participatory_space || create(:participatory_process, organization: organization) }
|
286
|
+
considered { true }
|
287
|
+
trustee { create(:trustee, organization: organization) }
|
288
|
+
|
289
|
+
trait :trustee_ready do
|
290
|
+
association :trustee, :with_public_key
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
factory :vote, class: "Decidim::Elections::Vote" do
|
295
|
+
election { create(:election) }
|
296
|
+
sequence(:voter_id) { |n| "voter_#{n}" }
|
297
|
+
encrypted_vote_hash { "adf89asd0f89das7f" }
|
298
|
+
status { "pending" }
|
299
|
+
message_id { "decidim-test-authority.2.vote.cast+v.5826de088371d1b15b38f00c8203871caec07041ed0c8fb0c6fb875f0df763b6" }
|
300
|
+
user { build(:user) }
|
104
301
|
end
|
105
302
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This is the engine that runs on the public interface for trustees of `decidim-elections`.
|
6
|
+
# It mostly handles rendering the trustees frontend zone.
|
7
|
+
class TrusteeZoneEngine < ::Rails::Engine
|
8
|
+
isolate_namespace Decidim::Elections::TrusteeZone
|
9
|
+
|
10
|
+
paths["db/migrate"] = nil
|
11
|
+
paths["lib/tasks"] = nil
|
12
|
+
|
13
|
+
routes do
|
14
|
+
resource :trustee, path: "/", only: [:show, :update] do
|
15
|
+
resources :election, only: [] do
|
16
|
+
resource :elections, only: [:show, :update]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def load_seed
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
initializer "decidim_elections.trustee_zone.menu" do
|
26
|
+
Decidim.menu :user_menu do |menu|
|
27
|
+
menu.item I18n.t("menu.trustee_zone", scope: "decidim.elections.trustee_zone"),
|
28
|
+
decidim.decidim_elections_trustee_zone_path,
|
29
|
+
active: :inclusive,
|
30
|
+
if: Decidim::Elections::Trustee.trustee?(current_user)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/votings/admin"
|
4
|
+
require "decidim/votings/api"
|
5
|
+
require "decidim/votings/polling_officer_zone"
|
6
|
+
require "decidim/votings/engine"
|
7
|
+
require "decidim/votings/admin_engine"
|
8
|
+
require "decidim/votings/polling_officer_zone_engine"
|
9
|
+
require "decidim/votings/participatory_space"
|
10
|
+
|
11
|
+
module Decidim
|
12
|
+
# This namespace holds the logic of the `Votings` space.
|
13
|
+
module Votings
|
14
|
+
autoload :VotingSerializer, "decidim/votings/voting_serializer"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Votings
|
5
|
+
# Decidim's Votings Rails Admin Engine.
|
6
|
+
class AdminEngine < ::Rails::Engine
|
7
|
+
isolate_namespace Decidim::Votings::Admin
|
8
|
+
|
9
|
+
paths["db/migrate"] = nil
|
10
|
+
paths["lib/tasks"] = nil
|
11
|
+
|
12
|
+
routes do
|
13
|
+
resources :votings, param: :slug do
|
14
|
+
member do
|
15
|
+
put :publish
|
16
|
+
put :unpublish
|
17
|
+
get :available_polling_officers
|
18
|
+
get :polling_officers_picker
|
19
|
+
end
|
20
|
+
|
21
|
+
resource :landing_page, only: [:edit, :update], controller: "votings_landing_page" do
|
22
|
+
resources :content_blocks, only: [:edit, :update], controller: "votings_landing_page_content_blocks"
|
23
|
+
end
|
24
|
+
|
25
|
+
resources :polling_stations
|
26
|
+
resources :polling_officers, only: [:new, :create, :destroy, :index]
|
27
|
+
resources :monitoring_committee_members, only: [:new, :create, :destroy, :index]
|
28
|
+
resources :attachments, controller: "voting_attachments"
|
29
|
+
resources :attachment_collections, controller: "voting_attachment_collections"
|
30
|
+
end
|
31
|
+
|
32
|
+
scope "/votings/:voting_slug" do
|
33
|
+
resources :components do
|
34
|
+
resource :permissions, controller: "component_permissions"
|
35
|
+
member do
|
36
|
+
put :publish
|
37
|
+
put :unpublish
|
38
|
+
get :share
|
39
|
+
end
|
40
|
+
resources :exports, only: :create
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
scope "/votings/:voting_slug/components/:component_id/manage" do
|
45
|
+
Decidim.component_manifests.each do |manifest|
|
46
|
+
next unless manifest.admin_engine
|
47
|
+
|
48
|
+
constraints CurrentComponent.new(manifest) do
|
49
|
+
mount manifest.admin_engine, at: "/", as: "decidim_admin_voting_#{manifest.name}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
initializer "decidim_votings.admin_menu" do
|
56
|
+
Decidim.menu :admin_menu do |menu|
|
57
|
+
menu.item I18n.t("menu.votings", scope: "decidim.votings.admin"),
|
58
|
+
decidim_admin_votings.votings_path,
|
59
|
+
icon_name: "comment-square",
|
60
|
+
position: 2.6,
|
61
|
+
active: :inclusive,
|
62
|
+
if: allowed_to?(:enter, :space_area, space_name: :votings)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
initializer "decidim_votings.admin_assets" do |app|
|
67
|
+
app.config.assets.precompile += %w(admin/decidim_votings_manifest.js admin/decidim_votings_manifest.css)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/votings/query_extensions"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Votings
|
7
|
+
# This is the engine that runs on the public interface for Votings of `decidim-elections`.
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
isolate_namespace Decidim::Votings
|
10
|
+
|
11
|
+
paths["db/migrate"] = nil
|
12
|
+
paths["lib/tasks"] = nil
|
13
|
+
|
14
|
+
routes do
|
15
|
+
resources :votings, param: :slug, only: [:index, :show, :update]
|
16
|
+
|
17
|
+
get "votings/:voting_id", to: redirect { |params, _request|
|
18
|
+
voting = Decidim::Votings::Voting.find(params[:voting_id])
|
19
|
+
voting ? "/votings/#{voting.slug}" : "/404"
|
20
|
+
}, constraints: { voting_id: /[0-9]+/ }
|
21
|
+
|
22
|
+
get "/votings/:voting_id/f/:component_id", to: redirect { |params, _request|
|
23
|
+
voting = Decidim::Votings::Voting.find(params[:voting_id])
|
24
|
+
voting ? "/votings/#{voting.slug}/f/#{params[:component_id]}" : "/404"
|
25
|
+
}, constraints: { voting_id: /[0-9]+/ }
|
26
|
+
|
27
|
+
scope "/votings/:voting_slug/f/:component_id" do
|
28
|
+
Decidim.component_manifests.each do |manifest|
|
29
|
+
next unless manifest.engine
|
30
|
+
|
31
|
+
constraints CurrentComponent.new(manifest) do
|
32
|
+
mount manifest.engine, at: "/", as: "decidim_voting_#{manifest.name}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
initializer "decidim_votings.assets" do |app|
|
39
|
+
app.config.assets.precompile += %w(
|
40
|
+
decidim_votings_manifest.js
|
41
|
+
decidim_votings_manifest.css
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
initializer "decidim.stats" do
|
46
|
+
Decidim.stats.register :votings_count, priority: StatsRegistry::HIGH_PRIORITY do |organization, _start_at, _end_at|
|
47
|
+
Decidim::Votings::Voting.where(organization: organization).published.count
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
initializer "decidim_votings.add_cells_view_paths" do
|
52
|
+
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Votings::Engine.root}/app/cells")
|
53
|
+
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Votings::Engine.root}/app/views") # for partials
|
54
|
+
end
|
55
|
+
|
56
|
+
initializer "decidim_votings.menu" do
|
57
|
+
Decidim.menu :menu do |menu|
|
58
|
+
menu.item I18n.t("menu.votings", scope: "decidim"),
|
59
|
+
decidim_votings.votings_path,
|
60
|
+
position: 2.6,
|
61
|
+
if: Decidim::Votings::Voting.where(organization: current_organization).published.any?,
|
62
|
+
active: :inclusive
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
initializer "decidim_votings.content_blocks" do
|
67
|
+
Decidim.content_blocks.register(:homepage, :highlighted_votings) do |content_block|
|
68
|
+
content_block.cell = "decidim/votings/content_blocks/highlighted_votings"
|
69
|
+
content_block.public_name_key = "decidim.votings.content_blocks.highlighted_votings.name"
|
70
|
+
content_block.settings_form_cell = "decidim/votings/content_blocks/highlighted_votings_settings_form"
|
71
|
+
|
72
|
+
content_block.settings do |settings|
|
73
|
+
settings.attribute :max_results, type: :integer, default: 4
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
Decidim.content_blocks.register(:voting_landing_page, :header) do |content_block|
|
78
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/header"
|
79
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.header.name"
|
80
|
+
content_block.default!
|
81
|
+
end
|
82
|
+
|
83
|
+
Decidim.content_blocks.register(:voting_landing_page, :description) do |content_block|
|
84
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/description"
|
85
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.description.name"
|
86
|
+
content_block.default!
|
87
|
+
end
|
88
|
+
|
89
|
+
Decidim.content_blocks.register(:voting_landing_page, :elections) do |content_block|
|
90
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/elections"
|
91
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.elections.name"
|
92
|
+
content_block.default!
|
93
|
+
end
|
94
|
+
|
95
|
+
Decidim.content_blocks.register(:voting_landing_page, :polling_stations) do |content_block|
|
96
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/polling_stations"
|
97
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.polling_stations.name"
|
98
|
+
content_block.default!
|
99
|
+
end
|
100
|
+
|
101
|
+
Decidim.content_blocks.register(:voting_landing_page, :attachments_and_folders) do |content_block|
|
102
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/attachments_and_folders"
|
103
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.attachments_and_folders.name"
|
104
|
+
content_block.default!
|
105
|
+
end
|
106
|
+
|
107
|
+
Decidim.content_blocks.register(:voting_landing_page, :stats) do |content_block|
|
108
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/stats"
|
109
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.stats.name"
|
110
|
+
content_block.default!
|
111
|
+
end
|
112
|
+
|
113
|
+
Decidim.content_blocks.register(:voting_landing_page, :metrics) do |content_block|
|
114
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/metrics"
|
115
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.metrics.name"
|
116
|
+
content_block.default!
|
117
|
+
end
|
118
|
+
|
119
|
+
Decidim.content_blocks.register(:voting_landing_page, :timeline) do |content_block|
|
120
|
+
content_block.cell = "decidim/votings/content_blocks/landing_page/timeline"
|
121
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.timeline.name"
|
122
|
+
content_block.default!
|
123
|
+
end
|
124
|
+
|
125
|
+
1.upto(3) do |i|
|
126
|
+
Decidim.content_blocks.register(:voting_landing_page, "html_block_#{i}".to_sym) do |content_block|
|
127
|
+
content_block.cell = "decidim/content_blocks/html"
|
128
|
+
content_block.public_name_key = "decidim.votings.admin.content_blocks.landing_page.html_block_#{i}.name"
|
129
|
+
content_block.settings_form_cell = "decidim/content_blocks/html_settings_form"
|
130
|
+
|
131
|
+
content_block.settings do |settings|
|
132
|
+
settings.attribute :html_content, type: :text, translated: true
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
initializer "decidim_votings.query_extensions" do
|
139
|
+
Decidim::Api::QueryType.include Decidim::Votings::QueryExtensions
|
140
|
+
end
|
141
|
+
|
142
|
+
def load_seed
|
143
|
+
nil
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|