decidim-forms 0.27.9 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/cells/decidim/forms/answer_readonly/show.erb +1 -1
- data/app/cells/decidim/forms/matrix_readonly/show.erb +1 -1
- data/app/cells/decidim/forms/question_readonly/show.erb +8 -8
- data/app/cells/decidim/forms/question_readonly/title_and_description.erb +8 -0
- data/app/cells/decidim/forms/question_readonly_cell.rb +7 -0
- data/app/cells/decidim/forms/step_navigation/show.erb +13 -26
- data/app/cells/decidim/forms/step_navigation_cell.rb +7 -0
- data/app/commands/decidim/forms/answer_questionnaire.rb +31 -11
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +4 -4
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_answers.rb +1 -1
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +3 -3
- data/app/forms/decidim/forms/answer_form.rb +7 -3
- data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
- data/app/helpers/decidim/forms/admin/application_helper.rb +1 -1
- data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_url_helper.rb +2 -2
- data/app/models/decidim/forms/answer.rb +1 -1
- data/app/models/decidim/forms/display_condition.rb +2 -2
- data/app/models/decidim/forms/question.rb +0 -4
- data/app/models/decidim/forms/questionnaire.rb +1 -1
- data/app/packs/entrypoints/decidim_forms.js +4 -0
- data/app/packs/src/decidim/forms/admin/collapsible_questions.js +12 -6
- data/app/packs/src/decidim/forms/admin/forms.js +7 -7
- data/app/packs/src/decidim/forms/display_conditions.component.js +3 -3
- data/app/packs/src/decidim/forms/forms.js +15 -9
- data/app/packs/src/decidim/forms/option_attached_inputs.component.js +1 -1
- data/app/packs/stylesheets/decidim/forms/forms.scss +82 -52
- data/app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss +13 -13
- data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +2 -2
- data/app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb +2 -2
- data/app/presenters/decidim/forms/answer_option_presenter.rb +1 -1
- data/app/queries/decidim/forms/questionnaire_participants.rb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
- data/app/views/decidim/forms/admin/questionnaires/_display_condition_template.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +52 -74
- data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +147 -135
- data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +15 -13
- data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +69 -63
- data/app/views/decidim/forms/admin/questionnaires/answers/export/_answer.html.erb +4 -4
- data/app/views/decidim/forms/admin/questionnaires/answers/export/pdf.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/answers/index.html.erb +41 -45
- data/app/views/decidim/forms/admin/questionnaires/answers/show.html.erb +13 -18
- data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +33 -6
- data/app/views/decidim/forms/questionnaires/_answer.html.erb +31 -27
- data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +78 -0
- data/app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb +11 -0
- data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +3 -1
- data/app/views/decidim/forms/questionnaires/answers/_matrix_multiple.html.erb +44 -41
- data/app/views/decidim/forms/questionnaires/answers/_matrix_single.html.erb +44 -41
- data/app/views/decidim/forms/questionnaires/answers/_multiple_option.html.erb +7 -6
- data/app/views/decidim/forms/questionnaires/answers/_separator.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +3 -1
- data/app/views/decidim/forms/questionnaires/answers/_single_option.html.erb +13 -12
- data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +9 -12
- data/app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/show.html.erb +35 -144
- data/config/initializers/wicked_pdf.rb +1 -1
- data/config/locales/ar.yml +0 -6
- data/config/locales/bg.yml +0 -177
- data/config/locales/ca.yml +7 -2
- data/config/locales/cs.yml +8 -3
- data/config/locales/de.yml +9 -4
- data/config/locales/el.yml +7 -2
- data/config/locales/en.yml +8 -3
- data/config/locales/es-MX.yml +7 -2
- data/config/locales/es-PY.yml +7 -2
- data/config/locales/es.yml +7 -2
- data/config/locales/eu.yml +8 -3
- data/config/locales/fi-plain.yml +7 -2
- data/config/locales/fi.yml +8 -3
- data/config/locales/fr-CA.yml +8 -3
- data/config/locales/fr.yml +8 -3
- data/config/locales/gl.yml +0 -4
- data/config/locales/hu.yml +3 -9
- data/config/locales/id-ID.yml +0 -4
- data/config/locales/it.yml +0 -6
- data/config/locales/ja.yml +6 -1
- data/config/locales/lb.yml +0 -6
- data/config/locales/lt.yml +7 -2
- data/config/locales/lv.yml +0 -6
- data/config/locales/nl.yml +0 -6
- data/config/locales/no.yml +0 -6
- data/config/locales/pl.yml +6 -8
- data/config/locales/pt-BR.yml +0 -25
- data/config/locales/pt.yml +0 -6
- data/config/locales/ro-RO.yml +19 -14
- data/config/locales/ru.yml +0 -3
- data/config/locales/sk.yml +0 -6
- data/config/locales/sv.yml +32 -43
- data/config/locales/tr-TR.yml +0 -6
- data/config/locales/zh-CN.yml +0 -6
- data/config/locales/zh-TW.yml +7 -2
- data/lib/decidim/forms/engine.rb +8 -0
- data/lib/decidim/forms/test/factories.rb +37 -51
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +129 -239
- data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +18 -18
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +14 -14
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +60 -78
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +6 -6
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +25 -25
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
- data/lib/decidim/forms/user_answers_serializer.rb +1 -1
- data/lib/decidim/forms/version.rb +1 -1
- metadata +23 -18
- data/app/packs/src/decidim/forms/autosortable_checkboxes.component.js +0 -83
- data/config/locales/he-IL.yml +0 -1
- data/decidim-forms.gemspec +0 -34
@@ -1,81 +1,111 @@
|
|
1
|
-
.questionnaire
|
2
|
-
|
3
|
-
font-size: .875rem;
|
1
|
+
.answer-questionnaire {
|
2
|
+
@apply border-t-2 border-background pt-8;
|
4
3
|
|
5
|
-
|
6
|
-
|
4
|
+
&__step {
|
5
|
+
@apply space-y-10;
|
7
6
|
}
|
8
7
|
|
9
|
-
|
10
|
-
font-
|
11
|
-
font-size: 90%;
|
8
|
+
&__step-counter {
|
9
|
+
@apply inline-block text-lg text-black font-semibold bg-tertiary;
|
12
10
|
}
|
13
11
|
|
14
|
-
|
15
|
-
|
12
|
+
&__step-heading {
|
13
|
+
@apply space-y-4;
|
14
|
+
|
15
|
+
div {
|
16
|
+
@apply text-gray-2 text-lg;
|
17
|
+
}
|
16
18
|
}
|
17
|
-
}
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
&__question {
|
21
|
+
@apply space-y-4;
|
22
|
+
}
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
+
&__question-label {
|
25
|
+
@apply text-black text-xl font-semibold relative before:content-[attr(data-answer-idx)] before:w-6 before:h-6 md:before:absolute md:before:-left-4 md:before:-translate-x-full before:inline-flex before:justify-center before:rounded-full before:bg-background before:text-lg before:text-gray-2 before:font-semibold;
|
24
26
|
}
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
+
&__question-description {
|
29
|
+
@apply text-gray-2;
|
28
30
|
}
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
+
&__multiple-option,
|
33
|
+
&__single-option {
|
34
|
+
@apply text-gray-2 space-y-4;
|
35
|
+
|
36
|
+
label {
|
37
|
+
@apply flex cursor-pointer;
|
38
|
+
}
|
39
|
+
|
40
|
+
label + * {
|
41
|
+
@apply mt-2 w-full;
|
42
|
+
}
|
32
43
|
}
|
33
|
-
}
|
34
44
|
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
&__multiple-matrix,
|
46
|
+
&__single-matrix {
|
47
|
+
@apply text-gray-2 text-sm rounded overflow-x-auto;
|
48
|
+
|
49
|
+
table {
|
50
|
+
@apply w-full;
|
51
|
+
}
|
52
|
+
|
53
|
+
th,
|
54
|
+
td {
|
55
|
+
@apply border border-background px-2 py-2.5;
|
56
|
+
}
|
38
57
|
|
39
|
-
|
40
|
-
|
41
|
-
|
58
|
+
thead td,
|
59
|
+
th {
|
60
|
+
@apply bg-background font-normal;
|
61
|
+
}
|
62
|
+
|
63
|
+
td:not(:first-child) {
|
64
|
+
@apply text-center [&>*]:flex [&>*]:items-center [&>*]:justify-center;
|
65
|
+
}
|
66
|
+
|
67
|
+
input[type="text"] {
|
68
|
+
@apply min-w-[120px] w-full;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
&__sorting {
|
73
|
+
@apply flex items-center justify-between relative text-gray-2 pl-8 pr-2 py-2.5 border-2 border-background rounded cursor-pointer before:content-[counter(item)] before:absolute before:left-0 before:top-0 before:bg-background before:w-5 before:h-full before:grid before:place-items-center before:text-gray-2 before:font-bold;
|
42
74
|
|
43
|
-
|
44
|
-
display: flex;
|
45
|
-
align-items: center;
|
46
|
-
justify-content: center;
|
47
|
-
flex-grow: 1;
|
48
|
-
flex-basis: 0;
|
75
|
+
counter-increment: item;
|
49
76
|
|
50
|
-
|
51
|
-
|
52
|
-
|
77
|
+
&-container {
|
78
|
+
@apply space-y-4;
|
79
|
+
|
80
|
+
counter-reset: item;
|
53
81
|
}
|
54
82
|
|
55
|
-
input
|
56
|
-
|
57
|
-
|
83
|
+
input {
|
84
|
+
@apply hidden;
|
85
|
+
}
|
58
86
|
|
59
|
-
|
60
|
-
|
61
|
-
}
|
87
|
+
svg {
|
88
|
+
@apply text-gray fill-current w-5 h-5;
|
62
89
|
}
|
63
90
|
}
|
64
91
|
|
65
|
-
|
66
|
-
|
67
|
-
background: initial;
|
68
|
-
border-bottom: 1px solid #f0f0f0;
|
92
|
+
&__footer {
|
93
|
+
@apply flex flex-col gap-10 pt-10 border-t-2 border-background text-gray-2 only:border-t-0;
|
69
94
|
}
|
70
95
|
|
71
|
-
|
72
|
-
|
96
|
+
&__tos {
|
97
|
+
@apply space-y-4 cursor-pointer;
|
98
|
+
|
99
|
+
div {
|
100
|
+
@apply text-sm;
|
101
|
+
}
|
73
102
|
}
|
74
103
|
|
75
|
-
|
76
|
-
|
77
|
-
|
104
|
+
&__submit {
|
105
|
+
@apply flex items-center justify-between;
|
106
|
+
|
107
|
+
> *:only-child {
|
108
|
+
@apply ml-auto;
|
109
|
+
}
|
78
110
|
}
|
79
111
|
}
|
80
|
-
|
81
|
-
@import "stylesheets/decidim/forms/questionnaire-answers-pdf";
|
@@ -1,6 +1,6 @@
|
|
1
|
-
.questionnaire-answers{
|
2
|
-
.header{
|
3
|
-
h1{
|
1
|
+
.questionnaire-answers {
|
2
|
+
.header {
|
3
|
+
h1 {
|
4
4
|
margin: 0;
|
5
5
|
padding: 25px;
|
6
6
|
background: rgb(59, 69, 87);
|
@@ -8,7 +8,7 @@
|
|
8
8
|
border-radius: 4px 4px 0 0;
|
9
9
|
}
|
10
10
|
|
11
|
-
.description{
|
11
|
+
.description {
|
12
12
|
margin: 0;
|
13
13
|
padding: 25px;
|
14
14
|
background: #f6f6f6;
|
@@ -17,12 +17,12 @@
|
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
20
|
-
.answer{
|
20
|
+
.answer {
|
21
21
|
margin-top: 25px;
|
22
22
|
background: #f6f6f6;
|
23
23
|
border-radius: 0 0 4px 4px;
|
24
24
|
|
25
|
-
.title{
|
25
|
+
.title {
|
26
26
|
page-break-inside: avoid;
|
27
27
|
border-radius: 4px 4px 0 0;
|
28
28
|
padding: 10px 25px;
|
@@ -30,7 +30,7 @@
|
|
30
30
|
color: white;
|
31
31
|
}
|
32
32
|
|
33
|
-
.participant-info{
|
33
|
+
.participant-info {
|
34
34
|
margin-top: 0;
|
35
35
|
padding: 10px 25px;
|
36
36
|
width: 100%;
|
@@ -39,27 +39,27 @@
|
|
39
39
|
color: #202751;
|
40
40
|
page-break-inside: avoid;
|
41
41
|
|
42
|
-
th:first-child{
|
42
|
+
th:first-child {
|
43
43
|
text-align: left;
|
44
44
|
}
|
45
45
|
|
46
|
-
td:first-child{
|
46
|
+
td:first-child {
|
47
47
|
text-align: left;
|
48
48
|
}
|
49
49
|
|
50
|
-
th:last-child{
|
50
|
+
th:last-child {
|
51
51
|
text-align: right;
|
52
52
|
}
|
53
53
|
|
54
|
-
td:last-child{
|
54
|
+
td:last-child {
|
55
55
|
text-align: right;
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
|
-
.answers{
|
59
|
+
.answers {
|
60
60
|
padding: 25px;
|
61
61
|
|
62
|
-
.question{
|
62
|
+
.question {
|
63
63
|
page-break-inside: avoid;
|
64
64
|
font-size: inherit;
|
65
65
|
color: #202751;
|
@@ -34,7 +34,7 @@ module Decidim
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def answers
|
37
|
-
sibilings.map { |answer| QuestionnaireAnswerPresenter.new(answer:
|
37
|
+
sibilings.map { |answer| QuestionnaireAnswerPresenter.new(answer:) }
|
38
38
|
end
|
39
39
|
|
40
40
|
def first_short_answer
|
@@ -56,7 +56,7 @@ module Decidim
|
|
56
56
|
def sibilings
|
57
57
|
Answer.not_separator
|
58
58
|
.not_title_and_description
|
59
|
-
.where(questionnaire
|
59
|
+
.where(questionnaire:, session_token: participant.session_token)
|
60
60
|
.joins(:question).order("decidim_forms_questions.position ASC")
|
61
61
|
end
|
62
62
|
end
|
@@ -6,8 +6,8 @@ module Decidim
|
|
6
6
|
# This class holds the logic to present a `Decidim::Forms::Questionnaire`
|
7
7
|
# for the `AdminLog` log.
|
8
8
|
#
|
9
|
-
# Usage should be automatic and you
|
10
|
-
# directly, but here
|
9
|
+
# Usage should be automatic and you should not need to call this class
|
10
|
+
# directly, but here is an example:
|
11
11
|
#
|
12
12
|
# action_log = Decidim::ActionLog.last
|
13
13
|
# view_helpers # => this comes from the views
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<h2 class="card-title">
|
6
6
|
<span><%= t(".answer_option") %></span>
|
7
7
|
<% if editable %>
|
8
|
-
<button class="button small alert hollow remove-answer-option button--title">
|
8
|
+
<button class="button button__sm button__secondary small alert hollow remove-answer-option button--title">
|
9
9
|
<%= t(".remove") %>
|
10
10
|
</button>
|
11
11
|
<% end %>
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
<script type="text/template" class="decidim-answer-option-template decidim-template" id="<%= template_id %>">
|
4
4
|
<%= fields_for "questionnaire[questions][#{question.to_param}][answer_options][]", blank_answer_option do |answer_option_form| %>
|
5
|
-
<%= render "decidim/forms/admin/questionnaires/answer_option", form: answer_option_form, question
|
5
|
+
<%= render "decidim/forms/admin/questionnaires/answer_option", form: answer_option_form, question:, editable: %>
|
6
6
|
<% end %>
|
7
7
|
</script>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<h2 class="card-title">
|
6
6
|
<span><%= t(".display_condition") %></span>
|
7
7
|
<% if editable %>
|
8
|
-
<button class="button small alert hollow remove-display-condition button--title">
|
8
|
+
<button class="button button__sm button__secondary small alert hollow remove-display-condition button--title">
|
9
9
|
<%= t(".remove") %>
|
10
10
|
</button>
|
11
11
|
<% end %>
|
@@ -36,7 +36,7 @@
|
|
36
36
|
:condition_type,
|
37
37
|
options_from_collection_for_select(display_condition_types, :first, :last, display_condition.condition_type),
|
38
38
|
{ prompt: t(".select_condition_type"), label: t(".condition_type") },
|
39
|
-
disabled: !editable
|
39
|
+
disabled: !editable
|
40
40
|
)
|
41
41
|
%>
|
42
42
|
</div>
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
<script type="text/template" class="decidim-template" id="<%= template_id %>">
|
4
4
|
<%= fields_for "questionnaire[questions][#{question.to_param}][display_conditions][]", blank_display_condition do |display_condition_form| %>
|
5
|
-
<%= render "decidim/forms/admin/questionnaires/display_condition", form: display_condition_form, question
|
5
|
+
<%= render "decidim/forms/admin/questionnaires/display_condition", form: display_condition_form, question:, editable: %>
|
6
6
|
<% end %>
|
7
7
|
</script>
|
@@ -1,107 +1,81 @@
|
|
1
|
-
<div class="
|
2
|
-
<div class="card-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<%= export_dropdown(current_component, questionnaire.id) if allowed_to? :export_answers, :questionnaire %>
|
14
|
-
</div>
|
15
|
-
<div class="button--title">
|
16
|
-
<% if allowed_to? :show, :questionnaire_answers %>
|
17
|
-
<%= link_to t("actions.show", scope: "decidim.forms.admin.questionnaires"), questionnaire_participants_url, class: "button tiny button--title new" %>
|
18
|
-
<% end %>
|
19
|
-
</div>
|
20
|
-
<% else %>
|
21
|
-
<button class="button tiny button--title" disabled><%= t("empty", scope: "decidim.forms.admin.questionnaires.answers") %></button>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
</h2>
|
25
|
-
</div>
|
26
|
-
<div class="card-section">
|
27
|
-
<div class="row column">
|
28
|
-
<%= form.translated :text_field, :title, autofocus: true %>
|
29
|
-
</div>
|
30
|
-
<div class="row column">
|
31
|
-
<%= form.translated :editor, :description, toolbar: :full, lines: 30, label: t("models.components.description", scope: "decidim.forms.admin") %>
|
32
|
-
</div>
|
33
|
-
<div class="row column">
|
34
|
-
<%= form.translated :editor, :tos, toolbar: :content, lines: 10, label: t("models.components.tos", scope: "decidim.forms.admin") %>
|
1
|
+
<div class="form__wrapper">
|
2
|
+
<div class="card pt-4">
|
3
|
+
<div class="card-section">
|
4
|
+
<div class="row column">
|
5
|
+
<%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
|
6
|
+
</div>
|
7
|
+
<div class="row column">
|
8
|
+
<%= form.translated :editor, :description, toolbar: :full, lines: 30, label: t("models.components.description", scope: "decidim.forms.admin"), aria: { label: :description } %>
|
9
|
+
</div>
|
10
|
+
<div class="row column">
|
11
|
+
<%= form.translated :editor, :tos, toolbar: :content, lines: 10, label: t("models.components.tos", scope: "decidim.forms.admin"), aria: { label: :tos } %>
|
12
|
+
</div>
|
35
13
|
</div>
|
36
14
|
</div>
|
37
15
|
</div>
|
38
16
|
|
39
|
-
<div class="questionnaire-questions">
|
40
|
-
<div class="row column text-center">
|
41
|
-
<button type="button" class="button collapse-all"><%= t(".collapse") %></button>
|
42
|
-
<button type="button" class="button expand-all"><%= t(".expand") %></button>
|
17
|
+
<div class="questionnaire-questions form__wrapper">
|
18
|
+
<div class="row column text-center my-4">
|
19
|
+
<button type="button" class="button button__sm button__secondary collapse-all"><%= t(".collapse") %></button>
|
20
|
+
<button type="button" class="button button__sm button__secondary expand-all"><%= t(".expand") %></button>
|
43
21
|
</div>
|
44
22
|
|
45
23
|
<% if questionnaire.questions_editable? %>
|
46
24
|
<% if questionnaire.answers.any? && !questionnaire.published? %>
|
47
|
-
|
48
|
-
<%= t(".unpublished_warning") %>
|
49
|
-
</div>
|
25
|
+
<%= cell("decidim/announcement", t(".unpublished_warning"), callout_class: "warning" ) %>
|
50
26
|
<% end %>
|
51
27
|
|
52
28
|
<%= fields_for "questionnaire[questions][#{blank_question.to_param}]", blank_question do |question_form| %>
|
53
29
|
<script type="text/template" class="decidim-question-template decidim-template" id="question-template">
|
54
30
|
<%= render "decidim/forms/admin/questionnaires/question",
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
31
|
+
form: question_form,
|
32
|
+
id: tabs_id_for_question(blank_question),
|
33
|
+
editable: questionnaire.questions_editable?,
|
34
|
+
answer_option_template_selector: "#answer-option-template-dummy",
|
35
|
+
display_condition_template_selector: "#display-condition-template-dummy",
|
36
|
+
matrix_row_template_selector: "#matrix-row-template-dummy" %>
|
61
37
|
</script>
|
62
38
|
<script type="text/template" class="decidim-separator-template decidim-template" id="separator-template">
|
63
39
|
<%= render "decidim/forms/admin/questionnaires/separator",
|
64
|
-
|
65
|
-
|
66
|
-
|
40
|
+
form: question_form,
|
41
|
+
id: tabs_id_for_question(blank_question),
|
42
|
+
editable: questionnaire.questions_editable? %>
|
67
43
|
</script>
|
68
44
|
<script type="text/template" class="decidim-title-and-description-template decidim-template" id="title-and-description-template">
|
69
45
|
<%= render "decidim/forms/admin/questionnaires/title_and_description",
|
70
|
-
|
71
|
-
|
72
|
-
|
46
|
+
form: question_form,
|
47
|
+
id: tabs_id_for_question(blank_question),
|
48
|
+
editable: questionnaire.questions_editable? %>
|
73
49
|
</script>
|
74
50
|
<%= render "decidim/forms/admin/questionnaires/answer_option_template", form: question_form, editable: questionnaire.questions_editable?, template_id: "answer-option-template-dummy" %>
|
75
51
|
<%= render "decidim/forms/admin/questionnaires/display_condition_template", form: question_form, editable: questionnaire.questions_editable?, template_id: "display-condition-template-dummy" %>
|
76
52
|
<%= render "decidim/forms/admin/questionnaires/matrix_row_template", form: question_form, editable: questionnaire.questions_editable?, template_id: "matrix-row-template-dummy" %>
|
77
53
|
<% end %>
|
78
54
|
<% else %>
|
79
|
-
|
80
|
-
<%= t(".already_answered_warning") %>
|
81
|
-
</div>
|
55
|
+
<%= cell("decidim/announcement", t(".already_answered_warning"), callout_class: "warning" ) %>
|
82
56
|
<% end %>
|
83
57
|
|
84
|
-
<div class="questionnaire-questions-list">
|
58
|
+
<div class="questionnaire-questions-list flex flex-col py-6 gap-6 last:pb-0">
|
85
59
|
<% @form.questions.each_with_index do |question, index| %>
|
86
60
|
<%= fields_for "questionnaire[questions][]", question do |question_form| %>
|
87
61
|
<% if question.separator? %>
|
88
62
|
<%= render "decidim/forms/admin/questionnaires/separator",
|
89
|
-
|
90
|
-
|
91
|
-
|
63
|
+
form: question_form,
|
64
|
+
id: tabs_id_for_question(question),
|
65
|
+
editable: questionnaire.questions_editable? %>
|
92
66
|
<% elsif question.title_and_description? %>
|
93
67
|
<%= render "decidim/forms/admin/questionnaires/title_and_description",
|
94
|
-
|
95
|
-
|
96
|
-
|
68
|
+
form: question_form,
|
69
|
+
id: tabs_id_for_question(question),
|
70
|
+
editable: questionnaire.questions_editable? %>
|
97
71
|
<% else %>
|
98
72
|
<%= render "decidim/forms/admin/questionnaires/question",
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
73
|
+
form: question_form,
|
74
|
+
id: tabs_id_for_question(question),
|
75
|
+
editable: questionnaire.questions_editable?,
|
76
|
+
display_condition_template_selector: "#display-condition-template-#{index}",
|
77
|
+
answer_option_template_selector: "#answer-option-template-#{index}",
|
78
|
+
matrix_row_template_selector: "#matrix-row-template-#{index}" %>
|
105
79
|
<%= render "decidim/forms/admin/questionnaires/display_condition_template", form: question_form, editable: questionnaire.questions_editable?, template_id: "display-condition-template-#{index}" %>
|
106
80
|
<%= render "decidim/forms/admin/questionnaires/answer_option_template", form: question_form, editable: questionnaire.questions_editable?, template_id: "answer-option-template-#{index}" %>
|
107
81
|
<%= render "decidim/forms/admin/questionnaires/matrix_row_template", form: question_form, editable: questionnaire.questions_editable?, template_id: "matrix-row-template-#{index}" %>
|
@@ -111,16 +85,20 @@
|
|
111
85
|
</div>
|
112
86
|
|
113
87
|
<% if questionnaire.questions_editable? %>
|
114
|
-
<
|
115
|
-
|
116
|
-
|
88
|
+
<div class="mt-4">
|
89
|
+
<button class="button button__sm button__secondary add-question"><%= t(".add_question") %></button>
|
90
|
+
<button class="button button__sm button__secondary add-separator"><%= t(".add_separator") %></button>
|
91
|
+
<button class="button button__sm button__secondary add-title-and-description"><%= t(".add_title_and_description") %></button>
|
92
|
+
</div>
|
117
93
|
<% end %>
|
118
94
|
</div>
|
119
95
|
|
120
|
-
<%=
|
96
|
+
<%= append_javascript_pack_tag "decidim_forms_admin" %>
|
121
97
|
|
122
98
|
<% if questionnaire.questions_editable? %>
|
123
99
|
<script>
|
124
|
-
|
100
|
+
document.addEventListener("DOMContentLoaded", function () {
|
101
|
+
window.Decidim.createEditableForm();
|
102
|
+
});
|
125
103
|
</script>
|
126
104
|
<% end %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<h2 class="card-title">
|
6
6
|
<span><%= t(".matrix_row") %></span>
|
7
7
|
<% if editable %>
|
8
|
-
<button class="button small alert hollow remove-matrix-row button--title">
|
8
|
+
<button class="button button__sm button__secondary small alert hollow remove-matrix-row button--title">
|
9
9
|
<%= t(".remove") %>
|
10
10
|
</button>
|
11
11
|
<% end %>
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
<script type="text/template" class="decidim-matrix-row-template decidim-template" id="<%= template_id %>">
|
4
4
|
<%= fields_for "questionnaire[questions][#{question.to_param}][matrix_rows][]", blank_matrix_row do |matrix_row_form| %>
|
5
|
-
<%= render "decidim/forms/admin/questionnaires/matrix_row", form: matrix_row_form, question
|
5
|
+
<%= render "decidim/forms/admin/questionnaires/matrix_row", form: matrix_row_form, question:, editable: %>
|
6
6
|
<% end %>
|
7
7
|
</script>
|