decidim-forms 0.28.6 → 0.29.0.rc1

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/forms/question_readonly_cell.rb +0 -2
  3. data/app/cells/decidim/forms/step_navigation/show.erb +3 -3
  4. data/app/cells/decidim/forms/step_navigation_cell.rb +2 -3
  5. data/app/commands/decidim/forms/answer_questionnaire.rb +4 -4
  6. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +1 -1
  7. data/app/forms/decidim/forms/admin/questionnaire_form.rb +2 -2
  8. data/app/forms/decidim/forms/answer_form.rb +2 -2
  9. data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
  10. data/app/helpers/decidim/forms/application_helper.rb +2 -2
  11. data/app/models/decidim/forms/answer_choice.rb +0 -2
  12. data/app/models/decidim/forms/answer_option.rb +1 -1
  13. data/app/models/decidim/forms/display_condition.rb +11 -3
  14. data/app/models/decidim/forms/question_matrix_row.rb +1 -1
  15. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +7 -7
  16. data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
  17. data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
  18. data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
  19. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +4 -4
  20. data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +4 -4
  21. data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +4 -4
  22. data/app/views/decidim/forms/questionnaires/_answer.html.erb +1 -11
  23. data/config/initializers/wicked_pdf.rb +6 -4
  24. data/config/locales/ar.yml +10 -2
  25. data/config/locales/bg.yml +38 -2
  26. data/config/locales/ca.yml +11 -11
  27. data/config/locales/cs.yml +14 -4
  28. data/config/locales/de.yml +11 -11
  29. data/config/locales/el.yml +37 -2
  30. data/config/locales/en.yml +2 -2
  31. data/config/locales/es-MX.yml +14 -14
  32. data/config/locales/es-PY.yml +14 -14
  33. data/config/locales/es.yml +13 -13
  34. data/config/locales/eu.yml +14 -14
  35. data/config/locales/fi-plain.yml +9 -9
  36. data/config/locales/fi.yml +10 -10
  37. data/config/locales/fr-CA.yml +11 -11
  38. data/config/locales/fr.yml +11 -11
  39. data/config/locales/ga-IE.yml +5 -0
  40. data/config/locales/gl.yml +5 -2
  41. data/config/locales/hu.yml +11 -5
  42. data/config/locales/id-ID.yml +4 -2
  43. data/config/locales/it.yml +24 -2
  44. data/config/locales/ja.yml +7 -7
  45. data/config/locales/lb.yml +27 -2
  46. data/config/locales/lt.yml +37 -2
  47. data/config/locales/lv.yml +9 -2
  48. data/config/locales/nl.yml +23 -1
  49. data/config/locales/no.yml +27 -1
  50. data/config/locales/pl.yml +38 -1
  51. data/config/locales/pt-BR.yml +29 -1
  52. data/config/locales/pt.yml +26 -1
  53. data/config/locales/ro-RO.yml +41 -16
  54. data/config/locales/ru.yml +1 -2
  55. data/config/locales/sk.yml +7 -2
  56. data/config/locales/sl.yml +7 -0
  57. data/config/locales/sv.yml +52 -33
  58. data/config/locales/tr-TR.yml +22 -1
  59. data/config/locales/val-ES.yml +2 -0
  60. data/config/locales/zh-CN.yml +22 -1
  61. data/config/locales/zh-TW.yml +37 -2
  62. data/db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb +16 -0
  63. data/db/migrate/20240402095253_add_matrix_row_counter_cache_to_questions.rb +16 -0
  64. data/db/migrate/20240416111953_add_display_conditions_counter_cache_to_questions.rb +16 -0
  65. data/db/migrate/20240416113926_add_display_conditions_for_other_questions_counter_cache_to_questions.rb +16 -0
  66. data/decidim-forms.gemspec +3 -2
  67. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +44 -70
  68. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +12 -12
  69. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +10 -10
  70. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +85 -85
  71. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +8 -8
  72. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +82 -82
  73. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
  74. data/lib/decidim/forms/user_answers_serializer.rb +1 -1
  75. data/lib/decidim/forms/version.rb +1 -1
  76. metadata +31 -16
  77. data/config/locales/bn-BD.yml +0 -1
  78. data/config/locales/bs-BA.yml +0 -1
  79. data/config/locales/ca-IT.yml +0 -198
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fcafadfabb905a455b812a3746398cf2fd5a7cf78fc7a292d8d24445a944592
4
- data.tar.gz: 465b76b5cef40361da66f3e2d385282b85a7ecfa7d83c4a905412c323c369192
3
+ metadata.gz: 2293a9e3534dc50768b5ed1a7ac9e501ec9a531089ac49a33e31cf7c4660d7ed
4
+ data.tar.gz: da021b4ab46c20cdb1aaeaa1f5a8cd1aedd46cd411c22b74b6cfdf72c4440592
5
5
  SHA512:
6
- metadata.gz: 5f4732b065be9361a9ff7f6bdb39475a177899127963fc8544767db4f6cad26010061dd5d2d0ee60f0b548f7a22407adf182c1205b68382f22e6609991bafd34
7
- data.tar.gz: 58b65ebb7ee123b42746f7f56ce547640eb7aa5bfb99f44ab04533e70360dd30f00cd7e6a80e185a45ca6f5995526dd51613333612b2195a6d9c957d9a85ec76
6
+ metadata.gz: d72b88bb788cb143ff3c422f0f9df2a1dedeac476b30c0c393d6cee92a0664a48ab1ad4dd0ac55313a5b902c1efaa5f7b8d9a9b4086320aa35a14bb42f6d3344
7
+ data.tar.gz: d2c4966ec421a62dda538e4257934223a1708eb8f7c20b9c31947d5e87f67bf261ca669d7cd0ee790397353017df8c62936fd7a02aef6702f424c3a6a6ea58f5
@@ -4,8 +4,6 @@ module Decidim
4
4
  module Forms
5
5
  # This cell renders a question (readonly) of a questionnaire
6
6
  class QuestionReadonlyCell < Decidim::ViewModel
7
- include Decidim::SanitizeHelper
8
-
9
7
  def show
10
8
  return if model.separator?
11
9
  return render :title_and_description if model.title_and_description?
@@ -1,6 +1,6 @@
1
- <div class="form-general-submit answer-questionnaire__submit">
1
+ <div class="answer-questionnaire__submit layout-aside__ctas-buttons survey-section-buttons" data-sticky-buttons>
2
2
  <% if !first_step? %>
3
- <button type="button" class="button button__sm button__text-secondary" data-toggle="<%= [previous_step_dom_id, current_step_dom_id].join(" ") %>">
3
+ <button type="button" class="button button__sm button__transparent-secondary" data-toggle="<%= [previous_step_dom_id, current_step_dom_id].join(" ") %>" data-survey-buttons>
4
4
  <%= icon "arrow-left-line", class: "fill-current" %>
5
5
  <%= t("decidim.forms.step_navigation.show.back") %>
6
6
  </button>
@@ -14,7 +14,7 @@
14
14
  **confirm_data
15
15
  ) %>
16
16
  <% else %>
17
- <button type="button" class="button button__sm button__secondary" data-toggle="<%= [next_step_dom_id, current_step_dom_id].join(" ") %>">
17
+ <button type="button" class="button button__sm button__secondary" data-toggle="<%= [next_step_dom_id, current_step_dom_id].join(" ") %>" data-survey-buttons>
18
18
  <%= t("decidim.forms.step_navigation.show.continue") %>
19
19
  <%= icon "arrow-right-line", class: "fill-current" %>
20
20
  </button>
@@ -4,8 +4,6 @@ module Decidim
4
4
  module Forms
5
5
  # This cell renders the navigation of a questionnaire step.
6
6
  class StepNavigationCell < Decidim::ViewModel
7
- include Decidim::LayoutHelper
8
-
9
7
  def current_step_index
10
8
  model
11
9
  end
@@ -45,7 +43,8 @@ module Decidim
45
43
  def confirm_data
46
44
  { data: {
47
45
  confirm: t("decidim.forms.step_navigation.show.are_you_sure"),
48
- disable: true
46
+ disable: true,
47
+ data: "survey-buttons"
49
48
  } }
50
49
  end
51
50
  end
@@ -4,15 +4,15 @@ module Decidim
4
4
  module Forms
5
5
  # This command is executed when the user answers a Questionnaire.
6
6
  class AnswerQuestionnaire < Decidim::Command
7
+ delegate :current_user, to: :form
7
8
  include ::Decidim::MultipleAttachmentsMethods
8
9
 
9
10
  # Initializes a AnswerQuestionnaire Command.
10
11
  #
11
12
  # form - The form from which to get the data.
12
13
  # questionnaire - The current instance of the questionnaire to be answered.
13
- def initialize(form, current_user, questionnaire)
14
+ def initialize(form, questionnaire)
14
15
  @form = form
15
- @current_user = current_user
16
16
  @questionnaire = questionnaire
17
17
  end
18
18
 
@@ -34,7 +34,7 @@ module Decidim
34
34
  end
35
35
  end
36
36
 
37
- attr_reader :form, :questionnaire, :current_user
37
+ attr_reader :form, :questionnaire
38
38
 
39
39
  private
40
40
 
@@ -82,7 +82,7 @@ module Decidim
82
82
  Answer.transaction(requires_new: true) do
83
83
  form.responses_by_step.flatten.select(&:display_conditions_fulfilled?).each do |form_answer|
84
84
  answer = Answer.new(
85
- user: @current_user,
85
+ user: current_user,
86
86
  questionnaire: @questionnaire,
87
87
  question: form_answer.question,
88
88
  body: form_answer.body,
@@ -30,7 +30,7 @@ module Decidim
30
30
 
31
31
  @form = form(Decidim::Forms::QuestionnaireForm).from_params(params, session_token:, ip_hash:)
32
32
 
33
- Decidim::Forms::AnswerQuestionnaire.call(@form, current_user, questionnaire) do
33
+ Decidim::Forms::AnswerQuestionnaire.call(@form, questionnaire) do
34
34
  on(:ok) do
35
35
  # i18n-tasks-use t("decidim.forms.questionnaires.answer.success")
36
36
  flash[:notice] = I18n.t("answer.success", scope: i18n_flashes_scope)
@@ -8,8 +8,8 @@ module Decidim
8
8
  include TranslatableAttributes
9
9
 
10
10
  translatable_attribute :title, String
11
- translatable_attribute :description, Decidim::Attributes::RichText
12
- translatable_attribute :tos, Decidim::Attributes::RichText
11
+ translatable_attribute :description, String
12
+ translatable_attribute :tos, String
13
13
 
14
14
  attribute :published_at, Decidim::Attributes::TimeWithZone
15
15
  attribute :questions, Array[QuestionForm]
@@ -108,9 +108,9 @@ module Decidim
108
108
 
109
109
  def max_choices
110
110
  if matrix?
111
- errors.add(:choices, :too_many) if grouped_choices.any? { |choices| choices.count > question.max_choices }
111
+ errors.add(:choices, :too_many, count: question.max_choices) if grouped_choices.any? { |choices| choices.count > question.max_choices }
112
112
  elsif selected_choices.size > question.max_choices
113
- errors.add(:choices, :too_many)
113
+ errors.add(:choices, :too_many, count: question.max_choices)
114
114
  end
115
115
  end
116
116
 
@@ -33,7 +33,7 @@ module Decidim
33
33
  context.responses = attributes[:responses]
34
34
  end
35
35
 
36
- # Public: Splits reponses by step, keeping the separator.
36
+ # Public: Splits responses by step, keeping the separator.
37
37
  #
38
38
  # Returns an array of steps. Each step is a list of the questions in that
39
39
  # step, including the separator.
@@ -8,11 +8,11 @@ module Decidim
8
8
  def show_represent_user_group?
9
9
  model_name = questionnaire_for.model_name.element
10
10
 
11
- permited_models.include?(model_name)
11
+ permitted_models.include?(model_name)
12
12
  end
13
13
  alias show_public_participation? show_represent_user_group?
14
14
 
15
- def permited_models
15
+ def permitted_models
16
16
  %(meeting)
17
17
  end
18
18
  end
@@ -17,8 +17,6 @@ module Decidim
17
17
  optional: true
18
18
 
19
19
  validates :matrix_row, presence: true, if: -> { answer.question.matrix? }
20
-
21
- default_scope { left_outer_joins(:matrix_row).order(arel_table[:position].asc, Decidim::Forms::QuestionMatrixRow.arel_table[:position].asc, arel_table[:id].asc) }
22
20
  end
23
21
  end
24
22
  end
@@ -9,7 +9,7 @@ module Decidim
9
9
 
10
10
  translatable_fields :body
11
11
 
12
- belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id"
12
+ belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id", counter_cache: true
13
13
 
14
14
  has_many :display_conditions,
15
15
  class_name: "DisplayCondition",
@@ -7,16 +7,24 @@ module Decidim
7
7
  # that we want to display or hide based on some conditions, and :condition_question
8
8
  # is the question the answers of which are checked against the conditions.
9
9
  # Conditions can be whether the question is answered ("answered") or it is not ("not_answered"),
10
- # if the selected answer option is ("equal") or is not ("not_equal") a given one, or whethe
10
+ # if the selected answer option is ("equal") or is not ("not_equal") a given one, or whether
11
11
  # the text value of the answer matches a string ("match").
12
12
  class DisplayCondition < Forms::ApplicationRecord
13
13
  enum condition_type: [:answered, :not_answered, :equal, :not_equal, :match], _prefix: true
14
14
 
15
15
  # Question which will be displayed or hidden
16
- belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id", inverse_of: :display_conditions
16
+ belongs_to :question,
17
+ class_name: "Question",
18
+ foreign_key: "decidim_question_id",
19
+ inverse_of: :display_conditions,
20
+ counter_cache: :display_conditions_count
17
21
 
18
22
  # Question the answers of which are checked against conditions
19
- belongs_to :condition_question, class_name: "Question", foreign_key: "decidim_condition_question_id", inverse_of: :display_conditions_for_other_questions
23
+ belongs_to :condition_question,
24
+ class_name: "Question",
25
+ foreign_key: "decidim_condition_question_id",
26
+ inverse_of: :display_conditions_for_other_questions,
27
+ counter_cache: :display_conditions_for_other_questions_count
20
28
 
21
29
  # Answer option provided to check for "equal" or "not_equal" (optional)
22
30
  belongs_to :answer_option, class_name: "AnswerOption", foreign_key: "decidim_answer_option_id", optional: true
@@ -7,7 +7,7 @@ module Decidim
7
7
  include Decidim::TranslatableResource
8
8
 
9
9
  translatable_fields :body
10
- belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id"
10
+ belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id", counter_cache: :matrix_rows_count
11
11
 
12
12
  delegate :answer_options, :mandatory, :max_choices, to: :question
13
13
 
@@ -34,26 +34,26 @@ module Decidim
34
34
  end
35
35
 
36
36
  def answers
37
- sibilings.map { |answer| QuestionnaireAnswerPresenter.new(answer:) }
37
+ siblings.map { |answer| QuestionnaireAnswerPresenter.new(answer:) }
38
38
  end
39
39
 
40
40
  def first_short_answer
41
- short = sibilings.where(decidim_forms_questions: { question_type: %w(short_answer) })
41
+ short = siblings.where(decidim_forms_questions: { question_type: %w(short_answer) })
42
42
  short.first
43
43
  end
44
44
 
45
45
  def completion
46
- with_body = sibilings.where(decidim_forms_questions: { question_type: %w(short_answer long_answer) })
47
- .where.not(body: "").count
48
- with_choices = sibilings.where.not("decidim_forms_questions.question_type in (?)", %w(short_answer long_answer))
49
- .where("decidim_forms_answers.id IN (SELECT decidim_answer_id FROM decidim_forms_answer_choices)").count
46
+ with_body = siblings.where(decidim_forms_questions: { question_type: %w(short_answer long_answer) })
47
+ .where.not(body: "").count
48
+ with_choices = siblings.where.not("decidim_forms_questions.question_type in (?)", %w(short_answer long_answer))
49
+ .where("decidim_forms_answers.id IN (SELECT decidim_answer_id FROM decidim_forms_answer_choices)").count
50
50
 
51
51
  (with_body + with_choices).to_f / questionnaire.questions.not_separator.not_title_and_description.count * 100
52
52
  end
53
53
 
54
54
  private
55
55
 
56
- def sibilings
56
+ def siblings
57
57
  Answer.not_separator
58
58
  .not_title_and_description
59
59
  .where(questionnaire:, session_token: participant.session_token)
@@ -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 button__sm button__transparent-secondary small alert hollow remove-answer-option button--title mb-2">
8
+ <button class="button button__sm button__transparent-secondary small alert remove-answer-option button--title mb-2">
9
9
  <%= icon("delete-bin-line") %>
10
10
  <%= t(".remove") %>
11
11
  </button>
@@ -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 button__sm button__transparent-secondary small alert hollow remove-display-condition button--title">
8
+ <button class="button button__sm button__transparent-secondary small alert remove-display-condition button--title">
9
9
  <%= icon("delete-bin-line") %>
10
10
  <%= t(".remove") %>
11
11
  </button>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  <div class="card-section">
16
16
  <div class="row column">
17
- <small class="text-muted">
17
+ <small>
18
18
  <%= t(".save_warning") %>
19
19
  </small>
20
20
  </div>
@@ -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 button__sm button__transparent-secondary small alert hollow remove-matrix-row button--title mb-2">
8
+ <button class="button button__sm button__transparent-secondary small alert remove-matrix-row button--title mb-2">
9
9
  <%= icon("delete-bin-line") %>
10
10
  <%= t(".remove") %>
11
11
  </button>
@@ -2,7 +2,7 @@
2
2
  <% is_expanded = question.errors.any? %>
3
3
  <div class="card questionnaire-question" id="accordion-<%= id %>-field">
4
4
  <div class="form__wrapper" data-component="accordion">
5
- <div class="card-divider question-divider">
5
+ <div class="card-divider">
6
6
  <h2 class="card-title flex items-center">
7
7
  <span>
8
8
  <% if editable %>
@@ -23,17 +23,17 @@
23
23
  </button>
24
24
 
25
25
  <% if editable %>
26
- <button class="button button__sm button__transparent-secondary small alert hollow move-up-question button--title">
26
+ <button class="button button__sm button__transparent-secondary small alert move-up-question button--title">
27
27
  <%= icon("arrow-up-line") %>
28
28
  <%= t(".up") %>
29
29
  </button>
30
30
 
31
- <button class="button button__sm button__transparent-secondary small alert hollow move-down-question button--title">
31
+ <button class="button button__sm button__transparent-secondary small alert move-down-question button--title">
32
32
  <%= icon("arrow-down-line") %>
33
33
  <%= t(".down") %>
34
34
  </button>
35
35
 
36
- <button class="button button__sm button__transparent-secondary small alert hollow remove-question button--title">
36
+ <button class="button button__sm button__transparent-secondary small alert remove-question button--title">
37
37
  <%= icon("delete-bin-line") %>
38
38
  <%= t(".remove") %>
39
39
  </button>
@@ -1,7 +1,7 @@
1
1
  <% question = form.object %>
2
2
 
3
3
  <div class="card questionnaire-question" id="<%= id %>-field">
4
- <div class="card-divider question-divider">
4
+ <div class="card-divider">
5
5
  <h2 class="card-title flex items-center">
6
6
  <span>
7
7
  <% if editable %>
@@ -12,15 +12,15 @@
12
12
 
13
13
  <div class="flex items-center gap-x-4 ml-auto">
14
14
  <% if editable %>
15
- <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-up-question button--title">
15
+ <button class="button button__sm button__transparent button__transparent-secondary small alert move-up-question button--title">
16
16
  <%== "#{icon("arrow-up-line")} #{t(".up")}" %>
17
17
  </button>
18
18
 
19
- <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-down-question button--title">
19
+ <button class="button button__sm button__transparent button__transparent-secondary small alert move-down-question button--title">
20
20
  <%== "#{icon("arrow-down-line")} #{t(".down")}" %>
21
21
  </button>
22
22
 
23
- <button class="button button__sm button__transparent button__transparent-secondary small alert hollow remove-question button--title">
23
+ <button class="button button__sm button__transparent button__transparent-secondary small alert remove-question button--title">
24
24
  <%= t(".remove") %>
25
25
  </button>
26
26
  <% end %>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="card questionnaire-question" id="accordion-<%= id %>-field">
5
5
  <div data-component="accordion">
6
- <div class="card-divider question-divider">
6
+ <div class="card-divider">
7
7
  <h2 class="card-title flex items-center">
8
8
  <span>
9
9
  <% if editable %>
@@ -23,17 +23,17 @@
23
23
  </button>
24
24
 
25
25
  <% if editable %>
26
- <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-up-question button--title">
26
+ <button class="button button__sm button__transparent button__transparent-secondary small alert move-up-question button--title">
27
27
  <%= icon("arrow-up-line") %>
28
28
  <%= t(".up") %>
29
29
  </button>
30
30
 
31
- <button class="button button__sm button__transparent button__transparent-secondary small alert hollow move-down-question button--title">
31
+ <button class="button button__sm button__transparent button__transparent-secondary small alert move-down-question button--title">
32
32
  <%= icon("arrow-down-line") %>
33
33
  <%= t(".down") %>
34
34
  </button>
35
35
 
36
- <button class="button button__sm button__transparent button__transparent-secondary small alert hollow remove-question button--title">
36
+ <button class="button button__sm button__transparent button__transparent-secondary small alert remove-question button--title">
37
37
  <%= icon("delete-bin-line") %>
38
38
  <%= t(".remove") %>
39
39
  </button>
@@ -29,17 +29,7 @@
29
29
  }
30
30
  label_options[:for] = nil if %w(matrix_single matrix_multiple single_option multiple_option).include?(answer.question.question_type)
31
31
  %>
32
-
33
- <%= label_tag field_id, **label_options do %>
34
- <%= translated_attribute(answer.question.body) %>
35
- <% if answer.question.mandatory? %>
36
- <%= answer_form.send(:required_indicator) %>
37
- <% end %>
38
- <% if answer.question.max_choices %>
39
- <%= " (#{answer.send(:max_choices_label)})" %>
40
- <% end %>
41
- <% end %>
42
-
32
+ <%= label_tag field_id, answer.label, **label_options %>
43
33
  <% if translated_attribute(answer.question.description).present? %>
44
34
  <div class="answer-questionnaire__question-description">
45
35
  <%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
@@ -14,12 +14,14 @@ require "wicked_pdf"
14
14
  #
15
15
  # https://github.com/mileszs/wicked_pdf/blob/master/README.md
16
16
 
17
- WickedPdf.config = {
17
+ WickedPdf.configure do |config|
18
18
  # Path to the wkhtmltopdf executable: This usually is not needed if using
19
19
  # one of the wkhtmltopdf-binary family of gems.
20
- # exe_path: '/usr/local/bin/wkhtmltopdf',
20
+ # or
21
+ # config.exe_path = '/usr/local/bin/wkhtmltopdf',
22
+ config.exe_path = Gem.bin_path("wkhtmltopdf-binary", "wkhtmltopdf")
21
23
 
22
24
  # Layout file to be used for all PDFs
23
25
  # (but can be overridden in `render :pdf` calls)
24
- # layout: 'pdf.html',
25
- }
26
+ # config.layout = 'pdf.html'
27
+ end
@@ -4,6 +4,7 @@ ar:
4
4
  attributes:
5
5
  answer:
6
6
  body: إجابة
7
+ choices: الخيارات
7
8
  question:
8
9
  max_choices: أقصى عدد من الخيارات
9
10
  question_type: نوع
@@ -14,7 +15,7 @@ ar:
14
15
  answer:
15
16
  attributes:
16
17
  choices:
17
- too_many: كثير جدا
18
+ missing: ليست كاملة
18
19
  decidim:
19
20
  forms:
20
21
  admin:
@@ -25,6 +26,7 @@ ar:
25
26
  questionnaires:
26
27
  answer_option:
27
28
  answer_option: خيار الإجابة
29
+ free_text: نص حر
28
30
  remove: إزالة
29
31
  statement: بيان
30
32
  display_condition:
@@ -34,6 +36,7 @@ ar:
34
36
  save: حفظ
35
37
  form:
36
38
  add_question: أضف سؤال
39
+ already_answered_warning: تمت الإجابة على النموذج من قبل بعض المستخدمين حتى لا تتمكن من تعديل أسئلته.
37
40
  matrix_row:
38
41
  remove: إزالة
39
42
  statement: بيان
@@ -64,6 +67,8 @@ ar:
64
67
  max_choices: 'خيارات ماكس: %{n}'
65
68
  show:
66
69
  answer_questionnaire:
70
+ already_have_an_account?: لديك حساب بالفعل؟
71
+ are_you_new?: مستخدم جديد؟
67
72
  title: أجب عن النموذج
68
73
  questionnaire_answered:
69
74
  body: لقد أجبت بالفعل على هذا النموذج.
@@ -77,8 +82,11 @@ ar:
77
82
  tos_agreement: من خلال المشاركة ، فإنك تقبل شروط الخدمة
78
83
  step_navigation:
79
84
  show:
85
+ are_you_sure: لا يمكن التراجع عن هذا الإجراء ولن تتمكن من تعديل إجاباتك. هل أنت واثق؟
80
86
  submit: خضع
81
87
  user_answers_serializer:
82
88
  created_at: أجاب على
83
89
  id: معرف الإجابة
84
- question: سؤال
90
+ registered: مُسجَّل
91
+ unregistered: غير مُسجَّل
92
+ user_status: حالة المستخدم
@@ -4,6 +4,8 @@ bg:
4
4
  attributes:
5
5
  answer:
6
6
  body: Отговор
7
+ choices: Възможности
8
+ selected_choices: Избрани възможности
7
9
  question:
8
10
  max_choices: Максимален брой възможности
9
11
  question_type: Тип
@@ -14,8 +16,13 @@ bg:
14
16
  models:
15
17
  answer:
16
18
  attributes:
19
+ add_documents:
20
+ needs_to_be_reattached: Необходимо е да се прикачи отново
21
+ body:
22
+ too_long: твърде дълъг
17
23
  choices:
18
- too_many: са твърде много
24
+ missing: не са завършени
25
+ too_many: Можете да изберете максимум %{count}.
19
26
  questionnaire:
20
27
  request_invalid: Възникна грешка при обработката на заявката. Моля, опитайте отново.
21
28
  decidim:
@@ -31,14 +38,24 @@ bg:
31
38
  show: Показване на отговорите
32
39
  answer_option:
33
40
  answer_option: Възможност за отговор
41
+ free_text: Свободен текст
34
42
  remove: Премахни
35
43
  statement: Изявление
36
44
  answers:
37
45
  actions:
46
+ back: Назад към отговорите
47
+ export: Експортиране
48
+ next: Следваща &rsaquo;
49
+ previous: "&lsaquo; Предна"
38
50
  show: Показване на отговорите
39
51
  empty: Все още няма отговори
52
+ export:
53
+ answer:
54
+ title: 'Отговор № %{number}'
40
55
  export_response:
41
56
  title: survey_user_answers_%{token}
57
+ index:
58
+ title: "Общ брой отговори: %{total}"
42
59
  show:
43
60
  title: 'Отговор № %{number}'
44
61
  display_condition:
@@ -64,10 +81,14 @@ bg:
64
81
  title: Редактиране на въпросника
65
82
  form:
66
83
  add_question: Добавяне на въпрос
84
+ add_separator: Добавяне на разделител
85
+ add_title_and_description: Добавете заглавие и описание
86
+ already_answered_warning: Няколко потребители вече са попълнили въпросника, поради което не можете да промените въпросите в него.
67
87
  collapse: Свиване на всички въпроси
68
88
  expand: Разгъване на всички въпроси
69
89
  preview: Преглед
70
90
  title: Редактирайте формуляра за %{questionnaire_for}
91
+ unpublished_warning: Формулярът не е публикуван. Можете да промените въпросите в него, но така ще се изтрият текущите въпроси.
71
92
  matrix_row:
72
93
  matrix_row: Ред
73
94
  remove: Премахни
@@ -106,6 +127,9 @@ bg:
106
127
  admin_log:
107
128
  questionnaire:
108
129
  update: "%{user_name} актуализира въпросника %{resource_name}"
130
+ errors:
131
+ answer:
132
+ body: Основният текст не може да бъде празен
109
133
  images:
110
134
  dimensions: "%{width} x %{height} пиксела"
111
135
  processors:
@@ -121,15 +145,20 @@ bg:
121
145
  single_option: Единична опция
122
146
  sorting: Сортиране
123
147
  title_and_description: Заглавие и описание
148
+ questionnaire_answer_presenter:
149
+ download_attachment: Изтегляне на прикачени файлове
124
150
  questionnaires:
125
151
  answer:
126
152
  invalid: Възникна проблем при попълването на отговорите във формуляра.
153
+ max_choices_alert: Избрани са прекалено много варианти
127
154
  success: Отговорите са попълнени успешно във формуляра.
128
155
  question:
129
156
  max_choices: 'Максимален брой избрани варианти: %{n}'
130
157
  show:
131
158
  answer_questionnaire:
132
- sign_in_description: Влезте, за да участвате в анкетата
159
+ already_have_an_account?: Вече имате профил?
160
+ are_you_new?: Нов потребител?
161
+ sign_up_description: Създайте акаунт на участник, за да участвате в анкетата
133
162
  title: Попълване на отговори във формуляра
134
163
  current_step: Стъпка %{step}
135
164
  empty: Все още няма конфигурирани въпроси за този формуляр.
@@ -151,11 +180,18 @@ bg:
151
180
  tos_agreement: С участието си приемате Условията на ползване
152
181
  step_navigation:
153
182
  show:
183
+ are_you_sure: Това действие не може да се отмени и Вие не можете да редактирате отговорите си. Сигурни ли сте?
154
184
  back: Назад
155
185
  continue: Продължи
156
186
  submit: Изпрати
157
187
  user_answers_serializer:
158
188
  body: Отговор
189
+ completion: Завършване
159
190
  created_at: Отговорено на
160
191
  id: ID на отговора
192
+ ip_hash: IP хеширане
161
193
  question: Въпрос
194
+ registered: Регистриран
195
+ session_token: Идентификатор на потребителя
196
+ unregistered: Нерегистриран
197
+ user_status: Статус на потребителя