decidim-forms 0.29.2 → 0.30.0.rc2

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/forms/step_navigation_cell.rb +18 -5
  3. data/app/commands/decidim/forms/admin/update_questionnaire.rb +1 -82
  4. data/app/commands/decidim/forms/admin/update_questions.rb +109 -0
  5. data/app/commands/decidim/forms/answer_questionnaire.rb +10 -3
  6. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +39 -3
  7. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_answers.rb +2 -2
  8. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +12 -4
  9. data/app/forms/decidim/forms/admin/display_condition_form.rb +1 -1
  10. data/app/forms/decidim/forms/admin/questionnaire_form.rb +0 -9
  11. data/app/forms/decidim/forms/admin/questions_form.rb +18 -0
  12. data/app/forms/decidim/forms/answer_choice_form.rb +5 -0
  13. data/app/forms/decidim/forms/answer_form.rb +1 -0
  14. data/app/forms/decidim/forms/questionnaire_form.rb +7 -0
  15. data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_pagination_helper.rb +1 -1
  16. data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_url_helper.rb +5 -5
  17. data/app/jobs/decidim/forms/export_questionnaire_answers_job.rb +5 -1
  18. data/app/models/decidim/forms/answer_choice.rb +0 -2
  19. data/app/models/decidim/forms/answer_option.rb +1 -1
  20. data/app/models/decidim/forms/question.rb +10 -0
  21. data/app/packs/entrypoints/decidim_forms.js +0 -1
  22. data/app/packs/entrypoints/decidim_forms_admin.js +6 -0
  23. data/app/packs/src/decidim/forms/admin/publish_answers_buttons.js +72 -0
  24. data/app/packs/src/decidim/forms/forms.js +22 -18
  25. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +1 -1
  26. data/app/presenters/decidim/forms/admin_log/question_presenter.rb +31 -0
  27. data/app/queries/decidim/forms/questionnaire_user_answers.rb +1 -1
  28. data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +1 -1
  29. data/app/views/decidim/forms/admin/questionnaires/_display_condition_template.html.erb +1 -1
  30. data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +0 -89
  31. data/app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb +1 -1
  32. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +3 -3
  33. data/app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb +80 -0
  34. data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +0 -20
  35. data/app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb +47 -0
  36. data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +8 -1
  37. data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +1 -1
  38. data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +12 -6
  39. data/app/views/decidim/forms/questionnaires/edit.html.erb +47 -0
  40. data/app/views/decidim/forms/questionnaires/show.html.erb +13 -2
  41. data/config/assets.rb +1 -2
  42. data/config/locales/bg.yml +0 -2
  43. data/config/locales/ca.yml +46 -6
  44. data/config/locales/cs.yml +45 -5
  45. data/config/locales/de.yml +45 -5
  46. data/config/locales/el.yml +0 -2
  47. data/config/locales/en.yml +45 -5
  48. data/config/locales/es-MX.yml +45 -5
  49. data/config/locales/es-PY.yml +45 -5
  50. data/config/locales/es.yml +45 -5
  51. data/config/locales/eu.yml +45 -5
  52. data/config/locales/fi-plain.yml +45 -5
  53. data/config/locales/fi.yml +45 -5
  54. data/config/locales/fr-CA.yml +37 -5
  55. data/config/locales/fr.yml +37 -5
  56. data/config/locales/ja.yml +46 -1
  57. data/config/locales/lt.yml +0 -2
  58. data/config/locales/pl.yml +0 -2
  59. data/config/locales/ro-RO.yml +22 -17
  60. data/config/locales/zh-TW.yml +0 -2
  61. data/db/migrate/20190315203056_add_session_token_to_decidim_forms_answers.rb +1 -1
  62. data/db/migrate/20241122142230_add_survey_answers_published_at_to_questions.rb +7 -0
  63. data/decidim-forms.gemspec +1 -2
  64. data/lib/decidim/api/answer_option_type.rb +1 -1
  65. data/lib/decidim/api/question_type.rb +4 -4
  66. data/lib/decidim/api/questionnaire_type.rb +4 -4
  67. data/lib/decidim/exporters/form_pdf.rb +114 -11
  68. data/lib/decidim/forms/download_your_data_user_answers_serializer.rb +0 -4
  69. data/lib/decidim/forms/test/factories.rb +2 -2
  70. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +44 -4
  71. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +17 -17
  72. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +19 -21
  73. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +70 -94
  74. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +15 -18
  75. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +90 -125
  76. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +4 -25
  77. data/lib/decidim/forms/version.rb +1 -1
  78. data/lib/decidim/forms.rb +0 -1
  79. metadata +18 -32
  80. data/app/packs/entrypoints/decidim_questionnaire_answers_pdf.js +0 -1
  81. data/app/packs/entrypoints/decidim_questionnaire_answers_pdf.scss +0 -1
  82. data/app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss +0 -69
  83. data/app/views/decidim/forms/admin/questionnaires/answers/export/_answer.html.erb +0 -31
  84. data/app/views/decidim/forms/admin/questionnaires/answers/export/pdf.html.erb +0 -13
  85. data/app/views/layouts/decidim/forms/admin/questionnaires/questionnaire_answers.html.erb +0 -12
  86. data/config/initializers/wicked_pdf.rb +0 -26
  87. data/lib/decidim/exporters/form_pdf_controller_helper.rb +0 -13
@@ -1,69 +0,0 @@
1
- .questionnaire-answers {
2
- .header {
3
- h1 {
4
- margin: 0;
5
- padding: 25px;
6
- background: rgb(59, 69, 87);
7
- color: white;
8
- border-radius: 4px 4px 0 0;
9
- }
10
-
11
- .description {
12
- margin: 0;
13
- padding: 25px;
14
- background: #f6f6f6;
15
- color: #202751;
16
- border-radius: 0 0 4px 4px;
17
- }
18
- }
19
-
20
- .answer {
21
- margin-top: 25px;
22
- background: #f6f6f6;
23
- border-radius: 0 0 4px 4px;
24
-
25
- .title {
26
- page-break-inside: avoid;
27
- border-radius: 4px 4px 0 0;
28
- padding: 10px 25px;
29
- background: rgb(59, 69, 87);
30
- color: white;
31
- }
32
-
33
- .participant-info {
34
- margin-top: 0;
35
- padding: 10px 25px;
36
- width: 100%;
37
- text-align: center;
38
- background: #eee;
39
- color: #202751;
40
- page-break-inside: avoid;
41
-
42
- th:first-child {
43
- text-align: left;
44
- }
45
-
46
- td:first-child {
47
- text-align: left;
48
- }
49
-
50
- th:last-child {
51
- text-align: right;
52
- }
53
-
54
- td:last-child {
55
- text-align: right;
56
- }
57
- }
58
-
59
- .answers {
60
- padding: 25px;
61
-
62
- .question {
63
- page-break-inside: avoid;
64
- font-size: inherit;
65
- color: #202751;
66
- }
67
- }
68
- }
69
- }
@@ -1,31 +0,0 @@
1
- <div class="answer">
2
- <h2 class="title"><%= t(".title", number: participant_counter + 1) %></h2>
3
-
4
- <table class="participant-info">
5
- <thead>
6
- <tr>
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>
12
- </tr>
13
- </thead>
14
- <tbody>
15
- <tr>
16
- <td><%= participant.session_token %></td>
17
- <td><%= participant.status %></td>
18
- <td><%= participant.ip_hash %></td>
19
- <td><%= display_percentage(participant.completion) %></td>
20
- <td><%= l participant.answered_at, format: :short %></td>
21
- </tr>
22
- </tbody>
23
- </table>
24
-
25
- <div class="answers">
26
- <% participant.answers.each do |answer| %>
27
- <h3 class="question"><%= answer.question %></h3>
28
- <p><%= answer.body %></p>
29
- <% end %>
30
- </div>
31
- </div>
@@ -1,13 +0,0 @@
1
- <div class="questionnaire-answers">
2
- <div class="header">
3
- <h1><%= translated_attribute(questionnaire.title) %></h1>
4
- <div class="description">
5
- <%== translated_attribute(questionnaire.description).html_safe %>
6
- </div>
7
- <% if collection.count > 1 %>
8
- <h2><%= t("title", scope: "decidim.forms.admin.questionnaires.answers.index", total: collection.count) %></h2>
9
- <% end %>
10
- </div>
11
-
12
- <%= render partial: "decidim/forms/admin/questionnaires/answers/export/answer", collection:, locals: { questionnaire: }, as: :participant %>
13
- </div>
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="<%= I18n.locale %>" class="no-js">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="viewport" content="width=device-width">
6
- <%= wicked_pdf_stylesheet_pack_tag "decidim_questionnaire_answers_pdf" %>
7
- <title><%= @title %></title>
8
- </head>
9
- <body>
10
- <%= yield %>
11
- </body>
12
- </html>
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "wicked_pdf"
4
-
5
- # frozen_string_literal: true
6
-
7
- # WickedPDF Global Configuration
8
- #
9
- # Use this to set up shared configuration options for your entire application.
10
- # Any of the configuration options shown here can also be applied to single
11
- # models by passing arguments to the `render :pdf` call.
12
- #
13
- # To learn more, check out the README:
14
- #
15
- # https://github.com/mileszs/wicked_pdf/blob/master/README.md
16
-
17
- WickedPdf.configure do |config|
18
- # Path to the wkhtmltopdf executable: This usually is not needed if using
19
- # one of the wkhtmltopdf-binary family of gems.
20
- # or
21
- # config.exe_path = '/usr/local/bin/wkhtmltopdf',
22
-
23
- # Layout file to be used for all PDFs
24
- # (but can be overridden in `render :pdf` calls)
25
- # config.layout = 'pdf.html'
26
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Exporters
5
- # rubocop: disable Rails/ApplicationController
6
- # A dummy controller to render views while exporting questionnaires
7
- class FormPDFControllerHelper < ActionController::Base
8
- # rubocop: enable Rails/ApplicationController
9
- helper Decidim::TranslationsHelper
10
- helper Decidim::Forms::Admin::QuestionnaireAnswersHelper
11
- end
12
- end
13
- end