decidim-initiatives 0.27.4 → 0.27.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +2 -2
  3. data/app/controllers/decidim/initiatives/widgets_controller.rb +15 -1
  4. data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +1 -1
  5. data/app/events/decidim/initiatives/approve_membership_request_event.rb +1 -4
  6. data/app/events/decidim/initiatives/create_initiative_event.rb +1 -4
  7. data/app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb +1 -1
  8. data/app/events/decidim/initiatives/revoke_membership_request_event.rb +1 -4
  9. data/app/events/decidim/initiatives/spawn_committee_request_event.rb +1 -4
  10. data/app/helpers/decidim/initiatives/application_helper.rb +2 -2
  11. data/app/models/decidim/initiative.rb +1 -6
  12. data/app/packs/stylesheets/decidim/initiatives/print-initiative.scss +16 -0
  13. data/app/permissions/decidim/initiatives/permissions.rb +10 -0
  14. data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +1 -1
  15. data/app/views/decidim/initiatives/initiatives/_result.html.erb +2 -2
  16. data/app/views/decidim/initiatives/initiatives/_tags.html.erb +3 -3
  17. data/app/views/decidim/initiatives/initiatives/print.html.erb +1 -1
  18. data/app/views/decidim/initiatives/initiatives/show.html.erb +3 -1
  19. data/config/locales/ar.yml +4 -0
  20. data/config/locales/bg.yml +143 -0
  21. data/config/locales/ca.yml +13 -13
  22. data/config/locales/cs.yml +3 -3
  23. data/config/locales/de.yml +19 -19
  24. data/config/locales/el.yml +1 -0
  25. data/config/locales/es-MX.yml +5 -5
  26. data/config/locales/es-PY.yml +5 -5
  27. data/config/locales/es.yml +12 -12
  28. data/config/locales/eu.yml +125 -76
  29. data/config/locales/fi-plain.yml +1 -1
  30. data/config/locales/fi.yml +1 -1
  31. data/config/locales/fr-CA.yml +8 -3
  32. data/config/locales/fr.yml +8 -3
  33. data/config/locales/gl.yml +2 -0
  34. data/config/locales/he-IL.yml +1 -0
  35. data/config/locales/hu.yml +11 -4
  36. data/config/locales/id-ID.yml +1 -0
  37. data/config/locales/is-IS.yml +3 -0
  38. data/config/locales/ja.yml +4 -4
  39. data/config/locales/lb.yml +17 -2
  40. data/config/locales/lt.yml +24 -2
  41. data/config/locales/lv.yml +1 -0
  42. data/config/locales/nl.yml +1 -0
  43. data/config/locales/pl.yml +28 -0
  44. data/config/locales/pt-BR.yml +31 -3
  45. data/config/locales/ru.yml +3 -0
  46. data/config/locales/sk.yml +2 -1
  47. data/config/locales/sq-AL.yml +1 -0
  48. data/config/locales/sv.yml +4 -0
  49. data/config/locales/th-TH.yml +1 -0
  50. data/config/locales/tr-TR.yml +0 -1
  51. data/config/locales/uk.yml +3 -0
  52. data/config/locales/zh-CN.yml +1 -1
  53. data/config/locales/zh-TW.yml +0 -2
  54. data/decidim-initiatives.gemspec +38 -0
  55. data/lib/decidim/initiatives/admin_engine.rb +1 -1
  56. data/lib/decidim/initiatives/test/factories.rb +51 -28
  57. data/lib/decidim/initiatives/version.rb +1 -1
  58. metadata +23 -20
  59. data/config/environment.rb +0 -0
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
4
+
5
+ require "decidim/initiatives/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.version = Decidim::Initiatives.version
9
+ s.authors = ["Juan Salvador Perez Garcia"]
10
+ s.email = ["jsperezg@gmail.com"]
11
+ s.license = "AGPL-3.0"
12
+ s.homepage = "https://github.com/decidim/decidim"
13
+ s.required_ruby_version = "~> 3.0.0"
14
+
15
+ s.name = "decidim-initiatives"
16
+ s.summary = "Decidim initiatives module"
17
+ s.description = "Participants initiatives plugin for decidim."
18
+
19
+ s.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").select do |f|
21
+ (File.expand_path(f) == __FILE__) ||
22
+ f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
23
+ end
24
+ end
25
+
26
+ s.add_dependency "decidim-admin", Decidim::Initiatives.version
27
+ s.add_dependency "decidim-comments", Decidim::Initiatives.version
28
+ s.add_dependency "decidim-core", Decidim::Initiatives.version
29
+ s.add_dependency "decidim-verifications", Decidim::Initiatives.version
30
+ s.add_dependency "origami", "~> 2.1"
31
+ s.add_dependency "rexml", "~> 3.2.5" # Required for Origami gem to work with Ruby 3.0.0+
32
+ s.add_dependency "wicked", "~> 1.3"
33
+ s.add_dependency "wicked_pdf", "~> 2.1"
34
+ s.add_dependency "wkhtmltopdf-binary", "~> 0.12"
35
+
36
+ s.add_development_dependency "decidim-dev", Decidim::Initiatives.version
37
+ s.add_development_dependency "decidim-meetings", Decidim::Initiatives.version
38
+ end
@@ -104,7 +104,7 @@ module Decidim
104
104
  initializer "admin_decidim_initiatives.admin_components_menu" do
105
105
  Decidim.menu :admin_initiatives_components_menu do |menu|
106
106
  current_participatory_space.components.each do |component|
107
- caption = translated_attribute(component.name)
107
+ caption = decidim_escape_translated(component.name)
108
108
  if component.primary_stat.present?
109
109
  caption += content_tag(:span, component.primary_stat, class: component.primary_stat.zero? ? "component-counter component-counter--off" : "component-counter")
110
110
  end
@@ -5,8 +5,11 @@ require "decidim/dev"
5
5
 
6
6
  FactoryBot.define do
7
7
  factory :initiatives_type, class: "Decidim::InitiativesType" do
8
- title { generate_localized_title }
9
- description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
8
+ transient do
9
+ skip_injection { false }
10
+ end
11
+ title { generate_localized_title(:initiatives_type_title, skip_injection: skip_injection) }
12
+ description { generate_localized_description(:initiatives_type_description, skip_injection: skip_injection) }
10
13
  organization
11
14
  # Keep banner_image after organization
12
15
  banner_image do
@@ -82,7 +85,7 @@ FactoryBot.define do
82
85
 
83
86
  trait :with_user_extra_fields_collection do
84
87
  collect_user_extra_fields { true }
85
- extra_fields_legal_information { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
88
+ extra_fields_legal_information { generate_localized_description(:initiatives_type_extra_fields_legal_information, skip_injection: skip_injection) }
86
89
  document_number_authorization_handler { "dummy_authorization_handler" }
87
90
  end
88
91
 
@@ -100,20 +103,26 @@ FactoryBot.define do
100
103
  end
101
104
 
102
105
  factory :initiatives_type_scope, class: "Decidim::InitiativesTypeScope" do
103
- type { create(:initiatives_type) }
104
- scope { create(:scope, organization: type.organization) }
106
+ transient do
107
+ skip_injection { false }
108
+ end
109
+ type { create(:initiatives_type, skip_injection: skip_injection) }
110
+ scope { create(:scope, organization: type.organization, skip_injection: skip_injection) }
105
111
  supports_required { 1000 }
106
112
 
107
113
  trait :with_user_extra_fields_collection do
108
- type { create(:initiatives_type, :with_user_extra_fields_collection) }
114
+ type { create(:initiatives_type, :with_user_extra_fields_collection, skip_injection: skip_injection) }
109
115
  end
110
116
  end
111
117
 
112
118
  factory :initiative, class: "Decidim::Initiative" do
113
- title { generate_localized_title }
114
- description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
119
+ transient do
120
+ skip_injection { false }
121
+ end
122
+ title { generate_localized_title(:initiative_title, skip_injection: skip_injection) }
123
+ description { generate_localized_description(:initiative_description, skip_injection: skip_injection) }
115
124
  organization
116
- author { create(:user, :confirmed, organization: organization) }
125
+ author { create(:user, :confirmed, organization: organization, skip_injection: skip_injection) }
117
126
  published_at { Time.current }
118
127
  state { "published" }
119
128
  signature_type { "online" }
@@ -121,15 +130,15 @@ FactoryBot.define do
121
130
  signature_end_date { Date.current + 120.days }
122
131
 
123
132
  scoped_type do
124
- create(:initiatives_type_scope,
125
- type: create(:initiatives_type, organization: organization, signature_type: signature_type))
133
+ create(:initiatives_type_scope, skip_injection: skip_injection,
134
+ type: create(:initiatives_type, organization: organization, signature_type: signature_type, skip_injection: skip_injection))
126
135
  end
127
136
 
128
- after(:create) do |initiative|
137
+ after(:create) do |initiative, evaluator|
129
138
  if initiative.author.is_a?(Decidim::User) && Decidim::Authorization.where(user: initiative.author).where.not(granted_at: nil).none?
130
- create(:authorization, user: initiative.author, granted_at: Time.now.utc)
139
+ create(:authorization, user: initiative.author, granted_at: Time.now.utc, skip_injection: evaluator.skip_injection)
131
140
  end
132
- create_list(:initiatives_committee_member, 3, initiative: initiative)
141
+ create_list(:initiatives_committee_member, 3, initiative: initiative, skip_injection: evaluator.skip_injection)
133
142
  end
134
143
 
135
144
  trait :created do
@@ -198,13 +207,13 @@ FactoryBot.define do
198
207
 
199
208
  trait :with_user_extra_fields_collection do
200
209
  scoped_type do
201
- create(:initiatives_type_scope,
202
- type: create(:initiatives_type, :with_user_extra_fields_collection, organization: organization))
210
+ create(:initiatives_type_scope, skip_injection: skip_injection,
211
+ type: create(:initiatives_type, :with_user_extra_fields_collection, organization: organization, skip_injection: skip_injection))
203
212
  end
204
213
  end
205
214
 
206
215
  trait :with_area do
207
- area { create(:area, organization: organization) }
216
+ area { create(:area, organization: organization, skip_injection: skip_injection) }
208
217
  end
209
218
 
210
219
  trait :with_documents do
@@ -217,7 +226,8 @@ FactoryBot.define do
217
226
  initiative.attachments << create(
218
227
  :attachment,
219
228
  :with_pdf,
220
- attached_to: initiative
229
+ attached_to: initiative,
230
+ skip_injection: evaluator.skip_injection
221
231
  )
222
232
  end
223
233
  end
@@ -233,7 +243,8 @@ FactoryBot.define do
233
243
  initiative.attachments << create(
234
244
  :attachment,
235
245
  :with_image,
236
- attached_to: initiative
246
+ attached_to: initiative,
247
+ skip_injection: evaluator.skip_injection
237
248
  )
238
249
  end
239
250
  end
@@ -241,8 +252,11 @@ FactoryBot.define do
241
252
  end
242
253
 
243
254
  factory :initiative_user_vote, class: "Decidim::InitiativesVote" do
244
- initiative { create(:initiative) }
245
- author { create(:user, :confirmed, organization: initiative.organization) }
255
+ transient do
256
+ skip_injection { false }
257
+ end
258
+ initiative { create(:initiative, skip_injection: skip_injection) }
259
+ author { create(:user, :confirmed, organization: initiative.organization, skip_injection: skip_injection) }
246
260
  hash_id { SecureRandom.uuid }
247
261
  scope { initiative.scope }
248
262
  after(:create) do |vote|
@@ -251,17 +265,23 @@ FactoryBot.define do
251
265
  end
252
266
 
253
267
  factory :organization_user_vote, class: "Decidim::InitiativesVote" do
254
- initiative { create(:initiative) }
255
- author { create(:user, :confirmed, organization: initiative.organization) }
256
- decidim_user_group_id { create(:user_group).id }
257
- after(:create) do |support|
258
- create(:user_group_membership, user: support.author, user_group: Decidim::UserGroup.find(support.decidim_user_group_id))
268
+ transient do
269
+ skip_injection { false }
270
+ end
271
+ initiative { create(:initiative, skip_injection: skip_injection) }
272
+ author { create(:user, :confirmed, organization: initiative.organization, skip_injection: skip_injection) }
273
+ decidim_user_group_id { create(:user_group, skip_injection: skip_injection).id }
274
+ after(:create) do |support, evaluator|
275
+ create(:user_group_membership, user: support.author, user_group: Decidim::UserGroup.find(support.decidim_user_group_id), skip_injection: evaluator.skip_injection)
259
276
  end
260
277
  end
261
278
 
262
279
  factory :initiatives_committee_member, class: "Decidim::InitiativesCommitteeMember" do
263
- initiative { create(:initiative) }
264
- user { create(:user, :confirmed, organization: initiative.organization) }
280
+ transient do
281
+ skip_injection { false }
282
+ end
283
+ initiative { create(:initiative, skip_injection: skip_injection) }
284
+ user { create(:user, :confirmed, organization: initiative.organization, skip_injection: skip_injection) }
265
285
  state { "accepted" }
266
286
 
267
287
  trait :accepted do
@@ -278,6 +298,9 @@ FactoryBot.define do
278
298
  end
279
299
 
280
300
  factory :initiatives_settings, class: "Decidim::InitiativesSettings" do
301
+ transient do
302
+ skip_injection { false }
303
+ end
281
304
  initiatives_order { "random" }
282
305
  organization
283
306
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-initiatives version.
5
5
  module Initiatives
6
6
  def self.version
7
- "0.27.4"
7
+ "0.27.6"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-initiatives
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.4
4
+ version: 0.27.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Salvador Perez Garcia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-27 00:00:00.000000000 Z
11
+ date: 2024-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.27.4
19
+ version: 0.27.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.27.4
26
+ version: 0.27.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: decidim-comments
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.27.4
33
+ version: 0.27.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.27.4
40
+ version: 0.27.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decidim-core
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.27.4
47
+ version: 0.27.6
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.27.4
54
+ version: 0.27.6
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim-verifications
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.27.4
61
+ version: 0.27.6
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.27.4
68
+ version: 0.27.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: origami
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 0.27.4
145
+ version: 0.27.6
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 0.27.4
152
+ version: 0.27.6
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: decidim-meetings
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.27.4
159
+ version: 0.27.6
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.27.4
166
+ version: 0.27.6
167
167
  description: Participants initiatives plugin for decidim.
168
168
  email:
169
169
  - jsperezg@gmail.com
@@ -399,7 +399,6 @@ files:
399
399
  - app/views/layouts/decidim/initiative_creation.html.erb
400
400
  - app/views/layouts/decidim/initiative_signature_creation.html.erb
401
401
  - config/assets.rb
402
- - config/environment.rb
403
402
  - config/initializers/wicked_pdf.rb
404
403
  - config/locales/am-ET.yml
405
404
  - config/locales/ar-SA.yml
@@ -433,6 +432,7 @@ files:
433
432
  - config/locales/ga-IE.yml
434
433
  - config/locales/gl.yml
435
434
  - config/locales/gn-PY.yml
435
+ - config/locales/he-IL.yml
436
436
  - config/locales/hr-HR.yml
437
437
  - config/locales/hr.yml
438
438
  - config/locales/hu.yml
@@ -467,9 +467,11 @@ files:
467
467
  - config/locales/sk.yml
468
468
  - config/locales/sl.yml
469
469
  - config/locales/so-SO.yml
470
+ - config/locales/sq-AL.yml
470
471
  - config/locales/sr-CS.yml
471
472
  - config/locales/sv.yml
472
473
  - config/locales/sw-KE.yml
474
+ - config/locales/th-TH.yml
473
475
  - config/locales/ti-ER.yml
474
476
  - config/locales/tr-TR.yml
475
477
  - config/locales/uk.yml
@@ -539,6 +541,7 @@ files:
539
541
  - db/migrate/20220527130640_create_decidim_initiatives_settings.rb
540
542
  - db/seeds/city.jpeg
541
543
  - db/seeds/city2.jpeg
544
+ - decidim-initiatives.gemspec
542
545
  - lib/decidim/api/initiative_api_type.rb
543
546
  - lib/decidim/api/initiative_committee_member_type.rb
544
547
  - lib/decidim/api/initiative_type.rb
@@ -562,15 +565,15 @@ homepage: https://github.com/decidim/decidim
562
565
  licenses:
563
566
  - AGPL-3.0
564
567
  metadata: {}
565
- post_install_message:
568
+ post_install_message:
566
569
  rdoc_options: []
567
570
  require_paths:
568
571
  - lib
569
572
  required_ruby_version: !ruby/object:Gem::Requirement
570
573
  requirements:
571
- - - ">="
574
+ - - "~>"
572
575
  - !ruby/object:Gem::Version
573
- version: '3.0'
576
+ version: 3.0.0
574
577
  required_rubygems_version: !ruby/object:Gem::Requirement
575
578
  requirements:
576
579
  - - ">="
@@ -578,7 +581,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
578
581
  version: '0'
579
582
  requirements: []
580
583
  rubygems_version: 3.2.22
581
- signing_key:
584
+ signing_key:
582
585
  specification_version: 4
583
586
  summary: Decidim initiatives module
584
587
  test_files: []
File without changes