decidim-forms 0.29.1 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/forms/step_navigation_cell.rb +18 -5
  3. data/app/commands/decidim/forms/admin/update_questionnaire.rb +1 -82
  4. data/app/commands/decidim/forms/admin/update_questions.rb +109 -0
  5. data/app/commands/decidim/forms/answer_questionnaire.rb +10 -3
  6. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +39 -3
  7. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_answers.rb +2 -2
  8. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +12 -4
  9. data/app/forms/decidim/forms/admin/display_condition_form.rb +1 -1
  10. data/app/forms/decidim/forms/admin/questionnaire_form.rb +2 -11
  11. data/app/forms/decidim/forms/admin/questions_form.rb +18 -0
  12. data/app/forms/decidim/forms/answer_choice_form.rb +5 -0
  13. data/app/forms/decidim/forms/answer_form.rb +1 -0
  14. data/app/forms/decidim/forms/questionnaire_form.rb +7 -0
  15. data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_pagination_helper.rb +1 -1
  16. data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_url_helper.rb +5 -5
  17. data/app/jobs/decidim/forms/export_questionnaire_answers_job.rb +5 -1
  18. data/app/models/decidim/forms/answer_option.rb +1 -1
  19. data/app/models/decidim/forms/question.rb +10 -0
  20. data/app/packs/entrypoints/decidim_forms.js +0 -1
  21. data/app/packs/entrypoints/decidim_forms_admin.js +6 -0
  22. data/app/packs/src/decidim/forms/admin/publish_answers_buttons.js +72 -0
  23. data/app/packs/src/decidim/forms/forms.js +22 -18
  24. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +1 -1
  25. data/app/presenters/decidim/forms/admin_log/question_presenter.rb +31 -0
  26. data/app/queries/decidim/forms/questionnaire_user_answers.rb +1 -1
  27. data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +1 -1
  28. data/app/views/decidim/forms/admin/questionnaires/_display_condition_template.html.erb +1 -1
  29. data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +0 -89
  30. data/app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb +1 -1
  31. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +3 -3
  32. data/app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb +80 -0
  33. data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +0 -20
  34. data/app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb +47 -0
  35. data/app/views/decidim/forms/questionnaires/_answer.html.erb +11 -1
  36. data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +8 -1
  37. data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +1 -1
  38. data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +12 -6
  39. data/app/views/decidim/forms/questionnaires/edit.html.erb +47 -0
  40. data/app/views/decidim/forms/questionnaires/show.html.erb +13 -2
  41. data/config/assets.rb +1 -2
  42. data/config/locales/ar.yml +3 -2
  43. data/config/locales/bg.yml +0 -7
  44. data/config/locales/bn-BD.yml +1 -0
  45. data/config/locales/bs-BA.yml +1 -0
  46. data/config/locales/ca.yml +46 -6
  47. data/config/locales/cs.yml +45 -5
  48. data/config/locales/de.yml +47 -7
  49. data/config/locales/el.yml +0 -7
  50. data/config/locales/en.yml +45 -5
  51. data/config/locales/es-MX.yml +45 -5
  52. data/config/locales/es-PY.yml +45 -5
  53. data/config/locales/es.yml +45 -5
  54. data/config/locales/eu.yml +50 -10
  55. data/config/locales/fi-plain.yml +45 -5
  56. data/config/locales/fi.yml +45 -5
  57. data/config/locales/fr-CA.yml +37 -5
  58. data/config/locales/fr.yml +37 -5
  59. data/config/locales/gl.yml +0 -3
  60. data/config/locales/hu.yml +0 -3
  61. data/config/locales/id-ID.yml +0 -2
  62. data/config/locales/it.yml +0 -4
  63. data/config/locales/ja.yml +1 -6
  64. data/config/locales/lb.yml +0 -4
  65. data/config/locales/lt.yml +0 -7
  66. data/config/locales/lv.yml +0 -3
  67. data/config/locales/nl.yml +0 -5
  68. data/config/locales/no.yml +0 -5
  69. data/config/locales/pl.yml +0 -7
  70. data/config/locales/pt-BR.yml +0 -5
  71. data/config/locales/pt.yml +0 -4
  72. data/config/locales/ro-RO.yml +8 -7
  73. data/config/locales/sk.yml +0 -2
  74. data/config/locales/sv.yml +0 -5
  75. data/config/locales/tr-TR.yml +0 -4
  76. data/config/locales/val-ES.yml +0 -2
  77. data/config/locales/zh-CN.yml +0 -4
  78. data/config/locales/zh-TW.yml +0 -7
  79. data/db/migrate/20190315203056_add_session_token_to_decidim_forms_answers.rb +1 -1
  80. data/db/migrate/20241122142230_add_survey_answers_published_at_to_questions.rb +7 -0
  81. data/decidim-forms.gemspec +2 -7
  82. data/lib/decidim/api/answer_option_type.rb +1 -1
  83. data/lib/decidim/api/question_type.rb +4 -4
  84. data/lib/decidim/api/questionnaire_type.rb +4 -4
  85. data/lib/decidim/exporters/form_pdf.rb +114 -11
  86. data/lib/decidim/forms/download_your_data_user_answers_serializer.rb +0 -4
  87. data/lib/decidim/forms/test/factories.rb +2 -2
  88. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +70 -4
  89. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +17 -17
  90. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +19 -21
  91. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +70 -94
  92. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +15 -18
  93. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +90 -125
  94. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +4 -25
  95. data/lib/decidim/forms/user_answers_serializer.rb +1 -1
  96. data/lib/decidim/forms/version.rb +1 -1
  97. data/lib/decidim/forms.rb +0 -1
  98. metadata +21 -47
  99. data/app/packs/entrypoints/decidim_questionnaire_answers_pdf.js +0 -1
  100. data/app/packs/entrypoints/decidim_questionnaire_answers_pdf.scss +0 -1
  101. data/app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss +0 -69
  102. data/app/views/decidim/forms/admin/questionnaires/answers/export/_answer.html.erb +0 -31
  103. data/app/views/decidim/forms/admin/questionnaires/answers/export/pdf.html.erb +0 -13
  104. data/app/views/layouts/decidim/forms/admin/questionnaires/questionnaire_answers.html.erb +0 -12
  105. data/config/initializers/wicked_pdf.rb +0 -27
  106. data/lib/decidim/exporters/form_pdf_controller_helper.rb +0 -13
