decidim-templates 0.26.3 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-templates might be problematic. Click here for more details.

Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/templates/admin/apply_questionnaire_template.rb +1 -1
  3. data/app/commands/decidim/templates/admin/copy_questionnaire_template.rb +8 -5
  4. data/app/commands/decidim/templates/admin/create_questionnaire_template.rb +1 -1
  5. data/app/commands/decidim/templates/admin/destroy_template.rb +1 -1
  6. data/app/commands/decidim/templates/admin/questionnaire_copier.rb +2 -1
  7. data/app/commands/decidim/templates/admin/update_template.rb +1 -1
  8. data/app/controllers/decidim/templates/admin/questionnaire_templates_controller.rb +1 -1
  9. data/app/models/decidim/templates/template.rb +6 -0
  10. data/app/packs/entrypoints/decidim_templates.js +1 -0
  11. data/app/packs/src/decidim/templates/admin/choose_template.js +30 -0
  12. data/app/presenters/decidim/templates/admin_log/template_presenter.rb +36 -0
  13. data/app/views/decidim/templates/admin/questionnaire_templates/_choose.html.erb +13 -3
  14. data/config/locales/am-ET.yml +1 -0
  15. data/config/locales/ar.yml +1 -0
  16. data/config/locales/bg.yml +1 -0
  17. data/config/locales/ca.yml +7 -0
  18. data/config/locales/cs.yml +7 -0
  19. data/config/locales/da.yml +1 -0
  20. data/config/locales/de.yml +1 -7
  21. data/config/locales/el.yml +1 -0
  22. data/config/locales/en.yml +6 -0
  23. data/config/locales/eo.yml +1 -0
  24. data/config/locales/es-MX.yml +7 -0
  25. data/config/locales/es-PY.yml +7 -0
  26. data/config/locales/es.yml +7 -0
  27. data/config/locales/et.yml +1 -0
  28. data/config/locales/eu.yml +1 -0
  29. data/config/locales/fi-plain.yml +7 -0
  30. data/config/locales/fi.yml +7 -0
  31. data/config/locales/fr-CA.yml +1 -0
  32. data/config/locales/fr.yml +1 -0
  33. data/config/locales/ga-IE.yml +1 -0
  34. data/config/locales/gl.yml +1 -0
  35. data/config/locales/hr.yml +1 -0
  36. data/config/locales/hu.yml +1 -66
  37. data/config/locales/id-ID.yml +1 -0
  38. data/config/locales/is-IS.yml +2 -1
  39. data/config/locales/it.yml +1 -0
  40. data/config/locales/ja.yml +7 -0
  41. data/config/locales/ko.yml +1 -0
  42. data/config/locales/lb.yml +1 -0
  43. data/config/locales/lt.yml +1 -66
  44. data/config/locales/lv.yml +1 -0
  45. data/config/locales/mt.yml +1 -0
  46. data/config/locales/nl.yml +1 -0
  47. data/config/locales/no.yml +1 -0
  48. data/config/locales/om-ET.yml +1 -0
  49. data/config/locales/pl.yml +1 -0
  50. data/config/locales/pt-BR.yml +2 -1
  51. data/config/locales/pt.yml +1 -0
  52. data/config/locales/ro-RO.yml +1 -0
  53. data/config/locales/ru.yml +1 -0
  54. data/config/locales/si-LK.yml +1 -0
  55. data/config/locales/sk.yml +1 -0
  56. data/config/locales/sl.yml +1 -0
  57. data/config/locales/so-SO.yml +1 -0
  58. data/config/locales/sr-CS.yml +1 -0
  59. data/config/locales/sv.yml +1 -0
  60. data/config/locales/sw-KE.yml +1 -0
  61. data/config/locales/ti-ER.yml +1 -0
  62. data/config/locales/tr-TR.yml +1 -0
  63. data/config/locales/uk.yml +1 -0
  64. data/config/locales/val-ES.yml +1 -0
  65. data/config/locales/vi.yml +1 -0
  66. data/config/locales/zh-CN.yml +1 -0
  67. data/config/locales/zh-TW.yml +1 -0
  68. data/db/seeds.rb +1 -1
  69. data/lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb +9 -8
  70. data/lib/decidim/templates/version.rb +1 -1
  71. metadata +16 -16
  72. data/app/helpers/decidim/templates/admin/templates_helper.rb +0 -32
  73. data/config/locales/oc-FR.yml +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfd907f4254fb022c89fc823d8b7bd76d95b1ceb34ad394a2655e82804384c59
4
- data.tar.gz: 84f885fe22eaec85fe5df6a6fe5a70c30623ba09bda363c4fbbf3af4d30f3a99
3
+ metadata.gz: 00fb7813ca553dfef2aa7b56f41da97804c6d27e0e62bc2d616842c4eff820a5
4
+ data.tar.gz: 37d4edffba55c81d5826439eb6a4b75549f3f891b9fd7d1d6fd482bbb47d4748
5
5
  SHA512:
6
- metadata.gz: 9a5f3b3a1c676126e1fd760adc01acb7572628e1bd279a1263a3c41573244c1d5b3ef2f252fd2995d935bc9c8d4eb892447582fec953f86304cd0707bb499479
7
- data.tar.gz: 63ad9ffa2c2b49dcd9b49b5465c472855b3b6cdde3b2d810b75585ac7d1679355f67fafb5bcd42923b4f8c6510492ec680aa547a2be3883189609c3e5edd3ac8
6
+ metadata.gz: 6b8eb0373fbb853f099283f3dc52a86b69426954ee1dd92fbf2cceeefe67d836c71f2b26e832a14b1fd098d861f226663e457b1ffb6d8a5894282ce3f55ceb75
7
+ data.tar.gz: 882db5f20769282c34c7065d941a2d65decaa7de86883226eb0f05f5bd2b197a81299b80157349bee87058f7543f496ca30b12b469d9cc083e276c36647af784
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Templates
5
5
  # A command with all the business logic when duplicating a questionnaire template
6
6
  module Admin
7
- class ApplyQuestionnaireTemplate < Rectify::Command
7
+ class ApplyQuestionnaireTemplate < Decidim::Command
8
8
  include Decidim::Templates::Admin::QuestionnaireCopier
9
9
 
10
10
  # Public: Initializes the command.
@@ -4,14 +4,15 @@ module Decidim
4
4
  module Templates
5
5
  # A command with all the business logic when duplicating a questionnaire template
6
6
  module Admin
7
- class CopyQuestionnaireTemplate < Rectify::Command
7
+ class CopyQuestionnaireTemplate < Decidim::Command
8
8
  include Decidim::Templates::Admin::QuestionnaireCopier
9
9
 
10
10
  # Public: Initializes the command.
11
11
  #
12
12
  # template - A template we want to duplicate
13
- def initialize(template)
13
+ def initialize(template, user)
14
14
  @template = template
15
+ @user = user
15
16
  end
16
17
 
17
18
  # Executes the command. Broadcasts these events:
@@ -23,9 +24,11 @@ module Decidim
23
24
  def call
24
25
  return broadcast(:invalid) unless @template.valid?
25
26
 
26
- Template.transaction do
27
- copy_template
28
- copy_questionnaire_questions(@template.templatable, @copied_template.templatable)
27
+ Decidim.traceability.perform_action!("duplicate", @template, @user) do
28
+ Template.transaction do
29
+ copy_template
30
+ copy_questionnaire_questions(@template.templatable, @copied_template.templatable)
31
+ end
29
32
  end
30
33
 
31
34
  broadcast(:ok, @copied_template)
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Templates
5
5
  module Admin
6
6
  # Creates a QuestionnaireTemplate.
7
- class CreateQuestionnaireTemplate < Rectify::Command
7
+ class CreateQuestionnaireTemplate < Decidim::Command
8
8
  # Initializes the command.
9
9
  #
10
10
  # form - The source for this QuestionnaireTemplate.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Templates
5
5
  module Admin
6
6
  # This command deals with destroying a template from the admin panel.
7
- class DestroyTemplate < Rectify::Command
7
+ class DestroyTemplate < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # template - The Template to be destroyed.
@@ -7,7 +7,7 @@ module Decidim
7
7
  module QuestionnaireCopier
8
8
  def copy_questionnaire_questions(original_questionnaire, new_questionnaire)
9
9
  # start by copying the questions so that they already exist when cross referencing them in the conditions
10
- original_questionnaire.questions.includes(:answer_options, :matrix_rows, :display_conditions).load
10
+ original_questionnaire.reload.questions.includes(:answer_options, :matrix_rows, :display_conditions)
11
11
  original_questionnaire.questions.each do |original_question|
12
12
  new_question = original_question.dup
13
13
  new_question.questionnaire = new_questionnaire
@@ -49,6 +49,7 @@ module Decidim
49
49
  new_display_condition.answer_option = find_answer_option_by_body(destination_question_to_be_checked.answer_options, original_display_condition.answer_option.body)
50
50
  end
51
51
  new_display_condition.save!
52
+ destination_question.display_conditions << new_display_condition
52
53
  end
53
54
  end
54
55
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Templates
5
5
  module Admin
6
6
  # Updates the questionnaire template given form data.
7
- class UpdateTemplate < Rectify::Command
7
+ class UpdateTemplate < Decidim::Command
8
8
  # Initializes the command.
9
9
  #
10
10
  # template - The Template to update.
@@ -54,7 +54,7 @@ module Decidim
54
54
  def copy
55
55
  enforce_permission_to :copy, :template
56
56
 
57
- CopyQuestionnaireTemplate.call(template) do
57
+ CopyQuestionnaireTemplate.call(template, current_user) do
58
58
  on(:ok) do
59
59
  flash[:notice] = I18n.t("templates.copy.success", scope: "decidim.admin")
60
60
  redirect_to action: :index
@@ -11,6 +11,8 @@
11
11
  module Decidim
12
12
  module Templates
13
13
  class Template < ApplicationRecord
14
+ include Decidim::Traceable
15
+
14
16
  belongs_to :organization,
15
17
  foreign_key: "decidim_organization_id",
16
18
  class_name: "Decidim::Organization"
@@ -28,6 +30,10 @@ module Decidim
28
30
  def destroy_templatable
29
31
  templatable.destroy
30
32
  end
33
+
34
+ def self.log_presenter_class_for(_log)
35
+ Decidim::Templates::AdminLog::TemplatePresenter
36
+ end
31
37
  end
32
38
  end
33
39
  end
@@ -1,3 +1,4 @@
1
+ import "src/decidim/templates/admin/choose_template"
1
2
  import "entrypoints/decidim_templates.scss";
2
3
 
3
4
  // Images
@@ -0,0 +1,30 @@
1
+ import { datalistSelect } from "src/decidim/datalist_select";
2
+
3
+ $(() => {
4
+ const wrapper = document.querySelector("#choose-template");
5
+ if (!wrapper) {
6
+ return;
7
+ }
8
+
9
+ const preview = (id) => {
10
+ const options = wrapper.dataset;
11
+ const previewURL = options.previewurl;
12
+ if (!previewURL) {
13
+ return;
14
+ }
15
+ const params = new URLSearchParams({ id: id });
16
+ fetch(`${previewURL}?${params.toString()}`, {
17
+ method: "GET",
18
+ headers: { "Content-Type": "application/json" }
19
+ }).then((response) => response.text()).then((data) => {
20
+ const script = document.createElement("script");
21
+ script.type = "text/javascript";
22
+ script.innerHTML = data;
23
+ document.getElementsByTagName("head")[0].appendChild(script);
24
+ }).catch((error) => {
25
+ console.error(error); // eslint-disable-line no-console
26
+ });
27
+ }
28
+
29
+ datalistSelect(wrapper, preview)
30
+ })
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Templates
5
+ module AdminLog
6
+ # This class holds the logic to present a `Decidim::Template`
7
+ # for the `AdminLog` log.
8
+ #
9
+ # Usage should be automatic and you shouldn't need to call this class
10
+ # directly, but here's an example:
11
+ #
12
+ # action_log = Decidim::ActionLog.last
13
+ # view_helpers # => this comes from the views
14
+ # TemplatePresenter.new(action_log, view_helpers).present
15
+ class TemplatePresenter < Decidim::Log::BasePresenter
16
+ private
17
+
18
+ def diff_fields_mapping
19
+ {
20
+ name: :i18n,
21
+ description: :i18n
22
+ }
23
+ end
24
+
25
+ def action_string
26
+ case action
27
+ when "create", "update", "delete", "duplicate"
28
+ "decidim.templates.admin_log.template.#{action}"
29
+ else
30
+ super
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -12,9 +12,18 @@
12
12
  </div>
13
13
 
14
14
  <%= decidim_form_for([questionnaire], url: decidim_admin_templates.apply_questionnaire_templates_url(questionnaire_id: questionnaire, url: request.url), method: :post, html: { class: "form choose_questionnaire_templates" }) do |form| %>
15
- <div class="row column">
16
- <%= select_template form, templates %>
17
- </div>
15
+ <%= datalist_select(templates,
16
+ {
17
+ id: "choose-template",
18
+ list: "template-list",
19
+ label: t(".label"),
20
+ name: "select-template",
21
+ placeholder: t("placeholder", scope: "decidim.templates.admin.questionnaire_templates.choose"),
22
+ data: {
23
+ previewurl: decidim_admin_templates.preview_questionnaire_templates_url(format: :js)
24
+ }
25
+ }
26
+ ) { form.hidden_field :questionnaire_template_id } %>
18
27
 
19
28
  <div class="card-section questionnaire-template-preview">
20
29
  <h3 class="template-name"></h3>
@@ -32,4 +41,5 @@
32
41
  </div>
33
42
  </div>
34
43
 
44
+ <%= javascript_pack_tag "decidim_templates" %>
35
45
  <%= stylesheet_pack_tag "decidim_templates", media: "all" %>
@@ -1 +1,2 @@
1
+ ---
1
2
  am:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ar:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  bg:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ca:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ ca:
63
64
  current_step: Pas %{step}
64
65
  of_total_steps: de %{total_steps}
65
66
  tos_agreement: En participar acceptes els Termes i condicions d'ús
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} ha actualitzat la plantilla del qüestionari %{resource_name}"
70
+ delete: "%{user_name} ha esborrat la plantilla del qüestionari %{resource_name}"
71
+ duplicate: "%{user_name} ha duplicat la plantilla del qüestionari %{resource_name}"
72
+ update: "%{user_name} ha actualitzat la plantilla del qüestionari %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Qüestionari
@@ -1,3 +1,4 @@
1
+ ---
1
2
  cs:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ cs:
63
64
  current_step: Krok %{step}
64
65
  of_total_steps: z %{total_steps}
65
66
  tos_agreement: Zúčastněním souhlasíte s podmínkami služby
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} vytvořil šablonu dotazníku %{resource_name}"
70
+ delete: "%{user_name} odstranil šablonu dotazníku %{resource_name}"
71
+ duplicate: "%{user_name} zkopíroval šablonu dotazníku %{resource_name}"
72
+ update: "%{user_name} aktualizoval šablonu dotazníku %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Dotazníky
@@ -1 +1,2 @@
1
+ ---
1
2
  da:
@@ -1,11 +1,5 @@
1
+ ---
1
2
  de:
2
- activemodel:
3
- attributes:
4
- questionnaire:
5
- title: Titel
6
- template:
7
- description: Beschreibung
8
- name: Name
9
3
  decidim:
10
4
  admin:
11
5
  menu:
@@ -1 +1,2 @@
1
+ ---
1
2
  el:
@@ -64,5 +64,11 @@ en:
64
64
  current_step: Step %{step}
65
65
  of_total_steps: of %{total_steps}
66
66
  tos_agreement: By participating you accept its Terms of Service
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} created the %{resource_name} questionnaire template"
70
+ delete: "%{user_name} deleted the %{resource_name} questionnaire template"
71
+ duplicate: "%{user_name} duplicated the %{resource_name} questionnaire template"
72
+ update: "%{user_name} updated the %{resource_name} questionnaire template"
67
73
  template_types:
68
74
  questionnaires: Questionnaires
@@ -1 +1,2 @@
1
+ ---
1
2
  eo:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es-MX:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ es-MX:
63
64
  current_step: Paso %{step}
64
65
  of_total_steps: de %{total_steps}
65
66
  tos_agreement: Al participar aceptas los Términos y condiciones de uso
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} ha creado la plantilla del cuestionario %{resource_name}"
70
+ delete: "%{user_name} ha eliminado la plantilla del cuestionario %{resource_name}"
71
+ duplicate: "%{user_name} ha duplicado la plantilla del cuestionario %{resource_name}"
72
+ update: "%{user_name} ha actualizado la platilla del cuestionario %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Cuestionarios
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es-PY:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ es-PY:
63
64
  current_step: Paso %{step}
64
65
  of_total_steps: de %{total_steps}
65
66
  tos_agreement: Al participar aceptas los Términos y condiciones de uso
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} ha creado la plantilla del cuestionario %{resource_name}"
70
+ delete: "%{user_name} ha eliminado la plantilla del cuestionario %{resource_name}"
71
+ duplicate: "%{user_name} ha duplicado la plantilla del cuestionario %{resource_name}"
72
+ update: "%{user_name} ha actualizado la platilla del cuestionario %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Cuestionarios
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ es:
63
64
  current_step: Paso %{step}
64
65
  of_total_steps: de %{total_steps}
65
66
  tos_agreement: Al participar aceptas los Términos y condiciones de uso
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} ha creado la plantilla del cuestionario %{resource_name}"
70
+ delete: "%{user_name} ha eliminado la plantilla del cuestionario %{resource_name}"
71
+ duplicate: "%{user_name} ha duplicado la plantilla del cuestionario %{resource_name}"
72
+ update: "%{user_name} ha actualizado la platilla del cuestionario %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Cuestionarios
@@ -1 +1,2 @@
1
+ ---
1
2
  et:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  eu:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fi-pl:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ fi-pl:
63
64
  current_step: Vaihe %{step}
64
65
  of_total_steps: / %{total_steps}
65
66
  tos_agreement: Osallistumalla hyväksyt käyttöehdot
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} loi kyselymallin %{resource_name}"
70
+ delete: "%{user_name} poisti kyselymallin %{resource_name}"
71
+ duplicate: "%{user_name} kopioi kyselymallin %{resource_name}"
72
+ update: "%{user_name} päivitti kyselymallia %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Kyselyt
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fi:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ fi:
63
64
  current_step: Vaihe %{step}
64
65
  of_total_steps: / %{total_steps}
65
66
  tos_agreement: Osallistumalla hyväksyt käyttöehdot
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} loi kyselymallin %{resource_name}"
70
+ delete: "%{user_name} poisti kyselymallin %{resource_name}"
71
+ duplicate: "%{user_name} kopioi kyselymallin %{resource_name}"
72
+ update: "%{user_name} päivitti kyselymallia %{resource_name}"
66
73
  template_types:
67
74
  questionnaires: Kyselyt
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fr-CA:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fr:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ga:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  gl:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  hr:
@@ -1,67 +1,2 @@
1
+ ---
1
2
  hu:
2
- activemodel:
3
- attributes:
4
- questionnaire:
5
- title: Cím
6
- template:
7
- description: Leírás
8
- name: Név
9
- decidim:
10
- admin:
11
- menu:
12
- templates: Sablonok
13
- templates:
14
- apply:
15
- error: Probléma merült fel a sablon alkalmazása során.
16
- success: Sablon sikeresen alkalmazva
17
- copy:
18
- error: Probléma merült fel a sablon másolása során.
19
- success: Sablon sikeresen másolva
20
- create:
21
- error: Probléma történt az sablon létrehozásakor.
22
- success: Sablon létrhehozása sikeres
23
- destroy:
24
- success: Sablon törlése sikeres
25
- empty: Nincsenek még sablonok.
26
- update:
27
- error: Probléma merült fel a sablon frissítése során.
28
- success: A sablon sikeresen frissült
29
- titles:
30
- template_types:
31
- questionnaires: Kérdőív-sablonok
32
- templates: Sablonok
33
- models:
34
- questionnaire_template:
35
- fields:
36
- questions: Kérdések száma
37
- title: Kérdõív címe
38
- template:
39
- fields:
40
- created_at: 'Létrehozva:'
41
- name: Sablon
42
- templates:
43
- admin:
44
- questionnaire_templates:
45
- choose:
46
- create_from_template: Létrehozás sablonból
47
- description: Egy új kérdőív létrehozására készült. Választhatsz előre létrehozott sablonok közül amelyeket később módosíthatsz.
48
- label: Válassz egy sablont
49
- placeholder: Válassz egy sablont
50
- skip_template: Átugrás
51
- edit:
52
- edit: Szerkesztés
53
- empty: Még nincsenek kérdések
54
- questionnaire: Kérdőív
55
- form:
56
- save: Mentés
57
- template_title: Sablon információi
58
- title: Kérdőív sablon %{questionnaire_for}
59
- index:
60
- confirm_delete: Biztos törölni szeretné a sablont?
61
- title: Kérdőív-sablonok
62
- preview:
63
- current_step: Lépés %{step}
64
- of_total_steps: 'ennyiből: %{total_steps}'
65
- tos_agreement: A részvétellel elfogadja az Általános Szerződési Feltételeket
66
- template_types:
67
- questionnaires: Kérdőívek
@@ -1 +1,2 @@
1
+ ---
1
2
  id:
@@ -1 +1,2 @@
1
- is-IS:
1
+ ---
2
+ is:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  it:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ja:
2
3
  activemodel:
3
4
  attributes:
@@ -63,5 +64,11 @@ ja:
63
64
  current_step: ステップ %{step}
64
65
  of_total_steps: / %{total_steps}
65
66
  tos_agreement: 参加することにより、利用規約に同意します。
67
+ admin_log:
68
+ template:
69
+ create: "%{user_name} が %{resource_name} アンケートテンプレートを作成しました"
70
+ delete: "%{user_name} が %{resource_name} アンケートテンプレートを削除しました"
71
+ duplicate: "%{user_name} が %{resource_name} アンケートテンプレートを複製しました"
72
+ update: "%{user_name} が %{resource_name} アンケートテンプレートを更新しました"
66
73
  template_types:
67
74
  questionnaires: アンケート
@@ -1 +1,2 @@
1
+ ---
1
2
  ko:
@@ -1 +1,2 @@
1
+ ---
1
2
  lb:
@@ -1,67 +1,2 @@
1
+ ---
1
2
  lt:
2
- activemodel:
3
- attributes:
4
- questionnaire:
5
- title: Pavadinimas
6
- template:
7
- description: Aprašymas
8
- name: Pavadinimas
9
- decidim:
10
- admin:
11
- menu:
12
- templates: Šablonai
13
- templates:
14
- apply:
15
- error: Pritaikant šį šabloną iškilo problema.
16
- success: Šablonas sėkmingai pritaikytas
17
- copy:
18
- error: Kopijuojant šį šabloną iškilo problema.
19
- success: Šablonas pritaikytas nukopijuotas
20
- create:
21
- error: Kuriant šį šabloną iškilo problema.
22
- success: Šablonas sukurtas sėkmingai
23
- destroy:
24
- success: Šablonas ištrintas sėkmingai
25
- empty: Dar nėra šablonų.
26
- update:
27
- error: Atnaujinant šį šabloną kilo problema.
28
- success: Šablonas atnaujintas sėkmingai
29
- titles:
30
- template_types:
31
- questionnaires: Klausimyno šablonai
32
- templates: Šablonai
33
- models:
34
- questionnaire_template:
35
- fields:
36
- questions: Klausimų skaičius
37
- title: Klausimyno pavadinimas
38
- template:
39
- fields:
40
- created_at: Sukurta
41
- name: Šablonas
42
- templates:
43
- admin:
44
- questionnaire_templates:
45
- choose:
46
- create_from_template: Kurti iš šablono
47
- description: Tuojaus sukursite naują klausimyną. Galite jį kurti iš šablono ir jį pakeisti vėliau.
48
- label: Pasirinkti šabloną
49
- placeholder: Pasirinkti šabloną
50
- skip_template: Praleisti
51
- edit:
52
- edit: Redaguoti
53
- empty: Dar nėra klausimų
54
- questionnaire: Klausimynas
55
- form:
56
- save: Išsaugoti
57
- template_title: Šablono informacija
58
- title: Klausimyno šablonas %{questionnaire_for}
59
- index:
60
- confirm_delete: Ar tikrai norite ištrinti šį šabloną?
61
- title: Klausimyno šablonai
62
- preview:
63
- current_step: Žingsnis %{step}
64
- of_total_steps: iš%{total_steps}
65
- tos_agreement: Dalyvaudami sutinkate su paslaugos teikimo sąlygomis
66
- template_types:
67
- questionnaires: Klausimynai
@@ -1 +1,2 @@
1
+ ---
1
2
  lv:
@@ -1 +1,2 @@
1
+ ---
1
2
  mt:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  nl:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  "no":
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  om:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pl:
2
3
  decidim:
3
4
  admin:
@@ -1,4 +1,5 @@
1
- pt-BR:
1
+ ---
2
+ pt:
2
3
  activemodel:
3
4
  attributes:
4
5
  questionnaire:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pt:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ro:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  ru:
@@ -1 +1,2 @@
1
+ ---
1
2
  si:
@@ -1 +1,2 @@
1
+ ---
1
2
  sk:
@@ -1 +1,2 @@
1
+ ---
1
2
  sl:
@@ -1 +1,2 @@
1
+ ---
1
2
  so:
@@ -1 +1,2 @@
1
+ ---
1
2
  sr:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sv:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  sw:
@@ -1 +1,2 @@
1
+ ---
1
2
  ti:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  tr:
2
3
  decidim:
3
4
  admin:
@@ -1 +1,2 @@
1
+ ---
1
2
  uk:
@@ -1 +1,2 @@
1
+ ---
1
2
  val:
@@ -1 +1,2 @@
1
+ ---
1
2
  vi:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  zh-CN:
2
3
  decidim:
3
4
  admin:
@@ -1 +1,2 @@
1
+ ---
1
2
  zh-TW:
data/db/seeds.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if !Rails.env.production? || ENV["SEED"]
3
+ if !Rails.env.production? || ENV.fetch("SEED", nil)
4
4
  print "Creating seeds for decidim-templates...\n" unless Rails.env.test?
5
5
 
6
6
  require "decidim/faker/localized"
@@ -9,7 +9,7 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
9
9
  context "when there are no templates" do
10
10
  before do
11
11
  questionnaire.update_columns(
12
- created_at: Time.zone.now - 1.day,
12
+ created_at: 1.day.ago,
13
13
  updated_at: Time.zone.now
14
14
  )
15
15
  end
@@ -27,7 +27,7 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
27
27
  context "when it is an existing questionnaire" do
28
28
  before do
29
29
  questionnaire.update_columns(
30
- created_at: Time.zone.now - 1.day,
30
+ created_at: 1.day.ago,
31
31
  updated_at: Time.zone.now
32
32
  )
33
33
  end
@@ -53,16 +53,17 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
53
53
  expect(page).to have_content("Choose template")
54
54
  end
55
55
 
56
- it "loads the last 5 templates in the select" do
57
- page.find(".Select-control").click
56
+ it "loads the templates in the select" do
57
+ page.find("input[name='select-template']").click
58
58
 
59
- within ".Select-menu" do
60
- expect(page).to have_selector(".Select-option:not(.is-focused)", count: 5)
59
+ within "#template-list", visible: :hidden do
60
+ expect(page).to have_selector("option", visible: :hidden, count: 6)
61
61
  end
62
62
  end
63
63
 
64
64
  it "displays the preview when a template is selected" do
65
- autocomplete_select template.name["en"], from: :questionnaire_template_id
65
+ select(template.name["en"], from: "select-template")
66
+
66
67
  within ".questionnaire-template-preview" do
67
68
  expect(page).to have_i18n_content(template.name)
68
69
  expect(page).to have_i18n_content(question.body)
@@ -88,7 +89,7 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
88
89
  )
89
90
  visit questionnaire_edit_path
90
91
 
91
- autocomplete_select template.name["en"], from: :questionnaire_template_id
92
+ select(template.name["en"], from: "select-template")
92
93
 
93
94
  within ".create-from-template" do
94
95
  find("*[type=submit]").click
@@ -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.26.3"
7
+ "0.27.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.26.3
4
+ version: 0.27.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: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2022-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-core
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.26.3
19
+ version: 0.27.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.26.3
26
+ version: 0.27.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.26.3
33
+ version: 0.27.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.26.3
40
+ version: 0.27.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decidim-admin
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.26.3
47
+ version: 0.27.0.rc1
48
48
  type: :development
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.26.3
54
+ version: 0.27.0.rc1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim-dev
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.26.3
61
+ version: 0.27.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.26.3
68
+ version: 0.27.0.rc1
69
69
  description: This module provides a solution to create templates for different Decidim
70
70
  models, such as Proposals and Questionnaires..
71
71
  email:
@@ -89,7 +89,6 @@ files:
89
89
  - app/controllers/decidim/templates/admin/questionnaire_templates_controller.rb
90
90
  - app/controllers/decidim/templates/application_controller.rb
91
91
  - app/forms/decidim/templates/admin/template_form.rb
92
- - app/helpers/decidim/templates/admin/templates_helper.rb
93
92
  - app/helpers/decidim/templates/application_helper.rb
94
93
  - app/models/concerns/decidim/templates/templatable.rb
95
94
  - app/models/decidim/templates/application_record.rb
@@ -97,8 +96,10 @@ files:
97
96
  - app/packs/entrypoints/decidim_templates.js
98
97
  - app/packs/entrypoints/decidim_templates.scss
99
98
  - app/packs/images/decidim/templates/decidim_templates.svg
99
+ - app/packs/src/decidim/templates/admin/choose_template.js
100
100
  - app/packs/stylesheets/decidim/templates/templates.scss
101
101
  - app/permissions/decidim/templates/admin/permissions.rb
102
+ - app/presenters/decidim/templates/admin_log/template_presenter.rb
102
103
  - app/views/decidim/templates/admin/questionnaire_templates/_choose.html.erb
103
104
  - app/views/decidim/templates/admin/questionnaire_templates/_form.html.erb
104
105
  - app/views/decidim/templates/admin/questionnaire_templates/_preview.html.erb
@@ -145,7 +146,6 @@ files:
145
146
  - config/locales/mt.yml
146
147
  - config/locales/nl.yml
147
148
  - config/locales/no.yml
148
- - config/locales/oc-FR.yml
149
149
  - config/locales/om-ET.yml
150
150
  - config/locales/pl.yml
151
151
  - config/locales/pt-BR.yml
@@ -189,14 +189,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
- version: '2.7'
192
+ version: '3.0'
193
193
  required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - ">="
195
+ - - ">"
196
196
  - !ruby/object:Gem::Version
197
- version: '0'
197
+ version: 1.3.1
198
198
  requirements: []
199
- rubygems_version: 3.1.6
199
+ rubygems_version: 3.2.22
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: A decidim templates module
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Templates
5
- module Admin
6
- # Custom helpers, scoped to the templates engine.
7
- #
8
- module TemplatesHelper
9
- def select_template(form, templates)
10
- prompt_options = {
11
- url: decidim_admin_templates.questionnaire_templates_url(format: :json),
12
- change_url: decidim_admin_templates.preview_questionnaire_templates_url(format: :js),
13
- placeholder: t("placeholder", scope: "decidim.templates.admin.questionnaire_templates.choose")
14
- }
15
-
16
- default_options = templates.last(5).map { |questionnaire_template| { value: questionnaire_template.id, label: translated_attribute(questionnaire_template.name) } }
17
-
18
- form.autocomplete_select(
19
- :questionnaire_template_id,
20
- false,
21
- {
22
- multiple: false,
23
- label: t("label", scope: "decidim.templates.admin.questionnaire_templates.choose"),
24
- default_options: default_options
25
- },
26
- prompt_options
27
- )
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1 +0,0 @@
1
- oc: