decidim-forms 0.26.5 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/forms/admin/update_questionnaire.rb +13 -8
  3. data/app/commands/decidim/forms/answer_questionnaire.rb +1 -1
  4. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +2 -2
  5. data/app/forms/decidim/forms/admin/display_condition_form.rb +3 -3
  6. data/app/models/decidim/forms/answer.rb +2 -2
  7. data/app/models/decidim/forms/display_condition.rb +1 -1
  8. data/app/models/decidim/forms/questionnaire.rb +7 -0
  9. data/app/packs/src/decidim/forms/admin/forms.js +0 -3
  10. data/app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb +13 -8
  11. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +5 -3
  12. data/app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb +35 -0
  13. data/app/queries/decidim/forms/questionnaire_participant.rb +1 -1
  14. data/app/queries/decidim/forms/questionnaire_participants.rb +1 -1
  15. data/app/queries/decidim/forms/questionnaire_user_answers.rb +1 -1
  16. data/app/views/decidim/forms/questionnaires/show.html.erb +4 -2
  17. data/config/locales/am-ET.yml +1 -0
  18. data/config/locales/ar.yml +1 -0
  19. data/config/locales/bg.yml +1 -0
  20. data/config/locales/ca.yml +7 -6
  21. data/config/locales/cs.yml +6 -5
  22. data/config/locales/da.yml +1 -0
  23. data/config/locales/de.yml +1 -4
  24. data/config/locales/el.yml +1 -4
  25. data/config/locales/en.yml +5 -5
  26. data/config/locales/eo.yml +1 -0
  27. data/config/locales/es-MX.yml +6 -5
  28. data/config/locales/es-PY.yml +6 -5
  29. data/config/locales/es.yml +6 -5
  30. data/config/locales/et.yml +1 -0
  31. data/config/locales/eu.yml +11 -29
  32. data/config/locales/fi-plain.yml +6 -5
  33. data/config/locales/fi.yml +6 -5
  34. data/config/locales/fr-CA.yml +3 -5
  35. data/config/locales/fr.yml +3 -5
  36. data/config/locales/ga-IE.yml +1 -0
  37. data/config/locales/gl.yml +5 -0
  38. data/config/locales/hr.yml +1 -0
  39. data/config/locales/hu.yml +4 -0
  40. data/config/locales/id-ID.yml +1 -0
  41. data/config/locales/is-IS.yml +2 -1
  42. data/config/locales/it.yml +1 -4
  43. data/config/locales/ja.yml +6 -5
  44. data/config/locales/ko.yml +1 -0
  45. data/config/locales/lb.yml +1 -4
  46. data/config/locales/lt.yml +1 -188
  47. data/config/locales/lv.yml +1 -4
  48. data/config/locales/mt.yml +1 -0
  49. data/config/locales/nl.yml +1 -4
  50. data/config/locales/no.yml +1 -4
  51. data/config/locales/om-ET.yml +1 -0
  52. data/config/locales/pl.yml +5 -9
  53. data/config/locales/pt-BR.yml +2 -5
  54. data/config/locales/pt.yml +1 -4
  55. data/config/locales/ro-RO.yml +1 -6
  56. data/config/locales/ru.yml +1 -0
  57. data/config/locales/si-LK.yml +1 -0
  58. data/config/locales/sk.yml +1 -0
  59. data/config/locales/sl.yml +1 -0
  60. data/config/locales/so-SO.yml +1 -0
  61. data/config/locales/sr-CS.yml +1 -0
  62. data/config/locales/sv.yml +1 -4
  63. data/config/locales/sw-KE.yml +1 -0
  64. data/config/locales/ti-ER.yml +1 -0
  65. data/config/locales/tr-TR.yml +1 -4
  66. data/config/locales/uk.yml +1 -0
  67. data/config/locales/val-ES.yml +1 -0
  68. data/config/locales/vi.yml +1 -0
  69. data/config/locales/zh-CN.yml +1 -4
  70. data/config/locales/zh-TW.yml +1 -0
  71. data/lib/decidim/exporters/form_pdf.rb +2 -2
  72. data/lib/decidim/forms/{data_portability_user_answers_serializer.rb → download_your_data_user_answers_serializer.rb} +2 -2
  73. data/lib/decidim/forms/test/factories.rb +22 -13
  74. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +2 -25
  75. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +2 -2
  76. data/lib/decidim/forms/user_answers_serializer.rb +2 -2
  77. data/lib/decidim/forms/version.rb +1 -1
  78. data/lib/decidim/forms.rb +1 -1
  79. metadata +14 -17
  80. data/config/locales/gn-PY.yml +0 -1
  81. data/config/locales/ka-GE.yml +0 -1
  82. data/config/locales/lo-LA.yml +0 -1
  83. data/config/locales/oc-FR.yml +0 -1
