decidim-forms 0.23.1 → 0.23.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00b6fa084292af8d4b343f801ccc5725a7983e3390b41dcd00f2b84b34afc914
4
- data.tar.gz: 9f037814dca4fd315e6425074dc2d8c42f8c144d1bb8c5042897dd8ab5410bdf
3
+ metadata.gz: 22d31db03a32b73c8aea6bc2fe8d1f4c31e09156db13c9507e7bad3abddc1bfc
4
+ data.tar.gz: e0bd6174d6b1516268d6da9f96f4c3db806a9861cc56cd6675dd13b52d7e9f88
5
5
  SHA512:
6
- metadata.gz: fc48b056500a941f30b72dd044e9614008b8a0e84111e10af937ce00bab58d13a2e8938a4fa7a8dea9660dbb6c00ffc5b897330f42a9f73a2203edd5c86dd6d9
7
- data.tar.gz: a0dbe8818ba0efbe2d7d8b1f9503c5b07cde7023437d81ab5ee1c1695a16631d26e054cc8dd072460c97c652101ef34ef5489e6bfb596cc6376d58f3e53fd184
6
+ metadata.gz: ff6c2524b6eba8f4f26c568f2c91c2b33d5aa30ea53bbaff4b4e5ff8cf70cc4e7e6612bcd29cdadca20dfc76bc28bd2618867253d4aead32c2cc747731840342
7
+ data.tar.gz: 684a2b52c6524f6ce2f9abc12e3ecebbf21586254c002bc222e4b294394c21e0bec4217afe9b9f2096954781383624321b84a04c05b6ee219670e29a9d6cc5ef
@@ -131,8 +131,9 @@ module Decidim
131
131
  @session_token ||= tokenize(id || session_id)
132
132
  end
133
133
 
134
- def tokenize(id)
135
- Digest::MD5.hexdigest("#{id}-#{Rails.application.secrets.secret_key_base}")
134
+ def tokenize(id, length: 10)
135
+ tokenizer = Decidim::Tokenizer.new(salt: questionnaire.salt || questionnaire.id, length: length)
136
+ tokenizer.int_digest(id).to_s
136
137
  end
137
138
  end
138
139
  end
@@ -7,13 +7,16 @@ module Decidim
7
7
  #
8
8
  module QuestionnaireAnswersHelper
9
9
  def first_table_th(answer)
10
- return translated_attribute answer.first_short_answer.question.body if answer.first_short_answer
10
+ if answer.first_short_answer
11
+ @first_short_answer = answer.first_short_answer
12
+ return translated_attribute @first_short_answer.question.body
13
+ end
11
14
 
12
15
  t("session_token", scope: "decidim.forms.user_answers_serializer")
13
16
  end
14
17
 
15
18
  def first_table_td(answer)
16
- return answer.first_short_answer.body if answer.first_short_answer
19
+ return answer.first_short_answer&.body if @first_short_answer
17
20
 
18
21
  answer.session_token
19
22
  end
@@ -14,6 +14,8 @@ module Decidim
14
14
  has_many :questions, -> { order(:position) }, class_name: "Question", foreign_key: "decidim_questionnaire_id", dependent: :destroy
15
15
  has_many :answers, class_name: "Answer", foreign_key: "decidim_questionnaire_id", dependent: :destroy
16
16
 
17
+ after_initialize :set_default_salt
18
+
17
19
  # Public: returns whether the questionnaire questions can be modified or not.
18
20
  def questions_editable?
19
21
  has_component = questionnaire_for.respond_to? :component
@@ -29,6 +31,15 @@ module Decidim
29
31
  def pristine?
30
32
  created_at.to_i == updated_at.to_i && questions.empty?
31
33
  end
34
+
35
+ private
36
+
37
+ # salt is used to generate secure hash in anonymous answers
38
+ def set_default_salt
39
+ return unless defined?(salt)
40
+
41
+ self.salt ||= Tokenizer.random_salt
42
+ end
32
43
  end
33
44
  end
34
45
  end
@@ -52,7 +52,7 @@ module Decidim
52
52
  private
53
53
 
54
54
  def sibilings
55
- Answer.where(session_token: participant.session_token).joins(:question).order("decidim_forms_questions.position ASC")
55
+ Answer.where(questionnaire: questionnaire, session_token: participant.session_token).joins(:question).order("decidim_forms_questions.position ASC")
56
56
  end
