decidim-templates 0.28.2 → 0.29.0.rc2

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 +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 +2 -2
  24. data/config/locales/fi.yml +2 -2
  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/tr-TR.yml +2 -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 +31 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02ea60391a68ed81505ad7dcfb4eb8d108f80af414704784cbc07de0866d02b4
4
- data.tar.gz: 1a92137e9d8c13571dbe7b268245ac57a6d87c03b5e98dacdced64013018cc14
3
+ metadata.gz: 4e68a117a9a367b621924760fbd878485a1b4d3415238941e84dd3d1b60af51e
4
+ data.tar.gz: fd42584e7bd3bae2f182664e9881f41b77700f988666fd674991857640225c48
5
5
  SHA512:
6
- metadata.gz: f56f6f547e3770e0b838c9c1718dd40548d2a4983a5d11368f294f28e46d2a878ef8add7c7bb9e66584fd6153f20351ef9d8c7714a2ece97c50348ba80c2afd0
7
- data.tar.gz: b7c3da44aa0b740b7c71b9b69fb21337efff38d59b09eb0428cb491bc335ba7d044d863a56c0b43add21a70f495b2304ac526023adfc7c575de9e42c28404a50
6
+ metadata.gz: 0a2cbfd073451a9289eced7fb674f42fa9911d2e4380ddb64bf1a3c365e638a79341d02bd6a43354cfcf9df2be3db35530f4c96723272c9db6daf36d563d888a
7
+ data.tar.gz: 4201e78f41c9d30f0265ea533e3a4fe506d3cbb6fba804c200a2760eb377332a4d84c3076a8aa6ba28efa82f1a3473996e5cc9eb58489497bbeb7f29cbcc6dd7
@@ -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
@@ -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
@@ -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ę
@@ -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,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.2"
7
+ "0.29.0.rc2"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2
4
+ version: 0.29.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vera Rojman
@@ -16,84 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.28.2
19
+ version: 0.29.0.rc2
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.2
26
+ version: 0.29.0.rc2
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.2
33
+ version: 0.29.0.rc2
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.2
40
+ version: 0.29.0.rc2
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.rc2
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.rc2
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.2
61
+ version: 0.29.0.rc2
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.2
68
+ version: 0.29.0.rc2
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.2
75
+ version: 0.29.0.rc2
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.2
82
+ version: 0.29.0.rc2
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.2
89
+ version: 0.29.0.rc2
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.2
96
+ version: 0.29.0.rc2
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.2
103
+ version: 0.29.0.rc2
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.2
110
+ version: 0.29.0.rc2
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:
@@ -257,14 +271,14 @@ 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.3.7
281
+ rubygems_version: 3.4.10
268
282
  signing_key:
269
283
  specification_version: 4
270
284
  summary: A decidim templates module