decidim-forms 0.27.4 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/cells/decidim/forms/answer_readonly/show.erb +1 -1
  4. data/app/cells/decidim/forms/matrix_readonly/show.erb +1 -1
  5. data/app/cells/decidim/forms/question_readonly/show.erb +7 -7
  6. data/app/cells/decidim/forms/question_readonly/title_and_description.erb +8 -0
  7. data/app/cells/decidim/forms/question_readonly_cell.rb +7 -0
  8. data/app/cells/decidim/forms/step_navigation/show.erb +13 -26
  9. data/app/cells/decidim/forms/step_navigation_cell.rb +7 -0
  10. data/app/commands/decidim/forms/answer_questionnaire.rb +31 -11
  11. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +3 -3
  12. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_answers.rb +1 -1
  13. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +3 -3
  14. data/app/forms/decidim/forms/answer_form.rb +7 -3
  15. data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
  16. data/app/helpers/decidim/forms/admin/application_helper.rb +1 -1
  17. data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_url_helper.rb +2 -2
  18. data/app/models/decidim/forms/answer.rb +1 -1
  19. data/app/models/decidim/forms/display_condition.rb +2 -2
  20. data/app/models/decidim/forms/question.rb +0 -4
  21. data/app/models/decidim/forms/questionnaire.rb +1 -1
  22. data/app/packs/entrypoints/decidim_forms.js +4 -0
  23. data/app/packs/src/decidim/forms/admin/collapsible_questions.js +12 -6
  24. data/app/packs/src/decidim/forms/admin/forms.js +7 -7
  25. data/app/packs/src/decidim/forms/display_conditions.component.js +3 -3
  26. data/app/packs/src/decidim/forms/forms.js +15 -9
  27. data/app/packs/src/decidim/forms/option_attached_inputs.component.js +1 -1
  28. data/app/packs/stylesheets/decidim/forms/forms.scss +82 -52
  29. data/app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss +13 -13
  30. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +2 -2
  31. data/app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb +2 -2
  32. data/app/presenters/decidim/forms/answer_option_presenter.rb +1 -1
  33. data/app/queries/decidim/forms/questionnaire_participants.rb +1 -1
  34. data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
  35. data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +1 -1
  36. data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
  37. data/app/views/decidim/forms/admin/questionnaires/_display_condition_template.html.erb +1 -1
  38. data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +52 -74
  39. data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
  40. data/app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb +1 -1
  41. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +147 -135
  42. data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +15 -13
  43. data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +69 -63
  44. data/app/views/decidim/forms/admin/questionnaires/answers/export/_answer.html.erb +4 -4
  45. data/app/views/decidim/forms/admin/questionnaires/answers/export/pdf.html.erb +1 -1
  46. data/app/views/decidim/forms/admin/questionnaires/answers/index.html.erb +41 -45
  47. data/app/views/decidim/forms/admin/questionnaires/answers/show.html.erb +13 -18
  48. data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +33 -6
  49. data/app/views/decidim/forms/questionnaires/_answer.html.erb +31 -27
  50. data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +78 -0
  51. data/app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb +11 -0
  52. data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +1 -1
  53. data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +3 -1
  54. data/app/views/decidim/forms/questionnaires/answers/_matrix_multiple.html.erb +44 -41
  55. data/app/views/decidim/forms/questionnaires/answers/_matrix_single.html.erb +44 -41
  56. data/app/views/decidim/forms/questionnaires/answers/_multiple_option.html.erb +7 -6
  57. data/app/views/decidim/forms/questionnaires/answers/_separator.html.erb +1 -1
  58. data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +3 -1
  59. data/app/views/decidim/forms/questionnaires/answers/_single_option.html.erb +13 -12
  60. data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +9 -12
  61. data/app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb +1 -1
  62. data/app/views/decidim/forms/questionnaires/show.html.erb +35 -144
  63. data/config/initializers/wicked_pdf.rb +1 -1
  64. data/config/locales/ar.yml +0 -6
  65. data/config/locales/ca.yml +7 -2
  66. data/config/locales/cs.yml +8 -3
  67. data/config/locales/de.yml +9 -4
  68. data/config/locales/el.yml +7 -2
  69. data/config/locales/en.yml +8 -3
  70. data/config/locales/es-MX.yml +7 -2
  71. data/config/locales/es-PY.yml +7 -2
  72. data/config/locales/es.yml +7 -2
  73. data/config/locales/eu.yml +22 -17
  74. data/config/locales/fi-plain.yml +7 -2
  75. data/config/locales/fi.yml +7 -2
  76. data/config/locales/fr-CA.yml +8 -3
  77. data/config/locales/fr.yml +8 -3
  78. data/config/locales/gl.yml +0 -4
  79. data/config/locales/hu.yml +1 -6
  80. data/config/locales/id-ID.yml +0 -4
  81. data/config/locales/it.yml +0 -6
  82. data/config/locales/ja.yml +6 -1
  83. data/config/locales/lb.yml +0 -6
  84. data/config/locales/lt.yml +9 -2
  85. data/config/locales/lv.yml +0 -6
  86. data/config/locales/nl.yml +0 -6
  87. data/config/locales/no.yml +0 -6
  88. data/config/locales/pl.yml +18 -2
  89. data/config/locales/pt-BR.yml +0 -6
  90. data/config/locales/pt.yml +0 -6
  91. data/config/locales/ro-RO.yml +7 -2
  92. data/config/locales/ru.yml +0 -3
  93. data/config/locales/sk.yml +0 -6
  94. data/config/locales/sq-AL.yml +1 -0
  95. data/config/locales/sv.yml +3 -6
  96. data/config/locales/th-TH.yml +1 -0
  97. data/config/locales/tr-TR.yml +0 -6
  98. data/config/locales/zh-CN.yml +0 -6
  99. data/config/locales/zh-TW.yml +7 -2
  100. data/lib/decidim/forms/engine.rb +8 -0
  101. data/lib/decidim/forms/test/factories.rb +6 -6
  102. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +127 -237
  103. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +18 -18
  104. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +14 -14
  105. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +60 -78
  106. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +6 -6
  107. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +25 -25
  108. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
  109. data/lib/decidim/forms/user_answers_serializer.rb +2 -2
  110. data/lib/decidim/forms/version.rb +1 -1
  111. metadata +24 -16
  112. data/app/packs/src/decidim/forms/autosortable_checkboxes.component.js +0 -83
  113. data/config/environment.rb +0 -0
@@ -1,81 +1,111 @@
1
- .questionnaire-question_readonly{
2
- font-weight: bold;
3
- font-size: .875rem;
1
+ .answer-questionnaire {
2
+ @apply border-t-2 border-background pt-8;
4
3
 
5
- p{
6
- margin-bottom: .5rem;
4
+ &__step {
5
+ @apply space-y-10;
7
6
  }
8
7
 
9
- em{
10
- font-weight: normal;
11
- font-size: 90%;
8
+ &__step-counter {
9
+ @apply inline-block text-lg text-black font-semibold bg-tertiary;
12
10
  }
13
11
 
14
- p + ul{
15
- margin-top: -.5rem;
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
- .questionnaire-question_readonly-answers{
20
- margin-bottom: .5rem;
20
+ &__question {
21
+ @apply space-y-4;
22
+ }
21
23
 
22
- &.single_option{
23
- list-style-type: disc;
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
- &.multiple_option{
27
- list-style-type: square;
28
+ &__question-description {
29
+ @apply text-gray-2;
28
30
  }
29
31
 
30
- &.sorting{
31
- list-style-type: circle;
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
- .questionnaire-question_readonly-answer{
36
- font-weight: normal;
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
- .questionnaire-question-matrix{
40
- display: block;
41
- overflow-x: auto;
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
- .collection-input{
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
- input[type="text"]{
51
- margin-top: auto;
52
- margin-bottom: auto;
77
+ &-container {
78
+ @apply space-y-4;
79
+
80
+ counter-reset: item;
53
81
  }
54
82
 
55
- input[type="checkbox"],
56
- input[type="radio"]{
57
- margin-bottom: 0;
83
+ input {
84
+ @apply hidden;
85
+ }
58
86
 
59
- & ~ input[type="text"]{
60
- margin-left: .5rem;
61
- }
87
+ svg {
88
+ @apply text-gray fill-current w-5 h-5;
62
89
  }
63
90
  }
64
91
 
65
- tr,
66
- tr:nth-child(2n){
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
- thead td{
72
- text-align: center;
96
+ &__tos {
97
+ @apply space-y-4 cursor-pointer;
98
+
99
+ div {
100
+ @apply text-sm;
101
+ }
73
102
  }
74
103
 
75
- td{
76
- min-width: 100px;
77
- border-right: 1px solid #f0f0f0;
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: 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: questionnaire, session_token: participant.session_token)
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 shouldn't need to call this class
10
- # directly, but here's an example:
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
@@ -13,7 +13,7 @@ module Decidim
13
13
  end
14
14
 
15
15
  def as_json(*_args)
16
- { id: id, body: translated_body }
16
+ { id:, body: translated_body }
17
17
  end
18
18
  end
19
19
  end
@@ -27,7 +27,7 @@ module Decidim
27
27
  end
28
28
 
29
29
  def participant(session_token)
30
- query.find_by(session_token: session_token)
30
+ query.find_by(session_token:)
31
31
  end
32
32
 
33
33
  def participants
@@ -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: question, editable: editable %>
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: question, editable: editable %>
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="card">
2
- <div class="card-divider">
3
- <h2 class="card-title">
4
- <%= edit_questionnaire_title %>
5
- <% unless template? questionnaire.questionnaire_for %>
6
- <% if allowed_to? :preview, :questionnaire %>
7
- <div class="button--title">
8
- <%= link_to t(".preview"), public_url, class: "button tiny button--simple", target: :_blank %>
9
- </div>
10
- <% end %>
11
- <% if questionnaire.answers.any? %>
12
- <div class="button--title">
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
- <div class="callout warning">
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
- form: question_form,
56
- id: tabs_id_for_question(blank_question),
57
- editable: questionnaire.questions_editable?,
58
- answer_option_template_selector: "#answer-option-template-dummy",
59
- display_condition_template_selector: "#display-condition-template-dummy",
60
- matrix_row_template_selector: "#matrix-row-template-dummy" %>
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
- form: question_form,
65
- id: tabs_id_for_question(blank_question),
66
- editable: questionnaire.questions_editable? %>
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
- form: question_form,
71
- id: tabs_id_for_question(blank_question),
72
- editable: questionnaire.questions_editable? %>
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
- <div class="callout warning">
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
- form: question_form,
90
- id: tabs_id_for_question(question),
91
- editable: questionnaire.questions_editable? %>
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
- form: question_form,
95
- id: tabs_id_for_question(question),
96
- editable: questionnaire.questions_editable? %>
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
- form: question_form,
100
- id: tabs_id_for_question(question),
101
- editable: questionnaire.questions_editable?,
102
- display_condition_template_selector: "#display-condition-template-#{index}",
103
- answer_option_template_selector: "#answer-option-template-#{index}",
104
- matrix_row_template_selector: "#matrix-row-template-#{index}" %>
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
- <button class="button add-question"><%= t(".add_question") %></button>
115
- <button class="button add-separator"><%= t(".add_separator") %></button>
116
- <button class="button add-title-and-description"><%= t(".add_title_and_description") %></button>
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
- <%= javascript_pack_tag "decidim_forms_admin", defer: false %>
96
+ <%= append_javascript_pack_tag "decidim_forms_admin" %>
121
97
 
122
98
  <% if questionnaire.questions_editable? %>
123
99
  <script>
124
- window.Decidim.createEditableForm()
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: question, editable: editable %>
5
+ <%= render "decidim/forms/admin/questionnaires/matrix_row", form: matrix_row_form, question:, editable: %>
6
6
  <% end %>
7
7
  </script>