decidim-generators 0.30.1 → 0.31.0.rc1

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 (26) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +377 -288
  4. data/lib/decidim/generators/app_generator.rb +60 -65
  5. data/lib/decidim/generators/app_templates/.node-version +1 -1
  6. data/lib/decidim/generators/app_templates/database.yml.erb +3 -3
  7. data/lib/decidim/generators/app_templates/dummy_signature_handler.rb +124 -0
  8. data/lib/decidim/generators/app_templates/dummy_signature_handler_form.html.erb +73 -0
  9. data/lib/decidim/generators/app_templates/dummy_sms_mobile_phone_validator.rb +11 -0
  10. data/lib/decidim/generators/app_templates/elections_initializer.rb +11 -0
  11. data/lib/decidim/generators/app_templates/initiatives_initializer.rb +54 -0
  12. data/lib/decidim/generators/app_templates/sidekiq.yml.erb +1 -1
  13. data/lib/decidim/generators/app_templates/storage.yml +42 -0
  14. data/lib/decidim/generators/component_templates/.node-version +1 -1
  15. data/lib/decidim/generators/component_templates/Gemfile.erb +2 -2
  16. data/lib/decidim/generators/component_templates/config/assets.rb.erb +3 -3
  17. data/lib/decidim/generators/component_templates/github/ci.yml.erb +2 -2
  18. data/lib/decidim/generators/component_templates/lib/decidim/component/engine.rb.erb +1 -1
  19. data/lib/decidim/generators/install_generator.rb +18 -21
  20. data/lib/decidim/generators/test/generator_examples.rb +24 -88
  21. data/lib/decidim/generators/version.rb +1 -1
  22. metadata +10 -8
  23. data/lib/decidim/generators/app_templates/ai_initializer.rb +0 -113
  24. data/lib/decidim/generators/app_templates/initializer.rb +0 -477
  25. data/lib/decidim/generators/app_templates/secrets.yml.erb +0 -190
  26. data/lib/decidim/generators/app_templates/storage.yml.erb +0 -42
@@ -93,11 +93,6 @@ module Decidim
93
93
  default: false,
94
94
  desc: "Do not add Puma development SSL configuration options"
95
95
 
96
- # we disable the webpacker installation as we will use shakapacker
97
- def webpacker_gemfile_entry
98
- []
99
- end
100
-
101
96
  def remove_old_assets
102
97
  remove_file "config/initializers/assets.rb"
103
98
  remove_dir("app/assets")
@@ -120,6 +115,22 @@ module Decidim
120
115
  gsub_file "config/environments/production.rb", /config\.assets.*$/, ""
121
116
  end
122
117
 
118
+ def patch_test_file
119
+ gsub_file "config/environments/test.rb", /config\.action_mailer\.default_url_options = { host: "www.example.com" }$/,
120
+ "# config.action_mailer.default_url_options = { host: \"www.example.com\" }"
121
+ gsub_file "config/environments/test.rb", /config\.action_controller\.raise_on_missing_callback_actions = true$/,
122
+ "# config.action_controller.raise_on_missing_callback_actions = false"
123
+ gsub_file "config/environments/development.rb", /config\.action_controller\.raise_on_missing_callback_actions = true$/,
124
+ "# config.action_controller.raise_on_missing_callback_actions = false"
125
+ end
126
+
127
+ def disable_annotate_rendered_view_on_development
128
+ gsub_file "config/environments/development.rb", /config\.action_view\.annotate_rendered_view_with_filenames = true$/,
129
+ "# Using annotate rendered view breaks rails-ujs functionality
130
+ # @see https://github.com/decidim/decidim/issues/14912
131
+ # config.action_view.annotate_rendered_view_with_filenames = true"
132
+ end
133
+
123
134
  def database_yml
124
135
  template "database.yml.erb", "config/database.yml", force: true
125
136
  end
@@ -129,7 +140,7 @@ module Decidim
129
140
  end
130
141
 
131
142
  def docker
132
- template "Dockerfile.erb", "Dockerfile"
143
+ template "Dockerfile.erb", "Dockerfile", force: true
133
144
  template "docker-compose.yml.erb", "docker-compose.yml"
134
145
  end
135
146
 
@@ -150,7 +161,7 @@ module Decidim
150
161
  end
151
162
 
152
163
  def rubocop
153
- copy_file ".rubocop.yml", ".rubocop.yml"
164
+ copy_file ".rubocop.yml", ".rubocop.yml", force: true
154
165
  end
155
166
 
156
167
  def ruby_version
@@ -181,7 +192,7 @@ module Decidim
181
192
 
182
193
  gsub_file "Gemfile", /gem "decidim-dev".*/, "gem \"decidim-dev\", #{gem_modifier}"
183
194
 
184
- %w(ai conferences design initiatives templates).each do |component|
195
+ %w(ai collaborative_texts conferences demographics design elections initiatives templates).each do |component|
185
196
  if options[:demo]
186
197
  gsub_file "Gemfile", /gem "decidim-#{component}".*/, "gem \"decidim-#{component}\", #{gem_modifier}"
187
198
  else
@@ -191,14 +202,14 @@ module Decidim
191
202
  end
192
203
 
193
204
  def add_storage_provider
194
- template "storage.yml.erb", "config/storage.yml", force: true
205
+ copy_file "storage.yml", "config/storage.yml", force: true
195
206
 
196
207
  providers = options[:storage].split(",")
197
208
 
198
209
  abort("#{providers} is not supported as storage provider, please use local, s3, gcs or azure") unless (providers - %w(local s3 gcs azure)).empty?
199
210
  gsub_file "config/environments/production.rb",
200
211
  /config.active_storage.service = :local/,
201
- "config.active_storage.service = Rails.application.secrets.dig(:storage, :provider) || :local"
212
+ %{config.active_storage.service = Decidim::Env.new("STORAGE_PROVIDER", "local").to_s}
202
213
 
203
214
  add_production_gems do
204
215
  gem "aws-sdk-s3", require: false if providers.include?("s3")
@@ -220,7 +231,7 @@ module Decidim
220
231
  /Rails.application.configure do/,
221
232
  "Rails.application.configure do\n config.active_job.queue_adapter = :sidekiq\n"
222
233
  gsub_file "config/environments/production.rb",
223
- /# config.active_job.queue_adapter = :resque/,
234
+ /# config.active_job.queue_adapter = :resque/,
224
235
  "config.active_job.queue_adapter = ENV['QUEUE_ADAPTER'] if ENV['QUEUE_ADAPTER'].present?"
225
236
 
226
237
  prepend_file "config/routes.rb", "require \"sidekiq/web\"\n\n"
@@ -231,7 +242,27 @@ module Decidim
231
242
  end
232
243
  RUBY
233
244
 
234
- append_file "Gemfile", %(gem "sidekiq")
245
+ redis_version = begin
246
+ require "redis"
247
+ ver = Redis.new.call("INFO").lines(chomp: true).find { |l| l.start_with?("redis_version:") }.split(":", 2).last
248
+ Gem::Version.new(ver)
249
+ rescue LoadError, Redis::CannotConnectError
250
+ # This does not have to be the actual Redis version, it can be
251
+ # anything that is above any of the version checks below to default to
252
+ # the latest Sidekiq version.
253
+ Gem::Version.new("8.0.0")
254
+ end
255
+
256
+ if redis_version < Gem::Version.new("6.2.0")
257
+ # Sidekiq 7.x requires Redis 6.2.0 or newer
258
+ append_file "Gemfile", %(gem "sidekiq", "~> 6.5")
259
+ elsif redis_version < Gem::Version.new("7.0.0")
260
+ # Sidekiq 8.x requires Redis 7.0.0 or newer
261
+ append_file "Gemfile", %(gem "sidekiq", "~> 7.3")
262
+ else
263
+ # Assume latest
264
+ append_file "Gemfile", %(gem "sidekiq")
265
+ end
235
266
  end
236
267
 
237
268
  def add_production_gems(&block)
@@ -247,12 +278,6 @@ module Decidim
247
278
  end
248
279
  end
249
280
 
250
- def load_defaults_rails61
251
- gsub_file "config/application.rb",
252
- /config.load_defaults 7.0/,
253
- "config.load_defaults 6.1"
254
- end
255
-
256
281
  def tweak_csp_initializer
257
282
  return unless File.exist?("config/initializers/content_security_policy.rb")
258
283
 
@@ -315,9 +340,7 @@ module Decidim
315
340
  remove_file "public/favicon.ico"
316
341
  end
317
342
 
318
- def decidim_initializer
319
- copy_file "initializer.rb", "config/initializers/decidim.rb"
320
-
343
+ def production_environment
321
344
  gsub_file "config/environments/production.rb",
322
345
  /config.log_level = :info/,
323
346
  "config.log_level = %w(debug info warn error fatal).include?(ENV['RAILS_LOG_LEVEL']) ? ENV['RAILS_LOG_LEVEL'] : :info"
@@ -325,20 +348,13 @@ module Decidim
325
348
  gsub_file "config/environments/production.rb",
326
349
  %r{# config.asset_host = "http://assets.example.com"},
327
350
  "config.asset_host = ENV['RAILS_ASSET_HOST'] if ENV['RAILS_ASSET_HOST'].present?"
328
-
329
- if options[:force_ssl] == "false"
330
- gsub_file "config/initializers/decidim.rb",
331
- /# config.force_ssl = true/,
332
- "config.force_ssl = false"
333
- end
334
- return if options[:locales].blank?
335
-
336
- gsub_file "config/initializers/decidim.rb",
337
- /#{Regexp.escape("# config.available_locales = %w(en ca es)")}/,
338
- "config.available_locales = %w(#{options[:locales].gsub(",", " ")})"
339
- gsub_file "config/initializers/decidim.rb",
340
- /#{Regexp.escape("config.available_locales = Rails.application.secrets.decidim[:available_locales].presence || [:en]")}/,
341
- "# config.available_locales = Rails.application.secrets.decidim[:available_locales].presence || [:en]"
351
+ gsub_file "config/environments/production.rb", /# Log to STDOUT by default\n((.*)\n){3}/, <<~CONFIG
352
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
353
+ config.logger = ActiveSupport::Logger.new(STDOUT)
354
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
355
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
356
+ end
357
+ CONFIG
342
358
  end
343
359
 
344
360
  def dev_performance_config
@@ -370,14 +386,6 @@ module Decidim
370
386
  copy_file "verifications_initializer.rb", "config/initializers/decidim_verifications.rb"
371
387
  end
372
388
 
373
- def sms_gateway
374
- return unless options[:demo]
375
-
376
- gsub_file "config/initializers/decidim.rb",
377
- /# config.sms_gateway_service = "MySMSGatewayService"/,
378
- "config.sms_gateway_service = 'Decidim::Verifications::Sms::ExampleGateway'"
379
- end
380
-
381
389
  def budgets_workflows
382
390
  return unless options[:demo]
383
391
 
@@ -387,34 +395,21 @@ module Decidim
387
395
  copy_file "budgets_initializer.rb", "config/initializers/decidim_budgets.rb"
388
396
  end
389
397
 
390
- def ai_toolkit
391
- return unless options[:demo]
392
-
393
- copy_file "ai_initializer.rb", "config/initializers/decidim_ai.rb"
394
- end
395
-
396
- def timestamp_service
397
- return unless options[:demo]
398
-
399
- gsub_file "config/initializers/decidim.rb",
400
- /# config.timestamp_service = "MyTimestampService"/,
401
- "config.timestamp_service = \"Decidim::Initiatives::DummyTimestamp\""
402
- end
403
-
404
- def pdf_signature_service
398
+ def elections_census_manifest
405
399
  return unless options[:demo]
406
400
 
407
- gsub_file "config/initializers/decidim.rb",
408
- /# config.pdf_signature_service = "MyPDFSignatureService"/,
409
- "config.pdf_signature_service = \"Decidim::Initiatives::PdfSignatureExample\""
401
+ copy_file "elections_initializer.rb", "config/initializers/decidim_elections.rb"
410
402
  end
411
403
 
412
- def machine_translation_service
404
+ def initiative_signatures_workflows
413
405
  return unless options[:demo]
414
406
 
415
- gsub_file "config/initializers/decidim.rb",
416
- /# config.machine_translation_service = "MyTranslationService"/,
417
- "config.machine_translation_service = 'Decidim::Dev::DummyTranslator'"
407
+ copy_file "dummy_signature_handler.rb", "app/services/dummy_signature_handler.rb"
408
+ copy_file "dummy_signature_handler_form.html.erb", "app/views/decidim/initiatives/initiative_signatures/dummy_signature/_form.html.erb"
409
+ copy_file "dummy_signature_handler_form.html.erb", "app/views/decidim/initiatives/initiative_signatures/ephemeral_dummy_signature/_form.html.erb"
410
+ copy_file "dummy_signature_handler_form.html.erb", "app/views/decidim/initiatives/initiative_signatures/dummy_signature_with_personal_data/_form.html.erb"
411
+ copy_file "dummy_sms_mobile_phone_validator.rb", "app/services/dummy_sms_mobile_phone_validator.rb"
412
+ copy_file "initiatives_initializer.rb", "config/initializers/decidim_initiatives.rb"
418
413
  end
419
414
 
420
415
  def install
@@ -1 +1 @@
1
- 18.17.1
1
+ 22.14.0
@@ -65,9 +65,9 @@ test:
65
65
  <<: *default
66
66
  database: <%= app_name %>_test<%%= ENV.fetch('TEST_ENV_NUMBER', "") %>
67
67
 
68
- # As with config/secrets.yml, you never want to store sensitive information,
69
- # like your database password, in your source code. If your source code is
70
- # ever seen by anyone, they now have access to your database.
68
+ # You never want to store sensitive information, like your database password,
69
+ # in your source code. If your source code is ever seen by anyone,
70
+ # they now have access to your database.
71
71
  #
72
72
  # Instead, provide the password as a unix environment variable when you boot
73
73
  # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ # An example signature handler used so that users can be verified against
4
+ # third party systems.
5
+ #
6
+ # You should probably rename this class and file to match your needs.
7
+ #
8
+ # If you need a custom form to be rendered, you can create a file matching the
9
+ # class name named "_form".
10
+ #
11
+ # Example:
12
+ #
13
+ # A handler named Decidim::CensusSignatureHandler would look for its partial in:
14
+ # decidim/initiatives/initiative_signatures/census_signature/form
15
+ #
16
+ # See Decidim::Initiatives::SignatureHandler for more documentation.
17
+ class DummySignatureHandler < Decidim::Initiatives::SignatureHandler
18
+ # i18n-tasks-use t("decidim.initiatives.initiative_signatures.dummy_signature.form.fields.gender.options.man")
19
+ # i18n-tasks-use t("decidim.initiatives.initiative_signatures.dummy_signature.form.fields.gender.options.non_binary")
20
+ # i18n-tasks-use t("decidim.initiatives.initiative_signatures.dummy_signature.form.fields.gender.options.woman")
21
+ AVAILABLE_GENDERS = %w(man woman non_binary).freeze
22
+
23
+ # Define the attributes you need for this signature handler. Attributes
24
+ # are defined using Decidim::AttributeObject.
25
+ #
26
+ attribute :name_and_surname, String
27
+ attribute :document_type, String
28
+ attribute :document_number, String
29
+ attribute :gender, String
30
+ attribute :postal_code, String
31
+ attribute :date_of_birth, Date
32
+ attribute :scope_id, Integer
33
+
34
+ # signature_scope_id is used by the base handler to define the user signature
35
+ # scope
36
+ alias signature_scope_id scope_id
37
+
38
+ # You can (and should) also define validations on each attribute:
39
+ #
40
+ validates :name_and_surname, :document_type, :document_number, :gender, :postal_code, :date_of_birth, :scope_id, presence: true
41
+
42
+ validates :document_type,
43
+ inclusion: { in: :document_types },
44
+ presence: true
45
+
46
+ validates :gender,
47
+ inclusion: { in: :available_genders },
48
+ allow_blank: true
49
+
50
+ def date_of_birth=(date)
51
+ date = nil if date.is_a?(Hash) && date.values.any?(&:blank?)
52
+
53
+ super
54
+ end
55
+
56
+ def document_types_for_select
57
+ document_types.map do |type|
58
+ [
59
+ I18n.t(type.downcase, scope: "decidim.verifications.id_documents"),
60
+ type
61
+ ]
62
+ end
63
+ end
64
+
65
+ def genders_for_select
66
+ available_genders.map do |gender|
67
+ [
68
+ I18n.t(gender, scope: "decidim.initiatives.initiative_signatures.dummy_signature.form.fields.gender.options", default: gender.humanize),
69
+ gender
70
+ ]
71
+ end
72
+ end
73
+
74
+ # The only method that needs to be implemented for a signature handler.
75
+ # Here you can add your business logic to check if the signature should
76
+ # be created or not based on the provided data, you should return a
77
+ # Boolean value.
78
+ #
79
+ # Note that if you set some validations and overwrite this method, then the
80
+ # validations will not run, so it is easier to remove this method and rewrite
81
+ # your logic using ActiveModel validations.
82
+ #
83
+ # def valid?
84
+ # raise NotImplementedError
85
+ # end
86
+
87
+ # If set, enforces the handler to validate the uniqueness of the field
88
+ #
89
+ def unique_id
90
+ document_number
91
+ end
92
+
93
+ # The user scope
94
+ #
95
+ def scope
96
+ user.organization.scopes.find_by(id: scope_id) if scope_id
97
+ end
98
+
99
+ # Any data that the developer would like to inject to the `metadata` field
100
+ # of a vote when it is created. Can be useful if some of the params the
101
+ # user sent with the signature form want to be persisted for future use.
102
+ #
103
+ # Returns a Hash.
104
+ def metadata
105
+ super.merge(name_and_surname:, document_type:, document_number:, gender:, date_of_birth:, postal_code:)
106
+ end
107
+
108
+ # Params to be passed to the authorization handler if defined in the workflow.
109
+ def authorization_handler_params
110
+ super.merge(scope_id:)
111
+ end
112
+
113
+ class DummySignatureActionAuthorizer < Decidim::Initiatives::DefaultSignatureAuthorizer; end
114
+
115
+ private
116
+
117
+ def document_types
118
+ Decidim::Verifications.document_types
119
+ end
120
+
121
+ def available_genders
122
+ AVAILABLE_GENDERS
123
+ end
124
+ end
@@ -0,0 +1,73 @@
1
+ <%# i18n-tasks-use t("decidim.initiatives.signatures.workflows.dummy_signature_handler.description") %>
2
+ <%# i18n-tasks-use t("decidim.initiatives.signatures.workflows.dummy_signature_with_personal_data_handler.description") %>
3
+ <%# i18n-tasks-use t("decidim.initiatives.signatures.workflows.dummy_signature_with_sms_handler.description") %>
4
+
5
+ <% content_for :title do %>
6
+ <%= t(
7
+ "decidim.verifications.authorizations.new.authorize_with",
8
+ authorizer: t("#{@form.signature_workflow_name}.name", scope: "decidim.initiatives.signatures.workflows")
9
+ ) %>
10
+ <% end %>
11
+
12
+ <% content_for :help do %>
13
+ <div class="form__wrapper">
14
+ <p>
15
+ <%= t("#{@form.signature_workflow_name}.description", scope: "decidim.initiatives.signatures.workflows") %>
16
+ </p>
17
+ </div>
18
+ <% end %>
19
+
20
+ <div class="form__wrapper">
21
+ <div class="row column">
22
+ <%= form.text_field :name_and_surname %>
23
+ </div>
24
+
25
+ <div class="row column">
26
+ <label for="dummy_signature_handler_document_type_and_number">
27
+ <%= t("document_type_and_number.label", scope: "decidim.initiatives.initiative_signatures.dummy_signature.form.fields") %>
28
+ <%= form.send(:required_indicator) %>
29
+ </label>
30
+ <span class="help-text">
31
+ <%= t("document_type_and_number.help_text", scope: "decidim.initiatives.initiative_signatures.dummy_signature.form.fields") %>
32
+ </span>
33
+ <div class="flex flex-row gap-6">
34
+ <div class="w-full">
35
+ <%= form.select(
36
+ :document_type,
37
+ handler.document_types_for_select,
38
+ prompt: t("decidim.initiatives.initiative_signatures.dummy_signature.form.fields.document_type.prompt"),
39
+ label: false
40
+ ) %>
41
+ </div>
42
+ <div class="w-full">
43
+ <%= form.text_field :document_number, label: false, placeholder: t("decidim.initiatives.initiative_signatures.dummy_signature.form.fields.document_number.placeholder") %>
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="row column">
49
+ <%= form.select(
50
+ :gender,
51
+ handler.genders_for_select,
52
+ prompt: true
53
+ ) %>
54
+ </div>
55
+
56
+ <div class="row column">
57
+ <label for="dummy_signature_handler_date_of_birth">
58
+ <%= t("date_of_birth.label", scope: "decidim.initiatives.initiative_signatures.dummy_signature.form.fields") %>
59
+
60
+ <div class="flex row-col space-x-3 w-full">
61
+ <%= form.date_select :date_of_birth, prompt: true, start_year: Date.today.year - 100, label: false %>
62
+ </div>
63
+ </label>
64
+ </div>
65
+
66
+ <div class="row column">
67
+ <%= scopes_select_field(form, :scope_id) %>
68
+ </div>
69
+
70
+ <div class="row column">
71
+ <%= form.text_field :postal_code %>
72
+ </div>
73
+ </div>
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This class overrides the two methods of the parent class ensuring that the
4
+ # user has a previous sms authorization with the same phone number provided in
5
+ # the initiative signature workflow. In this way only the sms code received in
6
+ # the phone is verified and no previous authorization is necessary.
7
+ class DummySmsMobilePhoneValidator < Decidim::Initiatives::ValidateMobilePhone
8
+ def authorized? = true
9
+
10
+ def phone_match? = true
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This is just an example on how to register a custom census in the elections module.
4
+ # Decidim::Elections.census_registry.register(:my_census) do |manifest|
5
+ # manifest.admin_form = "MyApp::MyCensusForm"
6
+ # manifest.admin_form_partial = "my_app/my_census_form"
7
+ # # This query should return users that will be part of the census.
8
+ # manifest.user_query do |election|
9
+ # election.organization.users.where(extended_data: { my_census_field: true })
10
+ # end
11
+ # end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Decidim.module_installed?(:initiatives)
4
+ Decidim::Initiatives::Signatures.register_workflow(:dummy_signature_handler) do |workflow|
5
+ workflow.form = "DummySignatureHandler"
6
+ workflow.authorization_handler_form = "DummyAuthorizationHandler"
7
+ workflow.action_authorizer = "DummySignatureHandler::DummySignatureActionAuthorizer"
8
+ workflow.promote_authorization_validation_errors = true
9
+ workflow.sms_verification = true
10
+ workflow.sms_mobile_phone_validator = "DummySmsMobilePhoneValidator"
11
+ end
12
+
13
+ Decidim::Initiatives::Signatures.register_workflow(:ephemeral_dummy_signature_handler) do |workflow|
14
+ workflow.form = "DummySignatureHandler"
15
+ workflow.ephemeral = true
16
+ workflow.authorization_handler_form = "DummyAuthorizationHandler"
17
+ workflow.action_authorizer = "DummySignatureHandler::DummySignatureActionAuthorizer"
18
+ workflow.promote_authorization_validation_errors = true
19
+ workflow.sms_verification = true
20
+ workflow.sms_mobile_phone_validator = "DummySmsMobilePhoneValidator"
21
+ end
22
+
23
+ Decidim::Initiatives::Signatures.register_workflow(:dummy_signature_with_sms_handler) do |workflow|
24
+ workflow.sms_verification = true
25
+ end
26
+
27
+ Decidim::Initiatives::Signatures.register_workflow(:dummy_signature_with_personal_data_handler) do |workflow|
28
+ workflow.form = "DummySignatureHandler"
29
+ workflow.authorization_handler_form = "DummyAuthorizationHandler"
30
+ workflow.action_authorizer = "DummySignatureHandler::DummySignatureActionAuthorizer"
31
+ workflow.promote_authorization_validation_errors = true
32
+ end
33
+
34
+ # Flow that reproduces the old signature feature. Change the following options
35
+ # to adapt to the configuration
36
+ Decidim::Initiatives::Signatures.register_workflow(:legacy_signature_handler) do |workflow|
37
+ # Enable this form to enable the same user data collection and store the same
38
+ # fields in the vote metadata when the "Collect participant personal data on
39
+ # signature" were checked
40
+ workflow.form = "Decidim::Initiatives::LegacySignatureHandler"
41
+
42
+ # Change this form and use the same handler selected in the "Authorization to
43
+ # verify document number on signatures" field
44
+ workflow.authorization_handler_form = "DummyAuthorizationHandler"
45
+
46
+ # This setting prevents the automatic creation of authorizations as in the
47
+ # old feature. You can remove this setting if the workflow does not use an
48
+ # authorization handler form. The default value is true.
49
+ workflow.save_authorizations = false
50
+
51
+ # Set this setting to false to skip SMS verification step
52
+ workflow.sms_verification = true
53
+ end
54
+ end
@@ -4,6 +4,7 @@
4
4
  - [vote_reminder, 2]
5
5
  - [reminders, 2]
6
6
  - [default, 2]
7
+ - [delete_inactive_participants, 2]
7
8
  - [newsletter, 2]
8
9
  - [newsletters_opt_in, 2]
9
10
  - [conference_diplomas, 2]
@@ -11,7 +12,6 @@
11
12
  - [translations, 2]
12
13
  - [user_report, 2]
13
14
  - [block_user, 2]
14
- - [metrics, 1]
15
15
  - [exports, 1]
16
16
  - [close_meeting_reminder, 1]
17
17
  - [spam_analysis, 1]
@@ -0,0 +1,42 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ s3:
10
+ service: S3
11
+ access_key_id: <%= Decidim::Env.new("AWS_ACCESS_KEY_ID").to_s %>
12
+ secret_access_key: <%= Decidim::Env.new("AWS_SECRET_ACCESS_KEY").to_s %>
13
+ bucket: <%= Decidim::Env.new("AWS_BUCKET").to_s %>
14
+ <%= "region: #{Decidim::Env.new("AWS_REGION").to_s}" if Decidim::Env.new("AWS_REGION").present? %>
15
+ <%= "endpoint: #{ Decidim::Env.new("AWS_ENDPOINT").to_s}" if Decidim::Env.new("AWS_ENDPOINT").present? %>
16
+
17
+ azure:
18
+ service: AzureStorage
19
+ storage_account_name: <%= Decidim::Env.new("AZURE_STORAGE_ACCOUNT_NAME").to_s %>
20
+ storage_access_key: <%= Decidim::Env.new("AZURE_STORAGE_ACCESS_KEY").to_s %>
21
+ container: <%= Decidim::Env.new("AZURE_CONTAINER").to_s %>
22
+
23
+ gcs:
24
+ service: GCS
25
+ project: <%= Decidim::Env.new("GCS_PROJECT").to_s %>
26
+ bucket: <%= Decidim::Env.new("GCS_BUCKET").to_s %>
27
+ credentials:
28
+ type: <%= Decidim::Env.new("GCS_TYPE", "service_account").to_s %>
29
+ project_id: <%= Decidim::Env.new("GCS_PROJECT_ID").to_s %>
30
+ private_key_id: <%= Decidim::Env.new("GCS_PRIVATE_KEY_ID").to_s %>
31
+ private_key: <%= Decidim::Env.new("GCS_PRIVATE_KEY").to_s %>
32
+ client_email: <%= Decidim::Env.new("GCS_CLIENT_EMAIL").to_s %>
33
+ client_id: <%= Decidim::Env.new("GCS_CLIENT_ID").to_s %>
34
+ auth_uri: <%= Decidim::Env.new("GCS_AUTH_URI", "https://accounts.google.com/o/oauth2/auth").to_s %>
35
+ token_uri: <%= Decidim::Env.new("GCS_TOKEN_URI", "https://accounts.google.com/o/oauth2/token").to_s %>
36
+ auth_provider_x509_cert_url: <%= Decidim::Env.new("GCS_AUTH_PROVIDER_X509_CERT_URL", "https://www.googleapis.com/oauth2/v1/certs").to_s %>
37
+ client_x509_cert_url: <%= Decidim::Env.new("GCS_CLIENT_X509_CERT_URL").to_s %>
38
+
39
+ # mirror:
40
+ # service: Mirror
41
+ # primary: local
42
+ # mirrors: [ s3, gcs, azure ]
@@ -1 +1 @@
1
- 18.17.1
1
+ 22.14.0
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
 
6
6
  ruby RUBY_VERSION
7
7
 
8
- gem "decidim", "~> 0.30.1"
8
+ gem "decidim", "~> 0.31.0.rc1"
9
9
  gem "decidim-<%= component_name %>", path: "."
10
10
 
11
11
  gem "puma", ">= 6.3.1"
@@ -14,7 +14,7 @@ gem "bootsnap", "~> 1.4"
14
14
  group :development, :test do
15
15
  gem "byebug", "~> 11.0", platform: :mri
16
16
 
17
- gem "decidim-dev", "~> 0.30.1"
17
+ gem "decidim-dev", "~> 0.31.0.rc1"
18
18
  end
19
19
 
20
20
  group :development do
@@ -2,8 +2,8 @@
2
2
 
3
3
  base_path = File.expand_path("..", __dir__)
4
4
 
5
- Decidim::Webpacker.register_path("#{base_path}/app/packs")
6
- Decidim::Webpacker.register_entrypoints(
5
+ Decidim::Shakapacker.register_path("#{base_path}/app/packs")
6
+ Decidim::Shakapacker.register_entrypoints(
7
7
  decidim_<%= component_name %>: "#{base_path}/app/packs/entrypoints/decidim_<%= component_name %>.js"
8
8
  )
9
- Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/<%= component_name %>/<%= component_name %>")
9
+ Decidim::Shakapacker.register_stylesheet_import("stylesheets/decidim/<%= component_name %>/<%= component_name %>")
@@ -12,7 +12,7 @@ on:
12
12
  env:
13
13
  CI: "true"
14
14
  RUBY_VERSION: <%= RUBY_VERSION %>
15
- NODE_VERSION: 18.17.1
15
+ NODE_VERSION: 22.14.0
16
16
 
17
17
  concurrency:
18
18
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -68,7 +68,7 @@ jobs:
68
68
  working-directory: ./spec/decidim_dummy_app/
69
69
  - run: bundle exec rspec
70
70
  name: RSpec
71
- - uses: codecov/codecov-action@v4
71
+ - uses: codecov/codecov-action@v5
72
72
  - uses: actions/upload-artifact@v4
73
73
  if: always()
74
74
  with:
@@ -15,7 +15,7 @@ module Decidim
15
15
  # root to: "<%= component_name %>#index"
16
16
  end
17
17
 
18
- initializer "<%= component_module_name %>.webpacker.assets_path" do
18
+ initializer "<%= component_module_name %>.shakapacker.assets_path" do
19
19
  Decidim.register_assets_path File.expand_path("app/packs", root)
20
20
  end
21
21
  end