57
57
  end
58
58
  end
@@ -74,8 +74,8 @@ cs:
74
74
  form:
75
75
  add_question: Přidat otázku
76
76
  add_separator: Přidat oddělovač
77
- already_answered_warning: Dotazník již odpověděli někteří uživatelé, takže nemusíte upravovat své dotazy.
78
- collapse: Sbalit všechny úlohy
77
+ already_answered_warning: Formulář je již zodpovězen některými uživateli, takže jeho otázky nemůžete upravovat.
78
+ collapse: Sbalit všechny otázky
79
79
  expand: Rozbalit všechny otázky
80
80
  preview: Náhled
81
81
  title: Upravit formulář
@@ -3,6 +3,8 @@ de:
3
3
  attributes:
4
4
  answer:
5
5
  body: Antworten
6
+ choices: Auswahl
7
+ selected_choices: Ausgewählte Auswahl
6
8
  question:
7
9
  max_choices: Maximale Anzahl von Auswahlmöglichkeiten
8
10
  question_type: Art
@@ -105,7 +105,7 @@ fr:
105
105
  up: Haut
106
106
  update:
107
107
  invalid: Il y a eu des erreurs lors de la sauvegarde du questionnaire.
108
- success: Le formulaire a bien été sauvegardé.
108
+ success: Le questionnaire a bien été sauvegardé.
109
109
  errors:
110
110
  answer:
111
111
  body: Le corps ne peut pas être vide
@@ -152,7 +152,7 @@ fr:
152
152
  title: JavaScript est désactivé
153
153
  questionnaire_not_published:
154
154
  body: Ce formulaire n'est pas encore publié.
155
- tos_agreement: En participant, vous acceptez ses conditions d'utilisation
155
+ tos_agreement: En participant, vous acceptez ces conditions d'utilisation
156
156
  step_navigation:
157
157
  show:
158
158
  are_you_sure: Cette action ne peut pas être annulée et vous ne pourrez pas modifier vos réponses. Êtes-vous sûr?
@@ -33,6 +33,7 @@ gl:
33
33
  form:
34
34
  add_question: Engadir pregunta
35
35
  already_answered_warning: Algúns usuarios xa responderon o cuestionario para que non poida modificar as súas preguntas.
36
+ title: Editar formulario
36
37
  matrix_row:
37
38
  remove: Quitar
38
39
  statement: Declaración
@@ -50,6 +51,8 @@ gl:
50
51
  errors:
51
52
  answer:
52
53
  body: O corpo non pode estar en branco
54
+ files:
55
+ extension_whitelist: 'Formatos aceptados:'
53
56
  question_types:
54
57
  long_answer: Resposta longa
55
58
  multiple_option: Múltipla opción
@@ -132,7 +132,7 @@ ja:
132
132
  max_choices: '最大選択肢: %{n}'
133
133
  show:
134
134
  answer_questionnaire:
135
- anonymous_user_message: <a href="%{sign_in_link}">アカウント</a> でログインするか、 <a href="%{sign_up_link}">ユーザ登録</a> してフォームに回答してください。
135
+ anonymous_user_message: <a href="%{sign_in_link}">あなたのアカウントでログインする</a> か、 <a href="%{sign_up_link}">ユーザー登録</a> してフォームに回答してください。
136
136
  title: フォームに回答
137
137
  current_step: ステップ %{step}
138
138
  of_total_steps: / %{total_steps}
@@ -53,6 +53,7 @@
53
53
  form:
54
54
  add_question: Legg til spørsmål
55
55
  already_answered_warning: Skjemaet er allerede besvart av noen brukere derfor kan du ikke endre spørsmålene.
56
+ title: Rediger skjema
56
57
  matrix_row:
57
58
  remove: Fjern
58
59
  statement: Uttalelse
@@ -3,6 +3,8 @@ pl:
3
3
  attributes:
4
4
  answer:
5
5
  body: Odpowiedź
6
+ choices: Opcje
7
+ selected_choices: Wybrane opcje
6
8
  question:
7
9
  max_choices: Maksymalna liczba opcji do wyboru
8
10
  question_type: Typ
@@ -103,6 +105,7 @@ pl:
103
105
  up: W górę
104
106
  update:
105
107
  invalid: Podczas zapisywania formularza wystąpił błąd.
108
+ success: Formularz został zapisany.
106
109
  errors:
107
110
  answer:
108
111
  body: Treść nie może być pusta
@@ -3,6 +3,8 @@ ro:
3
3
  attributes:
4
4
  answer:
5
5
  body: Răspuns
6
+ choices: Opțiuni
7
+ selected_choices: Alegeri selectate
6
8
  question:
7
9
  max_choices: Numărul maxim de opțiuni
8
10
  question_type: Tip
@@ -103,6 +105,7 @@ ro:
103
105
  up: Sus
104
106
  update:
105
107
  invalid: A apărut o eroare la salvarea formularului.
108
+ success: Formular salvat cu succes.
106
109
  errors:
107
110
  answer:
108
111
  body: Corpul nu poate fi gol
@@ -152,8 +155,10 @@ ro:
152
155
  tos_agreement: Prin participare acceptați termenii și condițiile sale de utilizare
153
156
  step_navigation:
154
157
  show:
158
+ are_you_sure: Această acțiune nu poate fi anulată și nu veți putea să vă editați răspunsurile. Sunteți sigur?
155
159
  back: Înapoi
156
160
  continue: Continuă
161
+ submit: Trimiteți
157
162
  user_answers_serializer:
158
163
  body: Răspuns
159
164
  completion: Finalizare
@@ -0,0 +1 @@
1
+ si:
@@ -3,6 +3,8 @@ sv:
3
3
  attributes:
4
4
  answer:
5
5
  body: Svar
6
+ choices: Val
7
+ selected_choices: Utvalda val
6
8
  question:
7
9
  max_choices: Högst antal val
8
10
  question_type: Typ
@@ -0,0 +1 @@
1
+ sw:
@@ -3,6 +3,8 @@ tr:
3
3
  attributes:
4
4
  answer:
5
5
  body: Cevap
6
+ choices: Seçenekler
7
+ selected_choices: Seçilmiş seçenekler
6
8
  question:
7
9
  max_choices: Maksimum seçenek sayısı
8
10
  question_type: tip
@@ -15,6 +17,8 @@ tr:
15
17
  choices:
16
18
  missing: tamamlanmadı
17
19
  too_many: çok fazla
20
+ questionnaire:
21
+ request_invalid: İsteği işlerken bir hata oluştu. Lütfen tekrar deneyin
18
22
  decidim:
19
23
  forms:
20
24
  admin:
@@ -23,42 +27,108 @@ tr:
23
27
  description: Açıklama
24
28
  tos: Kullanım Şartları
25
29
  questionnaires:
30
+ actions:
31
+ back: Sorulara geri dön
32
+ show: Yanıtları göster
26
33
  answer_option:
27
34
  answer_option: Cevap seçeneği
28
35
  free_text: Ücretsiz Metin
29
36
  remove: Kaldır
30
37
  statement: Beyan
38
+ answers:
39
+ actions:
40
+ back: Yanıtlara dön
41
+ export: Dışa aktar
42
+ show: Cevapları göster
43
+ empty: Henüz cevap bulunmuyor
44
+ export:
45
+ answer:
46
+ title: '#%{number} yanıt'
47
+ export_response:
48
+ title: survey_user_answers _%{token}
49
+ index:
50
+ title: "%{total} toplam yanıt"
51
+ show:
52
+ title: '%{number} cevap'
53
+ display_condition:
54
+ answer_option: Cevap seçeneği
55
+ condition_question: Soru
56
+ condition_type: Durum
57
+ condition_types:
58
+ answered: Cevaplanmış
59
+ equal: Eşittir
60
+ match: Metin içerir
61
+ not_answered: Cevaplanmadı
62
+ not_equal: Eşit değil
63
+ condition_value: Metin içerir
64
+ display_condition: Görüntüleme koşulları
65
+ mandatory: Bu koşul, diğer koşulların durumuna bakılmaksızın her zaman yerine getirilmelidir
66
+ remove: Kaldır
67
+ save_warning: Görüntüleme koşullarını yapılandırmadan önce formu kaydetmeyi unutmayın
68
+ select_answer_option: Cevap seçeneğini seçin
69
+ select_condition_question: Bir soru seçin
70
+ select_condition_type: Bir koşul türü seçin
31
71
  edit:
32
72
  save: Kayıt etmek
