decidim-forms 0.31.8 → 0.32.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/app/cells/decidim/forms/step_navigation_cell.rb +1 -2
  4. data/app/commands/decidim/forms/response_questionnaire.rb +3 -3
  5. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +22 -39
  6. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_responses.rb +2 -4
  7. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +1 -5
  8. data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
  9. data/app/forms/decidim/forms/response_form.rb +7 -7
  10. data/app/models/decidim/forms/question.rb +2 -2
  11. data/app/models/decidim/forms/response.rb +1 -1
  12. data/app/packs/src/decidim/forms/admin/collapsible_questions.js +10 -0
  13. data/app/packs/src/decidim/forms/display_conditions.component.js +0 -27
  14. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +1 -1
  15. data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +1 -1
  16. data/app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb +1 -1
  17. data/app/views/decidim/forms/admin/questionnaires/responses/index.html.erb +3 -1
  18. data/app/views/decidim/forms/admin/questionnaires/responses/show.html.erb +3 -1
  19. data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +2 -2
  20. data/app/views/decidim/forms/questionnaires/responses/_files.html.erb +1 -1
  21. data/app/views/decidim/forms/questionnaires/show.html.erb +1 -1
  22. data/config/locales/ar.yml +0 -4
  23. data/config/locales/bg.yml +0 -4
  24. data/config/locales/ca-IT.yml +5 -5
  25. data/config/locales/ca.yml +5 -5
  26. data/config/locales/cs.yml +3 -4
  27. data/config/locales/de.yml +2 -5
  28. data/config/locales/el.yml +0 -4
  29. data/config/locales/en.yml +3 -2
  30. data/config/locales/es-MX.yml +4 -4
  31. data/config/locales/es-PY.yml +4 -4
  32. data/config/locales/es.yml +3 -3
  33. data/config/locales/eu.yml +14 -14
  34. data/config/locales/fi-plain.yml +4 -4
  35. data/config/locales/fi.yml +3 -3
  36. data/config/locales/fr-CA.yml +4 -6
  37. data/config/locales/fr.yml +4 -6
  38. data/config/locales/ga-IE.yml +0 -1
  39. data/config/locales/gl.yml +0 -171
  40. data/config/locales/hu.yml +0 -4
  41. data/config/locales/id-ID.yml +0 -4
  42. data/config/locales/it.yml +0 -4
  43. data/config/locales/ja.yml +3 -3
  44. data/config/locales/kaa.yml +0 -1
  45. data/config/locales/lb.yml +0 -4
  46. data/config/locales/lt.yml +0 -4
  47. data/config/locales/lv.yml +0 -4
  48. data/config/locales/nl.yml +0 -4
  49. data/config/locales/no.yml +0 -4
  50. data/config/locales/pl.yml +0 -4
  51. data/config/locales/pt-BR.yml +3 -4
  52. data/config/locales/pt.yml +0 -4
  53. data/config/locales/ro-RO.yml +0 -4
  54. data/config/locales/ru.yml +0 -4
  55. data/config/locales/sk.yml +0 -186
  56. data/config/locales/sv.yml +3 -3
  57. data/config/locales/tr-TR.yml +0 -4
  58. data/config/locales/val-ES.yml +0 -1
  59. data/config/locales/zh-CN.yml +0 -4
  60. data/config/locales/zh-TW.yml +0 -4
  61. data/decidim-forms.gemspec +6 -8
  62. data/lib/decidim/api/questionnaire_entity_interface.rb +1 -0
  63. data/lib/decidim/forms/download_your_data_user_responses_serializer.rb +1 -0
  64. data/lib/decidim/forms/test/factories.rb +9 -5
  65. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +23 -23
  66. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +1 -1
  67. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +4 -9
  68. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +1 -1
  69. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +9 -11
  70. data/lib/decidim/forms/version.rb +1 -1
  71. metadata +10 -18
  72. data/app/packs/src/decidim/forms/display_conditions.component.test.js +0 -142
  73. data/app/packs/src/decidim/forms/display_conditions_hidden_responses.test.js +0 -224
  74. data/db/data/20260616144141_rename_answers_to_responses.rb +0 -31
  75. data/lib/decidim/forms/test/shared_examples/questionnaire_admin_access.rb +0 -95
  76. data/lib/decidim/forms/test/shared_examples/questionnaire_admin_controller_permissions.rb +0 -41
