decidim-elections 0.28.6 → 0.31.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (672) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -86
  3. data/app/cells/decidim/elections/election_card_metadata_cell.rb +55 -0
  4. data/app/cells/decidim/elections/election_cell.rb +3 -4
  5. data/app/cells/decidim/elections/election_g_cell.rb +11 -9
  6. data/app/cells/decidim/elections/election_l_cell.rb +39 -0
  7. data/app/cells/decidim/elections/election_s_cell.rb +11 -0
  8. data/app/commands/decidim/elections/admin/censuses/token_csv.rb +41 -0
  9. data/app/commands/decidim/elections/admin/create_election.rb +31 -42
  10. data/app/commands/decidim/elections/admin/process_census.rb +32 -0
  11. data/app/commands/decidim/elections/admin/publish_election.rb +14 -18
  12. data/app/commands/decidim/elections/admin/unpublish_election.rb +18 -16
  13. data/app/commands/decidim/elections/admin/update_election.rb +35 -35
  14. data/app/commands/decidim/elections/admin/update_election_status.rb +43 -0
  15. data/app/commands/decidim/elections/admin/update_question_status.rb +41 -0
  16. data/app/commands/decidim/elections/admin/update_questions.rb +91 -0
  17. data/app/commands/decidim/elections/cast_votes.rb +54 -0
  18. data/app/controllers/concerns/decidim/{votings → elections}/admin/filterable.rb +5 -6
  19. data/app/controllers/concerns/decidim/elections/orderable.rb +14 -3
  20. data/app/controllers/concerns/decidim/elections/uses_votes_booth.rb +115 -0
  21. data/app/controllers/decidim/elections/admin/application_controller.rb +1 -1
  22. data/app/controllers/decidim/elections/admin/census_controller.rb +52 -0
  23. data/app/controllers/decidim/elections/admin/elections_controller.rb +85 -32
  24. data/app/controllers/decidim/elections/admin/questions_controller.rb +40 -48
  25. data/app/controllers/decidim/elections/application_controller.rb +1 -2
  26. data/app/controllers/decidim/elections/elections_controller.rb +26 -57
  27. data/app/controllers/decidim/elections/per_question_votes_controller.rb +89 -0
  28. data/app/controllers/decidim/elections/votes_controller.rb +30 -139
  29. data/app/forms/decidim/elections/admin/censuses/internal_users_form.rb +79 -0
  30. data/app/forms/decidim/elections/admin/censuses/token_csv_form.rb +37 -0
  31. data/app/forms/decidim/elections/admin/election_form.rb +30 -20
  32. data/app/forms/decidim/elections/admin/question_form.rb +21 -8
  33. data/app/forms/decidim/elections/admin/questions_form.rb +27 -0
  34. data/app/forms/decidim/elections/admin/response_option_form.rb +23 -0
  35. data/app/forms/decidim/elections/censuses/internal_users_form.rb +64 -0
  36. data/app/forms/decidim/elections/censuses/token_csv_form.rb +38 -0
  37. data/app/helpers/decidim/elections/admin/elections_helper.rb +91 -0
  38. data/app/helpers/decidim/elections/application_helper.rb +35 -9
  39. data/app/helpers/decidim/elections/label_helper.rb +25 -0
  40. data/app/models/decidim/elections/csv_census/data.rb +43 -0
  41. data/app/models/decidim/elections/election.rb +126 -96
  42. data/app/models/decidim/elections/question.rb +71 -30
  43. data/app/models/decidim/elections/response_option.rb +26 -0
  44. data/app/models/decidim/elections/vote.rb +35 -6
  45. data/app/models/decidim/elections/voter.rb +26 -0
  46. data/app/packs/entrypoints/decidim_elections.js +3 -10
  47. data/app/packs/entrypoints/decidim_elections.scss +2 -0
  48. data/app/packs/entrypoints/decidim_elections_admin.js +6 -5
  49. data/app/packs/entrypoints/decidim_elections_admin.scss +1 -0
  50. data/app/packs/images/decidim/elections/elections.svg +1 -0
  51. data/app/packs/src/decidim/elections/admin/census_form.js +13 -0
  52. data/app/packs/src/decidim/elections/admin/election_form.js +38 -0
  53. data/app/packs/src/decidim/elections/live_results_update.js +119 -0
  54. data/app/packs/src/decidim/elections/waiting_room.js +32 -0
  55. data/app/packs/stylesheets/decidim/elections/elections.scss +49 -160
  56. data/app/packs/stylesheets/decidim/elections/live_results_update.scss +25 -0
  57. data/app/permissions/decidim/elections/admin/permissions.rb +35 -61
  58. data/app/permissions/decidim/elections/permissions.rb +17 -29
  59. data/app/presenters/decidim/elections/admin_log/election_presenter.rb +8 -35
  60. data/app/presenters/decidim/elections/admin_log/question_presenter.rb +37 -0
  61. data/app/presenters/decidim/elections/censuses/user_presenter.rb +37 -0
  62. data/app/presenters/decidim/elections/election_presenter.rb +48 -12
  63. data/app/{events/decidim/elections/election_published_event.rb → presenters/decidim/elections/question_presenter.rb} +1 -1
  64. data/app/presenters/decidim/elections/response_option_presenter.rb +8 -0
  65. data/app/views/decidim/elections/admin/census/_preview.html.erb +24 -0
  66. data/app/views/decidim/elections/admin/census/edit.html.erb +38 -0
  67. data/app/views/decidim/elections/admin/censuses/_internal_users_form.html.erb +34 -0
  68. data/app/views/decidim/elections/admin/censuses/_internal_users_options_form.html.erb +21 -0
  69. data/app/views/decidim/elections/admin/censuses/_token_csv_form.html.erb +16 -0
  70. data/app/views/decidim/elections/admin/dashboard/_calendar.html.erb +36 -0
  71. data/app/views/decidim/elections/admin/dashboard/_census.html.erb +17 -0
  72. data/app/views/decidim/elections/admin/dashboard/_main.html.erb +40 -0
  73. data/app/views/decidim/elections/admin/dashboard/_photos.html.erb +12 -0
  74. data/app/views/decidim/elections/admin/dashboard/_questions.html.erb +38 -0
  75. data/app/views/decidim/elections/admin/dashboard/_questions_with_results.html.erb +43 -0
  76. data/app/views/decidim/elections/admin/dashboard/_results.html.erb +20 -0
  77. data/app/views/decidim/elections/admin/dashboard/_status.html.erb +21 -0
  78. data/app/views/decidim/elections/admin/elections/_actions.html.erb +91 -0
  79. data/app/views/decidim/elections/admin/elections/_election-tr.html.erb +30 -0
  80. data/app/views/decidim/elections/admin/elections/_elections-thead.html.erb +10 -0
  81. data/app/views/decidim/elections/admin/elections/_form.html.erb +90 -15
  82. data/app/views/decidim/elections/admin/elections/_tabs_menu.html.erb +9 -0
  83. data/app/views/decidim/elections/admin/elections/dashboard.html.erb +51 -0
  84. data/app/views/decidim/elections/admin/elections/edit.html.erb +18 -10
  85. data/app/views/decidim/elections/admin/elections/index.html.erb +21 -77
  86. data/app/views/decidim/elections/admin/elections/manage_trash.html.erb +23 -0
  87. data/app/views/decidim/elections/admin/elections/new.html.erb +15 -7
  88. data/app/views/decidim/elections/admin/questions/_form.html.erb +66 -23
  89. data/app/views/decidim/elections/admin/questions/_question.html.erb +97 -0
  90. data/app/views/decidim/elections/admin/questions/_response_option.html.erb +37 -0
  91. data/app/views/decidim/elections/admin/questions/_response_option_template.html.erb +7 -0
  92. data/app/views/decidim/elections/admin/questions/edit_questions.html.erb +30 -0
  93. data/app/views/decidim/elections/censuses/_internal_users_form.html.erb +46 -0
  94. data/app/views/decidim/elections/censuses/_submit_button.html.erb +5 -0
  95. data/app/views/decidim/elections/censuses/_token_csv_form.html.erb +4 -0
  96. data/app/views/decidim/elections/elections/_election.html.erb +1 -0
  97. data/app/views/decidim/elections/elections/_election_aside.html.erb +13 -0
  98. data/app/views/decidim/elections/elections/_election_top.html.erb +15 -0
  99. data/app/views/decidim/elections/elections/_elections.html.erb +10 -14
  100. data/app/views/decidim/elections/elections/_questions.html.erb +23 -0
  101. data/app/views/decidim/elections/elections/_vote_results.html.erb +16 -0
  102. data/app/views/decidim/elections/elections/_vote_results_option.html.erb +14 -0
  103. data/app/views/decidim/elections/elections/_vote_results_question.html.erb +13 -0
  104. data/app/views/decidim/elections/elections/index.html.erb +10 -5
  105. data/app/views/decidim/elections/elections/show.html.erb +27 -65
  106. data/app/views/decidim/elections/per_question_votes/show.html.erb +27 -0
  107. data/app/views/decidim/elections/per_question_votes/waiting.html.erb +21 -0
  108. data/app/views/decidim/elections/votes/confirm.html.erb +34 -0
  109. data/app/views/decidim/elections/votes/new.html.erb +7 -86
  110. data/app/views/decidim/elections/votes/receipt.html.erb +8 -0
  111. data/app/views/decidim/elections/votes/responses/_multiple_option.html.erb +4 -0
  112. data/app/views/decidim/elections/votes/responses/_single_option.html.erb +4 -0
  113. data/app/views/decidim/elections/votes/show.html.erb +25 -10
  114. data/app/views/layouts/decidim/_election_votes_header.html.erb +14 -0
  115. data/app/views/layouts/decidim/election_booth.html.erb +35 -0
  116. data/config/assets.rb +3 -5
  117. data/config/locales/ar.yml +8 -83
  118. data/config/locales/bg.yml +60 -1336
  119. data/config/locales/ca-IT.yml +262 -1326
  120. data/config/locales/ca.yml +262 -1326
  121. data/config/locales/cs.yml +147 -1351
  122. data/config/locales/de.yml +78 -1336
  123. data/config/locales/el.yml +59 -1261
  124. data/config/locales/en.yml +262 -1327
  125. data/config/locales/es-MX.yml +261 -1325
  126. data/config/locales/es-PY.yml +261 -1325
  127. data/config/locales/es.yml +262 -1326
  128. data/config/locales/eu.yml +267 -1330
  129. data/config/locales/fi-plain.yml +259 -1322
  130. data/config/locales/fi.yml +259 -1322
  131. data/config/locales/fr-CA.yml +201 -1323
  132. data/config/locales/fr.yml +200 -1322
  133. data/config/locales/ga-IE.yml +45 -297
  134. data/config/locales/gl.yml +41 -519
  135. data/config/locales/hu.yml +21 -215
  136. data/config/locales/it.yml +58 -1006
  137. data/config/locales/ja.yml +253 -1307
  138. data/config/locales/lb.yml +0 -25
  139. data/config/locales/lt.yml +59 -1335
  140. data/config/locales/lv.yml +18 -76
  141. data/config/locales/nl.yml +49 -896
  142. data/config/locales/no.yml +38 -407
  143. data/config/locales/pl.yml +60 -1355
  144. data/config/locales/pt-BR.yml +59 -1283
  145. data/config/locales/pt.yml +58 -1008
  146. data/config/locales/ro-RO.yml +45 -580
  147. data/config/locales/ru.yml +0 -5
  148. data/config/locales/sk.yml +0 -5
  149. data/config/locales/sl.yml +7 -4
  150. data/config/locales/sv.yml +200 -683
  151. data/config/locales/tr-TR.yml +39 -291
  152. data/config/locales/uk.yml +0 -5
  153. data/config/locales/zh-CN.yml +34 -144
  154. data/config/locales/zh-TW.yml +60 -1263
  155. data/db/migrate/20250422110900_create_decidim_elections_elections.rb +19 -0
  156. data/db/migrate/20250513090151_create_decidim_elections_questions_and_response_options.rb +24 -0
  157. data/db/migrate/20250521101318_add_census_fields_to_decidim_elections_elections.rb +11 -0
  158. data/db/migrate/20250523100636_create_decidim_elections_voters.rb +12 -0
  159. data/db/migrate/20250616145355_add_published_fields_to_elections_and_questions.rb +9 -0
  160. data/db/migrate/20250703090427_create_decidim_elections_votes.rb +20 -0
  161. data/decidim-elections.gemspec +8 -12
  162. data/lib/decidim/elections/admin.rb +2 -2
  163. data/lib/decidim/elections/admin_engine.rb +48 -35
  164. data/lib/decidim/elections/census_manifest.rb +144 -0
  165. data/lib/decidim/elections/component.rb +9 -46
  166. data/lib/decidim/elections/engine.rb +40 -32
  167. data/lib/decidim/elections/seeds.rb +61 -386
  168. data/lib/decidim/elections/test/factories.rb +81 -299
  169. data/lib/decidim/elections/test/per_question_vote_examples.rb +164 -0
  170. data/lib/decidim/elections/test/vote_controller_examples.rb +107 -0
  171. data/lib/decidim/elections/test/vote_examples.rb +215 -0
  172. data/lib/decidim/elections/version.rb +1 -2
  173. data/lib/decidim/elections.rb +5 -36
  174. metadata +114 -572
  175. data/app/cells/decidim/elections/content_blocks/related_elections_cell.rb +0 -13
  176. data/app/cells/decidim/elections/election_metadata_cell.rb +0 -57
  177. data/app/cells/decidim/elections/election_preview/show.erb +0 -28
  178. data/app/cells/decidim/elections/election_preview_cell.rb +0 -13
  179. data/app/cells/decidim/elections/election_results/progress_bar.erb +0 -15
  180. data/app/cells/decidim/elections/election_results/show.erb +0 -43
  181. data/app/cells/decidim/elections/election_results_cell.rb +0 -13
  182. data/app/cells/decidim/elections/election_vote_cta/show.erb +0 -23
  183. data/app/cells/decidim/elections/election_vote_cta_cell.rb +0 -79
  184. data/app/cells/decidim/elections/highlighted_elections_for_component/show.erb +0 -18
  185. data/app/cells/decidim/elections/highlighted_elections_for_component_cell.rb +0 -50
  186. data/app/cells/decidim/elections/remaining_time_callout/show.erb +0 -3
  187. data/app/cells/decidim/elections/remaining_time_callout_cell.rb +0 -28
  188. data/app/cells/decidim/elections/voting_step_navigation/show.erb +0 -25
  189. data/app/cells/decidim/elections/voting_step_navigation_cell.rb +0 -42
  190. data/app/cells/decidim/votings/content_block_cell.rb +0 -21
  191. data/app/cells/decidim/votings/content_blocks/hero_cell.rb +0 -41
  192. data/app/cells/decidim/votings/content_blocks/hero_settings_form/show.erb +0 -4
  193. data/app/cells/decidim/votings/content_blocks/hero_settings_form_cell.rb +0 -15
  194. data/app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb +0 -33
  195. data/app/cells/decidim/votings/content_blocks/highlighted_votings_settings_form/show.erb +0 -3
  196. data/app/cells/decidim/votings/content_blocks/highlighted_votings_settings_form_cell.rb +0 -19
  197. data/app/cells/decidim/votings/content_blocks/main_data_cell.rb +0 -34
  198. data/app/cells/decidim/votings/content_blocks/metrics_cell.rb +0 -17
  199. data/app/cells/decidim/votings/content_blocks/polling_stations/show.erb +0 -21
  200. data/app/cells/decidim/votings/content_blocks/polling_stations_cell.rb +0 -31
  201. data/app/cells/decidim/votings/content_blocks/statistics_cell.rb +0 -18
  202. data/app/cells/decidim/votings/polling_officers/polling_officers_picker/show.erb +0 -15
  203. data/app/cells/decidim/votings/polling_officers/polling_officers_picker_cell.rb +0 -76
  204. data/app/cells/decidim/votings/polling_station_closure_certificate/show.erb +0 -7
  205. data/app/cells/decidim/votings/polling_station_closure_certificate_cell.rb +0 -12
  206. data/app/cells/decidim/votings/polling_station_closure_recount/show.erb +0 -70
  207. data/app/cells/decidim/votings/polling_station_closure_recount_cell.rb +0 -9
  208. data/app/cells/decidim/votings/voting_cell.rb +0 -24
  209. data/app/cells/decidim/votings/voting_dropdown_metadata_cell.rb +0 -19
  210. data/app/cells/decidim/votings/voting_g_cell.rb +0 -19
  211. data/app/cells/decidim/votings/voting_map/show.erb +0 -16
  212. data/app/cells/decidim/votings/voting_map_cell.rb +0 -28
  213. data/app/cells/decidim/votings/voting_metadata_cell.rb +0 -66
  214. data/app/cells/decidim/votings/voting_s_cell.rb +0 -10
  215. data/app/commands/decidim/elections/admin/add_user_as_trustee.rb +0 -92
  216. data/app/commands/decidim/elections/admin/create_answer.rb +0 -70
  217. data/app/commands/decidim/elections/admin/create_question.rb +0 -49
  218. data/app/commands/decidim/elections/admin/destroy_answer.rb +0 -49
  219. data/app/commands/decidim/elections/admin/destroy_election.rb +0 -49
  220. data/app/commands/decidim/elections/admin/destroy_question.rb +0 -46
  221. data/app/commands/decidim/elections/admin/end_vote.rb +0 -63
  222. data/app/commands/decidim/elections/admin/import_proposals_to_elections.rb +0 -90
  223. data/app/commands/decidim/elections/admin/publish_results.rb +0 -63
  224. data/app/commands/decidim/elections/admin/remove_trustee_from_participatory_space.rb +0 -37
  225. data/app/commands/decidim/elections/admin/report_missing_trustee.rb +0 -68
  226. data/app/commands/decidim/elections/admin/setup_election.rb +0 -168
  227. data/app/commands/decidim/elections/admin/start_key_ceremony.rb +0 -63
  228. data/app/commands/decidim/elections/admin/start_tally.rb +0 -63
  229. data/app/commands/decidim/elections/admin/start_vote.rb +0 -63
  230. data/app/commands/decidim/elections/admin/update_action_status.rb +0 -47
  231. data/app/commands/decidim/elections/admin/update_answer.rb +0 -72
  232. data/app/commands/decidim/elections/admin/update_answer_selection.rb +0 -41
  233. data/app/commands/decidim/elections/admin/update_question.rb +0 -52
  234. data/app/commands/decidim/elections/admin/update_trustee_participatory_space.rb +0 -40
  235. data/app/commands/decidim/elections/trustee_zone/update_election_bulletin_board_status.rb +0 -98
  236. data/app/commands/decidim/elections/trustee_zone/update_trustee.rb +0 -44
  237. data/app/commands/decidim/elections/voter/cast_vote.rb +0 -56
  238. data/app/commands/decidim/elections/voter/update_vote_status.rb +0 -86
  239. data/app/commands/decidim/votings/admin/create_ballot_style.rb +0 -61
  240. data/app/commands/decidim/votings/admin/create_monitoring_committee_member.rb +0 -99
  241. data/app/commands/decidim/votings/admin/create_polling_officer.rb +0 -99
  242. data/app/commands/decidim/votings/admin/create_polling_station.rb +0 -59
  243. data/app/commands/decidim/votings/admin/create_voting.rb +0 -61
  244. data/app/commands/decidim/votings/admin/destroy_ballot_style.rb +0 -41
  245. data/app/commands/decidim/votings/admin/destroy_monitoring_committee_member.rb +0 -51
  246. data/app/commands/decidim/votings/admin/destroy_polling_officer.rb +0 -52
  247. data/app/commands/decidim/votings/admin/destroy_polling_station.rb +0 -40
  248. data/app/commands/decidim/votings/admin/manage_polling_station.rb +0 -64
  249. data/app/commands/decidim/votings/admin/monitoring_committee_validate_polling_station_closure.rb +0 -37
  250. data/app/commands/decidim/votings/admin/update_ballot_style.rb +0 -75
  251. data/app/commands/decidim/votings/admin/update_polling_station.rb +0 -50
  252. data/app/commands/decidim/votings/admin/update_voting.rb +0 -77
  253. data/app/commands/decidim/votings/census/admin/create_dataset.rb +0 -101
  254. data/app/commands/decidim/votings/census/admin/create_datum.rb +0 -55
  255. data/app/commands/decidim/votings/census/admin/destroy_dataset.rb +0 -45
  256. data/app/commands/decidim/votings/census/admin/increment_dataset_processed_rows.rb +0 -43
  257. data/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb +0 -40
  258. data/app/commands/decidim/votings/census/admin/launch_access_codes_generation.rb +0 -44
  259. data/app/commands/decidim/votings/census/admin/update_dataset.rb +0 -51
  260. data/app/commands/decidim/votings/certify_polling_station_closure.rb +0 -45
  261. data/app/commands/decidim/votings/check_census.rb +0 -35
  262. data/app/commands/decidim/votings/create_polling_station_closure.rb +0 -53
  263. data/app/commands/decidim/votings/create_polling_station_results.rb +0 -83
  264. data/app/commands/decidim/votings/send_access_code.rb +0 -52
  265. data/app/commands/decidim/votings/sign_polling_station_closure.rb +0 -41
  266. data/app/commands/decidim/votings/voter/in_person_vote.rb +0 -55
  267. data/app/commands/decidim/votings/voter/update_in_person_vote_status.rb +0 -52
  268. data/app/constraints/decidim/votings/current_component.rb +0 -28
  269. data/app/constraints/decidim/votings/current_voting.rb +0 -43
  270. data/app/controllers/concerns/decidim/elections/content_security_policy.rb +0 -23
  271. data/app/controllers/concerns/decidim/elections/has_vote_flow.rb +0 -43
  272. data/app/controllers/concerns/decidim/monitoring_committee_polling_station_closures/admin/filterable.rb +0 -72
  273. data/app/controllers/concerns/decidim/polling_officers/admin/filterable.rb +0 -58
  274. data/app/controllers/concerns/decidim/polling_stations/admin/filterable.rb +0 -57
  275. data/app/controllers/concerns/decidim/votings/admin/voting_admin.rb +0 -49
  276. data/app/controllers/concerns/decidim/votings/needs_voting.rb +0 -44
  277. data/app/controllers/concerns/decidim/votings/orderable.rb +0 -32
  278. data/app/controllers/decidim/elections/admin/answers_controller.rb +0 -131
  279. data/app/controllers/decidim/elections/admin/feedback_forms_controller.rb +0 -55
  280. data/app/controllers/decidim/elections/admin/proposals_imports_controller.rb +0 -53
  281. data/app/controllers/decidim/elections/admin/steps_controller.rb +0 -118
  282. data/app/controllers/decidim/elections/admin/trustees_participatory_spaces_controller.rb +0 -89
  283. data/app/controllers/decidim/elections/feedbacks_controller.rb +0 -72
  284. data/app/controllers/decidim/elections/trustee_zone/application_controller.rb +0 -48
  285. data/app/controllers/decidim/elections/trustee_zone/elections_controller.rb +0 -49
  286. data/app/controllers/decidim/elections/trustee_zone/trustees_controller.rb +0 -36
  287. data/app/controllers/decidim/votings/admin/application_controller.rb +0 -26
  288. data/app/controllers/decidim/votings/admin/ballot_styles_controller.rb +0 -93
  289. data/app/controllers/decidim/votings/admin/component_permissions_controller.rb +0 -13
  290. data/app/controllers/decidim/votings/admin/components_controller.rb +0 -15
  291. data/app/controllers/decidim/votings/admin/exports_controller.rb +0 -14
  292. data/app/controllers/decidim/votings/admin/imports_controller.rb +0 -14
  293. data/app/controllers/decidim/votings/admin/monitoring_committee_election_results_controller.rb +0 -77
  294. data/app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb +0 -81
  295. data/app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_controller.rb +0 -73
  296. data/app/controllers/decidim/votings/admin/monitoring_committee_verify_elections_controller.rb +0 -24
  297. data/app/controllers/decidim/votings/admin/polling_officers_controller.rb +0 -66
  298. data/app/controllers/decidim/votings/admin/polling_stations_controller.rb +0 -95
  299. data/app/controllers/decidim/votings/admin/reminders_controller.rb +0 -14
  300. data/app/controllers/decidim/votings/admin/voting_attachment_collections_controller.rb +0 -27
  301. data/app/controllers/decidim/votings/admin/voting_attachments_controller.rb +0 -26
  302. data/app/controllers/decidim/votings/admin/voting_publications_controller.rb +0 -25
  303. data/app/controllers/decidim/votings/admin/votings_controller.rb +0 -100
  304. data/app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb +0 -40
  305. data/app/controllers/decidim/votings/admin/votings_landing_page_controller.rb +0 -46
  306. data/app/controllers/decidim/votings/application_controller.rb +0 -26
  307. data/app/controllers/decidim/votings/census/admin/application_controller.rb +0 -19
  308. data/app/controllers/decidim/votings/census/admin/census_controller.rb +0 -195
  309. data/app/controllers/decidim/votings/polling_officer_zone/application_controller.rb +0 -33
  310. data/app/controllers/decidim/votings/polling_officer_zone/closures_controller.rb +0 -134
  311. data/app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb +0 -159
  312. data/app/controllers/decidim/votings/polling_officer_zone/polling_officers_controller.rb +0 -25
  313. data/app/controllers/decidim/votings/votings_controller.rb +0 -182
  314. data/app/events/decidim/elections/trustees/notify_new_trustee_event.rb +0 -28
  315. data/app/events/decidim/elections/trustees/notify_trustee_new_election_event.rb +0 -14
  316. data/app/events/decidim/elections/votes/vote_accepted_event.rb +0 -24
  317. data/app/events/decidim/votings/polling_officers/polling_station_assigned_event.rb +0 -44
  318. data/app/forms/decidim/elections/admin/action_form.rb +0 -43
  319. data/app/forms/decidim/elections/admin/answer_form.rb +0 -54
  320. data/app/forms/decidim/elections/admin/answer_import_proposals_form.rb +0 -41
  321. data/app/forms/decidim/elections/admin/report_missing_trustee_form.rb +0 -22
  322. data/app/forms/decidim/elections/admin/setup_form.rb +0 -127
  323. data/app/forms/decidim/elections/admin/trustees_participatory_space_form.rb +0 -22
  324. data/app/forms/decidim/elections/admin/vote_period_form.rb +0 -37
  325. data/app/forms/decidim/elections/trustee_zone/trustee_form.rb +0 -26
  326. data/app/forms/decidim/elections/voter/verify_vote_form.rb +0 -25
  327. data/app/forms/decidim/elections/voter/vote_form.rb +0 -50
  328. data/app/forms/decidim/votings/admin/ballot_style_form.rb +0 -19
  329. data/app/forms/decidim/votings/admin/monitoring_committee_polling_station_closure_form.rb +0 -11
  330. data/app/forms/decidim/votings/admin/polling_station_form.rb +0 -58
  331. data/app/forms/decidim/votings/admin/publish_results_form.rb +0 -64
  332. data/app/forms/decidim/votings/admin/voting_form.rb +0 -73
  333. data/app/forms/decidim/votings/admin/voting_user_role_form.rb +0 -27
  334. data/app/forms/decidim/votings/answer_result_form.rb +0 -24
  335. data/app/forms/decidim/votings/ballot_result_form.rb +0 -28
  336. data/app/forms/decidim/votings/census/admin/dataset_form.rb +0 -22
  337. data/app/forms/decidim/votings/census/admin/datum_form.rb +0 -34
  338. data/app/forms/decidim/votings/census/check_fields.rb +0 -28
  339. data/app/forms/decidim/votings/census/check_form.rb +0 -13
  340. data/app/forms/decidim/votings/census/frontend_fields.rb +0 -42
  341. data/app/forms/decidim/votings/census/in_person_fields.rb +0 -52
  342. data/app/forms/decidim/votings/census/in_person_form.rb +0 -13
  343. data/app/forms/decidim/votings/census/login_form.rb +0 -13
  344. data/app/forms/decidim/votings/census/online_fields.rb +0 -28
  345. data/app/forms/decidim/votings/closure_certify_form.rb +0 -20
  346. data/app/forms/decidim/votings/closure_result_form.rb +0 -37
  347. data/app/forms/decidim/votings/closure_sign_form.rb +0 -11
  348. data/app/forms/decidim/votings/envelopes_result_form.rb +0 -34
  349. data/app/forms/decidim/votings/question_result_form.rb +0 -24
  350. data/app/forms/decidim/votings/voter/in_person_vote_form.rb +0 -40
  351. data/app/helpers/decidim/elections/admin/answers_helper.rb +0 -19
  352. data/app/helpers/decidim/elections/admin/steps_helper.rb +0 -23
  353. data/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb +0 -33
  354. data/app/helpers/decidim/elections/election_cells_helper.rb +0 -12
  355. data/app/helpers/decidim/elections/votes_helper.rb +0 -23
  356. data/app/helpers/decidim/votings/map_helper.rb +0 -22
  357. data/app/helpers/decidim/votings/votings_helper.rb +0 -53
  358. data/app/jobs/decidim/votings/census/admin/create_datum_job.rb +0 -41
  359. data/app/jobs/decidim/votings/census/admin/export_access_codes_job.rb +0 -39
  360. data/app/jobs/decidim/votings/census/admin/generate_access_codes_job.rb +0 -44
  361. data/app/mailers/decidim/elections/trustee_mailer.rb +0 -28
  362. data/app/mailers/decidim/elections/vote_accepted_mailer.rb +0 -29
  363. data/app/mailers/decidim/votings/access_code_mailer.rb +0 -34
  364. data/app/mailers/decidim/votings/census/export_mailer.rb +0 -44
  365. data/app/models/decidim/elections/action.rb +0 -13
  366. data/app/models/decidim/elections/answer.rb +0 -46
  367. data/app/models/decidim/elections/bulletin_board_closure.rb +0 -19
  368. data/app/models/decidim/elections/elections_trustee.rb +0 -11
  369. data/app/models/decidim/elections/result.rb +0 -22
  370. data/app/models/decidim/elections/trustee.rb +0 -39
  371. data/app/models/decidim/elections/trustees_participatory_space.rb +0 -13
  372. data/app/models/decidim/votings/ballot_style.rb +0 -35
  373. data/app/models/decidim/votings/ballot_style_question.rb +0 -11
  374. data/app/models/decidim/votings/census/dataset.rb +0 -34
  375. data/app/models/decidim/votings/census/datum.rb +0 -34
  376. data/app/models/decidim/votings/in_person_vote.rb +0 -22
  377. data/app/models/decidim/votings/monitoring_committee_member.rb +0 -30
  378. data/app/models/decidim/votings/polling_officer.rb +0 -81
  379. data/app/models/decidim/votings/polling_station.rb +0 -86
  380. data/app/models/decidim/votings/polling_station_closure.rb +0 -43
  381. data/app/models/decidim/votings/voting.rb +0 -176
  382. data/app/packs/entrypoints/decidim_votings.js +0 -11
  383. data/app/packs/entrypoints/decidim_votings_admin.js +0 -10
  384. data/app/packs/images/decidim/elections/decidim_elections.svg +0 -1
  385. data/app/packs/images/decidim/votings/decidim_votings.svg +0 -1
  386. data/app/packs/src/decidim/elections/admin/pending_action.js +0 -19
  387. data/app/packs/src/decidim/elections/admin/trustees_process.js +0 -130
  388. data/app/packs/src/decidim/elections/admin/vote_statistics.js +0 -14
  389. data/app/packs/src/decidim/elections/broken_promises_handler.js +0 -13
  390. data/app/packs/src/decidim/elections/election_log.js +0 -159
  391. data/app/packs/src/decidim/elections/trustee/key_ceremony.js +0 -165
  392. data/app/packs/src/decidim/elections/trustee/tally.js +0 -147
  393. data/app/packs/src/decidim/elections/trustee/trustee_zone.js +0 -64
  394. data/app/packs/src/decidim/elections/voter/casting-vote.js +0 -19
  395. data/app/packs/src/decidim/elections/voter/new-vote.js +0 -104
  396. data/app/packs/src/decidim/elections/voter/setup-preview.js +0 -75
  397. data/app/packs/src/decidim/elections/voter/setup-vote.js +0 -49
  398. data/app/packs/src/decidim/elections/voter/verify-vote.js +0 -77
  399. data/app/packs/src/decidim/elections/voter/vote_questions.component.js +0 -170
  400. data/app/packs/src/decidim/votings/admin/polling_officers_picker.js +0 -20
  401. data/app/packs/src/decidim/votings/admin/polling_stations_form.js +0 -9
  402. data/app/packs/src/decidim/votings/admin/update_census_dataset_status.js +0 -13
  403. data/app/packs/src/decidim/votings/admin/voting_user_role_form.js +0 -35
  404. data/app/packs/src/decidim/votings/in-person-vote.js +0 -23
  405. data/app/packs/src/decidim/votings/polling_officer_zone/edit-closure.js +0 -26
  406. data/app/packs/src/decidim/votings/polling_officer_zone/in-person-vote.js +0 -5
  407. data/app/packs/src/decidim/votings/polling_officer_zone/new-closure.js +0 -33
  408. data/app/packs/src/decidim/votings/polling_officer_zone/sign-closure.js +0 -13
  409. data/app/packs/stylesheets/decidim/votings/admin/votings/_ballot-styles.scss +0 -16
  410. data/app/packs/stylesheets/decidim/votings/admin/votings/_monitoring-committee-polling-station-closures.scss +0 -9
  411. data/app/packs/stylesheets/decidim/votings/admin/votings/_results.scss +0 -3
  412. data/app/packs/stylesheets/decidim/votings/admin/votings.scss +0 -23
  413. data/app/packs/stylesheets/decidim/votings/votings.scss +0 -53
  414. data/app/permissions/decidim/elections/trustee_zone/permissions.rb +0 -32
  415. data/app/permissions/decidim/votings/admin/permissions.rb +0 -180
  416. data/app/permissions/decidim/votings/permissions.rb +0 -42
  417. data/app/permissions/decidim/votings/polling_officer_zone/permissions.rb +0 -38
  418. data/app/presenters/decidim/elections/admin_log/trustee_presenter.rb +0 -50
  419. data/app/presenters/decidim/elections/trustee_presenter.rb +0 -28
  420. data/app/presenters/decidim/votings/admin_log/ballot_style_presenter.rb +0 -39
  421. data/app/presenters/decidim/votings/admin_log/monitoring_committee_member_presenter.rb +0 -50
  422. data/app/presenters/decidim/votings/admin_log/polling_officer_presenter.rb +0 -50
  423. data/app/presenters/decidim/votings/admin_log/polling_station_presenter.rb +0 -29
  424. data/app/presenters/decidim/votings/admin_log/voting_presenter.rb +0 -45
  425. data/app/presenters/decidim/votings/census/admin_log/dataset_presenter.rb +0 -31
  426. data/app/presenters/decidim/votings/polling_station_presenter.rb +0 -27
  427. data/app/presenters/decidim/votings/voting_presenter.rb +0 -27
  428. data/app/presenters/decidim/votings/voting_stats_presenter.rb +0 -16
  429. data/app/queries/decidim/elections/admin/pending_actions.rb +0 -20
  430. data/app/queries/decidim/elections/admin/votes_for_statistics.rb +0 -24
  431. data/app/queries/decidim/elections/elections_finished_to_end.rb +0 -19
  432. data/app/queries/decidim/elections/elections_ready_to_start.rb +0 -25
  433. data/app/queries/decidim/elections/filtered_elections.rb +0 -37
  434. data/app/queries/decidim/elections/trustees/by_participatory_space.rb +0 -24
  435. data/app/queries/decidim/elections/trustees/by_participatory_space_trustee_ids.rb +0 -24
  436. data/app/queries/decidim/elections/votes/last_vote_for_voter.rb +0 -29
  437. data/app/queries/decidim/elections/votes/pending_votes.rb +0 -20
  438. data/app/queries/decidim/votings/admin/admin_users.rb +0 -44
  439. data/app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb +0 -31
  440. data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations.rb +0 -33
  441. data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations_and_user.rb +0 -34
  442. data/app/queries/decidim/votings/admin/polling_officers_join_user.rb +0 -32
  443. data/app/queries/decidim/votings/organization_prioritized_votings.rb +0 -21
  444. data/app/queries/decidim/votings/organization_promoted_votings.rb +0 -16
  445. data/app/queries/decidim/votings/organization_published_votings.rb +0 -19
  446. data/app/queries/decidim/votings/organization_votings.rb +0 -16
  447. data/app/queries/decidim/votings/prioritized_votings.rb +0 -13
  448. data/app/queries/decidim/votings/published_votings.rb +0 -12
  449. data/app/queries/decidim/votings/votes/in_person_vote_for_voter.rb +0 -27
  450. data/app/queries/decidim/votings/votes/pending_in_person_votes.rb +0 -20
  451. data/app/serializers/decidim/votings/census/datum_serializer.rb +0 -29
  452. data/app/services/decidim/elections/current_user_vote_flow.rb +0 -68
  453. data/app/services/decidim/elections/vote_flow.rb +0 -109
  454. data/app/services/decidim/votings/census/access_codes_exporter.rb +0 -52
  455. data/app/services/decidim/votings/census_vote_flow.rb +0 -104
  456. data/app/uploaders/decidim/cw/votings/census/voting_census_uploader.rb +0 -19
  457. data/app/views/decidim/elections/admin/answers/_form.html.erb +0 -23
  458. data/app/views/decidim/elections/admin/answers/edit.html.erb +0 -23
  459. data/app/views/decidim/elections/admin/answers/index.html.erb +0 -93
  460. data/app/views/decidim/elections/admin/answers/new.html.erb +0 -23
  461. data/app/views/decidim/elections/admin/proposals_imports/new.html.erb +0 -39
  462. data/app/views/decidim/elections/admin/questions/edit.html.erb +0 -21
  463. data/app/views/decidim/elections/admin/questions/index.html.erb +0 -60
  464. data/app/views/decidim/elections/admin/questions/new.html.erb +0 -22
  465. data/app/views/decidim/elections/admin/shared/_trustees_secondary_nav.html.erb +0 -3
  466. data/app/views/decidim/elections/admin/steps/_create_election.html.erb +0 -56
  467. data/app/views/decidim/elections/admin/steps/_created.html.erb +0 -16
  468. data/app/views/decidim/elections/admin/steps/_key_ceremony.html.erb +0 -51
  469. data/app/views/decidim/elections/admin/steps/_key_ceremony_ended.html.erb +0 -15
  470. data/app/views/decidim/elections/admin/steps/_results_published.html.erb +0 -62
  471. data/app/views/decidim/elections/admin/steps/_tally_ended.html.erb +0 -55
  472. data/app/views/decidim/elections/admin/steps/_tally_started.html.erb +0 -67
  473. data/app/views/decidim/elections/admin/steps/_vote.html.erb +0 -21
  474. data/app/views/decidim/elections/admin/steps/_vote_ended.html.erb +0 -19
  475. data/app/views/decidim/elections/admin/steps/_vote_stats.html.erb +0 -31
  476. data/app/views/decidim/elections/admin/steps/index.html.erb +0 -54
  477. data/app/views/decidim/elections/admin/trustees_participatory_spaces/_form.html.erb +0 -15
  478. data/app/views/decidim/elections/admin/trustees_participatory_spaces/index.html.erb +0 -66
  479. data/app/views/decidim/elections/admin/trustees_participatory_spaces/new.html.erb +0 -19
  480. data/app/views/decidim/elections/elections/election_log.html.erb +0 -176
  481. data/app/views/decidim/elections/shared/_broken_promises_modal.html.erb +0 -24
  482. data/app/views/decidim/elections/trustee_mailer/notification.html.erb +0 -5
  483. data/app/views/decidim/elections/trustee_zone/elections/_backup_modal.html.erb +0 -14
  484. data/app/views/decidim/elections/trustee_zone/elections/_key_ceremony_steps.html.erb +0 -51
  485. data/app/views/decidim/elections/trustee_zone/elections/_restore_modal.html.erb +0 -15
  486. data/app/views/decidim/elections/trustee_zone/elections/_tally_started_steps.html.erb +0 -48
  487. data/app/views/decidim/elections/trustee_zone/elections/show.html.erb +0 -24
  488. data/app/views/decidim/elections/trustee_zone/elections/update.js.erb +0 -5
  489. data/app/views/decidim/elections/trustee_zone/trustees/_no_public_keys.html.erb +0 -30
  490. data/app/views/decidim/elections/trustee_zone/trustees/_public_keys.html.erb +0 -17
  491. data/app/views/decidim/elections/trustee_zone/trustees/_table.html.erb +0 -28
  492. data/app/views/decidim/elections/trustee_zone/trustees/show.html.erb +0 -29
  493. data/app/views/decidim/elections/vote_accepted_mailer/notification.html.erb +0 -3
  494. data/app/views/decidim/elections/votes/_new_ballot_decision_step.html.erb +0 -26
  495. data/app/views/decidim/elections/votes/_new_confirm_step.html.erb +0 -65
  496. data/app/views/decidim/elections/votes/_new_encrypting_step.html.erb +0 -9
  497. data/app/views/decidim/elections/votes/_new_question.html.erb +0 -33
  498. data/app/views/decidim/elections/votes/_new_question_modal.html.erb +0 -43
  499. data/app/views/decidim/elections/votes/_onboarding_modal.html.erb +0 -17
  500. data/app/views/decidim/elections/votes/_show_casted.html.erb +0 -34
  501. data/app/views/decidim/elections/votes/_show_casting.html.erb +0 -22
  502. data/app/views/decidim/elections/votes/_show_failed.html.erb +0 -26
  503. data/app/views/decidim/elections/votes/verify.html.erb +0 -57
  504. data/app/views/decidim/votings/access_code_mailer/send_access_code.html.erb +0 -5
  505. data/app/views/decidim/votings/admin/ballot_styles/_form.html.erb +0 -24
  506. data/app/views/decidim/votings/admin/ballot_styles/edit.html.erb +0 -18
  507. data/app/views/decidim/votings/admin/ballot_styles/index.html.erb +0 -65
  508. data/app/views/decidim/votings/admin/ballot_styles/new.html.erb +0 -18
  509. data/app/views/decidim/votings/admin/monitoring_committee_election_results/_results.html.erb +0 -50
  510. data/app/views/decidim/votings/admin/monitoring_committee_election_results/index.html.erb +0 -30
  511. data/app/views/decidim/votings/admin/monitoring_committee_election_results/show.html.erb +0 -24
  512. data/app/views/decidim/votings/admin/monitoring_committee_members/_form.html.erb +0 -26
  513. data/app/views/decidim/votings/admin/monitoring_committee_members/index.html.erb +0 -39
  514. data/app/views/decidim/votings/admin/monitoring_committee_members/new.html.erb +0 -18
  515. data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closure_certificate_results.erb +0 -9
  516. data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_closures.html.erb +0 -68
  517. data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/_elections.html.erb +0 -29
  518. data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/edit.html.erb +0 -30
  519. data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/index.html.erb +0 -5
  520. data/app/views/decidim/votings/admin/monitoring_committee_polling_station_closures/show.html.erb +0 -10
  521. data/app/views/decidim/votings/admin/monitoring_committee_verify_elections/index.html.erb +0 -57
  522. data/app/views/decidim/votings/admin/polling_officers/_form.html.erb +0 -26
  523. data/app/views/decidim/votings/admin/polling_officers/index.html.erb +0 -49
  524. data/app/views/decidim/votings/admin/polling_officers/new.html.erb +0 -18
  525. data/app/views/decidim/votings/admin/polling_stations/_form.html.erb +0 -34
  526. data/app/views/decidim/votings/admin/polling_stations/edit.html.erb +0 -18
  527. data/app/views/decidim/votings/admin/polling_stations/index.html.erb +0 -54
  528. data/app/views/decidim/votings/admin/polling_stations/new.html.erb +0 -18
  529. data/app/views/decidim/votings/admin/votings/_form.html.erb +0 -76
  530. data/app/views/decidim/votings/admin/votings/edit.html.erb +0 -39
  531. data/app/views/decidim/votings/admin/votings/index.html.erb +0 -65
  532. data/app/views/decidim/votings/admin/votings/new.html.erb +0 -19
  533. data/app/views/decidim/votings/census/admin/census/_creating_data.html.erb +0 -10
  534. data/app/views/decidim/votings/census/admin/census/_export_codes.html.erb +0 -8
  535. data/app/views/decidim/votings/census/admin/census/_exporting_codes.html.erb +0 -3
  536. data/app/views/decidim/votings/census/admin/census/_freeze.html.erb +0 -5
  537. data/app/views/decidim/votings/census/admin/census/_generate_codes.html.erb +0 -35
  538. data/app/views/decidim/votings/census/admin/census/_generating_codes.html.erb +0 -3
  539. data/app/views/decidim/votings/census/admin/census/_new_census.html.erb +0 -23
  540. data/app/views/decidim/votings/census/admin/census/_upload_info.html.erb +0 -17
  541. data/app/views/decidim/votings/census/admin/census/show.html.erb +0 -24
  542. data/app/views/decidim/votings/census/admin/census/status.js.erb +0 -1
  543. data/app/views/decidim/votings/census/export_mailer/access_codes_export.erb +0 -7
  544. data/app/views/decidim/votings/polling_officer_zone/closures/_answer_results_form_fields.html.erb +0 -11
  545. data/app/views/decidim/votings/polling_officer_zone/closures/_ballot_results_form_fields.html.erb +0 -29
  546. data/app/views/decidim/votings/polling_officer_zone/closures/_certify_form.html.erb +0 -13
  547. data/app/views/decidim/votings/polling_officer_zone/closures/_modal_ballots_count_error.html.erb +0 -47
  548. data/app/views/decidim/votings/polling_officer_zone/closures/_modal_ballots_results_count_error.html.erb +0 -20
  549. data/app/views/decidim/votings/polling_officer_zone/closures/_question_results_form_fields.html.erb +0 -17
  550. data/app/views/decidim/votings/polling_officer_zone/closures/_sign_form.html.erb +0 -43
  551. data/app/views/decidim/votings/polling_officer_zone/closures/edit.html.erb +0 -63
  552. data/app/views/decidim/votings/polling_officer_zone/closures/new.html.erb +0 -70
  553. data/app/views/decidim/votings/polling_officer_zone/closures/show.html.erb +0 -45
  554. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_complete_voting.html.erb +0 -48
  555. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_in_person_form.html.erb +0 -37
  556. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_verify_document.html.erb +0 -20
  557. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/new.html.erb +0 -25
  558. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/show.html.erb +0 -30
  559. data/app/views/decidim/votings/polling_officer_zone/polling_officers/_polling_station.html.erb +0 -53
  560. data/app/views/decidim/votings/polling_officer_zone/polling_officers/index.html.erb +0 -19
  561. data/app/views/decidim/votings/votings/_access_code_modal.html.erb +0 -28
  562. data/app/views/decidim/votings/votings/_check_fields.html.erb +0 -20
  563. data/app/views/decidim/votings/votings/_polling_officers_picker.html.erb +0 -4
  564. data/app/views/decidim/votings/votings/_votings.html.erb +0 -19
  565. data/app/views/decidim/votings/votings/check_census.html.erb +0 -68
  566. data/app/views/decidim/votings/votings/elections_log.html.erb +0 -37
  567. data/app/views/decidim/votings/votings/index.html.erb +0 -39
  568. data/app/views/decidim/votings/votings/index.js.erb +0 -5
  569. data/app/views/decidim/votings/votings/login.html.erb +0 -57
  570. data/app/views/decidim/votings/votings/show.html.erb +0 -18
  571. data/app/views/layouts/decidim/admin/voting.html.erb +0 -23
  572. data/app/views/layouts/decidim/admin/votings.html.erb +0 -16
  573. data/app/views/layouts/decidim/votings.html.erb +0 -14
  574. data/config/initializers/decidim_bulletin_board.rb +0 -29
  575. data/config/initializers/rack_attack.rb +0 -15
  576. data/config/locales/bg-BG.yml +0 -7
  577. data/config/locales/da-DK.yml +0 -1
  578. data/config/locales/eo-UY.yml +0 -1
  579. data/config/locales/et-EE.yml +0 -1
  580. data/config/locales/fr-LU.yml +0 -890
  581. data/config/locales/hr-HR.yml +0 -1
  582. data/config/locales/is.yml +0 -1
  583. data/config/locales/ko-KR.yml +0 -1
  584. data/config/locales/lb-LU.yml +0 -25
  585. data/config/locales/lt-LT.yml +0 -1
  586. data/config/locales/mt-MT.yml +0 -1
  587. data/config/locales/vi-VN.yml +0 -1
  588. data/db/migrate/20200430083618_create_decidim_elections_elections.rb +0 -15
  589. data/db/migrate/20200518082327_create_decidim_elections_questions.rb +0 -14
  590. data/db/migrate/20200518084144_create_decidim_elections_answers.rb +0 -12
  591. data/db/migrate/20200601141412_add_published_at_to_elections.rb +0 -7
  592. data/db/migrate/20200807125040_remove_subtitle_from_decidim_elections.rb +0 -7
  593. data/db/migrate/20200910103648_add_min_selections_to_decidim_elections_questions.rb +0 -7
  594. data/db/migrate/20200915142713_add_questionnaire_to_existing_elections.rb +0 -29
  595. data/db/migrate/20200918153813_create_decidim_elections_trustees_participatory_spaces.rb +0 -13
  596. data/db/migrate/20200918153824_create_decidim_elections_elections_trustees.rb +0 -10
  597. data/db/migrate/20200918153835_create_decidim_elections_trustees.rb +0 -12
  598. data/db/migrate/20201026163334_add_blocked_at_and_bb_status_to_elections.rb +0 -8
  599. data/db/migrate/20201028090110_add_votes_to_decidim_elections_answers.rb +0 -7
  600. data/db/migrate/20201028135614_add_selected_to_decidim_elections_answers.rb +0 -7
  601. data/db/migrate/20201209110653_create_decidim_elections_votes.rb +0 -14
  602. data/db/migrate/20201216091123_add_name_to_trustees.rb +0 -7
  603. data/db/migrate/20210113113818_add_message_id_to_decidim_elections_votes.rb +0 -7
  604. data/db/migrate/20210113120115_create_decidim_elections_votings.rb +0 -20
  605. data/db/migrate/20210114100749_add_published_at_to_decidim_votings_votings.rb +0 -7
  606. data/db/migrate/20210114111850_add_user_to_decidim_elections_votes.rb +0 -7
  607. data/db/migrate/20210120164634_add_promoted_to_voting.rb +0 -7
  608. data/db/migrate/20210125124801_add_voting_type_to_voting_voting.rb +0 -7
  609. data/db/migrate/20210129124956_create_decidim_elections_actions.rb +0 -14
  610. data/db/migrate/20210204132111_add_votings_polling_stations.rb +0 -19
  611. data/db/migrate/20210208090441_add_polling_officers_to_votings.rb +0 -12
  612. data/db/migrate/20210210090738_add_votings_polling_station_references_to_votings_polling_officer.rb +0 -8
  613. data/db/migrate/20210216074707_add_monitoring_committee_member.rb +0 -12
  614. data/db/migrate/20210308104024_add_decidim_votings_census_datasets.rb +0 -17
  615. data/db/migrate/20210308104154_add_decidim_votings_census_data.rb +0 -23
  616. data/db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb +0 -20
  617. data/db/migrate/20210326090435_create_elections_results.rb +0 -16
  618. data/db/migrate/20210330102348_remove_votes_count_from_answer.rb +0 -7
  619. data/db/migrate/20210330123606_add_voting_ballot_style.rb +0 -19
  620. data/db/migrate/20210330183204_add_email_to_votes.rb +0 -10
  621. data/db/migrate/20210331152729_add_census_contact_information_to_votings.rb +0 -7
  622. data/db/migrate/20210401095507_add_organization_to_decidim_elections_trustee.rb +0 -11
  623. data/db/migrate/20210402102215_add_ballot_style_to_decidim_votings_census_data.rb +0 -7
  624. data/db/migrate/20210402140402_add_salt_to_elections.rb +0 -22
  625. data/db/migrate/20210412144721_change_elections_results.rb +0 -24
  626. data/db/migrate/20210412144740_create_elections_bulletin_board_closures.rb +0 -13
  627. data/db/migrate/20210412144741_create_votings_polling_station_closures.rb +0 -22
  628. data/db/migrate/20210420112721_create_decidim_votings_in_person_votes.rb +0 -21
  629. data/db/migrate/20210422124826_add_verifiable_results_to_decidim_elections_election.rb +0 -8
  630. data/db/migrate/20210426072845_add_signed_at_to_polling_station_closure.rb +0 -7
  631. data/db/migrate/20210427131742_add_validated_at_to_votings_polling_station_closures.rb +0 -8
  632. data/db/migrate/20220404112802_rename_bb_status_tally_to_tally_started.rb +0 -19
  633. data/db/migrate/20220424121541_add_show_check_census_to_votings.rb +0 -7
  634. data/db/migrate/20220615102642_remove_description_from_elections_questions.rb +0 -7
  635. data/db/migrate/20220711112802_rename_dataset_file_to_filename.rb +0 -7
  636. data/lib/decidim/api/bulletin_board_closure_type.rb +0 -16
  637. data/lib/decidim/api/election_answer_type.rb +0 -24
  638. data/lib/decidim/api/election_question_type.rb +0 -21
  639. data/lib/decidim/api/election_result_type.rb +0 -19
  640. data/lib/decidim/api/election_type.rb +0 -27
  641. data/lib/decidim/api/elections_type.rb +0 -32
  642. data/lib/decidim/api/polling_station_closure_type.rb +0 -19
  643. data/lib/decidim/api/polling_station_type.rb +0 -24
  644. data/lib/decidim/api/trustee_type.rb +0 -16
  645. data/lib/decidim/api/voting_type.rb +0 -20
  646. data/lib/decidim/elections/answer_serializer.rb +0 -49
  647. data/lib/decidim/elections/api.rb +0 -13
  648. data/lib/decidim/elections/menu.rb +0 -39
  649. data/lib/decidim/elections/trustee_zone.rb +0 -10
  650. data/lib/decidim/elections/trustee_zone_engine.rb +0 -32
  651. data/lib/decidim/votings/admin.rb +0 -10
  652. data/lib/decidim/votings/admin_engine.rb +0 -83
  653. data/lib/decidim/votings/api.rb +0 -9
  654. data/lib/decidim/votings/census.rb +0 -16
  655. data/lib/decidim/votings/census_admin.rb +0 -12
  656. data/lib/decidim/votings/census_admin_engine.rb +0 -18
  657. data/lib/decidim/votings/census_engine.rb +0 -19
  658. data/lib/decidim/votings/census_menu.rb +0 -18
  659. data/lib/decidim/votings/content_blocks/registry_manager.rb +0 -95
  660. data/lib/decidim/votings/engine.rb +0 -76
  661. data/lib/decidim/votings/menu.rb +0 -161
  662. data/lib/decidim/votings/participatory_space.rb +0 -55
  663. data/lib/decidim/votings/polling_officer_zone.rb +0 -10
  664. data/lib/decidim/votings/polling_officer_zone_engine.rb +0 -38
  665. data/lib/decidim/votings/polling_officer_zone_menu.rb +0 -17
  666. data/lib/decidim/votings/query_extensions.rb +0 -43
  667. data/lib/decidim/votings/seeds.rb +0 -197
  668. data/lib/decidim/votings/test/factories.rb +0 -263
  669. data/lib/decidim/votings/voting_serializer.rb +0 -55
  670. data/lib/decidim/votings.rb +0 -33
  671. data/lib/tasks/decidim_elections.rake +0 -79
  672. data/lib/tasks/decidim_voting_census.rake +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90f58c1807b5702bce13a7018dc2f661c8474adde2e8d19c4505c0c07b84cb71
4
- data.tar.gz: 4dc59846b966086addd94950ed4407434762c8cd55547dd942e91dc8ab2c56c4
3
+ metadata.gz: 1350982617f9cf2b5417179740fe67d319fd01e74c85fbcc823f092d78b23923
4
+ data.tar.gz: 29788cfe9ee20c68fbbd6739baee65968c98c1ed3daf344e11634ba3f458687e
5
5
  SHA512:
6
- metadata.gz: 0bdbbc4045f6bc4027f0599e9df87979fd30e8d1676d09912269705727a020ff16a9953cc76a26fb870955439a14ecf3fad7752691629f6c22682da972e0f0f1
7
- data.tar.gz: 1ba5cd9848e457ad02f2b37b4d260fe52844b47ead6801f6001b6b44e087219dbb39f6934d5d5c11999642cacdc0b299a1bf8bbdc4a978b78342e97b3e2ba76e
6
+ metadata.gz: 3535497567d41f0d365331a63ffb3aa2f751bcef39460de3f9c3ab377f64e0be9011f85748b819f4910141bdcfbd5ff506b96d11ba3d52d71175571381b80f91
7
+ data.tar.gz: 07cfca093845a3378687f949072ac9a16fcace3ce766e1bbe6be70922db0dc04b8380c3c44fa67d867802766ef5cf1800dd164d9937889ec8c375be1140e3526
data/README.md CHANGED
@@ -1,97 +1,15 @@
1
1
  # Decidim::Elections
2
2
 
3
- :warning: This module is under development and is not ready to be used in production.
4
-
5
- The Elections module adds elections to any participatory space.
6
-
7
- ## Usage
8
-
9
- Elections will be available as a Component for a Participatory Space.
10
-
11
- In order to celebrate [End-to-end auditable votings](https://en.wikipedia.org/wiki/End-to-end_auditable_voting_systems) using the Elections module, you will need to connect your Decidim instance with an instance of the [Decidim Bulletin Board application](https://github.com/decidim/decidim-bulletin-board/). To create this connection, please check the [instructions](https://docs.decidim.org/en/services/elections_bulletin_board/).
12
-
13
- ## Development
14
-
15
- In the case that you only want to use this module for local development or testing purposes, you have an example docker-compose configuration in `docs/`. Mind that this setup is not recommended for production environments. It works with default seeds and configurations for a Decidim installation, so you should not do anything.
16
-
17
- ```bash
18
- cd docs/docker/bulletin_board
19
- docker-compose up
20
- ```
21
-
22
- One important caveat is that as the Trustees' key generation functionality uses the IndexedDB API, and at least in Firefox there is unsupported in the Private Browsing mode (see ticket [#1639542 in Mozilla's Bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1639542)). As a workaround there is the [Firefox Multi-Account Containers addon](https://addons.mozilla.org/es/firefox/addon/multi-account-containers/).
23
-
24
- ## Testing
25
-
26
- Besides the [set-up typical for Decidim](https://docs.decidim.org/en/develop/develop/testing), for some of the specs a Bulletin Board installation is needed, running in port 5017 by default with the `DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL` environment variable set up with the "true" string. There is a working configuration on `docs`.
27
-
28
- ```bash
29
- cd docs/docker/bulletin_board_test
30
- docker-compose up
31
- ```
32
-
33
- As the Bulletin Board service is a necessary dependency for this module to work, if it is not running while executing the specs, the following exception will be shown.
34
-
35
- > Failure/Error: Decidim::Elections.bulletin_board.reset_test_database
36
- >
37
- > StandardError:
38
- > Sorry, something went wrong
39
- >
40
- > ./spec/shared/test_bulletin_board_shared_context.rb:6:in 'block (2 levels) in <top (required)>'
41
- > (...)
42
- > -- Caused by:
43
- > Errno::ECONNREFUSED:
44
- > Connection refused - connect(2) for 127.0.0.1:5017
45
- > ./spec/shared/test_bulletin_board_shared_context.rb:6:in 'block (2 levels) in <top (required)>'
3
+ The Decidim::Elections is a component that allows users to setup non-cryptographic elections. Elections are basically polls/surveys with census access management built-in. This allows registered or non-registered users to directly participate in them.
46
4
 
47
5
  ## Installation
48
6
 
49
- Add this line to your application's Gemfile:
50
-
51
- ```ruby
52
- gem "decidim-elections"
53
- ```
54
-
55
- And then execute:
56
-
57
- ```bash
58
- bundle
59
- ```
60
-
61
- ## Configuration
62
-
63
- ### Identification numbers
64
-
65
- For the verification of the participants' data in the Voting's census, you can configure which type of documents a participant can have. By default these documents are `identification_number` and `passport`, but in some countries you may need to adapt these to your specifics needs. For instance, in Spain there are `dni`, `nie` and `passport`.
66
-
67
- For configuring these you can do so with the Environment Variable `ELECTIONS_DOCUMENT_TYPES`.
68
-
69
- ```env
70
- ELECTIONS_DOCUMENT_TYPES="dni,nie,passport"
71
- ```
72
-
73
- You need to also add the following keys in your i18n files (i.e. `config/locales/en.yml`).
74
-
75
- ```yaml
76
- en:
77
- decidim:
78
- votings:
79
- census:
80
- document_types:
81
- dni: DNI
82
- nie: NIE
83
- passport: Passport
84
- ```
85
-
86
- ### Scheduled tasks
87
-
88
- For the Elections module to function as expected, there are some background tasks that should be scheduled to be executed regularly. Alternatively you could use `whenever` gem or the scheduled jobs of your hosting provider.
7
+ In order to install use this module, you need at least Decidim 0.31 to be installed.
89
8
 
90
- You can configure it with `crontab -e`, for instance if you have created your Decidim application on /home/user/decidim_application:
9
+ To install this module, run in your console:
91
10
 
92
11
  ```bash
93
- # Remove census export files
94
- 0 0 * * * cd /home/user/decidim_application && RAILS_ENV=production bundle exec rake decidim_votings_census:delete_census_access_codes_export
12
+ bundle add decidim-elections
95
13
  ```
96
14
 
97
15
  ## Contributing
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Elections
5
+ # This cell renders metadata for an instance of a Meeting
6
+ class ElectionCardMetadataCell < Decidim::CardMetadataCell
7
+ include Decidim::LayoutHelper
8
+ include ActionView::Helpers::DateHelper
9
+ include Decidim::Elections::LabelHelper
10
+
11
+ alias election model
12
+
13
+ delegate :start_at, :end_at, to: :election
14
+
15
+ def initialize(*)
16
+ super
17
+
18
+ @items.prepend(*election_items)
19
+ end
20
+
21
+ def election_items
22
+ [label, progress_item]
23
+ end
24
+
25
+ def label
26
+ { text: election_status_with_label(election) }
27
+ end
28
+
29
+ def current_date
30
+ @current_date ||= Time.current.to_time
31
+ end
32
+
33
+ def start_date
34
+ return if start_at.blank?
35
+
36
+ @start_date ||= start_at.to_time
37
+ end
38
+
39
+ def end_date
40
+ return if end_at.blank?
41
+
42
+ @end_date ||= end_at.to_time
43
+ end
44
+
45
+ def progress_text
46
+ if election.published_results? && election.finished?
47
+ return t("published_results", scope: "decidim.metadata.progress",
48
+ end_date: l(election.results_at.to_time, format: :decidim_short))
49
+ end
50
+
51
+ super
52
+ end
53
+ end
54
+ end
55
+ end
@@ -2,10 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Elections
5
- # This cell renders the election card for an instance of an election
6
- # the default size is the Search Card (:s)
7
5
  class ElectionCell < Decidim::ViewModel
8
- include ElectionCellsHelper
9
6
  include Cell::ViewModel::Partial
10
7
 
11
8
  def show
@@ -18,8 +15,10 @@ module Decidim
18
15
  case @options[:size]
19
16
  when :s
20
17
  "decidim/elections/election_s"
21
- else
18
+ when :g
22
19
  "decidim/elections/election_g"
20
+ else
21
+ "decidim/elections/election_l"
23
22
  end
24
23
  end
25
24
  end
@@ -1,22 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "cell/partial"
4
+
3
5
  module Decidim
4
6
  module Elections
5
- # This cell renders the Grid (:g) election card
7
+ # This cell renders the Search (:s) election card
6
8
  # for a given instance of an Election
7
9
  class ElectionGCell < Decidim::CardGCell
8
- include ElectionCellsHelper
9
-
10
- def metadata_cell
11
- "decidim/elections/election_metadata"
10
+ def show
11
+ render
12
12
  end
13
13
 
14
- def has_image?
15
- model.photos.present?
14
+ private
15
+
16
+ def show_description?
17
+ true
16
18
  end
17
19
 
18
- def resource_image_path
19
- model.photos.first.url if has_image?
20
+ def metadata_cell
21
+ "decidim/elections/election_card_metadata"
20
22
  end
21
23
  end
22
24
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "cell/partial"
4
+
5
+ module Decidim
6
+ module Elections
7
+ # This cell renders the Search (:s) election card
8
+ # for a given instance of an Election
9
+ class ElectionLCell < Decidim::CardLCell
10
+ delegate :photo, to: :model
11
+
12
+ private
13
+
14
+ def has_description?
15
+ true
16
+ end
17
+
18
+ def title
19
+ present(model).title(html_escape: true)
20
+ end
21
+
22
+ def description
23
+ text = translated_attribute(model.description)
24
+
25
+ decidim_sanitize(html_truncate(text, length: 240), strip_tags: true)
26
+ end
27
+
28
+ def metadata_cell
29
+ "decidim/elections/election_card_metadata"
30
+ end
31
+
32
+ def resource_image_url
33
+ return if photo.blank?
34
+
35
+ photo.url
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,10 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "cell/partial"
4
+
3
5
  module Decidim
4
6
  module Elections
5
7
  # This cell renders the Search (:s) election card
6
8
  # for a given instance of an Election
7
9
  class ElectionSCell < Decidim::CardSCell
10
+ private
11
+
12
+ def title
13
+ present(model).title(html_escape: true)
14
+ end
15
+
16
+ def metadata_cell
17
+ "decidim/elections/election_card_metadata"
18
+ end
8
19
  end
9
20
  end
10
21
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Elections
5
+ module Admin
6
+ module Censuses
7
+ # A command with the business logic to create census data for an
8
+ # election.
9
+ class TokenCsv < Decidim::Command
10
+ def initialize(form, election)
11
+ @form = form
12
+ @election = election
13
+ end
14
+
15
+ # Executes the command. Broadcast these events:
16
+ # - :ok when everything is valid
17
+ # - :invalid when the form was not valid and could not proceed-
18
+ #
19
+ # Returns nothing.
20
+ def call
21
+ return broadcast(:invalid) if @form.invalid?
22
+ return broadcast(:invalid) if @form.remove_all && @election.census.blank?
23
+
24
+ # If the form is set to remove all, we just delete all voters
25
+ if @form.remove_all
26
+ @election.voters.delete_all
27
+ return broadcast(:ok)
28
+ end
29
+ return broadcast(:invalid) unless @form.file
30
+
31
+ rows = @form.data
32
+ return broadcast(:invalid) if rows.blank?
33
+
34
+ Voter.bulk_insert(@election, rows.map { |row| { email: row.first.downcase, token: row.second } })
35
+ broadcast(:ok)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -3,56 +3,45 @@
3
3
  module Decidim
4
4
  module Elections
5
5
  module Admin
6
- # This command is executed when the user creates an Election
7
- # from the admin panel.
8
- class CreateElection < Decidim::Command
6
+ class CreateElection < Decidim::Commands::CreateResource
9
7
  include ::Decidim::GalleryMethods
10
8
 
11
- def initialize(form)
12
- @form = form
13
- end
9
+ fetch_form_attributes :title, :description, :start_at, :end_at, :results_availability
10
+
11
+ protected
12
+
13
+ attr_reader :gallery
14
14
 
15
- # Creates the election if valid.
16
- #
17
- # Broadcasts :ok if successful, :invalid otherwise.
18
- def call
19
- return broadcast(:invalid) if form.invalid?
15
+ def resource_class = Decidim::Elections::Election
20
16
 
21
- if process_gallery?
22
- build_gallery
23
- return broadcast(:invalid) if gallery_invalid?
24
- end
17
+ def extra_params
18
+ { visibility: "all" }
19
+ end
25
20
 
26
- transaction do
27
- create_election!
28
- create_gallery if process_gallery?
29
- end
21
+ def attributes
22
+ parsed_title = Decidim::ContentProcessor.parse(form.title, current_organization: form.current_organization).rewrite
23
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:inline_images, form.description, current_organization: form.current_organization).rewrite
24
+
25
+ super.merge({
26
+ component: form.current_component,
27
+ title: parsed_title,
28
+ description: parsed_description,
29
+ start_at: form.manual_start ? nil : form.start_at,
30
+ end_at: form.end_at,
31
+ results_availability: form.results_availability
32
+ })
33
+ end
30
34
 
31
- broadcast(:ok, election)
35
+ def run_after_hooks
36
+ @attached_to = resource
37
+ create_gallery if process_gallery?
32
38
  end
33
39
 
34
- private
35
-
36
- attr_reader :form, :election, :gallery
37
-
38
- def create_election!
39
- attributes = {
40
- title: form.title,
41
- description: form.description,
42
- start_time: form.start_time,
43
- end_time: form.end_time,
44
- component: form.current_component,
45
- questionnaire: Decidim::Forms::Questionnaire.new,
46
- salt: Tokenizer.random_salt
47
- }
48
-
49
- @election = Decidim.traceability.create!(
50
- Election,
51
- form.current_user,
52
- attributes,
53
- visibility: "all"
54
- )
55
- @attached_to = @election
40
+ def run_before_hooks
41
+ return unless process_gallery?
42
+
43
+ build_gallery
44
+ raise Decidim::Commands::HookError if gallery_invalid?
56
45
  end
57
46
  end
58
47
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Elections
5
+ module Admin
6
+ # A command with the business logic to create census data for an
7
+ # election.
8
+ class ProcessCensus < Decidim::Commands::UpdateResource
9
+ def attributes
10
+ {
11
+ census_manifest: resource.census.name,
12
+ census_settings: census_settings
13
+ }
14
+ end
15
+
16
+ # This will run any post-processing hooks defined in the census manifest
17
+ def run_after_hooks
18
+ command = resource.census.after_update_command&.safe_constantize
19
+ return unless command
20
+
21
+ command.call(form, resource)
22
+ end
23
+
24
+ def census_settings
25
+ return {} unless form.respond_to?(:census_settings)
26
+
27
+ form.census_settings
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -3,23 +3,28 @@
3
3
  module Decidim
4
4
  module Elections
5
5
  module Admin
6
- # This command gets called when an election is published from the admin panel.
7
6
  class PublishElection < Decidim::Command
8
- # Public: Initializes the command.
7
+ # A command to publish an election.
9
8
  #
10
- # election - The election to publish.
11
- # current_user - the user performing the action
9
+ # election - Decidim::Elections::Election
10
+ # Current_user - the user performing the action
12
11
  def initialize(election, current_user)
13
12
  @election = election
14
13
  @current_user = current_user
15
14
  end
16
15
 
17
- # Public: Publishes the Election.
16
+ # Executes the command. Broadcasts these events:
18
17
  #
19
- # Broadcasts :ok if published, :invalid otherwise.
18
+ # - :ok when everything is valid.
19
+ # - :invalid if the form was not valid and we could not proceed.
20
+ #
21
+ # Returns nothing.
20
22
  def call
21
- publish_election
22
- publish_event unless election.previously_published?
23
+ return broadcast(:invalid) if election.published?
24
+
25
+ transaction do
26
+ publish_election
27
+ end
23
28
 
24
29
  broadcast(:ok, election)
25
30
  end
@@ -29,7 +34,7 @@ module Decidim
29
34
  attr_reader :election, :current_user
30
35
 
31
36
  def publish_election
32
- Decidim.traceability.perform_action!(
37
+ @election = Decidim.traceability.perform_action!(
33
38
  :publish,
34
39
  election,
35
40
  current_user,
@@ -39,15 +44,6 @@ module Decidim
39
44
  election
40
45
  end
41
46
  end
42
-
43
- def publish_event
44
- Decidim::EventsManager.publish(
45
- event: "decidim.events.elections.election_published",
46
- event_class: ::Decidim::Elections::ElectionPublishedEvent,
47
- resource: election,
48
- followers: election.participatory_space.followers
49
- )
50
- end
51
47
  end
52
48
  end
53
49
  end
@@ -3,40 +3,42 @@
3
3
  module Decidim
4
4
  module Elections
5
5
  module Admin
6
- # This command gets called when an election is unpublished from the admin panel.
6
+ # A command with all the business logic that unpublishes an
7
+ # existing election.
7
8
  class UnpublishElection < Decidim::Command
8
- # Public: Initializes the command.
9
+ # Public: initializes the command.
9
10
  #
10
- # election - The election to unpublish.
11
+ # election - Decidim::Elections::Election
11
12
  # current_user - the user performing the action
12
13
  def initialize(election, current_user)
13
14
  @election = election
14
15
  @current_user = current_user
15
16
  end
16
17
 
17
- # Public: Unpublishes the Election.
18
+ # Executes the command. Broadcasts these events:
18
19
  #
19
- # Broadcasts :ok if unpublished, :invalid otherwise.
20
+ # - :ok when everything is valid.
21
+ # - :invalid if the form was not valid and we could not proceed.
22
+ #
23
+ # Returns nothing.
20
24
  def call
21
- unpublish_election
22
-
23
- broadcast(:ok)
24
- end
25
+ return broadcast(:invalid) unless election.published?
25
26
 
26
- private
27
-
28
- attr_reader :election, :current_user
29
-
30
- def unpublish_election
31
- Decidim.traceability.perform_action!(
27
+ @election = Decidim.traceability.perform_action!(
32
28
  :unpublish,
33
29
  election,
34
- current_user
30
+ current_user,
31
+ visibility: "all"
35
32
  ) do
36
33
  election.unpublish!
37
34
  election
38
35
  end
36
+ broadcast(:ok, election)
39
37
  end
38
+
39
+ private
40
+
41
+ attr_reader :election, :current_user
40
42
  end
41
43
  end
42
44
  end
@@ -3,55 +3,55 @@
3
3
  module Decidim
4
4
  module Elections
5
5
  module Admin
6
- # This command is executed when the user updates an Election
7
- # from the admin panel.
8
- class UpdateElection < Decidim::Command
6
+ class UpdateElection < Decidim::Commands::UpdateResource
9
7
  include ::Decidim::GalleryMethods
8
+ fetch_form_attributes :title, :description, :start_at, :end_at, :results_availability
10
9
 
11
10
  def initialize(form, election)
12
- @form = form
13
- @election = election
11
+ super
14
12
  @attached_to = election
15
13
  end
16
14
 
17
- # Updates the election if valid.
18
- #
19
- # Broadcasts :ok if successful, :invalid otherwise.
20
- def call
21
- return broadcast(:invalid) if form.invalid?
15
+ private
22
16
 
23
- if process_gallery?
24
- build_gallery
25
- return broadcast(:invalid) if gallery_invalid?
26
- end
17
+ alias election resource
27
18
 
28
- transaction do
29
- update_election!
30
- create_gallery if process_gallery?
31
- photo_cleanup!
32
- end
19
+ def attributes
20
+ election.published? ? published_election_attributes : unpublished_election_attributes
21
+ end
33
22
 
34
- broadcast(:ok, election)
23
+ def published_election_attributes
24
+ { description: parsed_description }
35
25
  end
36
26
 
37
- private
27
+ def unpublished_election_attributes
28
+ {
29
+ title: parsed_title,
30
+ description: parsed_description,
31
+ start_at: form.manual_start ? nil : form.start_at,
32
+ end_at: form.end_at,
33
+ results_availability: form.results_availability
34
+ }
35
+ end
38
36
 
39
- attr_reader :form, :election, :gallery
37
+ def parsed_title
38
+ Decidim::ContentProcessor.parse(form.title, current_organization: form.current_organization).rewrite
39
+ end
40
40
 
41
- def update_election!
42
- attributes = {
43
- title: form.title,
44
- description: form.description,
45
- start_time: form.start_time,
46
- end_time: form.end_time
47
- }
41
+ def parsed_description
42
+ Decidim::ContentProcessor.parse(form.description, current_organization: form.current_organization).rewrite
43
+ end
44
+
45
+ def run_after_hooks
46
+ create_gallery if process_gallery?
47
+ photo_cleanup!
48
+ end
49
+
50
+ def run_before_hooks
51
+ return unless process_gallery?
48
52
 
49
- Decidim.traceability.update!(
50
- election,
51
- form.current_user,
52
- attributes,
53
- visibility: "all"
54
- )
53
+ build_gallery
54
+ raise Decidim::Commands::HookError if gallery_invalid?
55
55
  end
56
56
  end
57
57
  end