decidim-elections 0.23.3 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (324) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/app/assets/config/admin/decidim_votings_manifest.css +0 -0
  4. data/app/assets/config/admin/decidim_votings_manifest.js +4 -0
  5. data/app/assets/config/decidim_elections_manifest.css +3 -0
  6. data/app/assets/config/decidim_elections_manifest.js +6 -0
  7. data/app/assets/config/decidim_votings_manifest.css +3 -0
  8. data/app/assets/config/decidim_votings_manifest.js +0 -0
  9. data/app/assets/images/decidim/votings/icon.svg +1 -0
  10. data/app/assets/javascripts/decidim/elections/admin/pending_action.js.es6 +16 -0
  11. data/app/assets/javascripts/decidim/elections/admin/vote_statistics.js.es6 +11 -0
  12. data/app/assets/javascripts/decidim/elections/trustee_zone.js.es6 +54 -0
  13. data/app/assets/javascripts/decidim/elections/trustee_zone/key_ceremony.js.es6 +126 -0
  14. data/app/assets/javascripts/decidim/elections/trustee_zone/tally.js.es6 +104 -0
  15. data/app/assets/javascripts/decidim/elections/vote.js.es6 +107 -160
  16. data/app/assets/javascripts/decidim/elections/vote_questions.component.js.es6 +129 -0
  17. data/app/assets/javascripts/decidim/elections/vote_verify.js.es6 +71 -0
  18. data/app/assets/javascripts/decidim/votings/admin/monitoring_committee_members_form.js.es6 +35 -0
  19. data/app/assets/javascripts/decidim/votings/admin/polling_officers_form.js.es6 +35 -0
  20. data/app/assets/javascripts/decidim/votings/admin/polling_officers_picker.js.es6 +35 -0
  21. data/app/assets/javascripts/decidim/votings/admin/polling_stations_form.js.es6 +5 -0
  22. data/app/assets/stylesheets/decidim/elections/elections.scss +0 -4
  23. data/app/assets/stylesheets/decidim/elections/focus/_accordion.scss +36 -0
  24. data/app/assets/stylesheets/decidim/elections/focus/_evote.scss +58 -0
  25. data/app/assets/stylesheets/decidim/elections/trustee_zone.scss +24 -0
  26. data/app/assets/stylesheets/decidim/votings/votings.scss +1 -0
  27. data/app/assets/stylesheets/decidim/votings/votings/_votings-header.scss +99 -0
  28. data/app/assets/stylesheets/decidim/votings/votings/_votings-home-banner.scss +11 -0
  29. data/app/cells/decidim/votings/content_block_cell.rb +17 -0
  30. data/app/cells/decidim/votings/content_blocks/highlighted_votings/show.erb +30 -0
  31. data/app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb +33 -0
  32. data/app/cells/decidim/votings/content_blocks/highlighted_votings_settings_form/show.erb +3 -0
  33. data/app/cells/decidim/votings/content_blocks/highlighted_votings_settings_form_cell.rb +19 -0
  34. data/app/cells/decidim/votings/content_blocks/landing_page/attachments_and_folders_cell.rb +15 -0
  35. data/app/cells/decidim/votings/content_blocks/landing_page/description_cell.rb +15 -0
  36. data/app/cells/decidim/votings/content_blocks/landing_page/elections_cell.rb +15 -0
  37. data/app/cells/decidim/votings/content_blocks/landing_page/header_cell.rb +15 -0
  38. data/app/cells/decidim/votings/content_blocks/landing_page/metrics_cell.rb +15 -0
  39. data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations_cell.rb +15 -0
  40. data/app/cells/decidim/votings/content_blocks/landing_page/stats_cell.rb +15 -0
  41. data/app/cells/decidim/votings/content_blocks/landing_page/timeline_cell.rb +15 -0
  42. data/app/cells/decidim/votings/polling_officers/polling_officers_picker/polling_officers.erb +12 -0
  43. data/app/cells/decidim/votings/polling_officers/polling_officers_picker/show.erb +14 -0
  44. data/app/cells/decidim/votings/polling_officers/polling_officers_picker_cell.rb +73 -0
  45. data/app/cells/decidim/votings/voting_cell.rb +19 -0
  46. data/app/cells/decidim/votings/voting_m/data.erb +21 -0
  47. data/app/cells/decidim/votings/voting_m/footer.erb +5 -0
  48. data/app/cells/decidim/votings/voting_m_cell.rb +94 -0
  49. data/app/commands/decidim/elections/admin/add_user_as_trustee.rb +81 -0
  50. data/app/commands/decidim/elections/admin/create_election.rb +2 -1
  51. data/app/commands/decidim/elections/admin/end_vote.rb +63 -0
  52. data/app/commands/decidim/elections/admin/publish_results.rb +59 -0
  53. data/app/commands/decidim/elections/admin/remove_trustee_from_participatory_space.rb +37 -0
  54. data/app/commands/decidim/elections/admin/setup_election.rb +160 -0
  55. data/app/commands/decidim/elections/admin/start_key_ceremony.rb +63 -0
  56. data/app/commands/decidim/elections/admin/start_tally.rb +63 -0
  57. data/app/commands/decidim/elections/admin/start_vote.rb +63 -0
  58. data/app/commands/decidim/elections/admin/update_action_status.rb +47 -0
  59. data/app/commands/decidim/elections/admin/update_answer_selection.rb +41 -0
  60. data/app/commands/decidim/elections/admin/update_trustee_participatory_space.rb +40 -0
  61. data/app/commands/decidim/elections/trustee_zone/update_election_bulletin_board_status.rb +39 -0
  62. data/app/commands/decidim/elections/trustee_zone/update_trustee.rb +41 -0
  63. data/app/commands/decidim/elections/voter/cast_vote.rb +59 -0
  64. data/app/commands/decidim/elections/voter/update_vote_status.rb +70 -0
  65. data/app/commands/decidim/votings/admin/create_monitoring_committee_member.rb +99 -0
  66. data/app/commands/decidim/votings/admin/create_polling_officer.rb +99 -0
  67. data/app/commands/decidim/votings/admin/create_polling_station.rb +59 -0
  68. data/app/commands/decidim/votings/admin/create_voting.rb +59 -0
  69. data/app/commands/decidim/votings/admin/destroy_monitoring_committee_member.rb +51 -0
  70. data/app/commands/decidim/votings/admin/destroy_polling_officer.rb +52 -0
  71. data/app/commands/decidim/votings/admin/destroy_polling_station.rb +40 -0
  72. data/app/commands/decidim/votings/admin/manage_polling_station.rb +64 -0
  73. data/app/commands/decidim/votings/admin/publish_voting.rb +40 -0
  74. data/app/commands/decidim/votings/admin/unpublish_voting.rb +40 -0
  75. data/app/commands/decidim/votings/admin/update_polling_station.rb +50 -0
  76. data/app/commands/decidim/votings/admin/update_voting.rb +85 -0
  77. data/app/constraints/decidim/votings/current_component.rb +28 -0
  78. data/app/constraints/decidim/votings/current_voting.rb +43 -0
  79. data/app/controllers/concerns/decidim/elections/orderable.rb +2 -2
  80. data/app/controllers/concerns/decidim/polling_officers/admin/filterable.rb +58 -0
  81. data/app/controllers/concerns/decidim/polling_stations/admin/filterable.rb +57 -0
  82. data/app/controllers/concerns/decidim/votings/admin/filterable.rb +27 -0
  83. data/app/controllers/concerns/decidim/votings/admin/voting_admin.rb +48 -0
  84. data/app/controllers/concerns/decidim/votings/needs_voting.rb +44 -0
  85. data/app/controllers/concerns/decidim/votings/orderable.rb +32 -0
  86. data/app/controllers/decidim/elections/admin/answers_controller.rb +32 -0
  87. data/app/controllers/decidim/elections/admin/elections_controller.rb +2 -2
  88. data/app/controllers/decidim/elections/admin/feedback_forms_controller.rb +55 -0
  89. data/app/controllers/decidim/elections/admin/steps_controller.rb +96 -0
  90. data/app/controllers/decidim/elections/admin/trustees_participatory_spaces_controller.rb +89 -0
  91. data/app/controllers/decidim/elections/elections_controller.rb +5 -1
  92. data/app/controllers/decidim/elections/feedbacks_controller.rb +38 -0
  93. data/app/controllers/decidim/elections/trustee_zone/application_controller.rb +45 -0
  94. data/app/controllers/decidim/elections/trustee_zone/elections_controller.rb +35 -0
  95. data/app/controllers/decidim/elections/trustee_zone/trustees_controller.rb +36 -0
  96. data/app/controllers/decidim/elections/votes_controller.rb +54 -2
  97. data/app/controllers/decidim/votings/admin/application_controller.rb +26 -0
  98. data/app/controllers/decidim/votings/admin/component_permissions_controller.rb +13 -0
  99. data/app/controllers/decidim/votings/admin/components_controller.rb +15 -0
  100. data/app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb +62 -0
  101. data/app/controllers/decidim/votings/admin/polling_officers_controller.rb +66 -0
  102. data/app/controllers/decidim/votings/admin/polling_stations_controller.rb +92 -0
  103. data/app/controllers/decidim/votings/admin/voting_attachment_collections_controller.rb +22 -0
  104. data/app/controllers/decidim/votings/admin/voting_attachments_controller.rb +21 -0
  105. data/app/controllers/decidim/votings/admin/votings_controller.rb +124 -0
  106. data/app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb +44 -0
  107. data/app/controllers/decidim/votings/admin/votings_landing_page_controller.rb +46 -0
  108. data/app/controllers/decidim/votings/application_controller.rb +26 -0
  109. data/app/controllers/decidim/votings/polling_officer_zone/application_controller.rb +33 -0
  110. data/app/controllers/decidim/votings/polling_officer_zone/polling_officers_controller.rb +17 -0
  111. data/app/controllers/decidim/votings/polling_officer_zone/polling_stations_controller.rb +22 -0
  112. data/app/controllers/decidim/votings/votings_controller.rb +98 -0
  113. data/app/events/decidim/elections/trustees/notify_new_trustee_event.rb +28 -0
  114. data/app/events/decidim/elections/trustees/notify_trustee_new_election_event.rb +14 -0
  115. data/app/events/decidim/elections/votes/vote_accepted_event.rb +24 -0
  116. data/app/events/decidim/votings/polling_officers/polling_station_assigned_event.rb +44 -0
  117. data/app/forms/decidim/elections/admin/action_form.rb +34 -0
  118. data/app/forms/decidim/elections/admin/answer_form.rb +3 -2
  119. data/app/forms/decidim/elections/admin/election_form.rb +3 -2
  120. data/app/forms/decidim/elections/admin/setup_form.rb +79 -0
  121. data/app/forms/decidim/elections/admin/trustees_participatory_space_form.rb +22 -0
  122. data/app/forms/decidim/elections/admin/vote_period_form.rb +37 -0
  123. data/app/forms/decidim/elections/ballot/verify_vote_form.rb +29 -0
  124. data/app/forms/decidim/elections/trustee_zone/trustee_form.rb +26 -0
  125. data/app/forms/decidim/elections/voter/encrypted_vote_form.rb +49 -0
  126. data/app/forms/decidim/votings/admin/monitoring_committee_member_form.rb +27 -0
  127. data/app/forms/decidim/votings/admin/polling_officer_form.rb +27 -0
  128. data/app/forms/decidim/votings/admin/polling_station_form.rb +58 -0
  129. data/app/forms/decidim/votings/admin/voting_form.rb +71 -0
  130. data/app/helpers/decidim/elections/admin/answers_helper.rb +19 -0
  131. data/app/helpers/decidim/elections/admin/steps_helper.rb +23 -0
  132. data/app/helpers/decidim/elections/admin/trustees_participatory_spaces_helper.rb +31 -0
  133. data/app/helpers/decidim/elections/elections_helper.rb +29 -0
  134. data/app/helpers/decidim/votings/admin/polling_officers_picker_helper.rb +29 -0
  135. data/app/helpers/decidim/votings/votings_helper.rb +20 -0
  136. data/app/models/decidim/elections/action.rb +13 -0
  137. data/app/models/decidim/elections/election.rb +54 -3
  138. data/app/models/decidim/elections/elections_trustee.rb +11 -0
  139. data/app/models/decidim/elections/question.rb +19 -0
  140. data/app/models/decidim/elections/trustee.rb +26 -0
  141. data/app/models/decidim/elections/trustees_participatory_space.rb +13 -0
  142. data/app/models/decidim/elections/vote.rb +15 -0
  143. data/app/models/decidim/votings/monitoring_committee_member.rb +24 -0
  144. data/app/models/decidim/votings/polling_officer.rb +76 -0
  145. data/app/models/decidim/votings/polling_station.rb +64 -0
  146. data/app/models/decidim/votings/voting.rb +138 -0
  147. data/app/permissions/decidim/elections/admin/permissions.rb +50 -10
  148. data/app/permissions/decidim/elections/permissions.rb +20 -2
  149. data/app/permissions/decidim/elections/trustee_zone/permissions.rb +32 -0
  150. data/app/permissions/decidim/votings/admin/permissions.rb +127 -0
  151. data/app/permissions/decidim/votings/permissions.rb +40 -0
  152. data/app/permissions/decidim/votings/polling_officer_zone/permissions.rb +32 -0
  153. data/app/presenters/decidim/elections/admin_log/election_presenter.rb +1 -1
  154. data/app/presenters/decidim/elections/trustee_presenter.rb +24 -0
  155. data/app/presenters/decidim/votings/admin_log/voting_presenter.rb +45 -0
  156. data/app/presenters/decidim/votings/polling_station_presenter.rb +27 -0
  157. data/app/presenters/decidim/votings/voting_presenter.rb +36 -0
  158. data/app/queries/decidim/elections/admin/pending_actions.rb +20 -0
  159. data/app/queries/decidim/elections/admin/votes_for_statistics.rb +24 -0
  160. data/app/queries/decidim/elections/elections_finished_to_end.rb +19 -0
  161. data/app/queries/decidim/elections/elections_ready_to_start.rb +25 -0
  162. data/app/queries/decidim/elections/trustees/by_participatory_space.rb +24 -0
  163. data/app/queries/decidim/elections/trustees/by_participatory_space_trustee_ids.rb +24 -0
  164. data/app/queries/decidim/elections/votes/election_votes.rb +19 -0
  165. data/app/queries/decidim/elections/votes/pending_votes.rb +20 -0
  166. data/app/queries/decidim/elections/votes/user_election_last_vote.rb +26 -0
  167. data/app/queries/decidim/elections/votes/user_votes.rb +19 -0
  168. data/app/queries/decidim/votings/admin/admin_users.rb +39 -0
  169. data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations.rb +33 -0
  170. data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations_and_user.rb +34 -0
  171. data/app/queries/decidim/votings/admin/polling_officers_join_user.rb +32 -0
  172. data/app/queries/decidim/votings/organization_prioritized_votings.rb +21 -0
  173. data/app/queries/decidim/votings/organization_promoted_votings.rb +16 -0
  174. data/app/queries/decidim/votings/organization_published_votings.rb +19 -0
  175. data/app/queries/decidim/votings/organization_votings.rb +16 -0
  176. data/app/queries/decidim/votings/prioritized_votings.rb +13 -0
  177. data/app/queries/decidim/votings/published_votings.rb +12 -0
  178. data/app/services/decidim/votings/voting_search.rb +46 -0
  179. data/app/views/decidim/elections/admin/answers/index.html.erb +12 -0
  180. data/app/views/decidim/elections/admin/elections/index.html.erb +13 -1
  181. data/app/views/decidim/elections/admin/proposals_imports/new.html.erb +1 -1
  182. data/app/views/decidim/elections/admin/questions/index.html.erb +5 -1
  183. data/app/views/decidim/elections/admin/shared/_trustees_secondary_nav.html.erb +3 -0
  184. data/app/views/decidim/elections/admin/steps/_create_election.html.erb +38 -0
  185. data/app/views/decidim/elections/admin/steps/_created.html.erb +16 -0
  186. data/app/views/decidim/elections/admin/steps/_key_ceremony.html.erb +16 -0
  187. data/app/views/decidim/elections/admin/steps/_key_ceremony_ended.html.erb +15 -0
  188. data/app/views/decidim/elections/admin/steps/_tally.html.erb +17 -0
  189. data/app/views/decidim/elections/admin/steps/_tally_ended.html.erb +9 -0
  190. data/app/views/decidim/elections/admin/steps/_vote.html.erb +21 -0
  191. data/app/views/decidim/elections/admin/steps/_vote_ended.html.erb +15 -0
  192. data/app/views/decidim/elections/admin/steps/_vote_stats.html.erb +31 -0
  193. data/app/views/decidim/elections/admin/steps/index.html.erb +43 -0
  194. data/app/views/decidim/elections/admin/trustees_participatory_spaces/_form.html.erb +19 -0
  195. data/app/views/decidim/elections/admin/trustees_participatory_spaces/index.html.erb +64 -0
  196. data/app/views/decidim/elections/admin/trustees_participatory_spaces/new.html.erb +7 -0
  197. data/app/views/decidim/elections/elections/_preview.html.erb +26 -0
  198. data/app/views/decidim/elections/elections/_results.html.erb +47 -0
  199. data/app/views/decidim/elections/elections/show.html.erb +43 -18
  200. data/app/views/decidim/elections/trustee_zone/elections/_backup_modal.html.erb +24 -0
  201. data/app/views/decidim/elections/trustee_zone/elections/_key_ceremony_steps.html.erb +44 -0
  202. data/app/views/decidim/elections/trustee_zone/elections/_restore_modal.html.erb +25 -0
  203. data/app/views/decidim/elections/trustee_zone/elections/_tally_steps.html.erb +43 -0
  204. data/app/views/decidim/elections/trustee_zone/elections/show.html.erb +38 -0
  205. data/app/views/decidim/elections/trustee_zone/elections/update.js.erb +5 -0
  206. data/app/views/decidim/elections/trustee_zone/trustees/show.html.erb +102 -0
  207. data/app/views/decidim/elections/votes/_election_votes_confirmed.html.erb +38 -17
  208. data/app/views/decidim/elections/votes/_election_votes_failed.html.erb +21 -0
  209. data/app/views/decidim/elections/votes/_election_votes_question.html.erb +4 -4
  210. data/app/views/decidim/elections/votes/cast_failed.js.erb +1 -0
  211. data/app/views/decidim/elections/votes/cast_success.js.erb +1 -0
  212. data/app/views/decidim/elections/votes/new.html.erb +41 -33
  213. data/app/views/decidim/elections/votes/verify.html.erb +78 -0
  214. data/app/views/decidim/votings/admin/monitoring_committee_members/_form.html.erb +27 -0
  215. data/app/views/decidim/votings/admin/monitoring_committee_members/index.html.erb +41 -0
  216. data/app/views/decidim/votings/admin/monitoring_committee_members/new.html.erb +7 -0
  217. data/app/views/decidim/votings/admin/polling_officers/_form.html.erb +27 -0
  218. data/app/views/decidim/votings/admin/polling_officers/index.html.erb +50 -0
  219. data/app/views/decidim/votings/admin/polling_officers/new.html.erb +7 -0
  220. data/app/views/decidim/votings/admin/polling_stations/_form.html.erb +40 -0
  221. data/app/views/decidim/votings/admin/polling_stations/edit.html.erb +7 -0
  222. data/app/views/decidim/votings/admin/polling_stations/index.html.erb +55 -0
  223. data/app/views/decidim/votings/admin/polling_stations/new.html.erb +7 -0
  224. data/app/views/decidim/votings/admin/votings/_form.html.erb +63 -0
  225. data/app/views/decidim/votings/admin/votings/edit.html.erb +31 -0
  226. data/app/views/decidim/votings/admin/votings/index.html.erb +87 -0
  227. data/app/views/decidim/votings/admin/votings/new.html.erb +13 -0
  228. data/app/views/decidim/votings/admin/votings/polling_officers_picker.html.erb +2 -0
  229. data/app/views/decidim/votings/polling_officer_zone/polling_officers/show.html.erb +42 -0
  230. data/app/views/decidim/votings/polling_officer_zone/polling_stations/show.html.erb +1 -0
  231. data/app/views/decidim/votings/votings/_count.html.erb +1 -0
  232. data/app/views/decidim/votings/votings/_filters.html.erb +25 -0
  233. data/app/views/decidim/votings/votings/_filters_small_view.html.erb +23 -0
  234. data/app/views/decidim/votings/votings/_promoted_voting.html.erb +27 -0
  235. data/app/views/decidim/votings/votings/_voting_details.html.erb +7 -0
  236. data/app/views/decidim/votings/votings/_votings.html.erb +25 -0
  237. data/app/views/decidim/votings/votings/index.html.erb +42 -0
  238. data/app/views/decidim/votings/votings/index.js.erb +10 -0
  239. data/app/views/decidim/votings/votings/show.html.erb +20 -0
  240. data/app/views/layouts/decidim/_voting_header.html.erb +16 -0
  241. data/app/views/layouts/decidim/admin/voting.html.erb +101 -0
  242. data/app/views/layouts/decidim/voting.html.erb +16 -0
  243. data/config/initializers/decidim_bulletin_board.rb +23 -0
  244. data/config/locales/ca.yml +39 -6
  245. data/config/locales/cs.yml +640 -6
  246. data/config/locales/de.yml +635 -6
  247. data/config/locales/el.yml +0 -2
  248. data/config/locales/en.yml +636 -6
  249. data/config/locales/es-MX.yml +6 -10
  250. data/config/locales/es-PY.yml +6 -10
  251. data/config/locales/es.yml +6 -10
  252. data/config/locales/fi-plain.yml +635 -6
  253. data/config/locales/fi.yml +635 -6
  254. data/config/locales/fr-CA.yml +422 -6
  255. data/config/locales/fr.yml +422 -6
  256. data/config/locales/gl.yml +63 -6
  257. data/config/locales/it.yml +97 -6
  258. data/config/locales/ja.yml +8 -6
  259. data/config/locales/lv.yml +0 -2
  260. data/config/locales/nl.yml +498 -6
  261. data/config/locales/no.yml +0 -5
  262. data/config/locales/pl.yml +579 -9
  263. data/config/locales/pt.yml +0 -6
  264. data/config/locales/ro-RO.yml +0 -6
  265. data/config/locales/sv.yml +7 -6
  266. data/config/locales/tr-TR.yml +114 -6
  267. data/config/locales/zh-CN.yml +0 -6
  268. data/db/migrate/20200915142713_add_questionnaire_to_existing_elections.rb +29 -0
  269. data/db/migrate/20200918153813_create_decidim_elections_trustees_participatory_spaces.rb +13 -0
  270. data/db/migrate/20200918153824_create_decidim_elections_elections_trustees.rb +10 -0
  271. data/db/migrate/20200918153835_create_decidim_elections_trustees.rb +12 -0
  272. data/db/migrate/20201026163334_add_blocked_at_and_bb_status_to_elections.rb +8 -0
  273. data/db/migrate/20201028090110_add_votes_to_decidim_elections_answers.rb +7 -0
  274. data/db/migrate/20201028135614_add_selected_to_decidim_elections_answers.rb +7 -0
  275. data/db/migrate/20201209110653_create_decidim_elections_votes.rb +14 -0
  276. data/db/migrate/20201216091123_add_name_to_trustees.rb +7 -0
  277. data/db/migrate/20210113113818_add_message_id_to_decidim_elections_votes.rb +7 -0
  278. data/db/migrate/20210113120115_create_decidim_elections_votings.rb +20 -0
  279. data/db/migrate/20210114100749_add_published_at_to_decidim_votings_votings.rb +7 -0
  280. data/db/migrate/20210114111850_add_user_to_decidim_elections_votes.rb +7 -0
  281. data/db/migrate/20210120164634_add_promoted_to_voting.rb +7 -0
  282. data/db/migrate/20210125124801_add_voting_type_to_voting_voting.rb +7 -0
  283. data/db/migrate/20210129124956_create_decidim_elections_actions.rb +14 -0
  284. data/db/migrate/20210204132111_add_votings_polling_stations.rb +19 -0
  285. data/db/migrate/20210208090441_add_polling_officers_to_votings.rb +12 -0
  286. data/db/migrate/20210210090738_add_votings_polling_station_references_to_votings_polling_officer.rb +8 -0
  287. data/db/migrate/20210216074707_add_monitoring_committee_member.rb +12 -0
  288. data/db/seeds/city.jpeg +0 -0
  289. data/lib/decidim/api/election_answer_type.rb +23 -0
  290. data/lib/decidim/api/election_question_type.rb +22 -0
  291. data/lib/decidim/api/election_type.rb +27 -0
  292. data/lib/decidim/api/elections_type.rb +32 -0
  293. data/lib/decidim/api/trustee_type.rb +16 -0
  294. data/lib/decidim/api/voting_type.rb +20 -0
  295. data/lib/decidim/elections.rb +19 -2
  296. data/lib/decidim/elections/admin_engine.rb +42 -1
  297. data/lib/decidim/elections/answer_serializer.rb +48 -0
  298. data/lib/decidim/elections/api.rb +11 -0
  299. data/lib/decidim/elections/component.rb +367 -24
  300. data/lib/decidim/elections/engine.rb +8 -1
  301. data/lib/decidim/elections/test/factories.rb +201 -4
  302. data/lib/decidim/elections/trustee_zone.rb +10 -0
  303. data/lib/decidim/elections/trustee_zone_engine.rb +35 -0
  304. data/lib/decidim/elections/version.rb +1 -1
  305. data/lib/decidim/votings.rb +16 -0
  306. data/lib/decidim/votings/admin.rb +10 -0
  307. data/lib/decidim/votings/admin_engine.rb +71 -0
  308. data/lib/decidim/votings/api.rb +7 -0
  309. data/lib/decidim/votings/engine.rb +147 -0
  310. data/lib/decidim/votings/participatory_space.rb +92 -0
  311. data/lib/decidim/votings/polling_officer_zone.rb +10 -0
  312. data/lib/decidim/votings/polling_officer_zone_engine.rb +33 -0
  313. data/lib/decidim/votings/query_extensions.rb +43 -0
  314. data/lib/decidim/votings/test/capybara_polling_officers_picker.rb +49 -0
  315. data/lib/decidim/votings/test/factories.rb +83 -0
  316. data/lib/decidim/votings/voting_serializer.rb +54 -0
  317. data/lib/tasks/decidim_elections.rake +68 -5
  318. metadata +304 -21
  319. data/app/types/decidim/elections/election_answer_type.rb +0 -24
  320. data/app/types/decidim/elections/election_question_type.rb +0 -25
  321. data/app/types/decidim/elections/election_type.rb +0 -27
  322. data/app/types/decidim/elections/elections_type.rb +0 -32
  323. data/config/i18n-tasks.yml +0 -10
  324. data/lib/decidim/elections/bulletin_board_client.rb +0 -35
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, url: trustees_path, html: { class: "form new_trustee" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= f.submit t(".create") %>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <div class="row section">
2
+ <div class="columns large-8">
3
+ <h2 class="section-heading"><%= t(".title") %></h2>
4
+ <p>
5
+ <%= t(".description") %>:
6
+ </p>
7
+ <ul class="accordion mb-m evote__preview"
8
+ data-accordion
9
+ data-multi-expand="true"
10
+ data-allow-all-closed="true">
11
+ <% election.questions.each do |question| %>
12
+ <li class="accordion-item evote__preview-question" data-accordion-item>
13
+ <a href="#" class="accordion-title flex--sbc"><%= translated_attribute(question.title) %></a>
14
+ <div class="accordion-content" data-tab-content>
15
+ <strong><%= t(".available_answers") %>:</strong>
16
+ <ul>
17
+ <% question.answers.each do |answer| %>
18
+ <li><%= translated_attribute(answer.title) %></li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+ </li>
23
+ <% end %>
24
+ </ul>
25
+ </div>
26
+ </div>
@@ -0,0 +1,47 @@
1
+ <div class="row section">
2
+ <div class="columns large-8">
3
+ <h2 class="section-heading"><%= t(".title") %></h2>
4
+ <p>
5
+ <%= t(".description") %>:
6
+ </p>
7
+ <ul class="accordion mb-m evote__preview"
8
+ data-accordion
9
+ data-multi-expand="true"
10
+ data-allow-all-closed="true">
11
+ <% election.questions.each_with_index do |question, i| %>
12
+ <li class="accordion-item evote__preview-question <%= " is-active" if i == 0 %>" data-accordion-item>
13
+ <a href="#" class="accordion-title flex--sbc"><%= translated_attribute(question.title) %></a>
14
+ <div class="accordion-content" data-tab-content>
15
+ <% question.answers.each do |answer| %>
16
+ <div class="evote__preview-result">
17
+ <h3 class="evote__preview-option">
18
+ <%= translated_attribute(answer.title) %>
19
+ <% if answer.selected? %>
20
+ <span class="label label--small label--highlight">
21
+ <%= t(".selected") %>
22
+ </span>
23
+ <% end %>
24
+ </h3>
25
+
26
+ <div class="progress__bar">
27
+ <div class="evote__preview-bar">
28
+ <div class="progress progress__bar__bar" role="progressbar" tabindex="0" aria-valuenow="<%= answer.question.votes_percentage(answer.votes_count) %>%" aria-valuemin="0" aria-valuetext="<%= answer.question.votes_percentage(answer.votes_count) %>% percent" aria-valuemax="100">
29
+ <div class="progress-meter progress__bar__bar--complete" style="width: <%= answer.question.votes_percentage(answer.votes_count) %>%"></div>
30
+ <div class="progress__bar__bar--incomplete" style="width:calc(100% - <%= answer.question.votes_percentage(answer.votes_count) %>%);"></div>
31
+ </div>
32
+ <div class="evote__preview-perc">
33
+ <%= answer.question.votes_percentage(answer.votes_count) %>%
34
+ </div>
35
+ </div>
36
+ <div class="evote__preview-label">
37
+ <%= t(".votes", count: answer.votes_count) %>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ <% end %>
42
+ </div>
43
+ </li>
44
+ <% end %>
45
+ </ul>
46
+ </div>
47
+ </div>
@@ -18,15 +18,13 @@ edit_link(
18
18
  <div class="columns">
19
19
 
20
20
  <% unless single? %>
21
- <div class="m-bottom">
22
- <%= link_to :elections, class: "small hollow" do %>
23
- <%= icon "caret-left", class: "icon--small" %>
24
- <%= t(".back") %>
25
- <% end %>
26
- </div>
21
+ <%= link_to :elections, class: "small hollow" do %>
22
+ <%= icon "caret-left", class: "icon--small" %>
23
+ <%= t(".back") %>
24
+ <% end %>
27
25
  <% end %>
28
26
 
29
- <h1 class="heading2">
27
+ <h1 class="heading3">
30
28
  <%== present(election).title %>
31
29
  </h1>
32
30
  <p>
@@ -44,21 +42,48 @@ edit_link(
44
42
  <% end %>
45
43
  <div class="columns medium-8 mediumlarge-7">
46
44
  <div class="section">
47
- <%= decidim_sanitize(simple_format(translated_attribute(election.description))) %>
48
-
49
- <% if election.published? && election.ongoing? %>
50
- <%= action_authorized_link_to :vote, new_election_vote_path(election.id), resource: election, class: "title-action__action button small" do %>
51
- <%= t(".vote") %>
52
- <% end %>
53
- <% else %>
54
- <span class="title-action__action button small disabled"><%= t(".vote") %></span>
45
+ <p><%= decidim_sanitize(simple_format(translated_attribute(election.description)), strip_tags: true) %></p>
46
+ <% if election.ongoing? && already_voted? %>
47
+ <div class="callout warning">
48
+ <span class="callout-text"><%= callout_text %></span>
49
+ </div>
55
50
  <% end %>
56
51
 
57
- <% if allowed_to? :preview, :election, election: election %>
58
- <%= link_to new_election_vote_path(election.id), class: "title-action__action button small" do %>
59
- <%= t(".preview") %>
52
+ <div>
53
+ <% if election.ongoing? %>
54
+ <%= action_authorized_link_to :vote, new_election_vote_path(election), resource: election, class: "button" do %>
55
+ <%= vote_action_button %>
56
+ <% end %>
57
+ <% else %>
58
+ <span class="button disabled"><%= t(".action-button.vote") %></span>
60
59
  <% end %>
60
+ <% if allowed_to? :preview, :election, election: election %>
61
+ <%= link_to new_election_vote_path(election), class: "button" do %>
62
+ <%= t(".preview") %>
63
+ <% end %>
64
+ <% end %>
65
+ </div>
66
+
67
+ <% if election.started? %>
68
+ <p class="text-sm">
69
+ <%= t(".verify.already-voted") %>
70
+ <%= link_to verify_election_vote_path(election) do %>
71
+ <%= t(".verify.verify-here") %>
72
+ <% end %>
73
+ </p>
74
+ <% else %>
75
+ <span class="disabled text-sm"><%= t(".verify.will-verify") %></span>
61
76
  <% end %>
62
77
  </div>
63
78
  </div>
64
79
  </div>
80
+
81
+ <!-- Election questions preview -->
82
+ <% unless election.finished? %>
83
+ <%= render partial: "preview", election: election %>
84
+ <% end %>
85
+
86
+ <!-- Election results -->
87
+ <% if election.results_published? %>
88
+ <%= render partial: "results", election: election %>
89
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <div class="reveal" id="show-backup-modal" data-reveal data-close-on-click="false">
2
+ <div class="reveal__header">
3
+ <h3 class="reveal__title"><%= t(".title", election: translated_attribute(election.title)) %></h3>
4
+ </div>
5
+
6
+ <div class="row m-bottom">
7
+ <div class="columns">
8
+ <div class="section">
9
+ <div class="callout alert">
10
+ <p><%= t(".description") %></p>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row">
17
+ <div class="columns medium-5 medium-centered">
18
+ <a class="button download-election-keys">
19
+ <%= icon "data-transfer-download", class: "icon", role: "img", aria_label: t(".download_icon") %>
20
+ <span><%= t(".download_election_keys") %></span>
21
+ </a>
22
+ </div>
23
+ </div>
24
+ </div>
@@ -0,0 +1,44 @@
1
+ <h2><%= t(".title", election: translated_attribute(election.title)) %></h2>
2
+ <p><%= t(".description") %></p>
3
+ <div class="callout alert">
4
+ <p><%= t(".process_warning") %></p>
5
+ </div>
6
+
7
+ <div class="table-scroll">
8
+ <table class="table-list">
9
+ <thead>
10
+ <tr>
11
+ <th><%= t(".list.task") %></th>
12
+ <th><%= t(".list.status") %></th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% %w(create_election key_ceremony.step_1 key_ceremony.joint_election_key).each do |step| %>
17
+ <tr>
18
+ <td><%= t(".keys.#{step}") %></td>
19
+ <td id="<%= step.gsub(".", "-") %>" class="step_status" data-step-status="pending">
20
+ <span class="pending"><%= t(".status.pending") %></span>
21
+ <span class="processing"><%= t(".status.processing") %></span>
22
+ <span class="completed"><%= t(".status.completed") %></span>
23
+ </td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+ <%= render("backup_modal") %>
29
+ <%= render("restore_modal") %>
30
+ </div>
31
+
32
+ <button class="button start" disabled>
33
+ <%= icon "power-standby", class: "icon", role: "img", aria_label: t(".start_icon") %>
34
+ <span><%= t(".start") %></span>
35
+ </button>
36
+
37
+ <%= link_to trustee_path, class: "back button hide" do %>
38
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
39
+ <%= t(".back") %>
40
+ <% end %>
41
+
42
+ <div class="election-status">
43
+ <%= link_to "", trustee_election_elections_path(election), method: :put, class: "hide" %>
44
+ </div>
@@ -0,0 +1,25 @@
1
+ <div class="reveal" id="show-restore-modal" data-reveal data-close-on-click="false">
2
+ <div class="reveal__header">
3
+ <h3 class="reveal__title"><%= t(".title", election: translated_attribute(election.title)) %></h3>
4
+ </div>
5
+
6
+ <div class="row m-bottom">
7
+ <div class="columns">
8
+ <div class="section">
9
+ <div class="callout info">
10
+ <p><%= t(".description") %></p>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row">
17
+ <div class="columns medium-5 medium-centered">
18
+ <label class="button upload-election-keys">
19
+ <%= icon "data-transfer-upload", class: "icon", role: "img", aria_label: t(".upload_icon") %>
20
+ <span><%= t(".upload_election_keys") %></span>
21
+ <input class="restore-button-input" style="display: none" type="file">
22
+ </label>
23
+ </div>
24
+ </div>
25
+ </div>
@@ -0,0 +1,43 @@
1
+ <h2><%= t(".title", election: translated_attribute(election.title)) %></h2>
2
+ <p><%= t(".description") %></p>
3
+ <div class="callout alert">
4
+ <p><%= t(".process_warning") %></p>
5
+ </div>
6
+
7
+ <div class="table-scroll">
8
+ <table class="table-list">
9
+ <thead>
10
+ <tr>
11
+ <th><%= t(".list.task") %></th>
12
+ <th><%= t(".list.status") %></th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% %w(tally.cast tally.share end_tally).each do |step| %>
17
+ <tr>
18
+ <td><%= t(".keys.#{step}") %></td>
19
+ <td id="<%= step.gsub(".", "-") %>" class="step_status" data-step-status="pending">
20
+ <span class="pending"><%= t(".status.pending") %></span>
21
+ <span class="processing"><%= t(".status.processing") %></span>
22
+ <span class="completed"><%= t(".status.completed") %></span>
23
+ </td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+ <%= render("restore_modal") %>
29
+ </div>
30
+
31
+ <button class="button start" disabled>
32
+ <%= icon "power-standby", class: "icon", role: "img", aria_label: t(".start_icon") %>
33
+ <span><%= t(".start") %></span>
34
+ </button>
35
+
36
+ <%= link_to trustee_path, class: "back button hide" do %>
37
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
38
+ <%= t(".back") %>
39
+ <% end %>
40
+
41
+ <div class="election-status">
42
+ <%= link_to "", trustee_election_elections_path(election), method: :put, class: "hide" %>
43
+ </div>
@@ -0,0 +1,38 @@
1
+ <%= stylesheet_link_tag "decidim/elections/trustee_zone", media: "all" %>
2
+
3
+ <% if election.bb_key_ceremony? %>
4
+ <div class="key-ceremony"
5
+ data-election-id="<%= election.id %>"
6
+ data-trustee-public-key="<%= trustee.public_key %>"
7
+ data-trustee-unique-id="<%= trustee.unique_id %>"
8
+ data-api-endpoint-url="<%= Rails.application.secrets.bulletin_board[:server] %>"
9
+ data-authority-unique-id="<%= Rails.application.secrets.bulletin_board[:authority_name].parameterize %>"
10
+ data-update-election-status-url="<%= trustee_election_elections_path(election) %>"
11
+ data-backup="false">
12
+
13
+ <div class="key-ceremony-result">
14
+ </div>
15
+
16
+ <div class="election-key-generation">
17
+ <%= render("key_ceremony_steps") %>
18
+ </div>
19
+ </div>
20
+
21
+ <%= javascript_include_tag "decidim/elections/trustee_zone/key_ceremony", integrity: true %>
22
+ <% elsif election.bb_tally? %>
23
+ <div class="tally"
24
+ data-election-id="<%= election.id %>"
25
+ data-trustee-public-key="<%= trustee.public_key %>"
26
+ data-trustee-unique-id="<%= trustee.unique_id %>"
27
+ data-api-endpoint-url="<%= Rails.application.secrets.bulletin_board[:server] %>"
28
+ data-authority-unique-id="<%= Rails.application.secrets.bulletin_board[:authority_name].parameterize %>"
29
+ data-update-election-status-url="<%= trustee_election_elections_path(election) %>">
30
+
31
+ <div class="tally-result">
32
+ </div>
33
+
34
+ <%= render("tally_steps") %>
35
+ </div>
36
+
37
+ <%= javascript_include_tag "decidim/elections/trustee_zone/tally", integrity: true %>
38
+ <% end %>
@@ -0,0 +1,5 @@
1
+ $(".key-ceremony-result").html(
2
+ `<div class="callout success">
3
+ <%= j(I18n.t("elections.update.success", scope: "decidim.elections.trustee_zone", status: election.bb_status)) %>
4
+ </div>`
5
+ )
@@ -0,0 +1,102 @@
1
+ <%= stylesheet_link_tag "decidim/elections/trustee_zone", media: "all" %>
2
+
3
+ <div id="not_supported_browser" class="callout alert">
4
+ <p><strong><%= t(".not_supported_browser_title") %></strong></p>
5
+ <p><%= t(".not_supported_browser_description") %></p>
6
+ </div>
7
+
8
+ <div class="trustee_zone">
9
+ <%= decidim_form_for(trustee, html: { class: "form edit_trustee" }) do |f| %>
10
+ <%= f.hidden_field :unique_id %>
11
+ <%= f.hidden_field :name %>
12
+ <%= f.hidden_field :public_key %>
13
+ <%= f.submit "", id: "submit_identification_public_key", class: "hide" %>
14
+ <% end %>
15
+
16
+ <div class="callout success">
17
+ <p><%= t(".trustee_role_description") %></p>
18
+ </div>
19
+ <% if trustee.public_key.blank? %>
20
+ <h2><%= t(".identification_keys.title") %></h2>
21
+ <p><%= t(".identification_keys.generate_legend") %></p>
22
+ <ol>
23
+ <li><%= t(".identification_keys.generate_legend_1") %></li>
24
+ <li><%= t(".identification_keys.generate_legend_2") %></li>
25
+ <li><%= t(".identification_keys.generate_legend_3") %></li>
26
+ <li><%= t(".identification_keys.generate_legend_4") %></li>
27
+ </ol>
28
+ <div id="submit_identification_keys" class="small-12 large-6">
29
+ <div class="card">
30
+ <div class="card__content">
31
+ <h4 class="card__title"><%= t(".identification_keys.submit_title") %></h4>
32
+ <p><%= t(".identification_keys.submit_legend") %></p>
33
+ </div>
34
+ <div class="card__footer">
35
+ <div class="card__support">
36
+ <div>
37
+ <button class="card__button button small hollow" type="button">
38
+ <%= icon "x", role: "img" %> <%= t(".identification_keys.cancel") %>
39
+ </button>
40
+ <label class="card__button button small" for="submit_identification_public_key">
41
+ <%= icon "check", role: "img" %> <%= t(".identification_keys.submit") %>
42
+ </label>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <div id="generate_identification_keys" data-error="<%= t(".identification_keys.generate_error") %>">
49
+ <button class="button">
50
+ <%= icon "key", role: "img" %> <%= t(".identification_keys.generate") %>
51
+ </button>
52
+ </div>
53
+ <% else %>
54
+ <div <%= t(".identification_keys.upload_error").map {|key, message| "data-#{key}=\"#{message}\""} .join(" ").html_safe %>
55
+ id="upload_identification_keys" class="hide">
56
+ <h2><%= t(".identification_keys.title") %></h2>
57
+ <p><%= t(".identification_keys.upload_legend") %></p>
58
+ <button class="button" type="button">
59
+ <%= icon "data-transfer-upload", role: "img" %> <%= t(".identification_keys.upload") %>
60
+ </button>
61
+ </div>
62
+
63
+ <h2><%= t(".elections.title") %></h2>
64
+ <% if trustee.elections.any? %>
65
+ <div class="table-scroll">
66
+ <table class="table-list">
67
+ <thead>
68
+ <tr>
69
+ <th><%= t(".elections.list.election") %></th>
70
+ <th><%= t(".elections.list.voting_period") %></th>
71
+ <th><%= t(".elections.list.bb_status") %></th>
72
+ <th><%= t(".elections.list.action_required.name") %></th>
73
+ </tr>
74
+ </thead>
75
+ <tbody>
76
+ <% trustee.elections.each do |election| %>
77
+ <tr>
78
+ <td><%= present(election).title %></td>
79
+ <td><%= l(election.start_time, format: :decidim_short) %> - <%= l(election.end_time, format: :decidim_short) %></td>
80
+ <td><%= election.bb_status %></td>
81
+ <td>
82
+ <% if election.trustee_action_required? %>
83
+ <%= link_to trustee_election_elections_path(election) do %>
84
+ <%= t(".elections.list.action_required.true") %>
85
+ <% end %>
86
+ <% else %>
87
+ <%= t(".elections.list.action_required.false") %>
88
+ <% end %>
89
+ </td>
90
+ </tr>
91
+ <% end %>
92
+ </tbody>
93
+ </table>
94
+ <% else %>
95
+ <div class="callout warning">
96
+ <%= t(".elections.no_elections") %>
97
+ </div>
98
+ <% end %>
99
+ <% end %>
100
+ </div>
101
+
102
+ <%= javascript_include_tag "decidim/elections/trustee_zone", integrity: true %>