73
+ title: Anketi düzenleyin
33
74
  form:
34
75
  add_question: Soru ekle
76
+ add_separator: Ayırıcı ekle
35
77
  already_answered_warning: Form, bazı kullanıcılar tarafından zaten yanıtlandı, bu nedenle sorularını değiştiremezsiniz.
78
+ collapse: Tüm soruları daraltın
79
+ expand: Tüm soruları genişletin
80
+ preview: Önizleme
81
+ title: Formu düzenle
82
+ unpublished_warning: Form yayınlanmadı. Sorularını değiştirebilirsiniz, ancak bunu yapmak mevcut cevapları silecektir.
36
83
  matrix_row:
84
+ matrix_row: Satır
37
85
  remove: Kaldır
38
86
  statement: Beyan
39
87
  question:
40
88
  add_answer_option: Cevap seçeneği ekle
89
+ add_display_condition: Görüntü koşulu ekle
90
+ add_display_condition_info: Görüntüleme koşullarını yapılandırmak için formu kaydedin
91
+ add_matrix_row: Satır ekle
41
92
  any: herhangi
93
+ collapse: Daralt
42
94
  description: Açıklama
43
95
  down: Aşağı
96
+ expand: Genişlet
44
97
  question: Soru
45
98
  remove: Kaldır
46
99
  statement: Beyan
47
100
  up: yukarı
101
+ separator:
102
+ down: Aşağı
103
+ remove: Kaldır
104
+ separator: Ayraç
105
+ up: Yukarı
48
106
  update:
49
107
  invalid: Formu kaydederken bir sorun oluştu.
108
+ success: Başarıyla kaydedildi.
50
109
  errors:
51
110
  answer:
52
111
  body: Vücut boş olamaz
112
+ files:
113
+ extension_whitelist: 'Kabul edilen biçimler:'
114
+ images:
115
+ 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ı
53
120
  question_types:
54
121
  long_answer: Uzun cevap
122
+ matrix_multiple: Matris (Çoklu seçenek)
123
+ matrix_single: Matris (Tek seçenek)
55
124
  multiple_option: Çoklu seçenek
56
125
  short_answer: Kısa cevap
57
126
  single_option: Tek seçenek
58
- sorting: sınıflandırma
127
+ sorting: Sıralama
59
128
  questionnaires:
60
129
  answer:
61
130
  invalid: Formu yanıtlarken bir sorun oluştu.
131
+ max_choices_alert: Çok fazla seçenek seçilmiş
62
132
  success: Form başarıyla cevaplandı.
63
133
  question:
64
134
  max_choices: 'Maksimum seçenek: %{n}'
@@ -66,6 +136,8 @@ tr:
66
136
  answer_questionnaire:
67
137
  anonymous_user_message: <a href="%{sign_in_link}">Formu yanıtlamak için</a> veya <a href="%{sign_up_link}">hesabınızla giriş yapın</a>.
68
138
  title: Formu cevapla
139
+ current_step: '%{step} adım'
140
+ of_total_steps: '%{total_steps}'
69
141
  questionnaire_answered:
70
142
  body: Bu formu zaten cevapladınız.
71
143
  title: Zaten cevaplandı
@@ -75,11 +147,26 @@ tr:
75
147
  questionnaire_for_private_users:
76
148
  body: Form yalnızca özel kullanıcılar tarafından kullanılabilir
77
149
  title: Form kapatıldı
150
+ questionnaire_js_disabled:
151
+ body: Bu formun bazı özellikleri devre dışı bırakılacak. Deneyiminizi iyileştirmek için lütfen tarayıcınızda JavaScript'i etkinleştirin.
152
+ title: JavaScript devre dışı
153
+ questionnaire_not_published:
154
+ body: Bu form henüz yayınlanmadı.
78
155
  tos_agreement: Katılarak Hizmet Şartlarını kabul etmiş olursunuz.
79
156
  step_navigation:
80
157
  show:
81
158
  are_you_sure: Bu işlem geri alınamaz ve cevaplarınızı düzenleyemezsiniz. Emin misiniz?
159
+ back: Geri
160
+ continue: Devam et
82
161
  submit: Gönder
83
162
  user_answers_serializer:
163
+ body: Cevap
164
+ completion: Tamamlanma
84
165
  created_at: Yanıtlandı
85
166
  id: Cevap kimliği
167
+ ip_hash: IP Hash
168
+ question: Soru
169
+ registered: Kayıtlı
170
+ session_token: Kullanıcı tanımlayıcı
171
+ unregistered: Kayıtlı değil
172
+ user_status: Kullanıcı durumu
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddSaltToDecidimFormsQuestionnaires < ActiveRecord::Migration[5.2]
4
+ class Questionnaire < ApplicationRecord
5
+ self.table_name = :decidim_forms_questionnaires
6
+ end
7
+
8
+ def change
9
+ add_column :decidim_forms_questionnaires, :salt, :string
10
+
11
+ Questionnaire.find_each do |questionnaire|
12
+ questionnaire.salt = Decidim::Tokenizer.random_salt
13
+ questionnaire.save!
14
+ end
15
+ end
16
+ end
@@ -13,6 +13,7 @@ FactoryBot.define do
13
13
  end
14
14
  tos { generate_localized_title }
15
15
  questionnaire_for { build(:participatory_process) }
16
+ salt { SecureRandom.hex(32) }
16
17
 
17
18
  trait :with_questions do
18
19
  questions do
@@ -16,7 +16,7 @@ module Decidim
16
16
  def serialize
17
17
  @answers.each_with_index.inject({}) do |serialized, (answer, idx)|
18
18
  serialized.update(
19
- answer_translated_attribute_name(:id) => answer.id,
19
+ answer_translated_attribute_name(:id) => answer.session_token,
20
20
  answer_translated_attribute_name(:created_at) => answer.created_at.to_s(:db),
21
21
  answer_translated_attribute_name(:ip_hash) => answer.ip_hash,
22
22
  answer_translated_attribute_name(:user_status) => answer_translated_attribute_name(answer.decidim_user_id.present? ? "registered" : "unregistered"),
@@ -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.23.1"
7
+ "0.23.6"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
4
+ version: 0.23.6
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:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-11-12 00:00:00.000000000 Z
14
+ date: 2021-05-10 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.23.1
22
+ version: 0.23.6
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.23.1
29
+ version: 0.23.6
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.23.1
64
+ version: 0.23.6
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.23.1
71
+ version: 0.23.6
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.23.1
78
+ version: 0.23.6
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.23.1
85
+ version: 0.23.6
86
86
  description: A forms gem for decidim.
87
87
  email:
88
88
  - josepjaume@gmail.com
@@ -238,12 +238,14 @@ files:
238
238
  - config/locales/pt.yml
239
239
  - config/locales/ro-RO.yml
240
240
  - config/locales/ru.yml
241
+ - config/locales/si-LK.yml
241
242
  - config/locales/sk-SK.yml
242
243
  - config/locales/sk.yml
243
244
  - config/locales/sl.yml
244
245
  - config/locales/so-SO.yml
245
246
  - config/locales/sr-CS.yml
246
247
  - config/locales/sv.yml
248
+ - config/locales/sw-KE.yml
247
249
  - config/locales/ti-ER.yml
248
250
  - config/locales/tr-TR.yml
249
251
  - config/locales/uk.yml
@@ -261,6 +263,7 @@ files:
261
263
  - db/migrate/20200130194123_create_decidim_forms_display_conditions.rb
262
264
  - db/migrate/20200225123810_create_decidim_forms_question_matrix_rows.rb
263
265
  - db/migrate/20200304152939_add_matrix_row_id_to_decidim_forms_answer_choices.rb
266
+ - db/migrate/20201110152921_add_salt_to_decidim_forms_questionnaires.rb
264
267
  - lib/decidim/api/questionnaire_entity_interface.rb
265
268
  - lib/decidim/exporters/form_pdf.rb
266
269
  - lib/decidim/exporters/form_pdf_controller_helper.rb
@@ -285,7 +288,7 @@ homepage: https://github.com/decidim/decidim
285
288
  licenses:
286
289
  - AGPL-3.0
287
290
  metadata: {}
288
- post_install_message:
291
+ post_install_message:
289
292
  rdoc_options: []
290
293
  require_paths:
291
294
  - lib
@@ -301,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
304
  version: '0'
302
305
  requirements: []
303
306
  rubygems_version: 3.0.3
304
- signing_key:
307
+ signing_key:
305
308
  specification_version: 4
306
309
  summary: Decidim forms
307
310
  test_files: []