decidim-elections 0.26.0 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/cells/decidim/elections/election_preview/show.erb +1 -1
  4. data/app/cells/decidim/elections/election_results/show.erb +1 -1
  5. data/app/cells/decidim/elections/election_vote_cta_cell.rb +8 -3
  6. data/app/cells/decidim/votings/content_blocks/highlighted_votings/show.erb +1 -1
  7. data/app/cells/decidim/votings/content_blocks/highlighted_votings_cell.rb +4 -4
  8. data/app/cells/decidim/votings/content_blocks/landing_page/description/show.erb +2 -12
  9. data/app/cells/decidim/votings/content_blocks/landing_page/description_cell.rb +0 -8
  10. data/app/cells/decidim/votings/content_blocks/landing_page/header/show.erb +2 -2
  11. data/app/cells/decidim/votings/content_blocks/landing_page/header_cell.rb +1 -1
  12. data/app/cells/decidim/votings/content_blocks/landing_page/polling_stations/address.erb +1 -1
  13. data/app/commands/decidim/elections/admin/add_user_as_trustee.rb +22 -12
  14. data/app/commands/decidim/elections/admin/create_answer.rb +1 -1
  15. data/app/commands/decidim/elections/admin/create_election.rb +1 -1
  16. data/app/commands/decidim/elections/admin/create_question.rb +3 -7
  17. data/app/commands/decidim/elections/admin/destroy_answer.rb +1 -1
  18. data/app/commands/decidim/elections/admin/destroy_election.rb +1 -1
  19. data/app/commands/decidim/elections/admin/destroy_question.rb +1 -1
  20. data/app/commands/decidim/elections/admin/end_vote.rb +1 -1
  21. data/app/commands/decidim/elections/admin/import_proposals_to_elections.rb +1 -1
  22. data/app/commands/decidim/elections/admin/publish_election.rb +1 -1
  23. data/app/commands/decidim/elections/admin/publish_results.rb +1 -1
  24. data/app/commands/decidim/elections/admin/remove_trustee_from_participatory_space.rb +1 -1
  25. data/app/commands/decidim/elections/admin/report_missing_trustee.rb +1 -1
  26. data/app/commands/decidim/elections/admin/setup_election.rb +4 -2
  27. data/app/commands/decidim/elections/admin/start_key_ceremony.rb +1 -1
  28. data/app/commands/decidim/elections/admin/start_tally.rb +1 -1
  29. data/app/commands/decidim/elections/admin/start_vote.rb +1 -1
  30. data/app/commands/decidim/elections/admin/unpublish_election.rb +1 -1
  31. data/app/commands/decidim/elections/admin/update_action_status.rb +1 -1
  32. data/app/commands/decidim/elections/admin/update_answer.rb +1 -1
  33. data/app/commands/decidim/elections/admin/update_answer_selection.rb +1 -1
  34. data/app/commands/decidim/elections/admin/update_election.rb +1 -1
  35. data/app/commands/decidim/elections/admin/update_question.rb +1 -2
  36. data/app/commands/decidim/elections/admin/update_trustee_participatory_space.rb +1 -1
  37. data/app/commands/decidim/elections/trustee_zone/update_election_bulletin_board_status.rb +1 -1
  38. data/app/commands/decidim/elections/trustee_zone/update_trustee.rb +1 -1
  39. data/app/commands/decidim/elections/voter/cast_vote.rb +1 -1
  40. data/app/commands/decidim/elections/voter/update_vote_status.rb +2 -2
  41. data/app/commands/decidim/votings/admin/create_ballot_style.rb +1 -1
  42. data/app/commands/decidim/votings/admin/create_monitoring_committee_member.rb +1 -1
  43. data/app/commands/decidim/votings/admin/create_polling_officer.rb +1 -1
  44. data/app/commands/decidim/votings/admin/create_voting.rb +3 -2
  45. data/app/commands/decidim/votings/admin/destroy_ballot_style.rb +2 -2
  46. data/app/commands/decidim/votings/admin/destroy_monitoring_committee_member.rb +1 -1
  47. data/app/commands/decidim/votings/admin/destroy_polling_officer.rb +1 -1
  48. data/app/commands/decidim/votings/admin/destroy_polling_station.rb +1 -1
  49. data/app/commands/decidim/votings/admin/manage_polling_station.rb +2 -2
  50. data/app/commands/decidim/votings/admin/monitoring_committee_validate_polling_station_closure.rb +1 -1
  51. data/app/commands/decidim/votings/admin/publish_voting.rb +1 -1
  52. data/app/commands/decidim/votings/admin/unpublish_voting.rb +1 -1
  53. data/app/commands/decidim/votings/admin/update_ballot_style.rb +1 -1
  54. data/app/commands/decidim/votings/admin/update_voting.rb +3 -2
  55. data/app/commands/decidim/votings/census/admin/create_dataset.rb +22 -19
  56. data/app/commands/decidim/votings/census/admin/create_datum.rb +1 -1
  57. data/app/commands/decidim/votings/census/admin/destroy_dataset.rb +1 -1
  58. data/app/commands/decidim/votings/census/admin/increment_dataset_processed_rows.rb +1 -1
  59. data/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb +1 -1
  60. data/app/commands/decidim/votings/census/admin/launch_access_codes_generation.rb +1 -1
  61. data/app/commands/decidim/votings/census/admin/update_dataset.rb +1 -1
  62. data/app/commands/decidim/votings/certify_polling_station_closure.rb +1 -1
  63. data/app/commands/decidim/votings/check_census.rb +1 -1
  64. data/app/commands/decidim/votings/create_polling_station_closure.rb +1 -1
  65. data/app/commands/decidim/votings/create_polling_station_results.rb +1 -1
  66. data/app/commands/decidim/votings/send_access_code.rb +1 -1
  67. data/app/commands/decidim/votings/sign_polling_station_closure.rb +1 -1
  68. data/app/commands/decidim/votings/voter/in_person_vote.rb +1 -1
  69. data/app/commands/decidim/votings/voter/update_in_person_vote_status.rb +1 -1
  70. data/app/controllers/decidim/elections/admin/questions_controller.rb +5 -0
  71. data/app/controllers/decidim/elections/admin/steps_controller.rb +2 -2
  72. data/app/controllers/decidim/elections/elections_controller.rb +10 -12
  73. data/app/controllers/decidim/elections/trustee_zone/elections_controller.rb +1 -1
  74. data/app/controllers/decidim/votings/census/admin/census_controller.rb +1 -1
  75. data/app/controllers/decidim/votings/votings_controller.rb +12 -13
  76. data/app/forms/decidim/elections/admin/question_form.rb +0 -2
  77. data/app/forms/decidim/elections/admin/setup_form.rb +4 -3
  78. data/app/forms/decidim/elections/admin/vote_period_form.rb +2 -2
  79. data/app/forms/decidim/votings/admin/ballot_style_form.rb +1 -1
  80. data/app/forms/decidim/votings/admin/voting_form.rb +4 -3
  81. data/app/forms/decidim/votings/census/admin/dataset_form.rb +2 -5
  82. data/app/forms/decidim/votings/census/admin/datum_form.rb +5 -1
  83. data/app/helpers/decidim/elections/application_helper.rb +1 -1
  84. data/app/helpers/decidim/elections/votes_helper.rb +3 -1
  85. data/app/helpers/decidim/votings/votings_helper.rb +1 -1
  86. data/app/mailers/decidim/elections/trustee_mailer.rb +28 -0
  87. data/app/models/decidim/elections/answer.rb +1 -6
  88. data/app/models/decidim/elections/election.rb +13 -2
  89. data/app/models/decidim/elections/question.rb +2 -7
  90. data/app/models/decidim/votings/polling_station.rb +2 -3
  91. data/app/models/decidim/votings/voting.rb +15 -0
  92. data/app/packs/entrypoints/{decidim_elections_trustee_tally.js → decidim_elections_trustee_tally_started.js} +0 -0
  93. data/app/packs/src/decidim/elections/trustee/tally.js +1 -1
  94. data/app/packs/src/decidim/elections/voter/setup-vote.js +7 -0
  95. data/app/packs/src/decidim/votings/voting-description-cell.js +1 -8
  96. data/app/permissions/decidim/votings/admin/permissions.rb +5 -15
  97. data/app/permissions/decidim/votings/permissions.rb +1 -3
  98. data/app/presenters/decidim/votings/admin_log/ballot_style_presenter.rb +5 -1
  99. data/app/presenters/decidim/votings/voting_stats_presenter.rb +4 -1
  100. data/app/queries/decidim/elections/admin/pending_actions.rb +1 -1
  101. data/app/queries/decidim/elections/admin/votes_for_statistics.rb +1 -1
  102. data/app/queries/decidim/elections/elections_finished_to_end.rb +1 -1
  103. data/app/queries/decidim/elections/elections_ready_to_start.rb +1 -1
  104. data/app/queries/decidim/elections/filtered_elections.rb +1 -1
  105. data/app/queries/decidim/elections/trustees/by_participatory_space.rb +1 -1
  106. data/app/queries/decidim/elections/trustees/by_participatory_space_trustee_ids.rb +1 -1
  107. data/app/queries/decidim/elections/votes/last_vote_for_voter.rb +1 -1
  108. data/app/queries/decidim/elections/votes/pending_votes.rb +1 -1
  109. data/app/queries/decidim/votings/admin/admin_users.rb +1 -1
  110. data/app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb +1 -1
  111. data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations.rb +1 -1
  112. data/app/queries/decidim/votings/admin/polling_officers_join_polling_stations_and_user.rb +2 -2
  113. data/app/queries/decidim/votings/admin/polling_officers_join_user.rb +1 -1
  114. data/app/queries/decidim/votings/organization_prioritized_votings.rb +2 -2
  115. data/app/queries/decidim/votings/organization_promoted_votings.rb +1 -1
  116. data/app/queries/decidim/votings/organization_published_votings.rb +2 -2
  117. data/app/queries/decidim/votings/organization_votings.rb +1 -1
  118. data/app/queries/decidim/votings/prioritized_votings.rb +1 -1
  119. data/app/queries/decidim/votings/published_votings.rb +1 -1
  120. data/app/queries/decidim/votings/votes/in_person_vote_for_voter.rb +1 -1
  121. data/app/queries/decidim/votings/votes/pending_in_person_votes.rb +1 -1
  122. data/app/services/decidim/votings/census_vote_flow.rb +1 -3
  123. data/app/views/decidim/elections/admin/questions/_form.html.erb +0 -4
  124. data/app/views/decidim/elections/admin/steps/{_tally.html.erb → _tally_started.html.erb} +1 -1
  125. data/app/views/decidim/elections/elections/_filters.html.erb +2 -2
  126. data/app/views/decidim/elections/elections/election_log.html.erb +3 -1
  127. data/app/views/decidim/elections/elections/show.html.erb +2 -2
  128. data/app/views/decidim/elections/trustee_mailer/notification.html.erb +5 -0
  129. data/app/views/decidim/elections/trustee_zone/elections/{_tally_steps.html.erb → _tally_started_steps.html.erb} +0 -0
  130. data/app/views/decidim/elections/trustee_zone/elections/show.html.erb +3 -1
  131. data/app/views/decidim/elections/trustee_zone/trustees/show.html.erb +3 -1
  132. data/app/views/decidim/elections/votes/_onboarding_modal.html.erb +3 -1
  133. data/app/views/decidim/elections/votes/_server_error_modal.html.erb +28 -0
  134. data/app/views/decidim/elections/votes/_show_casting.html.erb +3 -1
  135. data/app/views/decidim/elections/votes/new.html.erb +19 -11
  136. data/app/views/decidim/elections/votes/verify.html.erb +4 -1
  137. data/app/views/decidim/votings/admin/votings/_form.html.erb +15 -6
  138. data/app/views/decidim/votings/polling_officer_zone/closures/_certify_form.html.erb +3 -1
  139. data/app/views/decidim/votings/polling_officer_zone/closures/_sign_form.html.erb +3 -1
  140. data/app/views/decidim/votings/polling_officer_zone/closures/edit.html.erb +3 -1
  141. data/app/views/decidim/votings/polling_officer_zone/closures/new.html.erb +3 -1
  142. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/_complete_voting.html.erb +8 -2
  143. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/new.html.erb +3 -1
  144. data/app/views/decidim/votings/polling_officer_zone/in_person_votes/show.html.erb +3 -1
  145. data/app/views/decidim/votings/votings/_check_fields.html.erb +13 -15
  146. data/app/views/decidim/votings/votings/_filters.html.erb +2 -3
  147. data/app/views/decidim/votings/votings/check_census.html.erb +5 -1
  148. data/app/views/layouts/decidim/election_votes.html.erb +3 -1
  149. data/config/assets.rb +1 -1
  150. data/config/locales/am-ET.yml +1 -0
  151. data/config/locales/ar.yml +28 -0
  152. data/config/locales/bg.yml +1 -0
  153. data/config/locales/ca.yml +74 -38
  154. data/config/locales/cs.yml +79 -37
  155. data/config/locales/da.yml +1 -0
  156. data/config/locales/de.yml +7 -42
  157. data/config/locales/el.yml +1 -1
  158. data/config/locales/en.yml +73 -36
  159. data/config/locales/eo.yml +1 -0
  160. data/config/locales/es-MX.yml +77 -41
  161. data/config/locales/es-PY.yml +77 -41
  162. data/config/locales/es.yml +79 -43
  163. data/config/locales/et.yml +1 -0
  164. data/config/locales/eu.yml +6 -48
  165. data/config/locales/fi-plain.yml +73 -37
  166. data/config/locales/fi.yml +75 -39
  167. data/config/locales/fr-CA.yml +62 -36
  168. data/config/locales/fr.yml +65 -39
  169. data/config/locales/ga-IE.yml +1 -15
  170. data/config/locales/gl.yml +24 -32
  171. data/config/locales/hr.yml +1 -0
  172. data/config/locales/hu.yml +103 -6
  173. data/config/locales/id-ID.yml +1 -0
  174. data/config/locales/is-IS.yml +2 -1
  175. data/config/locales/it.yml +7 -40
  176. data/config/locales/ja.yml +66 -40
  177. data/config/locales/ko.yml +1 -0
  178. data/config/locales/lb.yml +1 -0
  179. data/config/locales/lt.yml +1 -0
  180. data/config/locales/lv.yml +1 -1
  181. data/config/locales/mt.yml +1 -0
  182. data/config/locales/nl.yml +11 -48
  183. data/config/locales/no.yml +15 -40
  184. data/config/locales/om-ET.yml +1 -0
  185. data/config/locales/pl.yml +17 -43
  186. data/config/locales/pt-BR.yml +8 -43
  187. data/config/locales/pt.yml +13 -48
  188. data/config/locales/ro-RO.yml +11 -38
  189. data/config/locales/ru.yml +1 -0
  190. data/config/locales/si-LK.yml +1 -0
  191. data/config/locales/sk.yml +1 -0
  192. data/config/locales/sl.yml +1 -0
  193. data/config/locales/so-SO.yml +1 -0
  194. data/config/locales/sr-CS.yml +1 -0
  195. data/config/locales/sv.yml +61 -18
  196. data/config/locales/sw-KE.yml +1 -0
  197. data/config/locales/ti-ER.yml +1 -0
  198. data/config/locales/tr-TR.yml +4 -9
  199. data/config/locales/uk.yml +1 -0
  200. data/config/locales/val-ES.yml +1 -0
  201. data/config/locales/vi.yml +1 -0
  202. data/config/locales/zh-CN.yml +1 -1
  203. data/config/locales/zh-TW.yml +1 -0
  204. data/db/migrate/20220404112802_rename_bb_status_tally_to_tally_started.rb +19 -0
  205. data/db/migrate/20220424121541_add_show_check_census_to_votings.rb +7 -0
  206. data/db/migrate/20220615102642_remove_description_from_elections_questions.rb +7 -0
  207. data/lib/decidim/api/election_question_type.rb +0 -1
  208. data/lib/decidim/elections/admin_engine.rb +4 -1
  209. data/lib/decidim/elections/component.rb +4 -16
  210. data/lib/decidim/elections/test/factories.rb +4 -5
  211. data/lib/decidim/elections/version.rb +1 -1
  212. data/lib/decidim/votings/participatory_space.rb +3 -3
  213. data/lib/decidim/votings/test/factories.rb +2 -1
  214. metadata +31 -27
  215. data/app/services/decidim/elections/election_search.rb +0 -35
  216. data/app/services/decidim/votings/voting_search.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48839ff2ece46c0bd66bc1360423d2bb996f91c0581547f8ef61ca837aaf4b71
4
- data.tar.gz: a63a7431d25acbfe3d0967f84ed234359e4781537376bb139d2c4fc6f859bba8
3
+ metadata.gz: 11ba350fe95a17c5fdacb0d334da600c9661fefd43617ee0324655acc3a18bc8
4
+ data.tar.gz: 39b15243a85e5e7bc6d04bea37945c23e849a26e36ad421a855779ca2f681c8d
5
5
  SHA512:
6
- metadata.gz: 811ed896ec1b34ee134ad36cbe910e440f20cd538bfe2b74e288fd1e9505b4e1e02bd9b2e8156a9bc8da4716f45686fc06c6810ce5ed9d1f240cecb5a5300ef3
7
- data.tar.gz: 2ab58f77f16b978ae5bd9c74f09b6faa3d11f1f8fb434aa0468c8a7a6d4ee24711c5c7d355cab744be1d6360eda41d2946205a6419d916b9298288685cbcda09
6
+ metadata.gz: fac8953cc1dca3a079f3970efe597a3cf19c63cf60dde0443c0511060881bd4b424a434cab13f544a8a4d31a8d571ae2593c1f65c1ee465af81b87c599dac1f2
7
+ data.tar.gz: 180c6299a0f8a5e8a5451396865d82824e01e858431e570e2279240d4bd7026e1abdd97f887e05739db83aab32bcb204cfdd7b9a1e9b7e14b4feb00d7f52ba03
data/README.md CHANGED
@@ -8,7 +8,7 @@ The Elections module adds elections to any participatory space.
8
8
 
9
9
  Elections will be available as a Component for a Participatory Space.
10
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://github.com/decidim/decidim/blob/develop/docs/services/elections_bulletin_board.md).
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
12
 
13
13
  ## Installation
14
14
 
@@ -1,6 +1,6 @@
1
1
  <div class="row">
2
2
  <div class="columns large-8">
3
- <h2 class="section-heading"><%= t("decidim.elections.elections.preview.title") %></h2>
3
+ <h3 class="section-heading"><%= t("decidim.elections.elections.preview.title") %></h3>
4
4
 
5
5
  <p><%= t("decidim.elections.elections.preview.description") %></p>
6
6
 
@@ -1,6 +1,6 @@
1
1
  <div class="row">
2
2
  <div class="columns large-8">
3
- <h2 class="section-heading"><%= t("decidim.elections.elections.results.title") %></h2>
3
+ <h3 class="section-heading"><%= t("decidim.elections.elections.results.title") %></h3>
4
4
 
5
5
  <p><%= t("decidim.elections.elections.results.description") %></p>
6
6
 
@@ -5,15 +5,20 @@ module Decidim
5
5
  # This cell renders the results
6
6
  # for a given instance of an Election
7
7
  class ElectionVoteCtaCell < Decidim::ViewModel
8
+ include Decidim::Elections::HasVoteFlow
9
+
8
10
  delegate :current_user,
9
11
  :current_participatory_space,
10
- :preview_mode?,
11
- :can_preview?,
12
- :vote_flow,
12
+ :allowed_to?,
13
13
  to: :controller
14
14
 
15
15
  private
16
16
 
17
+ # This is needed by HasVoteFlow
18
+ def election
19
+ model
20
+ end
21
+
17
22
  def last_vote
18
23
  @last_vote ||= Decidim::Elections::Votes::LastVoteForVoter.for(model, vote_flow.voter_id) if vote_flow.has_voter?
19
24
  end
@@ -1,4 +1,4 @@
1
- <section class="wrapper-home home-section">
1
+ <section id="highlighted_votings" class="wrapper-home home-section">
2
2
  <div class="row" id="highlighted-votings">
3
3
  <h3 class="section-heading"><%= t("active_votings", scope: i18n_scope) %></h3>
4
4
  <div class="row collapse">
@@ -6,10 +6,6 @@ module Decidim
6
6
  class HighlightedVotingsCell < Decidim::ViewModel
7
7
  delegate :current_user, to: :controller
8
8
 
9
- cache :show, expires_in: 10.minutes, if: :perform_caching? do
10
- cache_hash
11
- end
12
-
13
9
  def show
14
10
  render if highlighted_votings.any?
15
11
  end
@@ -39,6 +35,10 @@ module Decidim
39
35
  hash.push(I18n.locale)
40
36
  hash.join(Decidim.cache_key_separator)
41
37
  end
38
+
39
+ def cache_expiry_time
40
+ 10.minutes
41
+ end
42
42
  end
43
43
  end
44
44
  end
@@ -5,20 +5,10 @@
5
5
  <img src="<%= introductory_image.path %>" alt="">
6
6
  </div>
7
7
  <% end %>
8
- <div class="columns medium-8 mediumlarge-7 content">
8
+ <div class="columns medium-8 mediumlarge-7">
9
+ <h2 class="show-for-sr"><%= t("decidim.votings.content_blocks.landing_page.description.title") %></h2>
9
10
  <div><%= description_text %></div>
10
11
  </div>
11
- <div class="content-height-toggler show-more">
12
- <button class="button button--muted tiny">
13
- <span class="button-text show-more-content">
14
- <%= button_show_more_text %>
15
- </span>
16
-
17
- <span class="button-text show-less-content hide">
18
- <%= button_show_less_text %>
19
- </span>
20
- </button>
21
- </div>
22
12
  </div>
23
13
  </div>
24
14
 
@@ -18,14 +18,6 @@ module Decidim
18
18
  def description_text
19
19
  decidim_sanitize_editor(translated_attribute(current_participatory_space.description))
20
20
  end
21
-
22
- def button_show_more_text
23
- t(:show_more, scope: "decidim.votings.content_blocks.landing_page.description")
24
- end
25
-
26
- def button_show_less_text
27
- t(:show_less, scope: "decidim.votings.content_blocks.landing_page.description")
28
- end
29
21
  end
30
22
  end
31
23
  end
@@ -6,9 +6,9 @@
6
6
  <%= translated_attribute(current_participatory_space.title) %>
7
7
  </h1>
8
8
 
9
- <h3 class="text-highlight">
9
+ <p class="text-highlight heading3">
10
10
  <%= voting_dates %>
11
- </h3>
11
+ </p>
12
12
  </div>
13
13
  </div>
14
14
 
@@ -74,7 +74,7 @@ module Decidim
74
74
  url: decidim_votings.voting_path(current_participatory_space),
75
75
  active: is_active_link?(decidim_votings.voting_path(current_participatory_space), :exclusive)
76
76
  },
77
- if current_participatory_space.dataset.present?
77
+ if current_participatory_space.check_census_enabled?
78
78
  {
79
79
  name: t("layouts.decidim.voting_navigation.check_census"),
80
80
  url: decidim_votings.voting_check_census_path(current_participatory_space),
@@ -1,5 +1,5 @@
1
1
  <div class="polling_station-address">
2
- <h5 class="mb-none"><%= translated_attribute polling_station.title %></h5>
2
+ <h4 class="mb-none heading5"><%= translated_attribute polling_station.title %></h4>
3
3
 
4
4
  <div>
5
5
  <strong><%= translated_attribute polling_station.location %></strong>
@@ -5,12 +5,14 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the admin user creates a trustee
7
7
  # from the admin panel.
8
- class AddUserAsTrustee < Rectify::Command
8
+ class AddUserAsTrustee < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
12
12
  def initialize(form, current_user)
13
13
  @form = form
14
+ @user = form.user
15
+ @participatory_space = form.current_participatory_space
14
16
  @current_user = current_user
15
17
  end
16
18
 
@@ -27,29 +29,31 @@ module Decidim
27
29
  notify_user_about_trustee_role if new_trustee?
28
30
  end
29
31
 
32
+ send_email
33
+
30
34
  broadcast(:ok)
31
35
  end
32
36
 
33
37
  private
34
38
 
35
- attr_reader :form, :current_user, :trustee
39
+ attr_reader :form, :current_user, :trustee, :participatory_space, :user
36
40
 
37
41
  def add_user_as_trustee!
38
42
  @trustee = Decidim.traceability.create!(
39
43
  Trustee,
40
- form.current_user,
41
- user: form.user,
42
- organization: form.user.organization
44
+ current_user,
45
+ user: user,
46
+ organization: user.organization
43
47
  )
44
48
  end
45
49
 
46
50
  # If a trustee exists for this participatory space, it won't get created again
47
51
  def existing_trustee_participatory_spaces?
48
- trustees_space = TrusteesParticipatorySpace.where(participatory_space: form.current_participatory_space).includes(:trustee)
52
+ trustees_space = TrusteesParticipatorySpace.where(participatory_space: participatory_space).includes(:trustee)
49
53
  @existing_trustee_participatory_spaces ||= Decidim::Elections::Trustee.joins(:trustees_participatory_spaces)
50
54
  .includes([:user])
51
55
  .where(trustees_participatory_spaces: trustees_space)
52
- .where(decidim_user_id: form.user.id).any?
56
+ .where(decidim_user_id: user.id).any?
53
57
  end
54
58
 
55
59
  # if there's no user - trustee relation, the trustee gets created and the notification
@@ -57,13 +61,13 @@ module Decidim
57
61
  def new_trustee?
58
62
  return @new_trustee if defined?(@new_trustee)
59
63
 
60
- @new_trustee = Decidim::Elections::Trustee.where(decidim_user_id: form.user.id).empty?
64
+ @new_trustee = Decidim::Elections::Trustee.where(decidim_user_id: user.id).empty?
61
65
  end
62
66
 
63
67
  def add_participatory_space
64
- trustee = Decidim::Elections::Trustee.find_by(decidim_user_id: form.user.id)
68
+ trustee = Decidim::Elections::Trustee.find_by(decidim_user_id: user.id)
65
69
  trustee.trustees_participatory_spaces.create!(
66
- participatory_space: form.current_participatory_space
70
+ participatory_space: participatory_space
67
71
  )
68
72
  end
69
73
 
@@ -71,11 +75,17 @@ module Decidim
71
75
  data = {
72
76
  event: "decidim.events.elections.trustees.new_trustee",
73
77
  event_class: Decidim::Elections::Trustees::NotifyNewTrusteeEvent,
74
- resource: form.current_participatory_space,
75
- affected_users: [form.user]
78
+ resource: participatory_space,
79
+ affected_users: [user]
76
80
  }
77
81
  Decidim::EventsManager.publish(**data)
78
82
  end
83
+
84
+ def send_email
85
+ Decidim::Elections::TrusteeMailer.notification(
86
+ user, participatory_space, I18n.locale.to_s
87
+ ).deliver_later
88
+ end
79
89
  end
80
90
  end
81
91
  end
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates an Answer
7
7
  # from the admin panel.
8
- class CreateAnswer < Rectify::Command
8
+ class CreateAnswer < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates an Election
7
7
  # from the admin panel.
8
- class CreateElection < Rectify::Command
8
+ class CreateElection < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates a Question
7
7
  # from the admin panel.
8
- class CreateQuestion < Rectify::Command
8
+ class CreateQuestion < Decidim::Command
9
9
  def initialize(form)
10
10
  @form = form
11
11
  end
@@ -14,7 +14,8 @@ module Decidim
14
14
  #
15
15
  # Broadcasts :ok if successful, :invalid otherwise.
16
16
  def call
17
- return broadcast(:invalid) if invalid?
17
+ return broadcast(:election_started) if form.election.started?
18
+ return broadcast(:invalid) if form.invalid?
18
19
 
19
20
  create_question!
20
21
 
@@ -25,15 +26,10 @@ module Decidim
25
26
 
26
27
  attr_reader :form, :question
27
28
 
28
- def invalid?
29
- form.election.started? || form.invalid?
30
- end
31
-
32
29
  def create_question!
33
30
  attributes = {
34
31
  election: form.election,
35
32
  title: form.title,
36
- description: form.description,
37
33
  max_selections: form.max_selections,
38
34
  weight: form.weight,
39
35
  random_answers_order: form.random_answers_order,
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user destroys an Answer
7
7
  # from the admin panel.
8
- class DestroyAnswer < Rectify::Command
8
+ class DestroyAnswer < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user destroys an Election
7
7
  # from the admin panel.
8
- class DestroyElection < Rectify::Command
8
+ class DestroyElection < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user destroys a Question
7
7
  # from the admin panel.
8
- class DestroyQuestion < Rectify::Command
8
+ class DestroyQuestion < Decidim::Command
9
9
  def initialize(question, current_user)
10
10
  @question = question
11
11
  @current_user = current_user
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called to end the voting period in the Bulletin Board.
7
- class EndVote < Rectify::Command
7
+ class EndVote < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A VotePeriodForm object with the information needed to start or end the vote period
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command is executed when an admin imports proposals from
7
7
  # one component to answers of elections component.
8
- class ImportProposalsToElections < Rectify::Command
8
+ class ImportProposalsToElections < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called when a election is published from the admin panel.
7
- class PublishElection < Rectify::Command
7
+ class PublishElection < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # election - The election to publish.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called to publish the election results in the Bulletin Board.
7
- class PublishResults < Rectify::Command
7
+ class PublishResults < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - An ActionForm object with the information needed to publish the results
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the admin user removes a trustee
7
7
  # from a participatory space from the admin panel.
8
- class RemoveTrusteeFromParticipatorySpace < Rectify::Command
8
+ class RemoveTrusteeFromParticipatorySpace < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # trustee_participatory_space - A trustee_participatory_space
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called to report a missing trustee during the tally process.
7
- class ReportMissingTrustee < Rectify::Command
7
+ class ReportMissingTrustee < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A ReportMissingTrusteeForm object with the information needed to report the missing trustee.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called when a election is setup from the admin panel.
7
- class SetupElection < Rectify::Command
7
+ class SetupElection < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A SetupForm object with the information needed to setup the election
@@ -94,7 +94,9 @@ module Decidim
94
94
  weight: question.weight,
95
95
  max_selections: question.max_selections,
96
96
  title: flatten_translations(question.title),
97
- description: flatten_translations(question.description),
97
+ # the bulletin_board gem (ruby client) expects a description for the question
98
+ # as development is in a separate repository, let's send an empty content for the moment
99
+ description: {},
98
100
  answers: question_answers_data(question)
99
101
  }
100
102
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called to start the key ceremony in the Bulletin Board.
7
- class StartKeyCeremony < Rectify::Command
7
+ class StartKeyCeremony < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - An ActionForm object with the information needed to perform an action
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called to start the tally in the Bulletin Board.
7
- class StartTally < Rectify::Command
7
+ class StartTally < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - An ActionForm object with the information needed to perform an action
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called to start the voting period in the Bulletin Board.
7
- class StartVote < Rectify::Command
7
+ class StartVote < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A VotePeriodForm object with the information needed to start or end the vote period
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command gets called when a election is unpublished from the admin panel.
7
- class UnpublishElection < Rectify::Command
7
+ class UnpublishElection < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # election - The election to unpublish.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Admin
6
6
  # This command updates the status of the action and the election if it got changed
7
- class UpdateActionStatus < Rectify::Command
7
+ class UpdateActionStatus < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # action - The pending action to be updated
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user updates an Answer
7
7
  # from the admin panel.
8
- class UpdateAnswer < Rectify::Command
8
+ class UpdateAnswer < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when an admin marks an answer
7
7
  # as selected.
8
- class UpdateAnswerSelection < Rectify::Command
8
+ class UpdateAnswerSelection < Decidim::Command
9
9
  def initialize(answer, selected)
10
10
  @answer = answer
11
11
  @selected = selected
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user updates an Election
7
7
  # from the admin panel.
8
- class UpdateElection < Rectify::Command
8
+ class UpdateElection < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user updates a Question
7
7
  # from the admin panel.
8
- class UpdateQuestion < Rectify::Command
8
+ class UpdateQuestion < Decidim::Command
9
9
  def initialize(form, question)
10
10
  @form = form
11
11
  @question = question
@@ -33,7 +33,6 @@ module Decidim
33
33
  def update_question!
34
34
  attributes = {
35
35
  title: form.title,
36
- description: form.description,
37
36
  max_selections: form.max_selections,
38
37
  weight: form.weight,
39
38
  random_answers_order: form.random_answers_order,
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user updates a trustee
7
7
  # status from the admin panel.
8
- class UpdateTrusteeParticipatorySpace < Rectify::Command
8
+ class UpdateTrusteeParticipatorySpace < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # trustee_participatory_space - A trustee_participatory_space
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module TrusteeZone
6
6
  # This command updates the election status if it got changed
7
- class UpdateElectionBulletinBoardStatus < Rectify::Command
7
+ class UpdateElectionBulletinBoardStatus < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # status - The actual election status
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module TrusteeZone
6
6
  # This command allows the user to update their trustee information
7
- class UpdateTrustee < Rectify::Command
7
+ class UpdateTrustee < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form with the new trustee information
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Voter
6
6
  # This command allows the user to store and cast their vote.
7
- class CastVote < Rectify::Command
7
+ class CastVote < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form with necessary info to cast a vote.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Elections
5
5
  module Voter
6
6
  # This command updates the vote status and sends a notification.
7
- class UpdateVoteStatus < Rectify::Command
7
+ class UpdateVoteStatus < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # vote - the vote that has been updated
@@ -74,7 +74,7 @@ module Decidim
74
74
  }
75
75
  }
76
76
 
77
- Decidim::EventsManager.publish(data)
77
+ Decidim::EventsManager.publish(**data)
78
78
  end
79
79
 
80
80
  def send_vote_email
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Votings
5
5
  module Admin
6
6
  # A command with the business logic to create the ballot style
7
- class CreateBallotStyle < Rectify::Command
7
+ class CreateBallotStyle < Decidim::Command
8
8
  def initialize(form)
9
9
  @form = form
10
10
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Votings
5
5
  module Admin
6
6
  # A command with the business logic to create a new monitoring committee member
7
- class CreateMonitoringCommitteeMember < Rectify::Command
7
+ class CreateMonitoringCommitteeMember < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Votings
5
5
  module Admin
6
6
  # A command with the business logic to create a new polling officer
7
- class CreatePollingOfficer < Rectify::Command
7
+ class CreatePollingOfficer < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Votings
5
5
  module Admin
6
6
  # A command with all the business logic when creating a new voting space
7
- class CreateVoting < Rectify::Command
7
+ class CreateVoting < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params.
@@ -51,7 +51,8 @@ module Decidim
51
51
  banner_image: form.banner_image,
52
52
  introductory_image: form.introductory_image,
53
53
  voting_type: form.voting_type,
54
- census_contact_information: form.census_contact_information
54
+ census_contact_information: form.census_contact_information,
55
+ show_check_census: form.show_check_census
55
56
  )
56
57
  end
57
58
  end