@@ -7,68 +7,61 @@ shared_examples_for "update questions" do
7
7
  let!(:question) { create(:questionnaire_question, questionnaire:, body:) }
8
8
 
9
9
  before do
10
- visit questionnaire_edit_path
11
- expand_all_questions
10
+ click_on "Save"
11
+ visit_manage_questions_and_expand_all
12
12
  end
13
13
 
14
14
  it "modifies the question when the information is valid" do
15
- within "form.edit_questionnaire" do
16
- within ".questionnaire-question" do
17
- fill_in "questionnaire_questions_#{question.id}_body_en", with: "Modified question"
18
- fill_in "questionnaire_questions_#{question.id}_max_characters", with: 30
19
- check "Mandatory"
20
- select "Long answer", from: "Type"
21
- end
22
-
23
- click_on "Save"
15
+ within ".questionnaire-question" do
16
+ fill_in "questions_questions_#{question.id}_body_en", with: "Modified question"
17
+ fill_in "questions_questions_#{question.id}_max_characters", with: 30
18
+ check "Mandatory"
19
+ select "Long answer", from: "Type"
24
20
  end
25
21
 
22
+ click_on "Save"
23
+
26
24
  expect(page).to have_admin_callout("successfully")
27
25
 
28
- visit_questionnaire_edit_path_and_expand_all
26
+ visit_manage_questions_and_expand_all
29
27
 
30
28
  expect(page).to have_css("input[value='Modified question']")
31
29
  expect(page).to have_no_css("input[value='This is the first question']")
32
- expect(page).to have_css("input#questionnaire_questions_#{question.id}_mandatory[checked]")
33
- expect(page).to have_css("input#questionnaire_questions_#{question.id}_max_characters[value='30']")
34
- expect(page).to have_css("select#questionnaire_questions_#{question.id}_question_type option[value='long_answer'][selected]")
30
+ expect(page).to have_css("input#questions_questions_#{question.id}_mandatory[checked]")
31
+ expect(page).to have_css("input#questions_questions_#{question.id}_max_characters[value='30']")
32
+ expect(page).to have_css("select#questions_questions_#{question.id}_question_type option[value='long_answer'][selected]")
35
33
  end
36
34
 
37
35
  it "re-renders the form when the information is invalid and displays errors" do
38
36
  expand_all_questions
39
37
 
40
- within "form.edit_questionnaire" do
41
- within ".questionnaire-question" do
42
- expect(page).to have_content("Statement*")
43
- fill_in "questionnaire_questions_#{question.id}_body_en", with: ""
44
- fill_in "questionnaire_questions_#{question.id}_max_characters", with: -3
45
- check "Mandatory"
46
- select "Matrix (Multiple option)", from: "Type"
47
- select "2", from: "Maximum number of choices"
48
- end
49
-
50
- click_on "Save"
38
+ within ".questionnaire-question" do
39
+ expect(page).to have_content("Statement*")
40
+ fill_in "questions_questions_#{question.id}_body_en", with: ""
41
+ fill_in "questions_questions_#{question.id}_max_characters", with: -3
42
+ check "Mandatory"
43
+ select "Matrix (Multiple option)", from: "Type"
44
+ select "2", from: "Maximum number of choices"
51
45
  end
52
46
 
53
- expand_all_questions
47
+ click_on "Save"
48
+ click_on "Expand all questions"
54
49
 
55
50
  expect(page).to have_admin_callout("There was a problem saving")
56
- expect(page).to have_content("cannot be blank", count: 5) # empty question, 2 empty default answer options, 2 empty default matrix rows
51
+ expect(page).to have_content("cannot be blank", count: 5)
57
52
  expect(page).to have_content("must be greater than or equal to 0", count: 1)
58
53
 
59
54
  expect(page).to have_css("input[value='']")
60
55
  expect(page).to have_no_css("input[value='This is the first question']")
61
- expect(page).to have_css("input#questionnaire_questions_#{question.id}_mandatory[checked]")
62
- expect(page).to have_css("input#questionnaire_questions_#{question.id}_max_characters[value='-3']")
56
+ expect(page).to have_css("input#questions_questions_#{question.id}_mandatory[checked]")
57
+ expect(page).to have_css("input#questions_questions_#{question.id}_max_characters[value='-3']")
58
+ expect(page).to have_css("select#questions_questions_#{question.id}_question_type option[value='matrix_multiple'][selected]")
63
59
  expect(page).to have_select("Maximum number of choices", selected: "2")
64
- expect(page).to have_css("select#questionnaire_questions_#{question.id}_question_type option[value='matrix_multiple'][selected]")
65
60
  end
66
61
 
67
62
  it "preserves deleted status across submission failures" do
68
- within "form.edit_questionnaire" do
69
- within ".questionnaire-question" do
70
- click_on "Remove"
71
- end
63
+ within ".questionnaire-question" do
64
+ click_on "Remove"
72
65
  end
73
66
 
74
67
  click_on "Add question"
@@ -84,36 +77,28 @@ shared_examples_for "update questions" do
84
77
  end
85
78
 
86
79
  it "removes the question" do
87
- within "form.edit_questionnaire" do
88
- within ".questionnaire-question" do
89
- click_on "Remove"
90
- end
91
-
92
- click_on "Save"
80
+ within ".questionnaire-question" do
81
+ click_on "Remove"
93
82
  end
94
83
 
84
+ click_on "Save"
85
+
95
86
  expect(page).to have_admin_callout("successfully")
96
87
 
97
- visit questionnaire_edit_path
88
+ click_on "Manage questions"
98
89
 
99
- within "form.edit_questionnaire" do
100
- expect(page).to have_css(".questionnaire-question", count: 0)
101
- end
90
+ expect(page).to have_css(".questionnaire-question", count: 0)
102
91
  end
103
92
 
104
93
  it "cannot be moved up" do
105
- within "form.edit_questionnaire" do
106
- within ".questionnaire-question" do
107
- expect(page).to have_no_button("Up")
108
- end
94
+ within ".questionnaire-question" do
95
+ expect(page).to have_no_button("Up")
109
96
  end
110
97
  end
111
98
 
112
99
  it "cannot be moved down" do
113
- within "form.edit_questionnaire" do
114
- within ".questionnaire-question" do
115
- expect(page).to have_no_button("Down")
116
- end
100
+ within ".questionnaire-question" do
101
+ expect(page).to have_no_button("Down")
117
102
  end
118
103
  end
119
104
  end
@@ -122,22 +107,20 @@ shared_examples_for "update questions" do
122
107
  let!(:question) { create(:questionnaire_question, :title_and_description, questionnaire:, body: title_and_description_body) }
123
108
 
124
109
  before do
125
- visit questionnaire_edit_path
126
- expand_all_questions
110
+ click_on "Save"
111
+ visit_manage_questions_and_expand_all
127
112
  end
128
113
 
129
114
  it "modifies the question when the information is valid" do
130
- within "form.edit_questionnaire" do
131
- within ".questionnaire-question" do
132
- fill_in "questionnaire_questions_#{question.id}_body_en", with: "Modified title and description"
133
- end
134
-
135
- click_on "Save"
115
+ within ".questionnaire-question" do
116
+ fill_in "questions_questions_#{question.id}_body_en", with: "Modified title and description"
136
117
  end
137
118
 
119
+ click_on "Save"
120
+
138
121
  expect(page).to have_admin_callout("successfully")
139
122
 
140
- visit_questionnaire_edit_path_and_expand_all
123
+ visit_manage_questions_and_expand_all
141
124
 
142
125
  expect(page).to have_css("input[value='Modified title and description']")
143
126
  expect(page).to have_no_css("input[value='This is the first title and description']")
@@ -146,14 +129,12 @@ shared_examples_for "update questions" do
146
129
  it "re-renders the form when the information is invalid and displays errors" do
147
130
  expand_all_questions
148
131
 
149
- within "form.edit_questionnaire" do
150
- within ".questionnaire-question" do
151
- fill_in "questionnaire_questions_#{question.id}_body_en", with: ""
152
- end
153
-
154
- click_on "Save"
132
+ within ".questionnaire-question" do
133
+ fill_in "questions_questions_#{question.id}_body_en", with: ""
155
134
  end
156
135
 
136
+ click_on "Save"
137
+
157
138
  expand_all_questions
158
139
 
159
140
  expect(page).to have_admin_callout("There was a problem saving")
@@ -163,10 +144,8 @@ shared_examples_for "update questions" do
163
144
  end
164
145
 
165
146
  it "preserves deleted status across submission failures" do
166
- within "form.edit_questionnaire" do
167
- within ".questionnaire-question" do
168
- click_on "Remove"
169
- end
147
+ within ".questionnaire-question" do
148
+ click_on "Remove"
170
149
  end
171
150
 
172
151
  click_on "Add question"
@@ -182,36 +161,28 @@ shared_examples_for "update questions" do
182
161
  end
183
162
 
184
163
  it "removes the question" do
185
- within "form.edit_questionnaire" do
186
- within ".questionnaire-question" do
187
- click_on "Remove"
188
- end
189
-
190
- click_on "Save"
164
+ within ".questionnaire-question" do
165
+ click_on "Remove"
191
166
  end
192
167
 
168
+ click_on "Save"
169
+
193
170
  expect(page).to have_admin_callout("successfully")
194
171
 
195
- visit questionnaire_edit_path
172
+ click_on "Manage questions"
196
173
 
197
- within "form.edit_questionnaire" do
198
- expect(page).to have_css(".questionnaire-question", count: 0)
199
- end
174
+ expect(page).to have_css(".questionnaire-question", count: 0)
200
175
  end
201
176
 
202
177
  it "cannot be moved up" do
203
- within "form.edit_questionnaire" do
204
- within ".questionnaire-question" do
205
- expect(page).to have_no_button("Up")
206
- end
178
+ within ".questionnaire-question" do
179
+ expect(page).to have_no_button("Up")
207
180
  end
208
181
  end
209
182
 
210
183
  it "cannot be moved down" do
211
- within "form.edit_questionnaire" do
212
- within ".questionnaire-question" do
213
- expect(page).to have_no_button("Down")
214
- end
184
+ within ".questionnaire-question" do
185
+ expect(page).to have_no_button("Down")
215
186
  end
216
187
  end
217
188
  end
@@ -233,7 +204,8 @@ shared_examples_for "update questions" do
233
204
  end
234
205
 
235
206
  before do
236
- visit questionnaire_edit_path
207
+ click_on "Save"
208
+ click_on "Manage questions"
237
209
  end
238
210
 
239
211
  it "allows deleting answer options" do
@@ -245,35 +217,31 @@ shared_examples_for "update questions" do
245
217
 
246
218
  click_on "Save"
247
219
 
248
- visit_questionnaire_edit_path_and_expand_all
220
+ visit_manage_questions_and_expand_all
249
221
 
250
222
  expect(page).to have_css(".questionnaire-question-answer-option", count: 2)
251
223
  end
252
224
 
253
225
  it "still removes the question even if previous editions rendered the options invalid" do
254
- within "form.edit_questionnaire" do
255
- expect(page).to have_css(".questionnaire-question", count: 1)
256
-
257
- expand_all_questions
226
+ expect(page).to have_css(".questionnaire-question", count: 1)
258
227
 
259
- within ".questionnaire-question-answer-option:first-of-type" do
260
- fill_in find_nested_form_field_locator("body_en"), with: ""
261
- end
228
+ expand_all_questions
262
229
 
263
- within ".questionnaire-question" do
264
- click_on "Remove", match: :first
265
- end
230
+ within ".questionnaire-question-answer-option:first-of-type" do
231
+ fill_in find_nested_form_field_locator("body_en"), with: ""
232
+ end
266
233
 
267
- click_on "Save"
234
+ within ".questionnaire-question" do
235
+ click_on "Remove", match: :first
268
236
  end
269
237
 
238
+ click_on "Save"
239
+
270
240
  expect(page).to have_admin_callout("successfully")
271
241
 
272
- visit_questionnaire_edit_path_and_expand_all
242
+ visit_manage_questions_and_expand_all
273
243
 
274
- within "form.edit_questionnaire" do
275
- expect(page).to have_css(".questionnaire-question", count: 0)
276
- end
244
+ expect(page).to have_css(".questionnaire-question", count: 0)
277
245
  end
278
246
  end
279
247
 
@@ -300,7 +268,8 @@ shared_examples_for "update questions" do
300
268
  end
301
269
 
302
270
  before do
303
- visit_questionnaire_edit_path_and_expand_all
271
+ click_on "Save"
272
+ visit_manage_questions_and_expand_all
304
273
  end
305
274
 
306
275
  it "allows deleting matrix rows" do
@@ -310,7 +279,7 @@ shared_examples_for "update questions" do
310
279
 
311
280
  click_on "Save"
312
281
 
313
- visit_questionnaire_edit_path_and_expand_all
282
+ visit_manage_questions_and_expand_all
314
283
 
315
284
  within ".questionnaire-question:last-of-type" do
316
285
  expect(page).to have_css(".questionnaire-question-matrix-row", count: 2)
@@ -319,27 +288,23 @@ shared_examples_for "update questions" do
319
288
  end
320
289
 
321
290
  it "still removes the question even if previous editions rendered the rows invalid" do
322
- within "form.edit_questionnaire" do
323
- expect(page).to have_css(".questionnaire-question", count: 2)
324
-
325
- within ".questionnaire-question-matrix-row:first-of-type" do
326
- fill_in find_nested_form_field_locator("body_en"), with: ""
327
- end
291
+ expect(page).to have_css(".questionnaire-question", count: 2)
328
292
 
329
- within ".questionnaire-question:last-of-type" do
330
- click_on "Remove", match: :first
331
- end
293
+ within ".questionnaire-question-matrix-row:first-of-type" do
294
+ fill_in find_nested_form_field_locator("body_en"), with: ""
295
+ end
332
296
 
333
- click_on "Save"
297
+ within ".questionnaire-question:last-of-type" do
298
+ click_on "Remove", match: :first
334
299
  end
335
300
 
301
+ click_on "Save"
302
+
336
303
  expect(page).to have_admin_callout("successfully")
337
304
 
338
- visit_questionnaire_edit_path_and_expand_all
305
+ visit_manage_questions_and_expand_all
339
306
 
340
- within "form.edit_questionnaire" do
341
- expect(page).to have_css(".questionnaire-question", count: 1)
342
- end
307
+ expect(page).to have_css(".questionnaire-question", count: 1)
343
308
  end
344
309
  end