@@ -53,7 +53,7 @@ shared_examples_for "has questionnaire" do
53
53
  click_on "Submit"
54
54
  end
55
55
 
56
- expect(page).to have_admin_callout(callout_success)
56
+ expect(page).to have_callout(callout_success)
57
57
 
58
58
  visit questionnaire_public_path
59
59
  see_questionnaire_questions
@@ -125,7 +125,7 @@ shared_examples_for "has questionnaire" do
125
125
  check "questionnaire_tos_agreement"
126
126
  accept_confirm { click_on "Submit" }
127
127
 
128
- expect(page).to have_admin_callout(callout_success)
128
+ expect(page).to have_callout(callout_success)
129
129
 
130
130
  visit questionnaire_public_path
131
131
  see_questionnaire_questions
@@ -269,7 +269,7 @@ shared_examples_for "has questionnaire" do
269
269
  end
270
270
 
271
271
  it "submits the form and shows errors" do
272
- expect(page).to have_admin_callout(callout_failure)
272
+ expect(page).to have_callout(callout_failure)
273
273
  expect(page).to have_content("cannot be blank")
274
274
  end
275
275
  end
@@ -283,7 +283,7 @@ shared_examples_for "has questionnaire" do
283
283
 
284
284
  it "submits the form and shows errors" do
285
285
  expect(page).to have_css ".alert.flash"
286
- expect(page).to have_admin_callout(callout_failure)
286
+ expect(page).to have_callout(callout_failure)
287
287
  different_error = I18n.t("decidim.forms.questionnaires.response.max_choices_alert")
288
288
  expect(different_error).to eq("There are too many choices selected")
289
289
  expect(page).to have_no_content(different_error)
@@ -317,7 +317,7 @@ shared_examples_for "has questionnaire" do
317
317
  end
318
318
 
319
319
  it "submits the form and shows errors" do
320
- expect(page).to have_admin_callout(callout_failure)
320
+ expect(page).to have_callout(callout_failure)
321
321
  expect(page).to have_content("cannot be blank")
322
322
  end
323
323
  end
@@ -391,7 +391,7 @@ shared_examples_for "has questionnaire" do
391
391
  check "questionnaire_tos_agreement"
392
392
  accept_confirm { click_on "Submit" }
393
393
 
394
- expect(page).to have_admin_callout(callout_success)
394
+ expect(page).to have_callout(callout_success)
395
395
  expect(Decidim::Forms::Response.first.choices.first.custom_body).to eq("Cacatua")
396
396
  end
397
397
 
@@ -406,7 +406,7 @@ shared_examples_for "has questionnaire" do
406
406
  check "questionnaire_tos_agreement"
407
407
  accept_confirm { click_on "Submit" }
408
408
 
409
- expect(page).to have_admin_callout("There was a problem responding")
409
+ expect(page).to have_callout("There was a problem responding")
410
410
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
411
411
  end
412
412
 
@@ -433,7 +433,7 @@ shared_examples_for "has questionnaire" do
433
433
  check "questionnaire_tos_agreement"
434
434
  accept_confirm { click_on "Submit" }
435
435
 
436
- expect(page).to have_admin_callout(callout_success)
436
+ expect(page).to have_callout(callout_success)
437
437
  expect(Decidim::Forms::Response.first.choices.first.custom_body).to eq("Cacatua")
438
438
  end
439
439
 
@@ -448,7 +448,7 @@ shared_examples_for "has questionnaire" do
448
448
  check "questionnaire_tos_agreement"
449
449
  accept_confirm { click_on "Submit" }
450
450
 
451
- expect(page).to have_admin_callout("There was a problem responding")
451
+ expect(page).to have_callout("There was a problem responding")
452
452
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
453
453
  end
454
454
 
@@ -500,7 +500,7 @@ shared_examples_for "has questionnaire" do
500
500
 
501
501
  accept_confirm { click_on "Submit" }
502
502
 
503
- expect(page).to have_admin_callout(callout_success)
503
+ expect(page).to have_callout(callout_success)
504
504
 
505
505
  visit questionnaire_public_path
506
506
  see_questionnaire_questions
@@ -529,7 +529,7 @@ shared_examples_for "has questionnaire" do
529
529
 
530
530
  accept_confirm { click_on "Submit" }
531
531
 
532
- expect(page).to have_admin_callout(callout_success)
532
+ expect(page).to have_callout(callout_success)
533
533
 
534
534
  visit questionnaire_public_path
535
535
  see_questionnaire_questions
@@ -556,14 +556,14 @@ shared_examples_for "has questionnaire" do
556
556
 
557
557
  accept_confirm { click_on "Submit" }
558
558
 
559
- expect(page).to have_admin_callout("There was a problem responding")
559
+ expect(page).to have_callout("There was a problem responding")
560
560
  expect(page).to have_content("are too many")
561
561
 
562
562
  uncheck response_options[2]["body"][:en]
563
563
 
564
564
  accept_confirm { click_on "Submit" }
565
565
 
566
- expect(page).to have_admin_callout(callout_success)
566
+ expect(page).to have_callout(callout_success)
567
567
  end
568
568
  end
569
569
 
@@ -606,7 +606,7 @@ shared_examples_for "has questionnaire" do
606
606
 
607
607
  accept_confirm { click_on "Submit" }
608
608
 
609
- expect(page).to have_admin_callout(callout_success)
609
+ expect(page).to have_callout(callout_success)
610
610
  expect(Decidim::Forms::Response.first.choices.pluck(:position, :body)).to eq(
611
611
  [[0, "We"], [1, "all"], [2, "like"], [3, "dark"], [4, "chocolate"]]
612
612
  )
@@ -647,7 +647,7 @@ shared_examples_for "has questionnaire" do
647
647
 
648
648
  accept_confirm { click_on "Submit" }
649
649
 
650
- expect(page).to have_admin_callout(callout_success)
650
+ expect(page).to have_callout(callout_success)
651
651
 
652
652
  visit questionnaire_public_path
653
653
  see_questionnaire_questions
@@ -670,7 +670,7 @@ shared_examples_for "has questionnaire" do
670
670
 
671
671
  accept_confirm { click_on "Submit" }
672
672
 
673
- expect(page).to have_admin_callout("There was a problem responding")
673
+ expect(page).to have_callout("There was a problem responding")
674
674
 
675
675
  radio_buttons = page.all(".js-radio-button-collection input[type=radio]")
676
676
  expect(radio_buttons.pluck(:checked)).to eq([nil, "true", nil, nil])
@@ -689,7 +689,7 @@ shared_examples_for "has questionnaire" do
689
689
  check "questionnaire_tos_agreement"
690
690
  accept_confirm { click_on "Submit" }
691
691
 
692
- expect(page).to have_admin_callout("There was a problem responding")
692
+ expect(page).to have_callout("There was a problem responding")
693
693
  expect(page).to have_content("Choices are not complete")
694
694
  end
695
695
  end
@@ -732,7 +732,7 @@ shared_examples_for "has questionnaire" do
732
732
 
733
733
  accept_confirm { click_on "Submit" }
734
734
 
735
- expect(page).to have_admin_callout(callout_success)
735
+ expect(page).to have_callout(callout_success)
736
736
 
737
737
  visit questionnaire_public_path
738
738
  see_questionnaire_questions
@@ -779,7 +779,7 @@ shared_examples_for "has questionnaire" do
779
779
 
780
780
  accept_confirm { click_on "Submit" }
781
781
 
782
- expect(page).to have_admin_callout("There was a problem responding")
782
+ expect(page).to have_callout("There was a problem responding")
783
783
  expect(page).to have_content("are too many")
784
784
 
785
785
  checkboxes = page.all(".js-check-box-collection input[type=checkbox]")
@@ -788,7 +788,7 @@ shared_examples_for "has questionnaire" do
788
788
 
789
789
  accept_confirm { click_on "Submit" }
790
790
 
791
- expect(page).to have_admin_callout(callout_success)
791
+ expect(page).to have_callout(callout_success)
792
792
  end
793
793
  end
794
794
 
@@ -805,7 +805,7 @@ shared_examples_for "has questionnaire" do
805
805
  check "questionnaire_tos_agreement"
806
806
  accept_confirm { click_on "Submit" }
807
807
 
808
- expect(page).to have_admin_callout("There was a problem responding")
808
+ expect(page).to have_callout("There was a problem responding")
809
809
  expect(page).to have_content("Choices are not complete")
810
810
  end
811
811
  end
@@ -826,7 +826,7 @@ shared_examples_for "has questionnaire" do
826
826
  check "questionnaire_tos_agreement"
827
827
  accept_confirm { click_on "Submit" }
828
828
 
829
- expect(page).to have_admin_callout("There was a problem responding")
829
+ expect(page).to have_callout("There was a problem responding")
830
830
 
831
831
  checkboxes = page.all(".js-check-box-collection input[type=checkbox]")
832
832
  expect(checkboxes.pluck(:checked)).to eq(["true", "true", "true", nil, nil, "true"])
@@ -1373,7 +1373,7 @@ shared_examples_for "has questionnaire" do
1373
1373
 
1374
1374
  accept_confirm { click_on "Submit" }
1375
1375
 
1376
- expect(page).to have_admin_callout(callout_success)
1376
+ expect(page).to have_callout(callout_success)
1377
1377
  end
1378
1378
  end
1379
1379
  end
@@ -173,7 +173,7 @@ shared_examples_for "add display conditions" do
173
173
 
174
174
  click_on "Save"
175
175
 
176
- expect(page).to have_admin_callout("successfully")
176
+ expect(page).to have_callout(callout_success)
177
177
  end
178
178
  end
179
179
  end
@@ -54,7 +54,7 @@ shared_examples_for "add questions" do
54
54
 
55
55
  click_on "Save"
56
56
 
57
- expect(page).to have_admin_callout("successfully")
57
+ expect(page).to have_callout(callout_success)
58
58
 
59
59
  visit_manage_questions_and_expand_all
60
60
 
@@ -76,7 +76,7 @@ shared_examples_for "add questions" do
76
76
 
77
77
  click_on "Save"
78
78
 
79
- expect(page).to have_admin_callout("successfully")
79
+ expect(page).to have_callout(callout_success)
80
80
 
81
81
  update_component_settings_or_attributes
82
82
 
@@ -98,7 +98,7 @@ shared_examples_for "add questions" do
98
98
 
99
99
  click_on "Save"
100
100
 
101
- expect(page).to have_admin_callout("successfully")
101
+ expect(page).to have_callout(callout_success)
102
102
 
103
103
  update_component_settings_or_attributes
104
104
 
@@ -152,7 +152,7 @@ shared_examples_for "add questions" do
152
152
 
153
153
  click_on "Save"
154
154
 
155
- expect(page).to have_admin_callout("successfully")
155
+ expect(page).to have_callout(callout_success)
156
156
 
157
157
  visit_manage_questions_and_expand_all
158
158
 
@@ -263,7 +263,6 @@ shared_examples_for "add questions" do
263
263
  select "Long response", from: "Type"
264
264
  click_on "Save"
265
265
 
266
- expect(page).to have_css(".panel-error", visible: :visible)
267
266
  expand_all_questions
268
267
  expect(page).to have_select("Type", selected: "Long response", wait: 10)
269
268
  end
@@ -281,7 +280,6 @@ shared_examples_for "add questions" do
281
280
  select "Long response", from: "Type"
282
281
 
283
282
  click_on "Save"
284
- expect(page).to have_css(".panel-error", visible: :visible)
285
283
  expand_all_questions
286
284
 
287
285
  expect(page).to have_text("Type")
@@ -305,7 +303,6 @@ shared_examples_for "add questions" do
305
303
  select "Long response", from: "Type"
306
304
 
307
305
  click_on "Save"
308
- expect(page).to have_css(".panel-error", visible: :visible)
309
306
  expand_all_questions
310
307
 
311
308
  expect(page).to have_text("Type")
@@ -335,7 +332,6 @@ shared_examples_for "add questions" do
335
332
  select "3", from: "Maximum number of choices"
336
333
 
337
334
  click_on "Save"
338
- expect(page).to have_css(".panel-error", visible: :visible)
339
335
  expand_all_questions
340
336
 
341
337
  expect(page).to have_css(".questionnaire-question-response-option")
@@ -363,7 +359,6 @@ shared_examples_for "add questions" do
363
359
  click_on "Add row"
364
360
 
365
361
  click_on "Save"
366
- expect(page).to have_css(".panel-error", visible: :visible)
367
362
  expand_all_questions
368
363
 
369
364
  within ".questionnaire-question-matrix-row:first-of-type" do
@@ -80,7 +80,7 @@ shared_examples_for "update display conditions" do
80
80
 
81
81
  click_on "Save"
82
82
 
83
- expect(page).to have_admin_callout("successfully")
83
+ expect(page).to have_callout(callout_success)
84
84
 
85
85
  visit_manage_questions_and_expand_all
86
86
 
@@ -21,7 +21,7 @@ shared_examples_for "update questions" do
21
21
 
22
22
  click_on "Save"
23
23
 
24
- expect(page).to have_admin_callout("successfully")
24
+ expect(page).to have_callout(callout_success)
25
25
 
26
26
  visit_manage_questions_and_expand_all
27
27
 
@@ -45,10 +45,9 @@ shared_examples_for "update questions" do
45
45
  end
46
46
 
47
47
  click_on "Save"
48
- expect(page).to have_css(".panel-error", visible: :visible)
49
48
  click_on "Expand all questions"
50
49
 
51
- expect(page).to have_admin_callout("There was a problem saving")
50
+ expect(page).to have_callout(callout_failure)
52
51
  expect(page).to have_content("cannot be blank", count: 5)
53
52
  expect(page).to have_content("must be greater than or equal to 0", count: 1)
54
53
 
@@ -84,7 +83,7 @@ shared_examples_for "update questions" do
84
83
 
85
84
  click_on "Save"
86
85
 
87
- expect(page).to have_admin_callout("successfully")
86
+ expect(page).to have_callout(callout_success)
88
87
 
89
88
  click_on "Questions"
90
89
 
@@ -119,7 +118,7 @@ shared_examples_for "update questions" do
119
118
 
120
119
  click_on "Save"
121
120
 
122
- expect(page).to have_admin_callout("successfully")
121
+ expect(page).to have_callout(callout_success)
123
122
 
124
123
  visit_manage_questions_and_expand_all
125
124
 
@@ -138,7 +137,7 @@ shared_examples_for "update questions" do
138
137
 
139
138
  expand_all_questions
140
139
 
141
- expect(page).to have_admin_callout("There was a problem saving")
140
+ expect(page).to have_callout(callout_failure)
142
141
  expect(page).to have_content("cannot be blank", count: 1)
143
142
  expect(page).to have_css("input[value='']")
144
143
  expect(page).to have_no_css("input[value='This is the first title and description']")
@@ -168,7 +167,7 @@ shared_examples_for "update questions" do
168
167
 
169
168
  click_on "Save"
170
169
 
171
- expect(page).to have_admin_callout("successfully")
170
+ expect(page).to have_callout(callout_success)
172
171
 
173
172
  click_on "Questions"
174
173
 
@@ -238,7 +237,7 @@ shared_examples_for "update questions" do
238
237
 
239
238
  click_on "Save"
240
239
 
241
- expect(page).to have_admin_callout("successfully")
240
+ expect(page).to have_callout(callout_success)
242
241
 
243
242
  visit_manage_questions_and_expand_all
244
243
 
@@ -301,7 +300,7 @@ shared_examples_for "update questions" do
301
300
 
302
301
  click_on "Save"
303
302
 
304
- expect(page).to have_admin_callout("successfully")
303
+ expect(page).to have_callout(callout_success)
305
304
 
306
305
  visit_manage_questions_and_expand_all
307
306
 
@@ -513,7 +512,6 @@ shared_examples_for "update questions" do
513
512
  end
514
513
 
515
514
  click_on "Save"
516
- expect(page).to have_css(".panel-error", visible: :visible)
517
515
  expand_all_questions
518
516
 
519
517
  within ".questionnaire-question:last-of-type" do
@@ -594,7 +592,7 @@ shared_examples_for "update questions" do
594
592
  sleep 0.5
595
593
 
596
594
  click_on "Save"
597
- expect(page).to have_admin_callout("successfully")
595
+ expect(page).to have_callout(callout_success)
598
596
 
599
597
  visit_manage_questions_and_expand_all
600
598
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-forms version.
5
5
  module Forms
6
6
  def self.version
7
- "0.31.8"
7
+ "0.32.0.rc1"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.8
4
+ version: 0.32.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
8
8
  - Marc Riera Casals
9
9
  - Oriol Gual Oliva
10
10
  - Rubén González Valero
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2026-10-22 00:00:00.000000000 Z
13
+ date: 1980-01-02 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: decidim-core
@@ -19,42 +18,42 @@ dependencies:
19
18
  requirements:
20
19
  - - '='
21
20
  - !ruby/object:Gem::Version
22
- version: 0.31.8
21
+ version: 0.32.0.rc1
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - '='
28
27
  - !ruby/object:Gem::Version
29
- version: 0.31.8
28
+ version: 0.32.0.rc1
30
29
  - !ruby/object:Gem::Dependency
31
30
  name: decidim-admin
32
31
  requirement: !ruby/object:Gem::Requirement
33
32
  requirements:
34
33
  - - '='
35
34
  - !ruby/object:Gem::Version
36
- version: 0.31.8
35
+ version: 0.32.0.rc1
37
36
  type: :development
38
37
  prerelease: false
39
38
  version_requirements: !ruby/object:Gem::Requirement
40
39
  requirements:
41
40
  - - '='
42
41
  - !ruby/object:Gem::Version
43
- version: 0.31.8
42
+ version: 0.32.0.rc1
44
43
  - !ruby/object:Gem::Dependency
45
44
  name: decidim-dev
46
45
  requirement: !ruby/object:Gem::Requirement
47
46
  requirements:
48
47
  - - '='
49
48
  - !ruby/object:Gem::Version
50
- version: 0.31.8
49
+ version: 0.32.0.rc1
51
50
  type: :development
52
51
  prerelease: false
53
52
  version_requirements: !ruby/object:Gem::Requirement
54
53
  requirements:
55
54
  - - '='
56
55
  - !ruby/object:Gem::Version
57
- version: 0.31.8
56
+ version: 0.32.0.rc1
58
57
  description: A forms gem for decidim.
59
58
  email:
60
59
  - josepjaume@gmail.com
@@ -117,8 +116,6 @@ files:
117
116
  - app/packs/src/decidim/forms/admin/live_text_update.component.js
118
117
  - app/packs/src/decidim/forms/admin/publish_responses_buttons.js
119
118
  - app/packs/src/decidim/forms/display_conditions.component.js
120
- - app/packs/src/decidim/forms/display_conditions.component.test.js
121
- - app/packs/src/decidim/forms/display_conditions_hidden_responses.test.js
122
119
  - app/packs/src/decidim/forms/forms.js
123
120
  - app/packs/src/decidim/forms/max_choices_alert.component.js
124
121
  - app/packs/src/decidim/forms/option_attached_inputs.component.js
@@ -246,7 +243,6 @@ files:
246
243
  - config/locales/vi.yml
247
244
  - config/locales/zh-CN.yml
248
245
  - config/locales/zh-TW.yml
249
- - db/data/20260616144141_rename_answers_to_responses.rb
250
246
  - db/migrate/20170511092231_create_decidim_forms_questionnaires.rb
251
247
  - db/migrate/20170515090916_create_decidim_forms_questions.rb
252
248
  - db/migrate/20170515144119_create_decidim_forms_answers.rb
@@ -290,8 +286,6 @@ files:
290
286
  - lib/decidim/forms/test/shared_examples/manage_questionnaires/draggable_behavior.rb
291
287
  - lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb
292
288
  - lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb
293
- - lib/decidim/forms/test/shared_examples/questionnaire_admin_access.rb
294
- - lib/decidim/forms/test/shared_examples/questionnaire_admin_controller_permissions.rb
295
289
  - lib/decidim/forms/user_responses_serializer.rb
296
290
  - lib/decidim/forms/version.rb
297
291
  homepage: https://decidim.org
@@ -303,7 +297,6 @@ metadata:
303
297
  funding_uri: https://opencollective.com/decidim
304
298
  homepage_uri: https://decidim.org
305
299
  source_code_uri: https://github.com/decidim/decidim
306
- post_install_message:
307
300
  rdoc_options: []
308
301
  require_paths:
309
302
  - lib
@@ -311,15 +304,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
311
304
  requirements:
312
305
  - - "~>"
313
306
  - !ruby/object:Gem::Version
314
- version: 3.3.0
307
+ version: 3.4.0
315
308
  required_rubygems_version: !ruby/object:Gem::Requirement
316
309
  requirements:
317
310
  - - ">="
318
311
  - !ruby/object:Gem::Version
319
312
  version: '0'
320
313
  requirements: []
321
- rubygems_version: 3.5.11
322
- signing_key:
314
+ rubygems_version: 3.6.9
323
315
  specification_version: 4
324
316
  summary: Decidim forms
325
317
  test_files: []
@@ -1,142 +0,0 @@
1
- import $ from "jquery"; // eslint-disable-line id-length
2
-
3
- // Relative import: the forms pack is not in jest's moduleDirectories, so it
4
- // cannot be resolved through the absolute "src/..." path used elsewhere.
5
- import createDisplayConditions from "./display_conditions.component"; // eslint-disable-line no-relative-import-paths/no-relative-import-paths
6
-
7
- describe("DisplayConditionsComponent", () => {
8
- // Renders a single-choice (radio) question with the DOM structure the
9
- // component expects (js-collection-input wrapping body/custom_body/option_id).
10
- const radioCollection = (qid, options) => `
11
- <div class="js-radio-button-collection">
12
- ${options.map((opt) => `
13
- <div class="js-collection-input">
14
- <input name="resp[${qid}][body]" type="radio" value="${opt.value}" />
15
- <input name="resp[${qid}][custom_body]" type="text" />
16
- <input name="resp[${qid}][response_option_id]" type="hidden" value="${opt.optionId}" />
17
- </div>
18
- `).join("")}
19
- </div>
20
- `;
21
-
22
- const conditionTag = (data) => {
23
- const attrs = Object.entries(data).map(([key, val]) => `data-${key}='${val}'`).join(" ");
24
- return `<div class="display-condition" ${attrs}></div>`;
25
- };
26
-
27
- // Q0 (A/B/C) --C--> Q3 (0/1) --0--> FINAL0
28
- // \--1--> FINAL1
29
- const content = `
30
- <div class="answer-questionnaire">
31
- <div class="question" data-question-id="Q0" data-conditioned="false">
32
- ${radioCollection("Q0", [{ optionId: "optA", value: "A" }, { optionId: "optB", value: "B" }, { optionId: "optC", value: "C" }])}
33
- </div>
34
- <div class="question" data-question-id="Q3" data-conditioned="true">
35
- ${conditionTag({ id: "dcQ3", type: "equal", condition: "Q0", option: "optC", mandatory: false })}
36
- ${radioCollection("Q3", [{ optionId: "opt0", value: "0" }, { optionId: "opt1", value: "1" }])}
37
- </div>
38
- <div class="question" data-question-id="FINAL0" data-conditioned="true">
39
- ${conditionTag({ id: "dcF0", type: "equal", condition: "Q3", option: "opt0", mandatory: false })}
40
- ${radioCollection("FINAL0", [{ optionId: "f0opt", value: "yes" }])}
41
- </div>
42
- <div class="question" data-question-id="FINAL1" data-conditioned="true">
43
- ${conditionTag({ id: "dcF1", type: "equal", condition: "Q3", option: "opt1", mandatory: false })}
44
- ${radioCollection("FINAL1", [{ optionId: "f1opt", value: "yes" }])}
45
- </div>
46
- </div>
47
- `;
48
-
49
- const wrapper = (qid) => $(`.question[data-question-id='${qid}']`);
50
- // The component enables inputs when a question is shown and disables them when
51
- // hidden, so the disabled state is a reliable proxy for visibility in jsdom.
52
- const isVisible = (qid) => !wrapper(qid).find("input[name$='[body]']").first().prop("disabled");
53
- const selectOption = (qid, value) => {
54
- const $input = wrapper(qid).find(`input[name$='[body]'][value='${value}']`);
55
- $input.prop("checked", true);
56
- $input.trigger("change");
57
- };
58
-
59
- beforeEach(() => {
60
- document.body.innerHTML = content;
61
- $(".answer-questionnaire .question[data-conditioned='true']").each((idx, el) => {
62
- createDisplayConditions({ wrapperField: $(el) });
63
- });
64
- });
65
-
66
- it("keeps conditioned questions hidden until their trigger is fulfilled", () => {
67
- expect(isVisible("Q3")).toBe(false);
68
- expect(isVisible("FINAL0")).toBe(false);
69
- expect(isVisible("FINAL1")).toBe(false);
70
- });
71
-
72
- it("shows only the directly conditioned question when its trigger is met", () => {
73
- selectOption("Q0", "C");
74
-
75
- expect(isVisible("Q3")).toBe(true);
76
- // Q3 is not answered yet, so neither final must appear
77
- expect(isVisible("FINAL0")).toBe(false);
78
- expect(isVisible("FINAL1")).toBe(false);
79
- });
80
-
81
- it("shows the matching final once the intermediate question is answered", () => {
82
- selectOption("Q0", "C");
83
- selectOption("Q3", "1");
84
-
85
- expect(isVisible("FINAL1")).toBe(true);
86
- expect(isVisible("FINAL0")).toBe(false);
87
- });
88
-
89
- it("cascades hiding down the chain when an ancestor trigger stops being fulfilled", () => {
90
- selectOption("Q0", "C");
91
- selectOption("Q3", "1");
92
- expect(isVisible("FINAL1")).toBe(true);
93
-
94
- // Move Q0 away from C: Q3 hides and stops counting as answered, and the
95
- // visibility change propagates so FINAL1 hides too instead of lingering.
96
- selectOption("Q0", "A");
97
-
98
- expect(isVisible("Q3")).toBe(false);
99
- expect(isVisible("FINAL1")).toBe(false);
100
- // Q3's response is kept, so showing it again restores the chain as it was
101
- expect(wrapper("Q3").find("input[value='1']").prop("checked")).toBe(true);
102
-
103
- selectOption("Q0", "C");
104
-
105
- expect(isVisible("Q3")).toBe(true);
106
- expect(isVisible("FINAL1")).toBe(true);
107
- });
108
-
109
- it("keeps file upload responses of a hidden question out of the submission without destroying them", () => {
110
- document.body.innerHTML = `
111
- <div class="answer-questionnaire">
112
- <div class="question" data-question-id="Q0" data-conditioned="false">
113
- ${radioCollection("Q0", [{ optionId: "optA", value: "A" }, { optionId: "optC", value: "C" }])}
114
- </div>
115
- <div class="question" data-question-id="QFILE" data-conditioned="true">
116
- ${conditionTag({ id: "dcFile", type: "equal", condition: "Q0", option: "optC", mandatory: false })}
117
- <div class="upload-modal__files" data-active-uploads="QFILE">
118
- <div class="attachment-details" data-filename="doc.pdf" data-state="uploaded">
119
- <input name="resp[QFILE][add_attachments]" type="hidden" value="signed-id-123" />
120
- </div>
121
- </div>
122
- </div>
123
- </div>
124
- `;
125
- $(".answer-questionnaire .question[data-conditioned='true']").each((idx, el) => {
126
- createDisplayConditions({ wrapperField: $(el) });
127
- });
128
-
129
- // Q0 is not "C", so QFILE is hidden. The attachment stays in the DOM, but it is
130
- // disabled, so nothing stale is submitted and nothing already uploaded is lost.
131
- const $hiddenField = wrapper("QFILE").find("input[name='resp[QFILE][add_attachments]']");
132
-
133
- expect(wrapper("QFILE").find(".attachment-details").length).toBe(1);
134
- expect($hiddenField.length).toBe(1);
135
- expect($hiddenField.prop("disabled")).toBe(true);
136
-
137
- // and it is submitted again once the question is shown
138
- selectOption("Q0", "C");
139
-
140
- expect($hiddenField.prop("disabled")).toBe(false);
141
- });
142
- });