decidim-forms 0.32.2 → 0.32.3
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/cells/decidim/forms/question_readonly/title_and_description.erb +5 -0
- data/app/commands/decidim/forms/response_questionnaire.rb +1 -1
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +1 -1
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +1 -1
- data/app/views/decidim/forms/questionnaires/_response.html.erb +1 -1
- data/config/locales/es.yml +1 -1
- data/db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb +14 -2
- data/decidim-forms.gemspec +1 -1
- data/lib/decidim/forms/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0302a38c207ff9ad3e5dda8548cf3382daf0faaa41e31c441811921566654d1
|
|
4
|
+
data.tar.gz: 0c5511aaeeb7a295ec27a4448b0cb4507f704cfbf3e88f542841b73a949ed3fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb004c173a184f39a423f846f007fe1616d7a2c4fef6d4a2295f9777a60053bffa9ce0ef9eac524ffc1ca45c6305d1786a8e1b23346b9c8ba4475192217d6903
|
|
7
|
+
data.tar.gz: 1aa65624891813f2e628083fa4e2003ac3f02d220555d6525a3e445b30ccc6c187814c7193afbe3fdcfa8b514dfa8238680da6aab27c4faa368a6f1b7c6bb9d4
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<li class="response-questionnaire__question" data-question-readonly>
|
|
2
2
|
<div class="response-questionnaire__step-heading">
|
|
3
3
|
<h3 class="h3"><%= decidim_escape_translated(model.body) %></h3>
|
|
4
|
+
<% if translated_attribute(model.description).present? %>
|
|
5
|
+
<div class="editor-content">
|
|
6
|
+
<%= decidim_sanitize_editor_admin translated_attribute(model.description) %>
|
|
7
|
+
</div>
|
|
8
|
+
<% end %>
|
|
4
9
|
<p class="response-questionnaire__question-description">
|
|
5
10
|
<em><%= t(model.question_type, scope: "decidim.forms.question_types") %></em>
|
|
6
11
|
</p>
|
|
@@ -79,7 +79,7 @@ module Decidim
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def clear_responses!
|
|
82
|
-
|
|
82
|
+
questionnaire.responses.where(user: current_user, session_token: form.context.session_token, ip_hash: form.context.ip_hash).destroy_all
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def response_questionnaire
|
|
@@ -143,7 +143,7 @@ module Decidim
|
|
|
143
143
|
# Returns the url to get the response options json (for the display conditions form)
|
|
144
144
|
# for the question with id = params[:id]
|
|
145
145
|
def response_options_url(params)
|
|
146
|
-
url_for([questionnaire.questionnaire_for,
|
|
146
|
+
url_for([questionnaire.questionnaire_for, decidim_url_params(params, action: :response_options, format: :json)])
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
# Implement this method in your controller to set the title
|
|
@@ -120,7 +120,7 @@ module Decidim
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
def questionnaire
|
|
123
|
-
@questionnaire ||= Questionnaire.includes(questions: :response_options).find_by(questionnaire_for:)
|
|
123
|
+
@questionnaire ||= Questionnaire.includes(questions: [:display_conditions, :response_options]).find_by(questionnaire_for:) # rubocop:disable Decidim/OrganizationScopedFinder -- questionnaire_for is scoped by the host controller
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
def spam_detected
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<% end %>
|
|
41
41
|
|
|
42
42
|
<% if translated_attribute(response.question.description).present? %>
|
|
43
|
-
<div class="response-questionnaire__question-description">
|
|
43
|
+
<div class="response-questionnaire__question-description editor-content">
|
|
44
44
|
<%= decidim_sanitize_editor_admin translated_attribute(response.question.description) %>
|
|
45
45
|
</div>
|
|
46
46
|
<% end %>
|
data/config/locales/es.yml
CHANGED
|
@@ -169,7 +169,7 @@ es:
|
|
|
169
169
|
matrix_multiple: Matriz (opción múltiple)
|
|
170
170
|
matrix_single: Matriz (opción única)
|
|
171
171
|
multiple_option: Opción múltiple
|
|
172
|
-
short_response: Respuesta
|
|
172
|
+
short_response: Respuesta corta
|
|
173
173
|
single_option: Opción única
|
|
174
174
|
sorting: Ordenación
|
|
175
175
|
title_and_description: Titulo y descripción
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class AddAnswerOptionsCounterCacheToQuestions < ActiveRecord::Migration[6.1]
|
|
4
|
+
class Question < ApplicationRecord
|
|
5
|
+
self.table_name = "decidim_forms_questions"
|
|
6
|
+
|
|
7
|
+
has_many :answer_options, class_name: "AnswerOption", foreign_key: "decidim_question_id"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class AnswerOption < ApplicationRecord
|
|
11
|
+
self.table_name = "decidim_forms_answer_options"
|
|
12
|
+
|
|
13
|
+
belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id", counter_cache: :answer_options_count
|
|
14
|
+
end
|
|
15
|
+
|
|
4
16
|
def change
|
|
5
17
|
add_column :decidim_forms_questions, :answer_options_count, :integer, null: false, default: 0
|
|
6
18
|
|
|
7
19
|
reversible do |dir|
|
|
8
20
|
dir.up do
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
Question.reset_column_information
|
|
22
|
+
Question.find_each do |record|
|
|
11
23
|
record.class.reset_counters(record.id, :answer_options)
|
|
12
24
|
end
|
|
13
25
|
end
|
data/decidim-forms.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
|
4
4
|
|
|
5
5
|
# Describe your gem and declare its dependencies:
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
|
-
version = "0.32.
|
|
7
|
+
version = "0.32.3"
|
|
8
8
|
s.version = version
|
|
9
9
|
s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva", "Rubén González Valero"]
|
|
10
10
|
s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com", "rbngzlv@gmail.com"]
|
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.32.
|
|
4
|
+
version: 0.32.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -18,42 +18,42 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - '='
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 0.32.
|
|
21
|
+
version: 0.32.3
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
requirements:
|
|
26
26
|
- - '='
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: 0.32.
|
|
28
|
+
version: 0.32.3
|
|
29
29
|
- !ruby/object:Gem::Dependency
|
|
30
30
|
name: decidim-admin
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
32
32
|
requirements:
|
|
33
33
|
- - '='
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: 0.32.
|
|
35
|
+
version: 0.32.3
|
|
36
36
|
type: :development
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
39
|
requirements:
|
|
40
40
|
- - '='
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: 0.32.
|
|
42
|
+
version: 0.32.3
|
|
43
43
|
- !ruby/object:Gem::Dependency
|
|
44
44
|
name: decidim-dev
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
47
|
- - '='
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: 0.32.
|
|
49
|
+
version: 0.32.3
|
|
50
50
|
type: :development
|
|
51
51
|
prerelease: false
|
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
|
54
54
|
- - '='
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: 0.32.
|
|
56
|
+
version: 0.32.3
|
|
57
57
|
description: A forms gem for decidim.
|
|
58
58
|
email:
|
|
59
59
|
- josepjaume@gmail.com
|