decidim-templates 0.28.1 → 0.29.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/templates/admin/create_proposal_answer_template.rb +2 -1
  3. data/app/commands/decidim/templates/admin/questionnaire_copier.rb +6 -0
  4. data/app/commands/decidim/templates/admin/update_proposal_answer_template.rb +4 -7
  5. data/app/controllers/decidim/templates/admin/proposal_answer_templates_controller.rb +29 -12
  6. data/app/forms/decidim/templates/admin/proposal_answer_template_form.rb +21 -8
  7. data/app/forms/decidim/templates/admin/template_form.rb +3 -1
  8. data/app/views/decidim/templates/admin/proposal_answer_templates/_form.html.erb +39 -28
  9. data/app/views/decidim/templates/admin/proposal_answer_templates/_template_chooser.html.erb +2 -1
  10. data/app/views/decidim/templates/admin/proposal_answer_templates/index.html.erb +2 -2
  11. data/app/views/decidim/templates/admin/questionnaire_templates/_choose.html.erb +3 -3
  12. data/app/views/decidim/templates/admin/questionnaire_templates/_preview.html.erb +4 -4
  13. data/app/views/decidim/templates/admin/questionnaire_templates/preview.js.erb +3 -3
  14. data/config/locales/bg.yml +4 -2
  15. data/config/locales/ca.yml +2 -2
  16. data/config/locales/cs.yml +2 -2
  17. data/config/locales/de.yml +2 -2
  18. data/config/locales/en.yml +2 -2
  19. data/config/locales/es-MX.yml +2 -2
  20. data/config/locales/es-PY.yml +2 -2
  21. data/config/locales/es.yml +2 -2
  22. data/config/locales/eu.yml +4 -2
  23. data/config/locales/fi-plain.yml +4 -2
  24. data/config/locales/fi.yml +4 -2
  25. data/config/locales/fr-CA.yml +4 -2
  26. data/config/locales/fr.yml +4 -2
  27. data/config/locales/hu.yml +0 -1
  28. data/config/locales/ja.yml +4 -2
  29. data/config/locales/pl.yml +55 -1
  30. data/config/locales/tr-TR.yml +4 -1
  31. data/decidim-templates.gemspec +2 -1
  32. data/lib/decidim/templates/test/factories.rb +0 -6
  33. data/lib/decidim/templates/test/shared_examples/copies_all_questionnaire_contents_examples.rb +3 -3
  34. data/lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb +6 -6
  35. data/lib/decidim/templates/version.rb +1 -1
  36. metadata +35 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a014a416d363441ef2bfc5682c2b069132963795dbbf25099b8347a56195d22
4
- data.tar.gz: 25234dab78eb65177b52c380541419037a6fd2ae433aa403132ee13ee2735564
3
+ metadata.gz: c9b72969a1ffc689d6abcd27cc5b6ac070ff31ca0affb0a9b6b9d8c1be14e2b6
4
+ data.tar.gz: 6f318b04297a61c3e624f5d8490076fe01540a6ce70f86c7cebfc4caa893ae38
5
5
  SHA512:
6
- metadata.gz: 61179f335f55af878c96ad6586c823355e7e0f78c08838b31d069c44f58b9efc5ea091a8def531a339da8db8f044fe71f596952e9643f13acf979fa27ca90a6c
7
- data.tar.gz: 51b833fa9ea3cc1af8b2c142de4d14fa83deb8528989c5f42144bccbe642abf073900ccb7f26e2f6875b595e0486dac60dfa6b45c4875dfc13ac19e09eb2d8c8
6
+ metadata.gz: 9e41c2209802518d81811990443caa42b50d2257bda5bcfcc7ca1ece831360df0bdd49497096a21cf24a542b1fb9a1f79d3d176460b9de4173b50880faada1e5
7
+ data.tar.gz: 22d61f04fe3c26f518dbba6883507d2c7ed2f21b881ecc46292face89fc6844f49a4bf841d02c6b747f96e7cdafb02cf6fb75e83ab6960c5b738260f9c6c6b4a
@@ -12,6 +12,7 @@ module Decidim
12
12
  end
13
13
 
14
14
  def call
15
+ return broadcast(:component_selected) if @form.select_component
15
16
  return broadcast(:invalid) unless @form.valid?
16
17
 
17
18
  @template = Decidim.traceability.create!(
@@ -20,7 +21,7 @@ module Decidim
20
21
  name: @form.name,
21
22
  description: @form.description,
22
23
  organization: @form.current_organization,
23
- field_values: { internal_state: @form.internal_state },
24
+ field_values: { proposal_state_id: @form.proposal_state_id },
24
25
  target: :proposal_answer
25
26
  )
26
27
 
@@ -11,6 +11,12 @@ module Decidim
11
11
  original_questionnaire.questions.each do |original_question|
12
12
  new_question = original_question.dup
13
13
  new_question.questionnaire = new_questionnaire
14
+ new_question.assign_attributes(
15
+ answer_options_count: 0,
16
+ matrix_rows_count: 0,
17
+ display_conditions_count: 0,
18
+ display_conditions_for_other_questions_count: 0
19
+ )
14
20
  new_question.save!
15
21
  copy_questionnaire_answer_options(original_question, new_question)
16
22
  copy_questionnaire_matrix_rows(original_question, new_question)
@@ -24,7 +24,7 @@ module Decidim
24
24
  @user,
25
25
  name: @form.name,
26
26
  description: @form.description,
27
- field_values: { internal_state: @form.internal_state },
27
+ field_values: { proposal_state_id: @form.proposal_state_id },
28
28
  target: :proposal_answer
29
29
  )
30
30
 
@@ -36,12 +36,9 @@ module Decidim
36
36
  private
37
37
 
38
38
  def identify_templateable_resource
39
- resource = @form.current_organization
40
- if @form.component_constraint.present?
41
- found_component = Decidim::Component.find_by(id: @form.component_constraint, manifest_name: "proposals")
42
- if found_component.present?
43
- resource = found_component&.participatory_space&.decidim_organization_id == @form.current_organization.id ? found_component : nil
44
- end
39
+ found_component = Decidim::Component.find_by(id: @form.component_constraint, manifest_name: "proposals")
40
+ if found_component.present?
41
+ resource = found_component&.participatory_space&.decidim_organization_id == @form.current_organization.id ? found_component : nil
45
42
  end
46
43
  resource
47
44
  end
@@ -7,7 +7,7 @@ module Decidim
7
7
  include Decidim::TranslatableAttributes
8
8
  include Decidim::Paginable
9
9
 
10
- helper_method :availability_option_as_text, :availability_options_for_select
10
+ helper_method :availability_option_as_text, :availability_options_for_select, :available_states, :proposal_state
11
11
 
12
12
  add_breadcrumb_item_from_menu :admin_template_types_menu
13
13
 
@@ -32,6 +32,10 @@ module Decidim
32
32
  redirect_to proposal_answer_templates_path
33
33
  end
34
34
 
35
+ on(:component_selected) do
36
+ render :new
37
+ end
38
+
35
39
  on(:invalid) do
36
40
  flash.now[:alert] = I18n.t("templates.create.error", scope: "decidim.admin")
37
41
  render :new
@@ -55,8 +59,10 @@ module Decidim
55
59
 
56
60
  return render json: { msg: I18n.t("templates.fetch.error", scope: "decidim.admin") }, status: :unprocessable_entity if template.blank?
57
61
 
62
+ state = fetch_proposal_state(template)
63
+
58
64
  response_object = {
59
- state: template.field_values["internal_state"],
65
+ state: state&.token,
60
66
  template: populate_template_interpolations(proposal)
61
67
  }
62
68
 
@@ -118,9 +124,23 @@ module Decidim
118
124
 
119
125
  private
120
126
 
127
+ def fetch_proposal_state(template)
128
+ available_states(template.templatable_id).find_by(id: template.field_values["proposal_state_id"])
129
+ end
130
+
131
+ def proposal_state(template)
132
+ state = fetch_proposal_state(template)
133
+
134
+ state ? translated_attribute(state&.title) : I18n.t("decidim.templates.admin.proposal_answer_templates.index.missing_state")
135
+ end
136
+
137
+ def available_states(component_id = nil)
138
+ Decidim::Proposals::ProposalState.where(decidim_component_id: component_id)
139
+ end
140
+
121
141
  def populate_template_interpolations(proposal)
122
142
  template.description.to_h do |language, value|
123
- value.gsub!("%{organization}", proposal.organization.name)
143
+ value.gsub!("%{organization}", translated_attribute(proposal.organization.name))
124
144
  value.gsub!("%{name}", author_name(proposal))
125
145
  value.gsub!("%{admin}", current_user.name)
126
146
 
@@ -138,25 +158,22 @@ module Decidim
138
158
 
139
159
  def availability_option_as_text(template)
140
160
  return unless template.templatable_type
141
- return t("global_scope", scope: "decidim.templates.admin.proposal_answer_templates.index") if template.templatable == current_organization
142
161
 
143
- avaliablity_options.select { |a| a.last == template.templatable_id }&.flatten&.first || t("templates.missing_resource", scope: "decidim.admin")
162
+ availability_options.select { |a| a.last == template.templatable_id }.flatten.first || t("templates.missing_resource", scope: "decidim.admin")
144
163
  end
145
164
 
146
165
  def availability_options_for_select
147
- avaliablity_options
166
+ availability_options
148
167
  end
149
168
 
150
- def avaliablity_options
151
- @avaliablity_options = []
152
- @avaliablity_options.push [t("global_scope", scope: "decidim.templates.admin.proposal_answer_templates.index"), 0]
153
-
169
+ def availability_options
170
+ @availability_options = []
154
171
  Decidim::Component.includes(:participatory_space).where(manifest_name: [:proposals])
155
172
  .select { |a| a.participatory_space.decidim_organization_id == current_organization.id }.each do |component|
156
- @avaliablity_options.push [formatted_name(component), component.id]
173
+ @availability_options.push [formatted_name(component), component.id]
157
174
  end
158
175
 
159
- @avaliablity_options
176
+ @availability_options
160
177
  end
161
178
 
162
179
  def formatted_name(component)
@@ -4,18 +4,31 @@ module Decidim
4
4
  module Templates
5
5
  module Admin
6
6
  class ProposalAnswerTemplateForm < TemplateForm
7
- attribute :internal_state, String
7
+ attribute :proposal_state_id, Integer
8
8
  attribute :component_constraint, Integer
9
+ attribute :select_component, Boolean, default: false
9
10
 
10
- validates :internal_state, presence: true
11
+ validate :component_has_been_selected
12
+ validate :proposal_state_id_is_valid
11
13
 
12
14
  def map_model(model)
13
- self.internal_state = model.field_values["internal_state"]
14
- self.component_constraint = if model.templatable_type == "Decidim::Organization"
15
- 0
16
- else
17
- model.templatable&.id
18
- end
15
+ self.proposal_state_id = model.field_values["proposal_state_id"]&.to_i
16
+ self.component_constraint = model.templatable&.id
17
+ end
18
+
19
+ def skip_name_validation
20
+ select_component
21
+ end
22
+
23
+ def proposal_state_id_is_valid
24
+ if Decidim::Proposals::ProposalState.where(decidim_component_id: component_constraint).find_by(id: proposal_state_id).blank?
25
+ errors.add(:proposal_state_id,
26
+ :blank)
27
+ end
28
+ end
29
+
30
+ def component_has_been_selected
31
+ errors.add(:select_component, :blank) if select_component
19
32
  end
20
33
  end
21
34
  end
@@ -10,7 +10,9 @@ module Decidim
10
10
  translatable_attribute :name, String
11
11
  translatable_attribute :description, String
12
12
 
13
- validates :name, translatable_presence: true
13
+ validates :name, translatable_presence: true, unless: :skip_name_validation
14
+
15
+ def skip_name_validation = false
14
16
  end
15
17
  end
16
18
  end
@@ -1,38 +1,49 @@
1
1
  <div class="form__wrapper">
2
2
  <div class="card pt-4">
3
3
  <div class="card-section">
4
- <div class="row column">
5
- <%= form.translated :text_field, :name, aria: { label: :name } %>
6
- </div>
7
4
 
8
- <div class="row column">
9
- <%= form.translated :editor, :description, rows: 3, aria: { label: :description } %>
10
- <%= t(".hint_html") %>
11
- <ul>
12
- <li><%= t(".hint1_html") %></li>
13
- <li><%= t(".hint2_html") %></li>
14
- <li><%= t(".hint3_html") %></li>
15
- </ul>
16
- </div>
5
+ <% if form.object.component_constraint %>
6
+ <%= form.hidden_field(:component_constraint, value: form.object.component_constraint) %>
7
+ <div class="row column">
8
+ <%= form.translated :text_field, :name, aria: { label: :name } %>
9
+ </div>
17
10
 
18
- <div class="row column">
19
- <%= form.label :internal_state %>
20
- <div class="flex items-center gap-x-4 my-2">
21
- <%= form.collection_radio_buttons :internal_state,
22
- Decidim::Proposals::Proposal::STATES.keys - [:withdrawn],
23
- :to_s,
24
- ->(mode) { t(mode, scope: "decidim.proposals.admin.proposal_answers.form") },
25
- prompt: true do |builder|
26
- builder.label { builder.radio_button + builder.text }
27
- end %>
11
+ <div class="row column">
12
+ <%= form.translated :editor, :description, rows: 3, aria: { label: :description } %>
13
+ <%= t(".hint_html") %>
14
+ <ul>
15
+ <li><%= t(".hint1_html") %></li>
16
+ <li><%= t(".hint2_html") %></li>
17
+ <li><%= t(".hint3_html") %></li>
18
+ </ul>
19
+ </div>
20
+ <div class="row column">
21
+ <%= form.label :proposal_state_id %>
22
+ <div class="flex items-center gap-x-4 my-2">
23
+ <%= form.collection_radio_buttons :proposal_state_id,
24
+ available_states( form.object.component_constraint),
25
+ :id,
26
+ lambda { |a|
27
+ translated_attribute(a.title)
28
+ }, prompt: true do |builder|
29
+ builder.label { builder.radio_button + builder.text } end %>
30
+ </div>
28
31
  </div>
29
- </div>
32
+ <% else %>
30
33
 
31
- <div class="row column">
32
- <%= form.select :component_constraint, availability_options_for_select,
33
- sselected: form.object.component_constraint,
34
- help_text: t(".component_constraint_help") %>
35
- </div>
34
+ <div class="row column">
35
+ <%= form.select :component_constraint,
36
+ availability_options_for_select,
37
+ {
38
+ selected: form.object.component_constraint,
39
+ help_text: t(".component_constraint_help"),
40
+ include_blank: true
41
+ },
42
+ onchange: "this.form.submit()",
43
+ disabled: form.object.component_constraint.present? %>
44
+ </div>
45
+ <%= form.hidden_field(:select_component, value: true) %>
46
+ <% end %>
36
47
  </div>
37
48
  </div>
38
49
  </div>
@@ -1,7 +1,8 @@
1
1
  <% templates = Decidim::Templates::Template.where(
2
2
  target: :proposal_answer,
3
- templatable: [current_organization, current_component]
3
+ templatable: current_component
4
4
  ).order(:templatable_id) %>
5
+
5
6
  <% if templates.any? %>
6
7
  <div class="row column">
7
8
  <%= append_javascript_pack_tag "decidim_templates_admin" %>
@@ -15,7 +15,7 @@
15
15
  <thead>
16
16
  <tr>
17
17
  <th><%= t("template.name", scope: "decidim.models") %></th>
18
- <th><%= t(".internal_state") %></th>
18
+ <th><%= t(".proposal_state_id") %></th>
19
19
  <th><%= t(".component_constraint") %></th>
20
20
  <th><%= t("template.fields.created_at", scope: "decidim.models") %></th>
21
21
  <th></th>
@@ -25,7 +25,7 @@
25
25
  <% @templates.each do |template| %>
