decidim-forms 0.31.5 → 0.31.6
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.
- checksums.yaml +4 -4
- data/app/commands/decidim/forms/response_questionnaire.rb +2 -2
- data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
- data/app/forms/decidim/forms/response_form.rb +7 -7
- data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/responses/_files.html.erb +1 -1
- data/config/locales/eu.yml +1 -1
- data/db/data/20260616144141_rename_answers_to_responses.rb +31 -0
- data/lib/decidim/forms/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f876821d13528d9c5c2295a65210f8892d31c035b5ff979369580028845b8ce
|
|
4
|
+
data.tar.gz: 35112840ecae63ba1ccbf64d3fcc11027ab1376f14cc92db3659ae5b77d4f935
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1a7634cb60b39ea11d2c7b6495045ff36ed956cc032400ccba6f4af8f898c66cae7944bb12d17406d50addae122643a766f5f6821884af0e9ffa551670b1797
|
|
7
|
+
data.tar.gz: 9e59083b34e23307b39502ffe0799b1e7db17bb93865082434dc789efbbdc9aa644099c5d09c7c8ed1eac028490e253ff0fcea9dd5fb1b57f73a50b251dd36ec
|
|
@@ -59,7 +59,7 @@ module Decidim
|
|
|
59
59
|
# of this problem.
|
|
60
60
|
def reset_form_attachments
|
|
61
61
|
@form.responses.each do |response|
|
|
62
|
-
response.errors.add(:
|
|
62
|
+
response.errors.add(:add_attachments, :needs_to_be_reattached) if response.has_attachments? || response.has_error_in_attachments?
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -116,7 +116,7 @@ module Decidim
|
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
create_attachments if process_attachments?
|
|
119
|
-
|
|
119
|
+
attachment_cleanup!
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
@form = @main_form
|
|
@@ -30,7 +30,7 @@ module Decidim
|
|
|
30
30
|
|
|
31
31
|
def add_responses!(questionnaire:, session_token:, ip_hash:)
|
|
32
32
|
self.responses = questionnaire.questions.map do |question|
|
|
33
|
-
ResponseForm.from_model(Decidim::Forms::Response.where(question:, user: current_user, session_token:, ip_hash:).first_or_initialize)
|
|
33
|
+
ResponseForm.from_model(Decidim::Forms::Response.where(question:, user: current_user, session_token:, ip_hash:).first_or_initialize).with_context(context)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -12,7 +12,7 @@ module Decidim
|
|
|
12
12
|
attribute :choices, Array[ResponseChoiceForm]
|
|
13
13
|
attribute :matrix_choices, Array[ResponseChoiceForm]
|
|
14
14
|
|
|
15
|
-
attachments_attribute :
|
|
15
|
+
attachments_attribute :attachments
|
|
16
16
|
|
|
17
17
|
validates :body, presence: true, if: :mandatory_body?
|
|
18
18
|
validates :selected_choices, presence: true, if: :mandatory_choices?
|
|
@@ -20,7 +20,7 @@ module Decidim
|
|
|
20
20
|
validate :max_choices, if: -> { question.max_choices }
|
|
21
21
|
validate :all_choices, if: :sorting?
|
|
22
22
|
validate :min_choices, if: -> { question.matrix? && question.mandatory? }
|
|
23
|
-
validate :
|
|
23
|
+
validate :attachments_present, if: -> { question.question_type == "files" && question.mandatory? }
|
|
24
24
|
validate :max_characters, if: -> { question.max_characters.positive? }
|
|
25
25
|
|
|
26
26
|
delegate :mandatory_body?, :mandatory_choices?, :matrix?, to: :question
|
|
@@ -44,7 +44,7 @@ module Decidim
|
|
|
44
44
|
def map_model(model)
|
|
45
45
|
self.question_id = model.decidim_question_id
|
|
46
46
|
self.question = model.question
|
|
47
|
-
self.
|
|
47
|
+
self.attachments = model.attachments
|
|
48
48
|
|
|
49
49
|
self.choices = model.choices.map do |choice|
|
|
50
50
|
ResponseChoiceForm.from_model(choice)
|
|
@@ -82,11 +82,11 @@ module Decidim
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def has_attachments?
|
|
85
|
-
question.has_attachments? && errors[:
|
|
85
|
+
question.has_attachments? && errors[:add_attachments].empty? && add_attachments.present?
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def has_error_in_attachments?
|
|
89
|
-
errors[:
|
|
89
|
+
errors[:add_attachments].present?
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def sorting?
|
|
@@ -141,8 +141,8 @@ module Decidim
|
|
|
141
141
|
I18n.t("questionnaires.question.max_choices", scope: "decidim.forms", n: question.max_choices)
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
-
def
|
|
145
|
-
errors.add(:
|
|
144
|
+
def attachments_present
|
|
145
|
+
errors.add(:add_attachments, :blank) if add_attachments.empty? && errors[:add_attachments].empty?
|
|
146
146
|
end
|
|
147
147
|
end
|
|
148
148
|
end
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<%= invisible_captcha %>
|
|
19
19
|
<% response_idx = 0 %>
|
|
20
20
|
<% @form.responses_by_step.each_with_index do |step_responses, step_index| %>
|
|
21
|
-
<div id="step-<%= step_index %>" class="response-questionnaire__step" <%= "hidden" if
|
|
21
|
+
<div id="step-<%= step_index %>" class="response-questionnaire__step" <%= "hidden" if step_index.positive? %>>
|
|
22
22
|
|
|
23
23
|
<% if @form.total_steps > 1 %>
|
|
24
24
|
<p class="response-questionnaire__step-counter">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= response_form.upload :
|
|
1
|
+
<%= response_form.upload :add_attachments, attachments: response.attachments, label: false, multiple: true, id: field_id, disabled:, button_class: "button button__lg button__transparent-secondary w-full" %>
|
data/config/locales/eu.yml
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class RenameAnswersToResponses < ActiveRecord::Migration[7.2]
|
|
4
|
+
class Attachment < ApplicationRecord
|
|
5
|
+
self.table_name = "decidim_attachments"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class ActionLog < ApplicationRecord
|
|
9
|
+
self.table_name = "decidim_action_logs"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class Version < ApplicationRecord
|
|
13
|
+
self.table_name = "versions"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def up
|
|
17
|
+
# rubocop:disable Rails/SkipsModelValidations
|
|
18
|
+
Attachment.where(attached_to_type: "Decidim::Forms::Answer").update_all(attached_to_type: "Decidim::Forms::Response")
|
|
19
|
+
ActionLog.where(resource_type: "Decidim::Forms::Answer").update_all(resource_type: "Decidim::Forms::Response")
|
|
20
|
+
Version.where(item_type: "Decidim::Forms::Answer").update_all(item_type: "Decidim::Forms::Response")
|
|
21
|
+
# rubocop:enable Rails/SkipsModelValidations
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def down
|
|
25
|
+
# rubocop:disable Rails/SkipsModelValidations
|
|
26
|
+
Attachment.where(attached_to_type: "Decidim::Forms::Response").update_all(attached_to_type: "Decidim::Forms::Answer")
|
|
27
|
+
ActionLog.where(resource_type: "Decidim::Forms::Response").update_all(resource_type: "Decidim::Forms::Answer")
|
|
28
|
+
Version.where(item_type: "Decidim::Forms::Response").update_all(item_type: "Decidim::Forms::Answer")
|
|
29
|
+
# rubocop:enable Rails/SkipsModelValidations
|
|
30
|
+
end
|
|
31
|
+
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.31.
|
|
4
|
+
version: 0.31.6
|
|
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: 2026-
|
|
14
|
+
date: 2026-07-06 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: decidim-core
|
|
@@ -19,42 +19,42 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - '='
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.31.
|
|
22
|
+
version: 0.31.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.31.
|
|
29
|
+
version: 0.31.6
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: decidim-admin
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
33
|
requirements:
|
|
34
34
|
- - '='
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 0.31.
|
|
36
|
+
version: 0.31.6
|
|
37
37
|
type: :development
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
|
41
41
|
- - '='
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.31.
|
|
43
|
+
version: 0.31.6
|
|
44
44
|
- !ruby/object:Gem::Dependency
|
|
45
45
|
name: decidim-dev
|
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
|
47
47
|
requirements:
|
|
48
48
|
- - '='
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 0.31.
|
|
50
|
+
version: 0.31.6
|
|
51
51
|
type: :development
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
55
|
- - '='
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 0.31.
|
|
57
|
+
version: 0.31.6
|
|
58
58
|
description: A forms gem for decidim.
|
|
59
59
|
email:
|
|
60
60
|
- josepjaume@gmail.com
|
|
@@ -244,6 +244,7 @@ files:
|
|
|
244
244
|
- config/locales/vi.yml
|
|
245
245
|
- config/locales/zh-CN.yml
|
|
246
246
|
- config/locales/zh-TW.yml
|
|
247
|
+
- db/data/20260616144141_rename_answers_to_responses.rb
|
|
247
248
|
- db/migrate/20170511092231_create_decidim_forms_questionnaires.rb
|
|
248
249
|
- db/migrate/20170515090916_create_decidim_forms_questions.rb
|
|
249
250
|
- db/migrate/20170515144119_create_decidim_forms_answers.rb
|