345
310
 
@@ -361,8 +326,8 @@ shared_examples_for "update questions" do
361
326
  end
362
327
 
363
328
  before do
364
- visit questionnaire_edit_path
365
- expand_all_questions
329
+ click_on "Save"
330
+ visit_manage_questions_and_expand_all
366
331
  end
367
332
 
368
333
  shared_examples_for "switching questions order" do
@@ -24,30 +24,9 @@ shared_examples_for "manage questionnaires" do
24
24
  }
25
25
  end
26
26
 
27
- it "updates the questionnaire" do
28
- visit questionnaire_edit_path
29
-
30
- new_description = {
31
- en: "<p>New description</p>",
32
- ca: "<p>Nova descripció</p>",
33
- es: "<p>Nueva descripción</p>"
34
- }
35
-
36
- within "form.edit_questionnaire" do
37
- fill_in_i18n_editor(:questionnaire_description, "#questionnaire-description-tabs", new_description)
38
- click_on "Save"
39
- end
40
-
41
- expect(page).to have_admin_callout("successfully")
42
-
43
- visit questionnaire_public_path
44
-
45
- expect(page).to have_content("New description")
46
- end
47
-
48
27
  context "when the questionnaire is not already answered" do
49
28
  before do
50
- visit questionnaire_edit_path
29
+ visit manage_questions_path
51
30
  end
52
31
 
53
32
  it_behaves_like "add questions"
@@ -61,7 +40,7 @@ shared_examples_for "manage questionnaires" do
61
40
  let!(:answer) { create(:answer, questionnaire:, question:) }
62
41
 
63
42
  it "cannot modify questionnaire questions" do
64
- visit questionnaire_edit_path
43
+ visit manage_questions_path
65
44
 
66
45
  expect(page).to have_no_content("Add question")
67
46
  expect(page).to have_no_content("Remove")
@@ -112,8 +91,8 @@ shared_examples_for "manage questionnaires" do
112
91
  find(".button.expand-all").click
113
92
  end
114
93
 
115
- def visit_questionnaire_edit_path_and_expand_all
116
- visit questionnaire_edit_path
94
+ def visit_manage_questions_and_expand_all
95
+ click_on "Manage questions"
117
96
  expand_all_questions
118
97
  end
119
98
  end
@@ -42,7 +42,7 @@ module Decidim
42
42
  questionnaire_id = @answers.first&.decidim_questionnaire_id
43
43
  return {} unless questionnaire_id
44
44
 
45
- questions = Decidim::Forms::Question.where(decidim_questionnaire_id: questionnaire_id)
45
+ questions = Decidim::Forms::Question.where(decidim_questionnaire_id: questionnaire_id).order(:position)
46
46
  return {} if questions.none?
47
47
 
48
48
  questions.each.inject({}) do |serialized, question|
@@ -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.29.1"
7
+ "0.30.0.rc1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/forms.rb CHANGED
@@ -14,6 +14,5 @@ module Decidim
14
14
 
15
15
  module Exporters
16
16
  autoload :FormPDF, "decidim/exporters/form_pdf"
17
- autoload :FormPDFControllerHelper, "decidim/exporters/form_pdf_controller_helper"
18
17
  end
19
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.1
4
+ version: 0.30.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-10-02 00:00:00.000000000 Z
14
+ date: 2025-02-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: decidim-core
@@ -19,70 +19,42 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.29.1
22
+ version: 0.30.0.rc1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.29.1
30
- - !ruby/object:Gem::Dependency
31
- name: wicked_pdf
32
- requirement: !ruby/object:Gem::Requirement
33
- requirements:
34
- - - "~>"
35
- - !ruby/object:Gem::Version
36
- version: '2.1'
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '2.1'
44
- - !ruby/object:Gem::Dependency
45
- name: wkhtmltopdf-binary
46
- requirement: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - '='
49
- - !ruby/object:Gem::Version
50
- version: 0.12.6.6
51
- type: :runtime
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - '='
56
- - !ruby/object:Gem::Version
57
- version: 0.12.6.6
29
+ version: 0.30.0.rc1
58
30
  - !ruby/object:Gem::Dependency
59
31
  name: decidim-admin
60
32
  requirement: !ruby/object:Gem::Requirement
61
33
  requirements:
62
34
  - - '='
63
35
  - !ruby/object:Gem::Version
64
- version: 0.29.1
36
+ version: 0.30.0.rc1
65
37
  type: :development
66
38
  prerelease: false
67
39
  version_requirements: !ruby/object:Gem::Requirement
68
40
  requirements:
69
41
  - - '='
70
42
  - !ruby/object:Gem::Version
71
- version: 0.29.1
43
+ version: 0.30.0.rc1
72
44
  - !ruby/object:Gem::Dependency
73
45
  name: decidim-dev
74
46
  requirement: !ruby/object:Gem::Requirement
75
47
  requirements:
76
48
  - - '='
77
49
  - !ruby/object:Gem::Version
78
- version: 0.29.1
50
+ version: 0.30.0.rc1
79
51
  type: :development
80
52
  prerelease: false
81
53
  version_requirements: !ruby/object:Gem::Requirement
82
54
  requirements:
83
55
  - - '='
84
56
  - !ruby/object:Gem::Version
85
- version: 0.29.1
57
+ version: 0.30.0.rc1
86
58
  description: A forms gem for decidim.
87
59
  email:
88
60
  - josepjaume@gmail.com
@@ -105,6 +77,7 @@ files:
105
77
  - app/cells/decidim/forms/step_navigation/show.erb
106
78
  - app/cells/decidim/forms/step_navigation_cell.rb
107
79
  - app/commands/decidim/forms/admin/update_questionnaire.rb
80
+ - app/commands/decidim/forms/admin/update_questions.rb
108
81
  - app/commands/decidim/forms/answer_questionnaire.rb
109
82
  - app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb
110
83
  - app/controllers/decidim/forms/admin/concerns/has_questionnaire_answers.rb
@@ -114,6 +87,7 @@ files:
114
87
  - app/forms/decidim/forms/admin/question_form.rb
115
88
  - app/forms/decidim/forms/admin/question_matrix_row_form.rb
116
89
  - app/forms/decidim/forms/admin/questionnaire_form.rb
90
+ - app/forms/decidim/forms/admin/questions_form.rb
117
91
  - app/forms/decidim/forms/answer_choice_form.rb
118
92
  - app/forms/decidim/forms/answer_form.rb
119
93
  - app/forms/decidim/forms/questionnaire_form.rb
@@ -134,8 +108,6 @@ files:
134
108
  - app/models/decidim/forms/questionnaire.rb
135
109
  - app/packs/entrypoints/decidim_forms.js
136
110
  - app/packs/entrypoints/decidim_forms_admin.js
137
- - app/packs/entrypoints/decidim_questionnaire_answers_pdf.js
138
- - app/packs/entrypoints/decidim_questionnaire_answers_pdf.scss
139
111
  - app/packs/images/decidim/surveys/decidim_surveys.svg
140
112
  - app/packs/src/decidim/forms/admin/auto_buttons_by_min_items.component.js
141
113
  - app/packs/src/decidim/forms/admin/auto_select_options_by_total_items.component.js
@@ -143,14 +115,15 @@ files:
143
115
  - app/packs/src/decidim/forms/admin/collapsible_questions.js
144
116
  - app/packs/src/decidim/forms/admin/forms.js
145
117
  - app/packs/src/decidim/forms/admin/live_text_update.component.js
118
+ - app/packs/src/decidim/forms/admin/publish_answers_buttons.js
146
119
  - app/packs/src/decidim/forms/display_conditions.component.js
147
120
  - app/packs/src/decidim/forms/forms.js
148
121
  - app/packs/src/decidim/forms/max_choices_alert.component.js
149
122
  - app/packs/src/decidim/forms/option_attached_inputs.component.js
150
123
  - app/packs/stylesheets/decidim/forms/forms.scss
151
- - app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss
152
124
  - app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb
153
125
  - app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb
126
+ - app/presenters/decidim/forms/admin_log/question_presenter.rb
154
127
  - app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb
155
128
  - app/presenters/decidim/forms/answer_option_presenter.rb
156
129
  - app/presenters/decidim/forms/question_presenter.rb
@@ -165,13 +138,13 @@ files:
165
138
  - app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb
166
139
  - app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb
167
140
  - app/views/decidim/forms/admin/questionnaires/_question.html.erb
141
+ - app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb
168
142
  - app/views/decidim/forms/admin/questionnaires/_separator.html.erb
169
143
  - app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb
170
- - app/views/decidim/forms/admin/questionnaires/answers/export/_answer.html.erb
171
- - app/views/decidim/forms/admin/questionnaires/answers/export/pdf.html.erb
172
144
  - app/views/decidim/forms/admin/questionnaires/answers/index.html.erb
173
145
  - app/views/decidim/forms/admin/questionnaires/answers/show.html.erb
174
146
  - app/views/decidim/forms/admin/questionnaires/edit.html.erb
147
+ - app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb
175
148
  - app/views/decidim/forms/questionnaires/_answer.html.erb
176
149
  - app/views/decidim/forms/questionnaires/_questionnaire.html.erb
177
150
  - app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb
@@ -185,15 +158,16 @@ files:
185
158
  - app/views/decidim/forms/questionnaires/answers/_single_option.html.erb
186
159
  - app/views/decidim/forms/questionnaires/answers/_sorting.html.erb
187
160
  - app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb
161
+ - app/views/decidim/forms/questionnaires/edit.html.erb
188
162
  - app/views/decidim/forms/questionnaires/show.html.erb
189
- - app/views/layouts/decidim/forms/admin/questionnaires/questionnaire_answers.html.erb
190
163
  - config/assets.rb
191
- - config/initializers/wicked_pdf.rb
192
164
  - config/locales/am-ET.yml
193
165
  - config/locales/ar-SA.yml
194
166
  - config/locales/ar.yml
195
167
  - config/locales/bg-BG.yml
196
168
  - config/locales/bg.yml
169
+ - config/locales/bn-BD.yml
170
+ - config/locales/bs-BA.yml
197
171
  - config/locales/ca.yml
198
172
  - config/locales/cs-CZ.yml
199
173
  - config/locales/cs.yml
@@ -286,13 +260,13 @@ files:
286
260
  - db/migrate/20240402095253_add_matrix_row_counter_cache_to_questions.rb
287
261
  - db/migrate/20240416111953_add_display_conditions_counter_cache_to_questions.rb
288
262
  - db/migrate/20240416113926_add_display_conditions_for_other_questions_counter_cache_to_questions.rb
263
+ - db/migrate/20241122142230_add_survey_answers_published_at_to_questions.rb
289
264
  - decidim-forms.gemspec
290
265
  - lib/decidim/api/answer_option_type.rb
291
266
  - lib/decidim/api/question_type.rb
292
267
  - lib/decidim/api/questionnaire_entity_interface.rb
293
268
  - lib/decidim/api/questionnaire_type.rb
294
269
  - lib/decidim/exporters/form_pdf.rb
295
- - lib/decidim/exporters/form_pdf_controller_helper.rb
296
270
  - lib/decidim/forms.rb
297
271
  - lib/decidim/forms/admin.rb
298
272
  - lib/decidim/forms/admin_engine.rb
@@ -312,7 +286,7 @@ files:
312
286
  - lib/decidim/forms/version.rb
313
287
  homepage: https://decidim.org
314
288
  licenses:
315
- - AGPL-3.0
289
+ - AGPL-3.0-or-later
316
290
  metadata:
317
291
  bug_tracker_uri: https://github.com/decidim/decidim/issues
318
292
  documentation_uri: https://docs.decidim.org/
@@ -327,14 +301,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
301
  requirements:
328
302
  - - "~>"
329
303
  - !ruby/object:Gem::Version
330
- version: 3.2.0
304
+ version: 3.3.0
331
305
  required_rubygems_version: !ruby/object:Gem::Requirement
332
306
  requirements:
333
307
  - - ">="
334
308
  - !ruby/object:Gem::Version
335
309
  version: '0'
336
310
  requirements: []
337
- rubygems_version: 3.4.10
311
+ rubygems_version: 3.5.11
338
312
  signing_key:
339
313
  specification_version: 4
340
314
  summary: Decidim forms
@@ -1 +0,0 @@
1
- import "entrypoints/decidim_questionnaire_answers_pdf.scss"
@@ -1 +0,0 @@
1
- @import "stylesheets/decidim/forms/questionnaire-answers-pdf.scss";