decidim-elections 0.26.7 → 0.26.8

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/elections/admin/create_answer.rb +1 -1
  3. data/app/commands/decidim/elections/admin/create_question.rb +1 -1
  4. data/app/commands/decidim/elections/admin/destroy_answer.rb +1 -1
  5. data/app/commands/decidim/elections/admin/destroy_election.rb +1 -1
  6. data/app/commands/decidim/elections/admin/destroy_question.rb +1 -1
  7. data/app/commands/decidim/elections/admin/import_proposals_to_elections.rb +1 -1
  8. data/app/commands/decidim/elections/admin/update_answer.rb +1 -1
  9. data/app/commands/decidim/elections/admin/update_question.rb +1 -1
  10. data/app/controllers/decidim/elections/admin/trustees_participatory_spaces_controller.rb +1 -1
  11. data/app/controllers/decidim/elections/trustee_zone/application_controller.rb +6 -4
  12. data/app/controllers/decidim/votings/admin/exports_controller.rb +14 -0
  13. data/app/controllers/decidim/votings/admin/reminders_controller.rb +14 -0
  14. data/app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb +1 -1
  15. data/app/controllers/decidim/votings/admin/votings_landing_page_controller.rb +1 -1
  16. data/app/controllers/decidim/votings/polling_officer_zone/closures_controller.rb +5 -1
  17. data/app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb +5 -1
  18. data/app/controllers/decidim/votings/votings_controller.rb +1 -1
  19. data/app/forms/decidim/elections/admin/setup_form.rb +2 -1
  20. data/app/forms/decidim/votings/admin/voting_role_form.rb +29 -0
  21. data/app/permissions/decidim/elections/admin/permissions.rb +1 -7
  22. data/app/permissions/decidim/votings/admin/permissions.rb +1 -1
  23. data/app/views/decidim/elections/admin/elections/edit.html.erb +1 -0
  24. data/app/views/decidim/elections/admin/elections/index.html.erb +1 -0
  25. data/app/views/decidim/elections/admin/elections/new.html.erb +1 -0
  26. data/app/views/decidim/elections/admin/trustees_participatory_spaces/index.html.erb +1 -0
  27. data/app/views/decidim/elections/admin/trustees_participatory_spaces/new.html.erb +1 -0
  28. data/app/views/decidim/votings/admin/ballot_styles/edit.html.erb +1 -0
  29. data/app/views/decidim/votings/admin/ballot_styles/index.html.erb +1 -0
  30. data/app/views/decidim/votings/admin/ballot_styles/new.html.erb +1 -0
  31. data/app/views/decidim/votings/admin/votings/edit.html.erb +1 -0
  32. data/app/views/decidim/votings/admin/votings/index.html.erb +1 -0
  33. data/app/views/decidim/votings/admin/votings/new.html.erb +0 -1
  34. data/app/views/decidim/votings/census/admin/census/show.html.erb +1 -0
  35. data/config/environment.rb +0 -0
  36. data/config/locales/ar.yml +3 -0
  37. data/config/locales/ca.yml +7 -7
  38. data/config/locales/cs.yml +0 -4
  39. data/config/locales/de.yml +111 -11
  40. data/config/locales/el.yml +1095 -0
  41. data/config/locales/en.yml +2 -2
  42. data/config/locales/es-MX.yml +5 -5
  43. data/config/locales/es-PY.yml +5 -5
  44. data/config/locales/es.yml +5 -5
  45. data/config/locales/eu.yml +1 -23
  46. data/config/locales/fi-plain.yml +1 -1
  47. data/config/locales/fi.yml +1 -1
  48. data/config/locales/fr-CA.yml +2 -24
  49. data/config/locales/fr.yml +5 -27
  50. data/config/locales/ga-IE.yml +1 -1
  51. data/config/locales/gl.yml +8 -5
  52. data/config/locales/hu.yml +11 -0
  53. data/config/locales/it.yml +4 -28
  54. data/config/locales/ja.yml +4 -4
  55. data/config/locales/lt.yml +0 -24
  56. data/config/locales/lv.yml +3 -0
  57. data/config/locales/nl.yml +4 -25
  58. data/config/locales/no.yml +14 -1
  59. data/config/locales/pl.yml +4 -26
  60. data/config/locales/pt-BR.yml +6 -27
  61. data/config/locales/pt.yml +1 -23
  62. data/config/locales/ro-RO.yml +11 -7
  63. data/config/locales/sv.yml +1 -18
  64. data/config/locales/tr-TR.yml +45 -1
  65. data/config/locales/zh-CN.yml +15 -1
  66. data/config/locales/zh-TW.yml +0 -24
  67. data/lib/decidim/elections/test/factories.rb +1 -0
  68. data/lib/decidim/elections/version.rb +1 -1
  69. data/lib/decidim/votings/admin_engine.rb +1 -0
  70. metadata +16 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb6adf6a39f0158f835bbee4df71f54d22e338e11482e28a1ea241c052f90787
4
- data.tar.gz: 4677017dfaa4318d866bfbbf78115243782b627035ae1bec46adff5b68e86435
3
+ metadata.gz: 786343e6be9c50d6b789d4fa5fb26ef66c0ed984ca72e62dfa376d5664642310
4
+ data.tar.gz: dcfe8ab018b810d8ce7c694f05c545966e5b21c947be3594db0a9ae7dab79908
5
5
  SHA512:
6
- metadata.gz: 60f51b35f2a326dcc472464a764a5c1149c814dd5e6d75194c35ecb82f527234b27d469754e5bc67e26f60f31a2531261bfb1b2d056151a88080a351b6a5812a
7
- data.tar.gz: 0fd97e7011e5ddbb74d81687d74ef3d56352ffc6edf97395b12c211faf36357bcdfaf2f73eb05d280f2788ad6e574e47c7d63264ccf694de4f73bc6a95bc4a68
6
+ metadata.gz: e14eabe02a500e64ef20e5b204057e7036af7b11690f08a3f7df7e533fbc9cede6ce6f5084f8a3d5b2f2b70525fbea5e8d6dd50a7d922da91b85ec1f94c7175c
7
+ data.tar.gz: 511ee2f08dc98e56bbb53ba3d2b884a1ab68effd61fe7478469a42e4772df006e16043a3b8989d09982f7c52bf35e608cf99d178f68c92512f5314fb1add487e
@@ -38,7 +38,7 @@ module Decidim
38
38
  attr_reader :form, :answer, :gallery
39
39
 
40
40
  def invalid?
41
- form.election.started? || form.invalid?
41
+ form.election.blocked? || form.invalid?
42
42
  end
43
43
 
44
44
  def create_answer
@@ -14,7 +14,7 @@ module Decidim
14
14
  #
15
15
  # Broadcasts :ok if successful, :invalid otherwise.
16
16
  def call
17
- return broadcast(:election_started) if form.election.started?
17
+ return broadcast(:election_started) if form.election.blocked?
18
18
  return broadcast(:invalid) if form.invalid?
19
19
 
20
20
  create_question!
@@ -31,7 +31,7 @@ module Decidim
31
31
  attr_reader :answer, :current_user
32
32
 
33
33
  def invalid?
34
- answer.question.election.started?
34
+ answer.question.election.blocked?
35
35
  end
36
36
 
37
37
  def destroy_answer
@@ -31,7 +31,7 @@ module Decidim
31
31
  attr_reader :election, :current_user
32
32
 
33
33
  def invalid?
34
- election.started?
34
+ election.blocked?
35
35
  end
36
36
 
37
37
  def destroy_election!
@@ -27,7 +27,7 @@ module Decidim
27
27
  attr_reader :question, :current_user
28
28
 
29
29
  def invalid?
30
- question.election.started?
30
+ question.election.blocked?
31
31
  end
32
32
 
33
33
  def destroy_question!
@@ -30,7 +30,7 @@ module Decidim
30
30
  attr_reader :form, :answer
31
31
 
32
32
  def invalid?
33
- form.election.started? || form.invalid?
33
+ form.election.blocked? || form.invalid?
34
34
  end
35
35
 
36
36
  def create_answers_from_accepted_proposals
@@ -41,7 +41,7 @@ module Decidim
41
41
  attr_reader :form, :answer, :gallery
42
42
 
43
43
  def invalid?
44
- form.election.started? || form.invalid?
44
+ form.election.blocked? || form.invalid?
45
45
  end
46
46
 
47
47
  def update_answer
@@ -27,7 +27,7 @@ module Decidim
27
27
  attr_reader :form, :question
28
28
 
29
29
  def invalid?
30
- question.election.started? || form.invalid?
30
+ question.election.blocked? || form.invalid?
31
31
  end
32
32
 
33
33
  def update_question!
@@ -72,7 +72,7 @@ module Decidim
72
72
  private
73
73
 
74
74
  def trustee_participatory_space
75
- @trustee_participatory_space ||= TrusteesParticipatorySpace.find_by(id: params[:id])
75
+ @trustee_participatory_space ||= TrusteesParticipatorySpace.find_by(id: params[:id], participatory_space: current_participatory_space)
76
76
  end
77
77
 
78
78
  def trustees
@@ -13,6 +13,11 @@ module Decidim
13
13
 
14
14
  before_action :ensure_configured_bulletin_board!
15
15
 
16
+ register_permissions(::Decidim::Elections::TrusteeZone::ApplicationController,
17
+ ::Decidim::Elections::Permissions,
18
+ ::Decidim::Admin::Permissions,
19
+ ::Decidim::Permissions)
20
+
16
21
  private
17
22
 
18
23
  def ensure_configured_bulletin_board!
@@ -34,10 +39,7 @@ module Decidim
34
39
  end
35
40
 
36
41
  def permission_class_chain
37
- [
38
- Decidim::Elections::Permissions,
39
- Decidim::Permissions
40
- ]
42
+ ::Decidim.permissions_registry.chain_for(::Decidim::Elections::TrusteeZone::ApplicationController)
41
43
  end
42
44
  end
43
45
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Votings
5
+ module Admin
6
+ # This controller allows exporting things.
7
+ # It is targeted for customizations for exporting things that lives under
8
+ # a participatory process.
9
+ class ExportsController < Decidim::Admin::ExportsController
10
+ include VotingAdmin
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Votings
5
+ module Admin
6
+ # This controller allows to send reminders.
7
+ # It is targeted for customizations for reminder things that lives under
8
+ # votings.
9
+ class RemindersController < Decidim::Admin::RemindersController
10
+ include VotingAdmin
11
+ end
12
+ end
13
+ end
14
+ end
@@ -18,7 +18,7 @@ module Decidim
18
18
  end
19
19
 
20
20
  def scoped_resource
21
- @scoped_resource ||= Voting.find_by(slug: params[:voting_slug])
21
+ @scoped_resource ||= Voting.find_by(slug: params[:voting_slug], organization: current_organization)
22
22
  end
23
23
 
24
24
  def enforce_permission_to_update_resource
@@ -16,7 +16,7 @@ module Decidim
16
16
  end
17
17
 
18
18
  def scoped_resource
19
- @scoped_resource ||= Voting.find_by(slug: params[:voting_slug])
19
+ @scoped_resource ||= Voting.find_by(slug: params[:voting_slug], organization: current_organization)
20
20
  end
21
21
 
22
22
  def enforce_permission_to_update_resource
@@ -111,7 +111,11 @@ module Decidim
111
111
  end
112
112
 
113
113
  def election
114
- @election ||= Decidim::Elections::Election.includes(questions: :answers).find_by(id: params[:election_id])
114
+ @election ||= Decidim::Elections::Election
115
+ .joins("INNER JOIN decidim_components component ON component.id = decidim_elections_elections.decidim_component_id")
116
+ .where(component: { participatory_space: current_organization.participatory_spaces })
117
+ .includes(questions: :answers)
118
+ .find_by(id: params[:election_id])
115
119
  end
116
120
 
117
121
  def polling_station
@@ -121,7 +121,11 @@ module Decidim
121
121
  end
122
122
 
123
123
  def election
124
- @election ||= Decidim::Elections::Election.find(params[:election_id])
124
+ @election ||= Decidim::Elections::Election
125
+ .joins("INNER JOIN decidim_components component ON component.id = decidim_elections_elections.decidim_component_id")
126
+ .where(component: { participatory_space: current_organization.participatory_spaces })
127
+ .includes(questions: :answers)
128
+ .find_by(id: params[:election_id])
125
129
  end
126
130
 
127
131
  def polling_officer
@@ -99,7 +99,7 @@ module Decidim
99
99
  end
100
100
 
101
101
  def election
102
- @election ||= Decidim::Elections::Election.find(params[:election_id])
102
+ @election ||= Decidim::Elections::Election.where(component: current_participatory_space.components).find(params[:election_id])
103
103
  end
104
104
 
105
105
  def elections
@@ -41,7 +41,8 @@ module Decidim
41
41
  [:max_selections, {}, election.valid_questions?],
42
42
  [:published, {}, election.published_at.present?],
43
43
  [:component_published, {}, election.component.published?],
44
- [:time_before, { hours: Decidim::Elections.setup_minimum_hours_before_start }, election.minimum_hours_before_start?],
44
+ [:time_before, { hours: I18n.t("datetime.distance_in_words.x_hours", count: Decidim::Elections.setup_minimum_hours_before_start) },
45
+ election.minimum_hours_before_start?],
45
46
  [:trustees_number, { number: bulletin_board.number_of_trustees }, participatory_space_trustees_with_public_key.size >= bulletin_board.number_of_trustees]
46
47
  ].freeze
47
48
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Votings
5
+ module Admin
6
+ # Base class to be inherited by other forms that have roles
7
+ # in the Votings space
8
+ class VotingRoleForm < Decidim::Form
9
+ attribute :name, String
10
+ attribute :email, String
11
+ attribute :user_id, Integer
12
+ attribute :existing_user, Boolean, default: false
13
+
14
+ validates :email, presence: true, format: { with: ::Devise.email_regexp }, unless: ->(form) { form.existing_user }
15
+ validates :name, presence: true, format: { with: UserBaseEntity::REGEXP_NAME }, unless: ->(form) { form.existing_user }
16
+ validates :user, presence: true, if: ->(form) { form.existing_user }
17
+
18
+ def map_model(model)
19
+ self.user_id = model.decidim_user_id
20
+ self.existing_user = user_id.present?
21
+ end
22
+
23
+ def user
24
+ @user ||= current_organization.users.find_by(id: user_id)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -24,10 +24,8 @@ module Decidim
24
24
  case permission_action.action
25
25
  when :create, :read
26
26
  allow!
27
- when :delete, :update, :unpublish
27
+ when :delete, :update, :unpublish, :publish
28
28
  allow_if_not_blocked
29
- when :publish
30
- allow_if_valid_and_not_blocked
31
29
  end
32
30
  when :trustees
33
31
  case permission_action.action
@@ -80,10 +78,6 @@ module Decidim
80
78
  toggle_allow(election && !election.blocked?)
81
79
  end
82
80
 
83
- def allow_if_valid_and_not_blocked
84
- toggle_allow(election && !election.blocked? && election.valid_questions?)
85
- end
86
-
87
81
  def allow_if_not_related_to_any_election
88
82
  toggle_allow(trustee_participatory_space.trustee.elections.empty?)
89
83
  end
@@ -132,7 +132,7 @@ module Decidim
132
132
  when :ballot_styles
133
133
  toggle_allow(user.admin?) if permission_action.action == :read
134
134
  when :component_data
135
- toggle_allow(user.admin?) if permission_action.action == :import
135
+ toggle_allow(user.admin?) if [:import, :export].member? permission_action.action
136
136
  end
137
137
  end
138
138
 
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <%= decidim_form_for(@form, html: { class: "form edit_election" }) do |f| %>
2
3
  <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
4
 
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <div class="card">
2
3
  <div class="card-divider">
3
4
  <h2 class="card-title">
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <%= decidim_form_for(@form, html: { class: "form new_election" }) do |f| %>
2
3
  <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
4
 
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <div class="card" id="trustees">
2
3
  <div class="card-divider">
3
4
  <h2 class="card-title">
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <%= decidim_form_for(@form, url: trustees_path, html: { class: "form new_trustee" }) do |f| %>
2
3
  <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
4
 
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <%= decidim_form_for([current_voting, @form], url: { action: "update" }, html: { class: "form edit_ballot_style" }) do |f| %>
2
3
  <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
4
 
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <div class="callout warning">
2
3
  <%= icon "info" %>
3
4
  <span class="callout-text"><%= t("explanation_callout", scope: "decidim.votings.admin.ballot_styles.index") %></span>
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t(".title")) %>
1
2
  <%= decidim_form_for([current_participatory_space, @form], html: { class: "form new_ballot_style" }) do |f| %>
2
3
  <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
4
 
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t("votings.edit.update", scope: "decidim.votings.admin")) %>
1
2
  <%= decidim_form_for @form,
2
3
  method: :patch,
3
4
  url: voting_path(@current_voting),
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t("decidim.votings.admin.titles.votings")) %>
1
2
  <div class="card with-overflow" id="votings">
2
3
  <div class="card-divider">
3
4
  <h2 class="card-title">
@@ -1,5 +1,4 @@
1
1
  <% add_decidim_page_title(t("votings.new.title", scope: "decidim.votings.admin")) %>
2
-
3
2
  <h2 class="voting-title-summary">
4
3
  <%= t("votings.new.title", scope: "decidim.votings.admin") %>
5
4
  </h2>
@@ -1,3 +1,4 @@
1
+ <% add_decidim_page_title(t("show.heading", scope: "decidim.votings.census.admin.census")) %>
1
2
  <div class="card">
2
3
  <div class="card-divider">
3
4
  <h2 class="card-title">
File without changes
@@ -42,6 +42,9 @@ ar:
42
42
  show:
43
43
  identification_keys:
44
44
  cancel: إلغاء
45
+ votes:
46
+ confirm:
47
+ answer: الإجابة
45
48
  votings:
46
49
  admin:
47
50
  models:
@@ -684,10 +684,10 @@ ca:
684
684
  header:
685
685
  ballot_decision: Envia o audita el teu vot
686
686
  casting: El vot s'està dipositant
687
- confirm: Confirma el teu vot
687
+ confirm: Confirmar el teu vot
688
688
  confirmed: Vot confirmat
689
689
  encrypting: El vot s'està xifrant
690
- failed: Error en el vot
690
+ failed: Vot fallit
691
691
  messages:
692
692
  invalid_token: La sessió de la cabina de votació no és vàlida. Prova de votar de nou.
693
693
  not_allowed: No pots votar en aquesta votació en aquest moment.
@@ -818,15 +818,15 @@ ca:
818
818
  description:
819
819
  name: Descripció de la votació
820
820
  elections:
821
- name: Eleccions de la votació
821
+ name: Eleccions
822
822
  header:
823
823
  name: Capçalera de la votació
824
824
  html_block_1:
825
- name: Bloc html 1 de votació
825
+ name: Bloc html 1 de la votació
826
826
  html_block_2:
827
- name: Bloc html 2 de votació
827
+ name: Bloc html 2 de la votació
828
828
  html_block_3:
829
- name: Bloc html 3 de votació
829
+ name: Bloc html 3 de la votació
830
830
  metrics:
831
831
  name: Mètriques de la votació
832
832
  polling_stations:
@@ -1404,7 +1404,7 @@ ca:
1404
1404
  footer_button_text:
1405
1405
  participate: Participa
1406
1406
  view: Veure
1407
- vote: Vota
1407
+ vote: Votar
1408
1408
  unspecified: Sense especificar
1409
1409
  voting_type:
1410
1410
  hybrid: Híbrida
@@ -833,14 +833,10 @@ cs:
833
833
  highlighted_votings:
834
834
  max_results: Maximální počet prvků k zobrazení
835
835
  landing_page:
836
- attachments_and_folders:
837
- name: Přílohy a složky hlasování
838
836
  description:
839
837
  name: Popis hlasování
840
838
  elections:
841
839
  name: Hlasovací volby
842
- header:
843
- name: Záhlaví hlasování
844
840
  html_block_1:
845
841
  name: Html blok 1 hlasování
846
842
  html_block_2: