decidim-templates 0.28.3 → 0.29.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) 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 +2 -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 +2 -2
  23. data/config/locales/fi-plain.yml +3 -3
  24. data/config/locales/fi.yml +3 -3
  25. data/config/locales/fr-CA.yml +2 -2
  26. data/config/locales/fr.yml +2 -2
  27. data/config/locales/hu.yml +0 -1
  28. data/config/locales/ja.yml +2 -2
  29. data/config/locales/pl.yml +2 -2
  30. data/config/locales/sv.yml +2 -33
  31. data/config/locales/tr-TR.yml +2 -1
  32. data/decidim-templates.gemspec +2 -2
  33. data/lib/decidim/templates/test/factories.rb +0 -6
  34. data/lib/decidim/templates/test/shared_examples/copies_all_questionnaire_contents_examples.rb +3 -3
  35. data/lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb +6 -6
  36. data/lib/decidim/templates/version.rb +1 -1
  37. metadata +25 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1727bbce0e106f37851710a4a3dc0ca2f193d7448837562f029aea4895acea0
4
- data.tar.gz: 9633de1b0b95f2b22a385a4d8caa1883c8f670d015e50ea1b7f5aba452f42ee2
3
+ metadata.gz: c9b72969a1ffc689d6abcd27cc5b6ac070ff31ca0affb0a9b6b9d8c1be14e2b6
4
+ data.tar.gz: 6f318b04297a61c3e624f5d8490076fe01540a6ce70f86c7cebfc4caa893ae38
5
5
  SHA512:
6
- metadata.gz: b199d92d0fad9f0716cac37a5aa560ffe208f9e8f079b0c01efce80d626acfab350468359ca1b762fda9018cb6a8aae25ec42f632bbc6f32eb4b8f97a4a9feaa
7
- data.tar.gz: 35814562442adeca9a0538d53a6565098133999cd13224f3a7f21d224700458aad5b64fe7c0d54bdf08de31634280a125e80d1613da30e39e7fe595804cd7f2f
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 %>");
@@ -72,8 +72,8 @@ bg:
72
72
  index:
73
73
  component_constraint: Добавяне на ограничение
74
74
  confirm_delete: Сигурни ли сте, че желаете да изтриете този шаблон?
75
- global_scope: Глобално (достъпно навсякъде)
76
- internal_state: Вътрешно състояние
75
+ missing_state: Липсващо състояние
76
+ proposal_state_id: Вътрешно състояние
77
77
  title: Отговори на предложенията
78
78
  new:
79
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
@@ -72,8 +72,8 @@ eu:
72
72
  index:
73
73
  component_constraint: Gehitu hertsapena.
74
74
  confirm_delete: Ziur zaude txantiloi hau ezabatu nahi duzula?
75
- global_scope: Globala (nonahi eskuragarri)
76
- internal_state: Barne egoera
75
+ missing_state: Egoera desagertua
76
+ proposal_state_id: Barne egoera
77
77
  title: Proposamenen erantzunak
78
78
  new:
79
79
  title: Proposamenaren erantzun-txantilioi berria
@@ -27,7 +27,7 @@ fi-pl:
27
27
  success: Mallipohjan poisto onnistui.
28
28
  empty: Mallipohjia ei ole vielä lisätty.
29
29
  fetch:
30
- error: Mallipohjaa ei löytynyt. Lataa sivu uudestaan.
30
+ error: Mallipohjaa ei löytynyt. Lataa sivu uudelleen.
31
31
  missing_resource: "(puuttuva resurssi)"
32
32
  update:
33
33
  error: Mallipohjan päivitys epäonnistui.
@@ -72,8 +72,8 @@ fi-pl:
72
72
  index:
73
73
  component_constraint: Lisää rajaussääntö
74
74
  confirm_delete: Haluatko varmasti poistaa tämän mallipohjan?
75
- global_scope: Yleinen (saatavilla kaikkialla)
76
- internal_state: Sisäinen tila
75
+ missing_state: Puuttuva tila
76
+ proposal_state_id: Sisäinen tila
77
77
  title: Ehdotusten vastaukset
78
78
  new:
79
79
  title: Uusi ehdotusten vastausten mallipohja
@@ -27,7 +27,7 @@ fi:
27
27
  success: Mallipohjan poisto onnistui.
28
28
  empty: Mallipohjia ei ole vielä lisätty.
29
29
  fetch:
30
- error: Mallipohjaa ei löytynyt. Lataa sivu uudestaan.
30
+ error: Mallipohjaa ei löytynyt. Lataa sivu uudelleen.
31
31
  missing_resource: "(puuttuva resurssi)"
32
32
  update:
33
33
  error: Mallipohjan päivitys epäonnistui.
@@ -72,8 +72,8 @@ fi:
72
72
  index:
73
73
  component_constraint: Lisää rajaussääntö
74
74
  confirm_delete: Haluatko varmasti poistaa tämän mallipohjan?
75
- global_scope: Yleinen (saatavilla kaikkialla)
76
- internal_state: Sisäinen tila
75
+ missing_state: Puuttuva tila
76
+ proposal_state_id: Sisäinen tila
77
77
  title: Ehdotusten vastaukset
78
78
  new:
79
79
  title: Uusi ehdotusten vastausten mallipohja
@@ -72,8 +72,8 @@ fr-CA:
72
72
  index:
73
73
  component_constraint: Ajouter une contrainte
74
74
  confirm_delete: Êtes-vous sûr de vouloir supprimer ce modèle ?
75
- global_scope: Global (disponible partout)
76
- internal_state: Etat interne
75
+ missing_state: Etat manquant
76
+ proposal_state_id: Etat interne
77
77
  title: Réponses à la proposition
78
78
  new:
79
79
  title: Nouveau modèle de réponse à proposition
@@ -72,8 +72,8 @@ fr:
72
72
  index:
73
73
  component_constraint: Ajouter une contrainte
74
74
  confirm_delete: Êtes-vous sûr de vouloir supprimer ce modèle ?
75
- global_scope: Global (disponible partout)
76
- internal_state: Etat interne
75
+ missing_state: Etat manquant
76
+ proposal_state_id: Etat interne
77
77
  title: Réponses à la proposition
78
78
  new:
79
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:
@@ -72,8 +72,8 @@ ja:
72
72
  index:
73
73
  component_constraint: 制約を追加
74
74
  confirm_delete: このテンプレートを削除してもよろしいですか?
75
- global_scope: グローバル (どこでも利用可能)
76
- internal_state: 内部状態
75
+ missing_state: 状態がありません
76
+ proposal_state_id: 内部状態
77
77
  title: 提案の回答
78
78
  new:
79
79
  title: 新しい提案回答テンプレート
@@ -72,8 +72,8 @@ pl:
72
72
  index:
73
73
  component_constraint: Dodaj ograniczenie
74
74
  confirm_delete: Czy na pewno chcesz usunąć ten szablon?
75
- global_scope: Globalny (dostępny wszędzie)
76
- internal_state: Stan wewnętrzny
75
+ missing_state: Brakujący stan
76
+ proposal_state_id: Stan wewnętrzny
77
77
  title: Odpowiedzi na propozycję
78
78
  new:
79
79
  title: Nowy szablon odpowiedzi na propozycję
@@ -11,52 +11,21 @@ sv:
11
11
  admin:
12
12
  menu:
13
13
  templates: Mallar
14
- templates:
15
- actions:
16
- new_template: Ny mall
17
- apply:
18
- error: Det gick inte att tillämpa mallen.
19
- success: Mallen har tillämpats.
20
- copy:
21
- error: Det gick inte att kopiera mallen.
22
- success: Mallen har kopierats.
23
- create:
24
- error: Det gick inte att skapa mallen.
25
- success: Mallen har skapats.
26
- destroy:
27
- success: Mallen har tagits bort.
28
- empty: Det finns inga mallar ännu.
29
- fetch:
30
- error: Kunde inte hitta mallen. Ladda om sidan.
31
- missing_resource: "(saknad resurs)"
32
- update:
33
- error: Det gick inte att uppdatera mallen.
34
- success: Mallen har uppdaterats.
35
14
  titles:
36
- template_types:
37
- questionnaires: Mallar för enkäter
38
15
  templates: Mallar
39
16
  models:
40
- questionnaire_template:
41
- fields:
42
- questions: Antal frågor
43
- title: Titel på enkät
44
17
  template:
45
18
  fields:
46
- created_at: Skapad
19
+ created_at: Skapad den
47
20
  name: Mall
48
21
  templates:
49
22
  admin:
50
23
  block_user_templates:
51
24
  form:
52
25
  save: Spara
53
- index:
54
- confirm_delete: Är det säkert att du vill ta bort mallen?
55
26
  proposal_answer_templates:
56
27
  form:
57
28
  save: Spara
58
- index:
59
- global_scope: Globalt (tillgängligt överallt)
60
29
  questionnaire_templates:
61
30
  choose:
62
31
  label: Välj mall
@@ -66,7 +35,7 @@ sv:
66
35
  edit: Redigera
67
36
  questionnaire: Enkät
68
37
  preview:
69
- current_step: Steg %{step}
38
+ current_step: Steg %{step} av
70
39
  of_total_steps: av %{total_steps}
71
40
  template_types:
72
41
  questionnaires: Enkäter
@@ -38,7 +38,8 @@ tr:
38
38
  form:
39
39
  save: Kaydet
40
40
  index:
41
- internal_state: İçsel durum
41
+ missing_state: Kayıp Durum
42
+ proposal_state_id: İçsel durum
42
43
  questionnaire_templates:
43
44
  choose:
44
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,10 +32,10 @@ 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
38
39
  s.add_development_dependency "decidim-participatory_processes", Decidim::Templates.version
39
- s.add_development_dependency "decidim-proposals", Decidim::Templates.version
40
40
  s.add_development_dependency "decidim-surveys", Decidim::Templates.version
41
41
  end
@@ -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.3"
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.3
4
+ version: 0.29.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vera Rojman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-10 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,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.28.3
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.3
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.3
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.3
40
+ version: 0.29.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
- name: decidim-admin
42
+ name: decidim-proposals
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.28.3
48
- type: :development
47
+ version: 0.29.0.rc1
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.28.3
54
+ version: 0.29.0.rc1
55
55
  - !ruby/object:Gem::Dependency
56
- name: decidim-dev
56
+ name: decidim-admin
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.28.3
61
+ version: 0.29.0.rc1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.28.3
68
+ version: 0.29.0.rc1
69
69
  - !ruby/object:Gem::Dependency
70
- name: decidim-participatory_processes
70
+ name: decidim-dev
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.28.3
75
+ version: 0.29.0.rc1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.28.3
82
+ version: 0.29.0.rc1
83
83
  - !ruby/object:Gem::Dependency
84
- name: decidim-proposals
84
+ name: decidim-participatory_processes
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.28.3
89
+ version: 0.29.0.rc1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.28.3
96
+ version: 0.29.0.rc1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: decidim-surveys
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.28.3
103
+ version: 0.29.0.rc1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.28.3
110
+ version: 0.29.0.rc1
111
111
  description: This module provides a solution to create templates for different Decidim
112
112
  models, such as Proposals and Questionnaires..
113
113
  email:
@@ -271,14 +271,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
271
  requirements:
272
272
  - - "~>"
273
273
  - !ruby/object:Gem::Version
274
- version: 3.1.0
274
+ version: 3.2.0
275
275
  required_rubygems_version: !ruby/object:Gem::Requirement
276
276
  requirements:
277
- - - ">="
277
+ - - ">"
278
278
  - !ruby/object:Gem::Version
279
- version: '0'
279
+ version: 1.3.1
280
280
  requirements: []
281
- rubygems_version: 3.3.7
281
+ rubygems_version: 3.4.10
282
282
  signing_key:
283
283
  specification_version: 4
284
284
  summary: A decidim templates module