@@ -1,4 +1,5 @@
1
- pt-BR:
1
+ ---
2
+ pt:
2
3
  activemodel:
3
4
  attributes:
4
5
  answer:
@@ -118,10 +119,6 @@ pt-BR:
118
119
  extension_allowlist: 'Formatos aceitos:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Esta imagem será:'
122
- processors:
123
- resize_and_pad: Redimensionado e acolchoado para
124
- resize_to_fit: Redimensionado para caber
125
122
  question_types:
126
123
  files: Arquivos
127
124
  long_answer: Resposta longa
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pt:
2
3
  activemodel:
3
4
  attributes:
@@ -118,10 +119,6 @@ pt:
118
119
  extension_allowlist: 'Formatos aceites:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Esta imagem será:'
122
- processors:
123
- resize_and_pad: Redimensionada e ajustada para
124
- resize_to_fit: Redimensionada para caber
125
122
  question_types:
126
123
  files: Ficheiros
127
124
  long_answer: Resposta longa
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ro:
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,6 @@ ro:
128
129
  extension_allowlist: 'Formate acceptate:'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Această imagine va fi:'
132
- processors:
133
- resize_and_pad: Redimensionat și padded la
134
- resize_to_fit: Redimensionată pentru a se potrivi
135
132
  question_types:
136
133
  files: Fișiere
137
134
  long_answer: Răspuns lung
@@ -142,8 +139,6 @@ ro:
142
139
  single_option: Opțiune unică
143
140
  sorting: Sortare
144
141
  title_and_description: Titlu și descriere
145
- questionnaire_answer_presenter:
146
- download_attachment: Descărcare atașament
147
142
  questionnaires:
148
143
  answer:
149
144
  invalid: A apărut o problemă la completarea chestionarului.
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ru:
2
3
  decidim:
3
4
  forms:
@@ -1 +1,2 @@
1
+ ---
1
2
  si:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sk:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sl:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  so:
@@ -1 +1,2 @@
1
+ ---
1
2
  sr:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sv:
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,6 @@ sv:
128
129
  extension_allowlist: 'Godkända format:'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Denna bild kommer att vara:'
132
- processors:
133
- resize_and_pad: Anpassad och vadderad till
134
- resize_to_fit: Anpassad för att passa
135
132
  question_types:
136
133
  files: Filer
137
134
  long_answer: Långt svar
@@ -1 +1,2 @@
1
+ ---
1
2
  sw:
@@ -1 +1,2 @@
1
+ ---
1
2
  ti:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  tr:
2
3
  activemodel:
3
4
  attributes:
@@ -113,10 +114,6 @@ tr:
113
114
  extension_allowlist: 'Kabul edilen biçimler:'
114
115
  images:
115
116
  dimensions: "%{width} x %{height} px"
116
- dimensions_info: 'Bu resim:'
117
- processors:
118
- resize_and_pad: Yeniden boyutlandırıldı ve dolduruldu
119
- resize_to_fit: Sığacak şekilde yeniden boyutlandırıldı
120
117
  question_types:
121
118
  long_answer: Uzun cevap
122
119
  matrix_multiple: Matris (Çoklu seçenek)
@@ -1 +1,2 @@
1
+ ---
1
2
  uk:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  val:
2
3
  decidim:
3
4
  forms:
@@ -1 +1,2 @@
1
+ ---
1
2
  vi:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  zh-CN:
2
3
  activemodel:
3
4
  attributes:
@@ -112,10 +113,6 @@ zh-CN:
112
113
  extension_allowlist: '接受的格式:'
113
114
  images:
114
115
  dimensions: "%{width} x %{height} px"
115
- dimensions_info: '这张图片将是:'
116
- processors:
117
- resize_and_pad: 缩放并填充到
118
- resize_to_fit: 调整到适合的
119
116
  question_types:
120
117
  long_answer: 长答案
121
118
  matrix_multiple: 矩阵(多选项)
@@ -1 +1,2 @@
1
+ ---
1
2
  zh-TW:
@@ -15,11 +15,11 @@ module Decidim
15
15
  end
16
16
 
17
17
  def template
18
- "decidim/forms/admin/questionnaires/answers/export/pdf.html.erb"
18
+ "decidim/forms/admin/questionnaires/answers/export/pdf"
19
19
  end
20
20
 
21
21
  def layout
22
- "decidim/forms/admin/questionnaires/questionnaire_answers.html.erb"
22
+ "decidim/forms/admin/questionnaires/questionnaire_answers"
23
23
  end
24
24
 
25
25
  def locals
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Decidim
4
4
  module Forms
5
- class DataPortabilityUserAnswersSerializer < Decidim::Exporters::Serializer
5
+ class DownloadYourDataUserAnswersSerializer < Decidim::Exporters::Serializer
6
6
  include Decidim::TranslationsHelper
7
- # Serializes an user answer for data portability
7
+ # Serializes an user answer for download your data
8
8
  def serialize
9
9
  {
10
10
  id: resource.id,
@@ -29,38 +29,47 @@ FactoryBot.define do
29
29
  end
30
30
 
31
31
  trait :with_all_questions do
32
- questions do
32
+ after(:build) do |questionaire, _evaluator|
33
33
  position = 0
34
- qs = %w(short_answer long_answer).collect do |text_question_type|
35
- q = build(:questionnaire_question, question_type: text_question_type, position: position)
34
+ %w(short_answer long_answer).collect do |text_question_type|
35
+ q = create(:questionnaire_question,
36
+ question_type: text_question_type,
37
+ position: position,
38
+ questionnaire: questionaire)
36
39
  position += 1
37
- q
40
+ questionaire.questions << q
38
41
  end
39
42
 
40
43
  %w(single_option multiple_option).each do |option_question_type|
41
- q = build(:questionnaire_question, :with_answer_options, question_type: option_question_type, position: position)
42
- position += 1
43
- qs << q
44
+ q = create(:questionnaire_question, :with_answer_options,
45
+ question_type: option_question_type,
46
+ position: position,
47
+ questionnaire: questionaire)
44
48
  q.display_conditions.build(
45
- condition_question: qs[q.position - 2],
49
+ condition_question: questionaire.questions[q.position - 1],
46
50
  question: q,
47
51
  condition_type: :answered,
48
52
  mandatory: true
49
53
  )
54
+ questionaire.questions << q
55
+ position += 1
50
56
  end
51
57
 
52
58
  %w(matrix_single matrix_multiple).collect do |matrix_question_type|
53
- q = build(:questionnaire_question, :with_answer_options, question_type: matrix_question_type, position: position, body: generate_localized_title)
54
- position += 1
55
- qs << q
59
+ q = build(:questionnaire_question, :with_answer_options,
60
+ question_type: matrix_question_type,
61
+ position: position,
62
+ body: generate_localized_title,
63
+ questionnaire: questionaire)
56
64
  q.display_conditions.build(
57
- condition_question: qs[q.position - 2],
65
+ condition_question: questionaire.questions[q.position - 1],
58
66
  question: q,
59
67
  condition_type: :answered,
60
68
  mandatory: true
61
69
  )
70
+ questionaire.questions << q
71
+ position += 1
62
72
  end
63
- qs
64
73
  end
65
74
  end
66
75
 
@@ -10,11 +10,8 @@ shared_examples_for "manage questionnaire answers" do
10
10
  let!(:second) do
11
11
  create :questionnaire_question, questionnaire: questionnaire, position: 2, question_type: "single_option"
12
12
  end
13
- let!(:third) do
14
- create :questionnaire_question, questionnaire: questionnaire, position: 3, question_type: "files"
15
- end
16
13
  let(:questions) do
17
- [first, second, third]
14
+ [first, second]
18
15
  end
19
16
 
20
17
  context "when there are no answers" do
@@ -28,7 +25,6 @@ shared_examples_for "manage questionnaire answers" do
28
25
  let!(:answer1) { create :answer, questionnaire: questionnaire, question: first }
29
26
  let!(:answer2) { create :answer, body: "second answer", questionnaire: questionnaire, question: first }
30
27
  let!(:answer3) { create :answer, questionnaire: questionnaire, question: second }
31
- let!(:file_answer) { create :answer, :with_attachments, questionnaire: questionnaire, question: third, body: nil, user: answer3.user, session_token: answer3.session_token }
32
28
 
33
29
  it "shows the answer admin link" do
34
30
  visit questionnaire_edit_path
@@ -49,7 +45,7 @@ shared_examples_for "manage questionnaire answers" do
49
45
  end
50
46
 
51
47
  it "shows the percentage" do
52
- expect(page).to have_content("33%")
48
+ expect(page).to have_content("50%")
53
49
  end
54
50
 
55
51
  it "has a detail link" do
@@ -125,25 +121,6 @@ shared_examples_for "manage questionnaire answers" do
125
121
  expect(page).not_to have_link("Next ›")
126
122
  expect(page).to have_link("‹ Prev")
127
123
  end
128
-
129
- it "third answer has download link for the attachments" do
130
- click_link answer3.session_token, match: :first
131
- expect(page).to have_content(translated(file_answer.attachments.first.title))
132
- expect(page).to have_content(translated(file_answer.attachments.second.title))
133
- end
134
-
135
- context "when the file answer does not have a title for the attachment" do
136
- let!(:file_answer) { create :answer, questionnaire: questionnaire, question: third, body: nil, user: answer3.user, session_token: answer3.session_token }
137
-
138
- before do
139
- create :attachment, :with_image, attached_to: file_answer, title: {}, description: {}
140
- end
141
-
142
- it "third answer has download link for the attachments" do
143
- click_link answer3.session_token, match: :first
144
- expect(page).to have_content("Download attachment")
145
- end
146
- end
147
124
  end
148
125
  end
149
126
  end
@@ -344,11 +344,11 @@ shared_examples_for "update questions" do
344
344
  end
345
345
 
346
346
  context "when a questionnaire has multiple existing questions" do
347
- let!(:question_1) do
347
+ let!(:question1) do
348
348
  create(:questionnaire_question, questionnaire: questionnaire, body: first_body, position: 0)
349
349
  end
350
350
 
351
- let!(:question_2) do
351
+ let!(:question2) do
352
352
  create(:questionnaire_question, questionnaire: questionnaire, body: second_body, position: 1)
353
353
  end
354
354
 
@@ -79,7 +79,7 @@ module Decidim
79
79
  end
80
80
 
81
81
  def normalize_matrix_choices(answer, choices)
82
- answer.question.matrix_rows.map do |matrix_row|
82
+ answer.question.matrix_rows.to_h do |matrix_row|
83
83
  row_body = translated_attribute(matrix_row.body)
84
84
 
85
85
  row_choices = answer.question.answer_options.map do |answer_option|
@@ -88,7 +88,7 @@ module Decidim
88
88
  end
89
89
 
90
90
  [row_body, row_choices]
91
- end.to_h
91
+ end
92
92
  end
93
93
 
94
94
  def answer_translated_attribute_name(attribute)
@@ -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.26.5"
7
+ "0.27.0.rc1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/forms.rb CHANGED
@@ -9,7 +9,7 @@ module Decidim
9
9
  # This namespace holds the logic of the `Forms`.
10
10
  module Forms
11
11
  autoload :UserAnswersSerializer, "decidim/forms/user_answers_serializer"
12
- autoload :DataPortabilityUserAnswersSerializer, "decidim/forms/data_portability_user_answers_serializer"
12
+ autoload :DownloadYourDataUserAnswersSerializer, "decidim/forms/download_your_data_user_answers_serializer"
13
13
  end
14
14
 
15
15
  module Exporters
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.26.5
4
+ version: 0.27.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: 2023-02-13 00:00:00.000000000 Z
14
+ date: 2022-06-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: decidim-core
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.26.5
22
+ version: 0.27.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.26.5
29
+ version: 0.27.0.rc1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: wicked_pdf
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -61,28 +61,28 @@ dependencies:
61
61
  requirements:
62
62
  - - '='
63
63
  - !ruby/object:Gem::Version
64
- version: 0.26.5
64
+ version: 0.27.0.rc1
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - '='
70
70
  - !ruby/object:Gem::Version
71
- version: 0.26.5
71
+ version: 0.27.0.rc1
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: decidim-dev
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
76
  - - '='
77
77
  - !ruby/object:Gem::Version
78
- version: 0.26.5
78
+ version: 0.27.0.rc1
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: 0.26.5
85
+ version: 0.27.0.rc1
86
86
  description: A forms gem for decidim.
87
87
  email:
88
88
  - josepjaume@gmail.com
@@ -151,6 +151,7 @@ files:
151
151
  - app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss
152
152
  - app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb
153
153
  - app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb
154
+ - app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb
154
155
  - app/presenters/decidim/forms/answer_option_presenter.rb
155
156
  - app/presenters/decidim/forms/question_presenter.rb
156
157
  - app/queries/decidim/forms/questionnaire_participant.rb
@@ -216,7 +217,6 @@ files:
216
217
  - config/locales/fr.yml
217
218
  - config/locales/ga-IE.yml
218
219
  - config/locales/gl.yml
219
- - config/locales/gn-PY.yml
220
220
  - config/locales/hr-HR.yml
221
221
  - config/locales/hr.yml
222
222
  - config/locales/hu.yml
@@ -225,12 +225,10 @@ files:
225
225
  - config/locales/is.yml
226
226
  - config/locales/it.yml
227
227
  - config/locales/ja.yml
228
- - config/locales/ka-GE.yml
229
228
  - config/locales/ko-KR.yml
230
229
  - config/locales/ko.yml
231
230
  - config/locales/lb-LU.yml
232
231
  - config/locales/lb.yml
233
- - config/locales/lo-LA.yml
234
232
  - config/locales/lt-LT.yml
235
233
  - config/locales/lt.yml
236
234
  - config/locales/lv.yml
@@ -238,7 +236,6 @@ files:
238
236
  - config/locales/mt.yml
239
237
  - config/locales/nl.yml
240
238
  - config/locales/no.yml
241
- - config/locales/oc-FR.yml
242
239
  - config/locales/om-ET.yml
243
240
  - config/locales/pl.yml
244
241
  - config/locales/pt-BR.yml
@@ -284,7 +281,7 @@ files:
284
281
  - lib/decidim/forms/admin.rb
285
282
  - lib/decidim/forms/admin_engine.rb
286
283
  - lib/decidim/forms/api.rb
287
- - lib/decidim/forms/data_portability_user_answers_serializer.rb
284
+ - lib/decidim/forms/download_your_data_user_answers_serializer.rb
288
285
  - lib/decidim/forms/engine.rb
289
286
  - lib/decidim/forms/test.rb
290
287
  - lib/decidim/forms/test/factories.rb
@@ -309,14 +306,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
306
  requirements:
310
307
  - - ">="
311
308
  - !ruby/object:Gem::Version
312
- version: '2.7'
309
+ version: '3.0'
313
310
  required_rubygems_version: !ruby/object:Gem::Requirement
314
311
  requirements:
315
- - - ">="
312
+ - - ">"
316
313
  - !ruby/object:Gem::Version
317
- version: '0'
314
+ version: 1.3.1
318
315
  requirements: []
319
- rubygems_version: 3.1.6
316
+ rubygems_version: 3.2.22
320
317
  signing_key:
321
318
  specification_version: 4
322
319
  summary: Decidim forms
@@ -1 +0,0 @@
1
- gn:
@@ -1 +0,0 @@
1
- ka:
@@ -1 +0,0 @@
1
- lo:
@@ -1 +0,0 @@
1
- oc: