decidim-forms 0.27.4 → 0.28.0.rc5

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 +2 -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 +3 -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 +2 -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/environment.rb +3 -0
  64. data/config/initializers/wicked_pdf.rb +1 -1
  65. data/config/locales/ar.yml +0 -6
  66. data/config/locales/ca.yml +7 -2
  67. data/config/locales/cs.yml +8 -3
  68. data/config/locales/de.yml +9 -4
  69. data/config/locales/el.yml +7 -2
  70. data/config/locales/en.yml +8 -3
  71. data/config/locales/es-MX.yml +7 -2
  72. data/config/locales/es-PY.yml +7 -2
  73. data/config/locales/es.yml +7 -2
  74. data/config/locales/eu.yml +22 -17
  75. data/config/locales/fi-plain.yml +7 -2
  76. data/config/locales/fi.yml +7 -2
  77. data/config/locales/fr-CA.yml +8 -3
  78. data/config/locales/fr.yml +8 -3
  79. data/config/locales/gl.yml +0 -4
  80. data/config/locales/hu.yml +1 -6
  81. data/config/locales/id-ID.yml +0 -4
  82. data/config/locales/it.yml +0 -6
  83. data/config/locales/ja.yml +6 -1
  84. data/config/locales/lb.yml +0 -6
  85. data/config/locales/lt.yml +9 -2
  86. data/config/locales/lv.yml +0 -6
  87. data/config/locales/nl.yml +0 -6
  88. data/config/locales/no.yml +0 -6
  89. data/config/locales/pl.yml +18 -2
  90. data/config/locales/pt-BR.yml +0 -6
  91. data/config/locales/pt.yml +0 -6
  92. data/config/locales/ro-RO.yml +7 -2
  93. data/config/locales/ru.yml +0 -3
  94. data/config/locales/sk.yml +0 -6
  95. data/config/locales/sq-AL.yml +1 -0
  96. data/config/locales/sv.yml +3 -6
  97. data/config/locales/th-TH.yml +1 -0
  98. data/config/locales/tr-TR.yml +0 -6
  99. data/config/locales/zh-CN.yml +0 -6
  100. data/config/locales/zh-TW.yml +7 -2
  101. data/lib/decidim/forms/engine.rb +8 -0
  102. data/lib/decidim/forms/test/factories.rb +6 -6
  103. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +127 -237
  104. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +18 -18
  105. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +14 -14
  106. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +60 -78
  107. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +6 -6
  108. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +25 -25
  109. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
  110. data/lib/decidim/forms/user_answers_serializer.rb +2 -2
  111. data/lib/decidim/forms/version.rb +1 -1
  112. metadata +24 -15
  113. data/app/packs/src/decidim/forms/autosortable_checkboxes.component.js +0 -83
@@ -1,159 +1,171 @@
1
1
  <% question = form.object %>
2
2
  <% is_expanded = question.errors.any? %>
3
-
4
- <div class="card questionnaire-question" id="<%= id %>-field">
5
- <div class="card-divider question-divider">
6
- <h2 class="card-title">
7
- <span>
8
- <% if editable %>
9
- <%== icon("move") %>
10
- <% end %>
11
- <%= dynamic_title(translated_attribute(question.body), class: "question-title-statement", max_length: 50, omission: "...", placeholder: t(".question")) %>
12
- </span>
13
-
14
- <button type="button" class="button small secondary button--title question--collapse" data-toggle="<%= id %>-question-card button--collapse-question-<%= id %> button--expand-question-<%= id %>">
15
- <span id="button--collapse-question-<%= id %>" data-toggler=".hide" class="icon-collapse <%= "hide" unless is_expanded %>">
16
- <%== icon("caret-top", aria_label: t(".collapse"), role: "img") %>
17
- </span>
18
-
19
- <span id="button--expand-question-<%= id %>" data-toggler=".hide" class="icon-expand <%= "hide" if is_expanded %>">
20
- <%== icon("caret-bottom", aria_label: t(".expand"), role: "img") %>
21
- </span>
22
- </button>
23
-
24
- <% if editable %>
25
- <button class="button small alert hollow move-up-question button--title">
26
- <%== "#{icon("arrow-top")} #{t(".up")}" %>
27
- </button>
28
-
29
- <button class="button small alert hollow move-down-question button--title">
30
- <%== "#{icon("arrow-bottom")} #{t(".down")}" %>
31
- </button>
32
-
33
- <button class="button small alert hollow remove-question button--title">
34
- <%= t(".remove") %>
35
- </button>
36
- <% end %>
37
- </h2>
38
- </div>
39
-
40
- <div class="card-section collapsible <%= "hide" unless is_expanded %>" data-toggler=".hide" id="<%= id %>-question-card">
41
- <div class="row column">
42
- <%=
43
- form.translated(
44
- :text_field,
45
- :body,
46
- tabs_id: id,
47
- label: t(".statement"),
48
- disabled: !editable
49
- )
50
- %>
3
+ <div class="card questionnaire-question" id="accordion-<%= id %>-field">
4
+ <div class="form__wrapper" data-component="accordion">
5
+ <div class="card-divider question-divider">
6
+ <h2 class="card-title flex items-center">
7
+ <span>
8
+ <% if editable %>
9
+ <%== icon("drag-move-2-fill") %>
10
+ <% end %>
11
+ <%= dynamic_title(translated_attribute(question.body), class: "question-title-statement", max_length: 50, omission: "...", placeholder: t(".question")) %>
12
+ </span>
13
+
14
+ <span class="ml-auto flex flex-row-reverse items-center gap-2">
15
+ <button type="button" class="question--collapse <%= "question-error" if is_expanded %>" data-controls="panel-<%= id %>-question-card">
16
+ <span class="icon-collapse">
17
+ <%== icon("arrow-up-s-line", aria_label: t(".collapse"), role: "img") %>
18
+ </span>
19
+
20
+ <span class="icon-expand">
21
+ <%== icon("arrow-down-s-line", aria_label: t(".expand"), role: "img") %>
22
+ </span>
23
+ </button>
24
+
25
+ <% if editable %>
26
+ <button class="button button__sm button__transparent-secondary small alert hollow move-up-question button--title">
27
+ <%= icon("arrow-up-line") %>
28
+ <%= t(".up") %>
29
+ </button>
30
+
31
+ <button class="button button__sm button__transparent-secondary small alert hollow move-down-question button--title">
32
+ <%= icon("arrow-down-line") %>
33
+ <%= t(".down") %>
34
+ </button>
35
+
36
+ <button class="button button__sm button__transparent-secondary small alert hollow remove-question button--title">
37
+ <%= icon("delete-bin-line") %>
38
+ <%= t(".remove") %>
39
+ </button>
40
+ <% end %>
41
+ </span>
42
+ </h2>
51
43
  </div>
52
44
 
53
- <div class="row column">
54
- <%=
55
- form.translated(
56
- :editor,
57
- :description,
58
- toolbar: :full,
59
- tabs_id: id,
60
- label: t(".description"),
61
- disabled: !editable
62
- )
63
- %>
64
- </div>
45
+ <div id="panel-<%= id %>-question-card" class="panel-question-card card-section collapsible <%= "panel-error" if is_expanded %>">
46
+ <div class="row column">
47
+ <%=
48
+ form.translated(
49
+ :text_field,
50
+ :body,
51
+ tabs_id: id,
52
+ label: t(".statement"),
53
+ disabled: !editable
54
+ )
55
+ %>
56
+ </div>
65
57
 
66
- <div class="row column">
67
- <%=
68
- form.check_box(
69
- :mandatory,
70
- disabled: !editable,
71
- label: t("activemodel.attributes.questionnaire_question.mandatory")
72
- )
73
- %>
74
- </div>
58
+ <div class="row column">
59
+ <%=
60
+ form.translated(
61
+ :editor,
62
+ :description,
63
+ toolbar: :full,
64
+ tabs_id: id,
65
+ label: t(".description"),
66
+ disabled: !editable
67
+ )
68
+ %>
69
+ </div>
75
70
 
76
- <div class="row column">
77
- <%=
78
- form.number_field(
79
- :max_characters,
80
- disabled: !editable,
81
- min: 0,
82
- label: t("activemodel.attributes.questionnaire_question.max_characters")
83
- )
84
- %>
85
- </div>
71
+ <div class="row column">
72
+ <%=
73
+ form.check_box(
74
+ :mandatory,
75
+ disabled: !editable,
76
+ label: t("activemodel.attributes.questionnaire_question.mandatory")
77
+ )
78
+ %>
79
+ </div>
86
80
 
87
- <div class="row column">
88
- <%=
89
- form.select(
90
- :question_type,
91
- options_from_collection_for_select(question_types, :first, :last, question.question_type),
92
- {},
93
- disabled: !editable
94
- )
95
- %>
96
- </div>
81
+ <div class="row column">
82
+ <%=
83
+ form.number_field(
84
+ :max_characters,
85
+ disabled: !editable,
86
+ min: 0,
87
+ label: t("activemodel.attributes.questionnaire_question.max_characters")
88
+ )
89
+ %>
90
+ </div>
97
91
 
98
- <% if question.persisted? %>
99
- <%= form.hidden_field :id, disabled: !editable %>
100
- <% end %>
92
+ <div class="row column">
93
+ <%=
94
+ form.select(
95
+ :question_type,
96
+ options_from_collection_for_select(question_types, :first, :last, question.question_type),
97
+ {},
98
+ disabled: !editable
99
+ )
100
+ %>
101
+ </div>
101
102
 
102
- <%= form.hidden_field :position, value: question.position || 0, disabled: !editable %>
103
- <%= form.hidden_field :deleted, disabled: !editable %>
103
+ <% if question.persisted? %>
104
+ <%= form.hidden_field :id, disabled: !editable %>
105
+ <% end %>
104
106
 
105
- <div class="questionnaire-question-matrix-rows" data-template="<%= matrix_row_template_selector %>">
106
- <div class="questionnaire-question-matrix-rows-list">
107
- <% question.matrix_rows_by_position.each do |matrix_row| %>
108
- <%= fields_for "questionnaire[questions][#{question.to_param}][matrix_rows][]", matrix_row do |matrix_row_form| %>
109
- <%= render "decidim/forms/admin/questionnaires/matrix_row", form: matrix_row_form, question: question, editable: editable %>
107
+ <%= form.hidden_field :position, value: question.position || 0, disabled: !editable %>
108
+ <%= form.hidden_field :deleted, disabled: !editable %>
109
+
110
+ <div class="row column">
111
+ <div class="questionnaire-question-matrix-rows" data-template="<%= matrix_row_template_selector %>">
112
+ <div class="questionnaire-question-matrix-rows-list">
113
+ <% question.matrix_rows_by_position.each do |matrix_row| %>
114
+ <%= fields_for "questionnaire[questions][#{question.to_param}][matrix_rows][]", matrix_row do |matrix_row_form| %>
115
+ <%= render "decidim/forms/admin/questionnaires/matrix_row", form: matrix_row_form, question:, editable: %>
116
+ <% end %>
117
+ <% end %>
118
+ </div>
119
+
120
+ <% if editable %>
121
+ <button class="button button__sm button__secondary add-matrix-row"><%= t(".add_matrix_row") %></button>
110
122
  <% end %>
111
- <% end %>
123
+ </div>
112
124
  </div>
113
125
 
114
- <% if editable %>
115
- <button class="button add-matrix-row"><%= t(".add_matrix_row") %></button>
116
- <% end %>
117
- </div>
118
-
119
- <div class="questionnaire-question-answer-options" data-template="<%= answer_option_template_selector %>">
120
- <div class="questionnaire-question-answer-options-list">
121
- <% question.answer_options.each do |answer_option| %>
122
- <%= fields_for "questionnaire[questions][#{question.to_param}][answer_options][]", answer_option do |answer_option_form| %>
123
- <%= render "decidim/forms/admin/questionnaires/answer_option", form: answer_option_form, question: question, editable: editable %>
126
+ <div class="questionnaire-question-answer-options" data-template="<%= answer_option_template_selector %>">
127
+ <div class="questionnaire-question-answer-options-list">
128
+ <% question.answer_options.each do |answer_option| %>
129
+ <%= fields_for "questionnaire[questions][#{question.to_param}][answer_options][]", answer_option do |answer_option_form| %>
130
+ <%= render "decidim/forms/admin/questionnaires/answer_option", form: answer_option_form, question:, editable: %>
131
+ <% end %>
124
132
  <% end %>
133
+ </div>
134
+
135
+ <% if editable %>
136
+ <div class="row column">
137
+ <button type="button" class="button button__sm button__secondary mt-4 add-answer-option"><%= t(".add_answer_option") %></button>
138
+ </div>
125
139
  <% end %>
126
140
  </div>
127
141
 
128
- <% if editable %>
129
- <button class="button add-answer-option"><%= t(".add_answer_option") %></button>
130
- <% end %>
131
- </div>
132
-
133
- <div class="row column questionnaire-question-max-choices">
134
- <%=
135
- form.select(
136
- :max_choices,
137
- (2..question.number_of_options),
138
- { include_blank: t(".any") },
139
- disabled: !editable
140
- )
141
- %>
142
- </div>
142
+ <div class="row column questionnaire-question-max-choices">
143
+ <%=
144
+ form.select(
145
+ :max_choices,
146
+ (2..question.number_of_options),
147
+ { include_blank: t(".any") },
148
+ disabled: !editable
149
+ )
150
+ %>
151
+ </div>
143
152
 
144
- <div class="questionnaire-question-display-conditions" data-template="<%= display_condition_template_selector %>">
145
- <div class="questionnaire-question-display-conditions-list">
146
- <% question.display_conditions.each do |display_condition| %>
147
- <%= fields_for "questionnaire[questions][#{question.to_param}][display_conditions][]", display_condition do |display_condition_form| %>
148
- <%= render "decidim/forms/admin/questionnaires/display_condition", form: display_condition_form, question: question, editable: editable %>
153
+ <div class="questionnaire-question-display-conditions" data-template="<%= display_condition_template_selector %>">
154
+ <div class="questionnaire-question-display-conditions-list">
155
+ <% question.display_conditions.each do |display_condition| %>
156
+ <%= fields_for "questionnaire[questions][#{question.to_param}][display_conditions][]", display_condition do |display_condition_form| %>
157
+ <%= render "decidim/forms/admin/questionnaires/display_condition", form: display_condition_form, question:, editable: %>
158
+ <% end %>
149
159
  <% end %>
160
+ </div>
161
+
162
+ <% if editable %>
163
+ <% disabled = !question.persisted? %>
164
+ <div class="row column">
165
+ <button <%= "disabled" if disabled %> title="<%= disabled ? t(".add_display_condition_info") : t(".add_display_condition_info") %>" class="button button__sm button__secondary mt-4 add-display-condition"><%= t(".add_display_condition") %></button>
166
+ </div>
150
167
  <% end %>
151
168
  </div>
152
-
153
- <% if editable %>
154
- <% disabled = !question.persisted? %>
155
- <button <%= "disabled" if disabled %> title="<%= disabled ? t(".add_display_condition_info") : t(".add_display_condition_info") %>" class="button add-display-condition"><%= t(".add_display_condition") %></button>
156
- <% end %>
157
169
  </div>
158
170
  </div>
159
171
  </div>
@@ -2,27 +2,29 @@
2
2
 
3
3
  <div class="card questionnaire-question" id="<%= id %>-field">
4
4
  <div class="card-divider question-divider">
5
- <h2 class="card-title">
5
+ <h2 class="card-title flex items-center">
6
6
  <span>
7
7
  <% if editable %>
8
- <%== icon("move") %>
8
+ <%== icon("drag-move-2-fill") %>
9
9
  <% end %>
10
10
  <%= dynamic_title(t(".separator"), class: "question-title-statement", max_length: 50, omission: "...", placeholder: t(".separator")) %>
11
11
  </span>
12
12
 
13
- <% if editable %>
14
- <button class="button small alert hollow move-up-question button--title">
15
- <%== "#{icon("arrow-top")} #{t(".up")}" %>
16
- </button>
13
+ <div class="flex items-center gap-x-4 ml-auto">
14
+ <% if editable %>
15
+ <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-up-question button--title">
16
+ <%== "#{icon("arrow-up-line")} #{t(".up")}" %>
17
+ </button>
17
18
 
18
- <button class="button small alert hollow move-down-question button--title">
19
- <%== "#{icon("arrow-bottom")} #{t(".down")}" %>
20
- </button>
19
+ <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-down-question button--title">
20
+ <%== "#{icon("arrow-down-line")} #{t(".down")}" %>
21
+ </button>
21
22
 
22
- <button class="button small alert hollow remove-question button--title">
23
- <%= t(".remove") %>
24
- </button>
25
- <% end %>
23
+ <button class="button button__sm button__transparent button__transparent-secondary small alert hollow remove-question button--title">
24
+ <%= t(".remove") %>
25
+ </button>
26
+ <% end %>
27
+ </div>
26
28
  </h2>
27
29
 
28
30
  <%=
@@ -1,80 +1,86 @@
1
1
  <% question = form.object %>
2
2
  <% is_expanded = question.errors.any? %>
3
3
 
4
- <div class="card questionnaire-question" id="<%= id %>-field">
5
- <div class="card-divider question-divider">
6
- <h2 class="card-title">
7
- <span>
8
- <% if editable %>
9
- <%== icon("move") %>
10
- <% end %>
11
- <%= dynamic_title(translated_attribute(question.body), class: "question-title-statement", max_length: 50, omission: "...", placeholder: t(".title_and_description")) %>
12
- </span>
13
-
14
- <button type="button" class="button small secondary button--title question--collapse" data-toggle="<%= id %>-question-card button--collapse-question-<%= id %> button--expand-question-<%= id %>">
15
- <span id="button--collapse-question-<%= id %>" data-toggler=".hide" class="icon-collapse <%= "hide" unless is_expanded %>">
16
- <%== icon("caret-top", aria_label: t(".collapse"), role: "img") %>
17
- </span>
18
-
19
- <span id="button--expand-question-<%= id %>" data-toggler=".hide" class="icon-expand <%= "hide" if is_expanded %>">
20
- <%== icon("caret-bottom", aria_label: t(".expand"), role: "img") %>
4
+ <div class="card questionnaire-question" id="accordion-<%= id %>-field">
5
+ <div data-component="accordion">
6
+ <div class="card-divider question-divider">
7
+ <h2 class="card-title flex items-center">
8
+ <span>
9
+ <% if editable %>
10
+ <%== icon("drag-move-2-fill") %>
11
+ <% end %>
12
+ <%= dynamic_title(translated_attribute(question.body), class: "question-title-statement", max_length: 50, omission: "...", placeholder: t(".title_and_description")) %>
21
13
  </span>
22
- </button>
14
+ <div class="ml-auto flex flex-row-reverse items-center gap-2">
15
+ <button type="button" class="question--collapse" data-controls="panel-<%= id %>-question-card">
16
+ <span class="icon-collapse">
17
+ <%== icon("arrow-up-s-line", aria_label: t(".collapse"), role: "img") %>
18
+ </span>
23
19
 
24
- <% if editable %>
25
- <button class="button small alert hollow move-up-question button--title">
26
- <%== "#{icon("arrow-top")} #{t(".up")}" %>
27
- </button>
20
+ <span class="icon-expand">
21
+ <%== icon("arrow-down-s-line", aria_label: t(".expand"), role: "img") %>
22
+ </span>
23
+ </button>
28
24
 
29
- <button class="button small alert hollow move-down-question button--title">
30
- <%== "#{icon("arrow-bottom")} #{t(".down")}" %>
31
- </button>
25
+ <% if editable %>
26
+ <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-up-question button--title">
27
+ <%= icon("arrow-up-line") %>
28
+ <%= t(".up") %>
29
+ </button>
32
30
 
33
- <button class="button small alert hollow remove-question button--title">
34
- <%= t(".remove") %>
35
- </button>
36
- <% end %>
37
- </h2>
38
- </div>
31
+ <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-down-question button--title">
32
+ <%= icon("arrow-down-line") %>
33
+ <%= t(".down") %>
34
+ </button>
39
35
 
40
- <div class="card-section collapsible <%= "hide" unless is_expanded %>" data-toggler=".hide" id="<%= id %>-question-card">
41
- <div class="row column">
42
- <%=
43
- form.translated(
44
- :text_field,
45
- :body,
46
- tabs_id: id,
47
- label: t(".title"),
48
- disabled: !editable
49
- )
50
- %>
36
+ <button class="button button__sm button__transparent button__transparent-secondary small alert hollow remove-question button--title">
37
+ <%= icon("delete-bin-line") %>
38
+ <%= t(".remove") %>
39
+ </button>
40
+ <% end %>
41
+ </div>
42
+ </h2>
51
43
  </div>
52
44
 
53
- <div class="row column">
45
+ <div id="panel-<%= id %>-question-card" class="card-section collapsible" aria-hidden="true">
46
+ <div class="row column">
47
+ <%=
48
+ form.translated(
49
+ :text_field,
50
+ :body,
51
+ tabs_id: id,
52
+ label: t(".title"),
53
+ disabled: !editable
54
+ )
55
+ %>
56
+ </div>
57
+
58
+ <div class="row column">
59
+ <%=
60
+ form.translated(
61
+ :editor,
62
+ :description,
63
+ toolbar: :full,
64
+ tabs_id: id,
65
+ label: t(".description"),
66
+ disabled: !editable
67
+ )
68
+ %>
69
+ </div>
70
+
54
71
  <%=
55
- form.translated(
56
- :editor,
57
- :description,
58
- toolbar: :full,
59
- tabs_id: id,
60
- label: t(".description"),
61
- disabled: !editable
72
+ form.hidden_field(
73
+ :question_type,
74
+ value: :title_and_description
62
75
  )
63
76
  %>
64
- </div>
65
77
 
66
- <%=
67
- form.hidden_field(
68
- :question_type,
69
- value: :title_and_description
70
- )
71
- %>
72
-
73
- <% if question.persisted? %>
74
- <%= form.hidden_field :id, disabled: !editable %>
75
- <% end %>
78
+ <% if question.persisted? %>
79
+ <%= form.hidden_field :id, disabled: !editable %>
80
+ <% end %>
76
81
 
77
- <%= form.hidden_field :position, value: question.position || 0, disabled: !editable %>
78
- <%= form.hidden_field :deleted, disabled: !editable %>
82
+ <%= form.hidden_field :position, value: question.position || 0, disabled: !editable %>
83
+ <%= form.hidden_field :deleted, disabled: !editable %>
84
+ </div>
79
85
  </div>
80
86
  </div>
@@ -5,10 +5,10 @@
5
5
  <thead>
6
6
  <tr>
7
7
  <th class='token'><%= t("session_token", scope: "decidim.forms.user_answers_serializer") %></th>
8
- <th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
9
- <th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
10
- <th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
11
- <th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
8
+ <th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
9
+ <th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
10
+ <th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
11
+ <th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
12
12
  </tr>
13
13
  </thead>
14
14
  <tbody>
@@ -9,5 +9,5 @@
9
9
  <% end %>
10
10
  </div>
11
11
 
12
- <%= render partial: "decidim/forms/admin/questionnaires/answers/export/answer", collection: collection, locals: { questionnaire: questionnaire }, as: :participant %>
12
+ <%= render partial: "decidim/forms/admin/questionnaires/answers/export/answer", collection:, locals: { questionnaire: }, as: :participant %>
13
13
  </div>
@@ -1,53 +1,49 @@
1
1
  <div class="card" id="answers">
2
- <div class="card-divider">
3
- <h2 class="card-title">
2
+ <div class="item_show__header">
3
+ <h2 class="item_show__header-title">
4
4
  <%= t ".title", total: @total %>
5
- <div class="button--title">
6
- <%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), questionnaire_url, class: "button tiny button--title new" %>
7
- </div>
5
+ <%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), questionnaire_url, class: "button button__sm button__secondary new" %>
8
6
  </h2>
9
7
  </div>
10
- <div class="card-section">
11
- <div class="table-scroll">
12
- <table class="table-list">
13
- <thead>
8
+ <div class="table-scroll">
9
+ <table class="table-list">
10
+ <thead>
11
+ <tr>
12
+ <th>#</th>
13
+ <th><%= first_table_th(@participants.first) %></th>
14
+ <th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
15
+ <th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
16
+ <th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
17
+ <th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
18
+ <th></th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <% @participants.each_with_index do |participant, idx| %>
14
23
  <tr>
15
- <th>#</th>
16
- <th><%= first_table_th(@participants.first) %></th>
17
- <th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
18
- <th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
19
- <th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
20
- <th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
21
- <th></th>
24
+ <td><%= idx + 1 + page_offset %></td>
25
+ <td>
26
+ <% if allowed_to? :show, :questionnaire_answers %>
27
+ <%= link_to first_table_td(participant), questionnaire_participant_answers_url(participant.session_token) %>
28
+ <% else %>
29
+ <%= first_table_td(participant) %></td>
30
+ <% end %>
31
+ <td><%= participant.status %></td>
32
+ <td><%= participant.ip_hash %></td>
33
+ <td><%= display_percentage(participant.completion) %></td>
34
+ <td><%= l participant.answered_at, format: :short %></td>
35
+ <td class="table-list__actions">
36
+ <% if allowed_to? :show, :questionnaire_answers %>
37
+ <%= icon_link_to "eye-line", questionnaire_participant_answers_url(participant.session_token), t("actions.show", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--eye", target: "_blank", data: { "external-link": false } %>
38
+ <% end %>
39
+ <% if allowed_to? :export_response, :questionnaire_answers %>
40
+ <%= icon_link_to "download-line", questionnaire_export_response_url(participant.session_token), t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--data-transfer-download" %>
41
+ <% end %>
42
+ </td>
22
43
  </tr>
23
- </thead>
24
- <tbody>
25
- <% @participants.each_with_index do |participant, idx| %>
26
- <tr>
27
- <td><%= idx + 1 + page_offset %></td>
28
- <td>
29
- <% if allowed_to? :show, :questionnaire_answers %>
30
- <%= link_to first_table_td(participant), questionnaire_participant_answers_url(participant.session_token) %>
31
- <% else %>
32
- <%= first_table_td(participant) %></td>
33
- <% end %>
34
- <td><%= participant.status %></td>
35
- <td><%= participant.ip_hash %></td>
36
- <td><%= display_percentage(participant.completion) %></td>
37
- <td><%= l participant.answered_at, format: :short %></td>
38
- <td class="table-list__actions">
39
- <% if allowed_to? :show, :questionnaire_answers %>
40
- <%= icon_link_to "eye", questionnaire_participant_answers_url(participant.session_token), t("actions.show", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--eye" %>
41
- <% end %>
42
- <% if allowed_to? :export_response, :questionnaire_answers %>
43
- <%= icon_link_to "data-transfer-download", questionnaire_export_response_url(participant.session_token), t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--data-transfer-download" %>
44
- <% end %>
45
- </td>
46
- </tr>
47
- <% end %>
48
- </tbody>
49
- </table>
50
- <%= paginate @query, theme: "decidim" %>
51
- </div>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
52
47
  </div>
53
48
  </div>
49
+ <%= decidim_paginate @query %>