26
26
  <tr data-proposal_answer-id="<%= template.id %>">
27
27
  <td><%= link_to_if allowed_to?(:update, :template, template:) , translated_attribute(template.name), edit_proposal_answer_template_path(template) %></td>
28
- <td> <%= t(template.field_values.dig("internal_state"), scope: "decidim.proposals.admin.proposal_answers.form") %></td>
28
+ <td> <%= proposal_state(template) %></td>
29
29
  <td><%= availability_option_as_text(template) %></td>
30
30
  <td><%= l template.created_at, format: :long %></td>
31
31
 
@@ -25,9 +25,9 @@
25
25
  }
26
26
  ) { form.hidden_field :questionnaire_template_id } %>
27
27
  <div class="card-section questionnaire-template-preview pt-4 hide">
28
- <h2 class="item_show__header-title template-name"></h2>
29
- <p class="template-description py-4"></p>
30
- <div class="row column choose-template-preview"></div>
28
+ <h2 class="item_show__header-title" data-template-name></h2>
29
+ <p class="py-4" data-template-description></p>
30
+ <div class="row column" data-choose-template-preview></div>
31
31
  </div>
32
32
  </div>
33
33
  </div>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class="row columns">
4
4
  <h3 class="h3"><%= translated_attribute questionnaire.title %></h3>
5
- <%= decidim_sanitize translated_attribute questionnaire.description %>
5
+ <%= decidim_sanitize_translated questionnaire.description %>
6
6
  </div>
7
7
 
8
8
  <div class="row columns">
@@ -15,7 +15,7 @@
15
15
  <div class="form__wrapper">
16
16
  <% if @preview_form.total_steps > 1 %>
17
17
  <h4>
18
- <%= t(".current_step", step: step_index + 1) %> <span class="answer-questionnaire__steps"><%= t(".of_total_steps", total_steps: @preview_form.total_steps) %></span>
18
+ <%= t(".current_step", step: step_index + 1) %> <span><%= t(".of_total_steps", total_steps: @preview_form.total_steps) %></span>
19
19
  </h4>
20
20
  <% end %>
21
21
 
@@ -39,10 +39,10 @@
39
39
  <% end %>
40
40
 
41
41
  <% if step_index + 1 == @preview_form.total_steps %>
42
- <div class="tos-agreement">
42
+ <div>
43
43
  <%= form.check_box :tos_agreement, label: t(".tos_agreement"), id: "questionnaire_tos_agreement", disabled: false %>
44
44
  <div class="help-text">
45
- <%= decidim_sanitize translated_attribute questionnaire.tos %>
45
+ <%= decidim_sanitize_translated questionnaire.tos %>
46
46
  </div>
47
47
  </div>
48
48
  <% end %>
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable no-var, prefer-template */
2
2
  (function () {
3
- var $preview = $(".choose-template-preview");
4
- var $templateName = $(".template-name");
5
- var $templateDescription = $(".template-description");
3
+ var $preview = $("[data-choose-template-preview]");
4
+ var $templateName = $("[data-template-name]");
5
+ var $templateDescription = $("[data-template-description]");
6
6
 
7
7
  $templateName.html("<%= translated_attribute @template.name %>");
8
8
  $templateDescription.html("<%= translated_attribute @template.description %>");
@@ -26,6 +26,8 @@ bg:
26
26
  destroy:
27
27
  success: Шаблонът е изтрит успешно.
28
28
  empty: Все още няма шаблони.
29
+ fetch:
30
+ error: Не можах да намеря този шаблон. Моля, презаредете страницата.
29
31
  missing_resource: "(липсващ ресурс)"
30
32
  update:
31
33
  error: Възникна проблем при обновяването на този шаблон.
@@ -70,8 +72,8 @@ bg:
70
72
  index:
71
73
  component_constraint: Добавяне на ограничение
72
74
  confirm_delete: Сигурни ли сте, че желаете да изтриете този шаблон?
73
- global_scope: Глобално (достъпно навсякъде)
74
- internal_state: Вътрешно състояние
75
+ missing_state: Липсващо състояние
76
+ proposal_state_id: Вътрешно състояние
75
77
  title: Отговори на предложенията
76
78
  new:
77
79
  title: Нов шаблон за отговор на предложение
@@ -72,8 +72,8 @@ ca:
72
72
  index:
73
73
  component_constraint: Afegir restricció
74
74
  confirm_delete: Segur que vols eliminar aquesta plantilla?
75
- global_scope: Global (disponible a tot arreu)
76
- internal_state: Estat intern
75
+ missing_state: Hi manca l'estat
76
+ proposal_state_id: Estat intern
77
77
  title: Respostes a la proposta
78
78
  new:
79
79
  title: Nova plantilla de resposta a proposta
@@ -72,8 +72,8 @@ cs:
72
72
  index:
73
73
  component_constraint: Přidat omezení
74
74
  confirm_delete: Opravdu chcete tuto šablonu odstranit?
75
- global_scope: Globální (k dispozici všude)
76
- internal_state: Vnitřní stav
75
+ missing_state: Chybějící stav
76
+ proposal_state_id: Vnitřní stav
77
77
  title: Odpovědi na návrh
78
78
  new:
79
79
  title: Nová šablona odpovědi na návrh
@@ -72,8 +72,8 @@ de:
72
72
  index:
73
73
  component_constraint: Einschränkung hinzufügen
74
74
  confirm_delete: Möchten Sie diese Vorlage wirklich löschen?
75
- global_scope: Global (überall verfügbar)
76
- internal_state: Interner Status
75
+ missing_state: Fehlender Status
76
+ proposal_state_id: Interner Status
77
77
  title: Vorschlagsantworten
78
78
  new:
79
79
  title: Neue Vorlage für Vorschlagsantworten
@@ -72,8 +72,8 @@ en:
72
72
  index:
73
73
  component_constraint: Add constraint
74
74
  confirm_delete: Are you sure you want to delete this template?
75
- global_scope: Global (available everywhere)
76
- internal_state: Internal state
75
+ missing_state: Missing state
76
+ proposal_state_id: Internal state
77
77
  title: Proposal answers
78
78
  new:
79
79
  title: New proposal answer template
@@ -72,8 +72,8 @@ es-MX:
72
72
  index:
73
73
  component_constraint: Añadir restricción
74
74
  confirm_delete: '¿Seguro que quieres eliminar esta plantilla?'
75
- global_scope: Global (disponible en todas partes)
76
- internal_state: Estado interno
75
+ missing_state: Falta el estado
76
+ proposal_state_id: Estado interno
77
77
  title: Respuestas a propuestas
78
78
  new:
79
79
  title: Nueva la plantilla de respuesta a propuesta
@@ -72,8 +72,8 @@ es-PY:
72
72
  index:
73
73
  component_constraint: Añadir restricción
74
74
  confirm_delete: '¿Seguro que quieres eliminar esta plantilla?'
75
- global_scope: Global (disponible en todas partes)
76
- internal_state: Estado interno
75
+ missing_state: Falta el estado
76
+ proposal_state_id: Estado interno
77
77
  title: Respuestas a propuestas
78
78
  new:
79
79
  title: Nueva la plantilla de respuesta a propuesta
@@ -72,8 +72,8 @@ es:
72
72
  index:
73
73
  component_constraint: Añadir restricción
74
74
  confirm_delete: '¿Seguro que quieres eliminar esta plantilla?'
75
- global_scope: Global (disponible en todas partes)
76
- internal_state: Estado interno
75
+ missing_state: Falta el estado
76
+ proposal_state_id: Estado interno
77
77
  title: Respuestas a propuestas
78
78
  new:
79
79
  title: Nueva la plantilla de respuesta a propuesta
@@ -26,6 +26,8 @@ eu:
26
26
  destroy:
27
27
  success: Txantiloia zuzen ezabatua.
28
28
  empty: Oraindik ez dago txantiloirik.
29
+ fetch:
30
+ error: Ezin da plantilla hau aurkitu. Kargatu orria, mesedez.
29
31
  missing_resource: "(baliabide galdua)"
30
32
  update:
31
33
  error: Arazo bat egon da eztabaida hau eguneratzean.
@@ -70,8 +72,8 @@ eu:
70
72
  index:
71
73
  component_constraint: Gehitu hertsapena.
72
74
  confirm_delete: Ziur zaude txantiloi hau ezabatu nahi duzula?
73
- global_scope: Globala (nonahi eskuragarri)
74
- internal_state: Barne egoera
75
+ missing_state: Egoera desagertua
76
+ proposal_state_id: Barne egoera
75
77
  title: Proposamenen erantzunak
76
78
  new:
77
79
  title: Proposamenaren erantzun-txantilioi berria
@@ -26,6 +26,8 @@ fi-pl:
26
26
  destroy:
27
27
  success: Mallipohjan poisto onnistui.
28
28
  empty: Mallipohjia ei ole vielä lisätty.
29
+ fetch:
30
+ error: Mallipohjaa ei löytynyt. Lataa sivu uudelleen.
29
31
  missing_resource: "(puuttuva resurssi)"
30
32
  update:
31
33
  error: Mallipohjan päivitys epäonnistui.
@@ -70,8 +72,8 @@ fi-pl:
70
72
  index:
71
73
  component_constraint: Lisää rajaussääntö
72
74
  confirm_delete: Haluatko varmasti poistaa tämän mallipohjan?
73
- global_scope: Yleinen (saatavilla kaikkialla)
74
- internal_state: Sisäinen tila
75
+ missing_state: Puuttuva tila
76
+ proposal_state_id: Sisäinen tila
75
77
  title: Ehdotusten vastaukset
76
78
  new:
77
79
  title: Uusi ehdotusten vastausten mallipohja
@@ -26,6 +26,8 @@ fi:
26
26
  destroy:
27
27
  success: Mallipohjan poisto onnistui.
28
28
  empty: Mallipohjia ei ole vielä lisätty.
29
+ fetch:
30
+ error: Mallipohjaa ei löytynyt. Lataa sivu uudelleen.
29
31
  missing_resource: "(puuttuva resurssi)"
30
32
  update:
31
33
  error: Mallipohjan päivitys epäonnistui.
@@ -70,8 +72,8 @@ fi:
70
72
  index:
71
73
  component_constraint: Lisää rajaussääntö
72
74
  confirm_delete: Haluatko varmasti poistaa tämän mallipohjan?
73
- global_scope: Yleinen (saatavilla kaikkialla)
74
- internal_state: Sisäinen tila
75
+ missing_state: Puuttuva tila
76
+ proposal_state_id: Sisäinen tila
75
77
  title: Ehdotusten vastaukset
76
78
  new:
77
79
  title: Uusi ehdotusten vastausten mallipohja
@@ -26,6 +26,8 @@ fr-CA:
26
26
  destroy:
27
27
  success: Modèle supprimé avec succès.
28
28
  empty: Il n'y a pas de modèle pour l'instant.
29
+ fetch:
30
+ error: Impossible de trouver ce modèle. Veuillez recharger la page.
29
31
  missing_resource: "(ressource manquante)"
30
32
  update:
31
33
  error: Un problème est survenu lors de la mise à jour de ce modèle.
@@ -70,8 +72,8 @@ fr-CA:
70
72
  index:
71
73
  component_constraint: Ajouter une contrainte
72
74
  confirm_delete: Êtes-vous sûr de vouloir supprimer ce modèle ?
73
- global_scope: Global (disponible partout)
74
- internal_state: Etat interne
75
+ missing_state: Etat manquant
76
+ proposal_state_id: Etat interne
75
77
  title: Réponses à la proposition
76
78
  new:
77
79
  title: Nouveau modèle de réponse à proposition
@@ -26,6 +26,8 @@ fr:
26
26
  destroy:
27
27
  success: Modèle supprimé avec succès.
28
28
  empty: Il n'y a pas de modèle pour l'instant.
29
+ fetch:
30
+ error: Impossible de trouver ce modèle. Veuillez recharger la page.
29
31
  missing_resource: "(ressource manquante)"
30
32
  update:
31
33
  error: Un problème est survenu lors de la mise à jour de ce modèle.
@@ -70,8 +72,8 @@ fr:
70
72
  index:
71
73
  component_constraint: Ajouter une contrainte
72
74
  confirm_delete: Êtes-vous sûr de vouloir supprimer ce modèle ?
73
- global_scope: Global (disponible partout)
74
- internal_state: Etat interne
75
+ missing_state: Etat manquant
76
+ proposal_state_id: Etat interne
75
77
  title: Réponses à la proposition
76
78
  new:
77
79
  title: Nouveau modèle de réponse à proposition
@@ -45,7 +45,6 @@ hu:
45
45
  form:
46
46
  save: Mentés
47
47
  index:
48
- global_scope: Globális
49
48
  title: Javaslat válaszok
50
49
  questionnaire_templates:
51
50
  choose:
@@ -26,6 +26,8 @@ ja:
26
26
  destroy:
27
27
  success: テンプレートを削除しました。
28
28
  empty: テンプレートはまだありません。
29
+ fetch:
30
+ error: テンプレートが見つかりませんでした。ページをリロードしてください。
29
31
  missing_resource: "(リソースが見つかりません)"
30
32
  update:
31
33
  error: テンプレートの更新中に問題が発生しました。
@@ -70,8 +72,8 @@ ja:
70
72
  index:
71
73
  component_constraint: 制約を追加
72
74
  confirm_delete: このテンプレートを削除してもよろしいですか?
73
- global_scope: グローバル (どこでも利用可能)
74
- internal_state: 内部状態
75
+ missing_state: 状態がありません
76
+ proposal_state_id: 内部状態
75
77
  title: 提案の回答
76
78
  new:
77
79
  title: 新しい提案回答テンプレート
@@ -1,17 +1,37 @@
1
1
  ---
2
2
  pl:
3
+ activemodel:
4
+ attributes:
5
+ questionnaire:
6
+ title: Tytuł
7
+ template:
8
+ description: Opis
9
+ name: Nazwa
3
10
  decidim:
4
11
  admin:
5
12
  menu:
6
13
  templates: Szablony
7
14
  templates:
15
+ actions:
16
+ new_template: Nowy szablon
8
17
  apply:
9
18
  error: Wystąpił błąd z zastosowaniem tego szablonu.
19
+ success: Szablon zastosowany pomyślnie.
10
20
  copy:
11
21
  error: Wystąpił błąd podczas kopiowania tego szablonu.
22
+ success: Szablon został skopiowany.
12
23
  create:
13
24
  error: Wystąpił błąd podczas tworzenia tego szablonu.
25
+ success: Szablon został utworzony.
26
+ destroy:
27
+ success: Szablon został usunięty.
14
28
  empty: Brak szablonów.
29
+ fetch:
30
+ error: Nie można znaleźć tego szablonu. Proszę odświeżyć stronę.
31
+ missing_resource: "(brak zasobu)"
32
+ update:
33
+ error: Wystąpił problem z aktualizacją tego szablonu.
34
+ success: Szablon został zaktualizowany.
15
35
  titles:
16
36
  template_types:
17
37
  questionnaires: Szablony kwestionariusza
@@ -28,15 +48,37 @@ pl:
28
48
  templates:
29
49
  admin:
30
50
  block_user_templates:
51
+ edit:
52
+ title: Edytuj szablon wiadomości blokowania użytkownika
31
53
  form:
32
54
  save: Zapisz
33
55
  index:
56
+ confirm_delete: Czy na pewno chcesz usunąć ten szablon?
34
57
  title: Blokuj wiadomości użytkownika
58
+ new:
59
+ title: Nowy szablon wiadomości blokowania użytkownika
60
+ template_chooser:
61
+ select_template: Wybierz szablon odpowiedzi
35
62
  proposal_answer_templates:
63
+ edit:
64
+ title: Edytuj szablon odpowiedzi na propozycję
36
65
  form:
66
+ component_constraint_help: Należy zauważyć, że wymieniona zostanie tylko przestrzeń uczestnicząca posiadająca elementy składowe typu „propozycje”.
67
+ hint1_html: "<strong>%{organization}</strong> zostanie zastąpione nazwą organizacji"
68
+ hint2_html: "<strong>%{name}</strong> zostanie zastąpione przez imię autora"
69
+ hint3_html: "<strong>%{admin}</strong> zostanie zastąpione przez nazwę administratora (tego, który odpowiada na propozycję)"
70
+ hint_html: "<strong>Wskazówka:</strong> Możesz użyć tych zmiennych w dowolnym miejscu w szablonie odpowiedzi, które zostaną zastąpione podczas korzystania z szablonu"
37
71
  save: Zapisz
38
72
  index:
39
- internal_state: Stan wewnętrzny
73
+ component_constraint: Dodaj ograniczenie
74
+ confirm_delete: Czy na pewno chcesz usunąć ten szablon?
75
+ missing_state: Brakujący stan
76
+ proposal_state_id: Stan wewnętrzny
77
+ title: Odpowiedzi na propozycję
78
+ new:
79
+ title: Nowy szablon odpowiedzi na propozycję
80
+ template_chooser:
81
+ select_template: Wybierz szablon odpowiedzi
40
82
  questionnaire_templates:
41
83
  choose:
42
84
  create_from_template: Utwórz z szablonu
@@ -46,15 +88,27 @@ pl:
46
88
  skip_template: Pomiń
47
89
  edit:
48
90
  edit: Edytuj
91
+ empty: Nie ma jeszcze żadnych pytań.
49
92
  questionnaire: Kwestionariusz
93
+ title: Edytuj szablon kwestionariusza
50
94
  form:
51
95
  title: Szablon kwestionariusza %{questionnaire_for}
52
96
  index:
53
97
  confirm_delete: Czy na pewno chcesz usunąć ten szablon?
54
98
  title: Szablony kwestionariusza
99
+ new:
100
+ title: Nowy szablon kwestionariusza
55
101
  preview:
56
102
  current_step: Krok %{step}
57
103
  of_total_steps: z %{total_steps}
58
104
  tos_agreement: Biorąc udział akceptujesz Warunki korzystania z Platformy
105
+ admin_log:
106
+ template:
107
+ create: "Użytkownik %{user_name} utworzył szablon kwestionariusza %{resource_name}"
108
+ delete: "Użytkownik %{user_name} usunął szablon kwestionariusza %{resource_name}"
109
+ duplicate: "Użytkownik %{user_name} zduplikował szablon kwestionariusza %{resource_name}"
110
+ update: "Użytkownik %{user_name} zaktualizował szablon kwestionariusza %{resource_name}"
59
111
  template_types:
112
+ block_user: Blokuj wiadomości użytkownika
113
+ proposal_answer_templates: Odpowiedzi na propozycję
60
114
  questionnaires: Kwestionariusze
@@ -14,6 +14,8 @@ tr:
14
14
  create:
15
15
  error: Bu şablonu oluştururken bir hata oluştu.
16
16
  empty: Burada henüz şablon yok.
17
+ fetch:
18
+ error: Aradığınız şablon bulunamadı. Lütfen sayfayı yenileyin.
17
19
  titles:
18
20
  template_types:
19
21
  questionnaires: Anket şablonları
@@ -36,7 +38,8 @@ tr:
36
38
  form:
37
39
  save: Kaydet
38
40
  index:
39
- internal_state: İçsel durum
41
+ missing_state: Kayıp Durum
42
+ proposal_state_id: İçsel durum
40
43
  questionnaire_templates:
41
44
  choose:
42
45
  create_from_template: Şablondan Oluştur
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  "homepage_uri" => "https://decidim.org",
18
18
  "source_code_uri" => "https://github.com/decidim/decidim"
19
19
  }
20
- s.required_ruby_version = "~> 3.1.0"
20
+ s.required_ruby_version = "~> 3.2.0"
21
21
 
22
22
  s.name = "decidim-templates"
23
23
  s.summary = "A decidim templates module"
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
 
33
33
  s.add_dependency "decidim-core", Decidim::Templates.version
34
34
  s.add_dependency "decidim-forms", Decidim::Templates.version
35
+ s.add_dependency "decidim-proposals", Decidim::Templates.version
35
36
 
36
37
  s.add_development_dependency "decidim-admin", Decidim::Templates.version
37
38
  s.add_development_dependency "decidim-dev", Decidim::Templates.version
@@ -19,12 +19,6 @@ FactoryBot.define do
19
19
  target { :user_block }
20
20
  end
21
21
 
22
- trait :proposal_answer do
23
- templatable { organization }
24
- target { :proposal_answer }
25
- field_values { { internal_state: :accepted } }
26
- end
27
-
28
22
  ## Questionnaire templates
29
23
  factory :questionnaire_template do
30
24
  transient do
@@ -31,7 +31,7 @@ shared_examples_for "copies all questionnaire contents" do
31
31
  end
32
32
 
33
33
  def check_answer_options(source_question, new_question)
34
- expect(source_question.answer_options.count).to eq(new_question.answer_options.count)
34
+ expect(source_question.answer_options.size).to eq(new_question.answer_options.size)
35
35
 
36
36
  source_question.answer_options.each_with_index do |source_answer_option, idx|
37
37
  new_answer_option = new_question.answer_options[idx]
@@ -41,7 +41,7 @@ shared_examples_for "copies all questionnaire contents" do
41
41
  end
42
42
 
43
43
  def check_matrix_rows(source_question, new_question)
44
- expect(source_question.matrix_rows.count).to eq(new_question.matrix_rows.count)
44
+ expect(source_question.matrix_rows.size).to eq(new_question.matrix_rows.size)
45
45
 
46
46
  source_question.matrix_rows.each_with_index do |source_matrix_row, idx|
47
47
  new_matrix_row = new_question.matrix_rows[idx]
@@ -52,7 +52,7 @@ shared_examples_for "copies all questionnaire contents" do
52
52
  end
53
53
 
54
54
  def check_display_conditions(source_display_conditions, new_display_conditions)
55
- expect(source_display_conditions.count).to eq(new_display_conditions.count)
55
+ expect(source_display_conditions.size).to eq(new_display_conditions.size)
56
56
 
57
57
  source_display_conditions.each_with_index do |source_matrix_row, idx|
58
58
  new_matrix_row = new_display_conditions[idx]
@@ -15,7 +15,7 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
15
15
  end
16
16
 
17
17
  it "does not show the template selection screen" do
18
- expect(page).not_to have_content("Choose template")
18
+ expect(page).to have_no_content("Choose template")
19
19
  end
20
20
  end
21
21
 
@@ -33,7 +33,7 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
33
33
  end
34
34
 
35
35
  it "does not show the template selection screen" do
36
- expect(page).not_to have_content("Choose template")
36
+ expect(page).to have_no_content("Choose template")
37
37
  end
38
38
  end
39
39
 
@@ -57,7 +57,7 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
57
57
  page.find("input[name='select-template']").click
58
58
 
59
59
  within "#template-list", visible: :hidden do
60
- expect(page).to have_selector("option", visible: :hidden, count: 6)
60
+ expect(page).to have_css("option", visible: :hidden, count: 6)
61
61
  end
62
62
  end
63
63
 
@@ -95,13 +95,13 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
95
95
  expect(page).to have_content(template.templatable.title["en"])
96
96
  end
97
97
 
98
- click_button "Create from template"
98
+ click_on "Create from template"
99
99
  end
100
100
 
101
101
  it "copies the template data to the questionnaire on submit" do
102
102
  within "form.edit_questionnaire" do
103
- click_button "Expand all"
104
- expect(page.find("#questionnaire_title_en").value).to eq(template.templatable.title["en"])
103
+ click_on "Expand all"
104
+ expect(page.find_by_id("questionnaire_title_en").value).to eq(template.templatable.title["en"])
105
105
  expect(page.find("#questionnaire_questions_#{questionnaire_question.id}_body_en").value).to eq(question.body["en"])
106
106
  end
107
107
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-templates version.
5
5
  module Templates
6
6
  def self.version
7
- "0.28.1"
7
+ "0.29.0.rc1"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.1
4
+ version: 0.29.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vera Rojman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-core
@@ -16,84 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.28.1
19
+ version: 0.29.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.28.1
26
+ version: 0.29.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: decidim-forms
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.28.1
33
+ version: 0.29.0.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.28.1
40
+ version: 0.29.0.rc1
41
+ - !ruby/object:Gem::Dependency
42
+ name: decidim-proposals
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.29.0.rc1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.29.0.rc1
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: decidim-admin
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - '='
46
60
  - !ruby/object:Gem::Version
47
- version: 0.28.1
61
+ version: 0.29.0.rc1
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: 0.28.1
68
+ version: 0.29.0.rc1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: decidim-dev
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: 0.28.1
75
+ version: 0.29.0.rc1
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - '='
67
81
  - !ruby/object:Gem::Version
68
- version: 0.28.1
82
+ version: 0.29.0.rc1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: decidim-participatory_processes
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - '='
74
88
  - !ruby/object:Gem::Version
75
- version: 0.28.1
89
+ version: 0.29.0.rc1
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - '='
81
95
  - !ruby/object:Gem::Version
82
- version: 0.28.1
96
+ version: 0.29.0.rc1
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: decidim-surveys
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - '='
88
102
  - !ruby/object:Gem::Version
89
- version: 0.28.1
103
+ version: 0.29.0.rc1
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - '='
95
109
  - !ruby/object:Gem::Version
96
- version: 0.28.1
110
+ version: 0.29.0.rc1
97
111
  description: This module provides a solution to create templates for different Decidim
98
112
  models, such as Proposals and Questionnaires..
99
113
  email:
@@ -249,7 +263,7 @@ metadata:
249
263
  funding_uri: https://opencollective.com/decidim
250
264
  homepage_uri: https://decidim.org
251
265
  source_code_uri: https://github.com/decidim/decidim
252
- post_install_message:
266
+ post_install_message:
253
267
  rdoc_options: []
254
268
  require_paths:
255
269
  - lib
@@ -257,15 +271,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
257
271
  requirements:
258
272
  - - "~>"
259
273
  - !ruby/object:Gem::Version
260
- version: 3.1.0
274
+ version: 3.2.0
261
275
  required_rubygems_version: !ruby/object:Gem::Requirement
262
276
  requirements:
263
- - - ">="
277
+ - - ">"
264
278
  - !ruby/object:Gem::Version
265
- version: '0'
279
+ version: 1.3.1
266
280
  requirements: []
267
- rubygems_version: 3.5.9
268
- signing_key:
281
+ rubygems_version: 3.4.10
282
+ signing_key:
269
283
  specification_version: 4
270
284
  summary: A decidim templates module
271
285
  test_files: []