decidim-templates 0.27.4 → 0.28.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) 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_proposal_answer_template.rb +21 -0
  4. data/app/commands/decidim/templates/admin/copy_questionnaire_template.rb +3 -33
  5. data/app/commands/decidim/templates/admin/copy_template.rb +43 -0
  6. data/app/commands/decidim/templates/admin/create_block_user_template.rb +15 -0
  7. data/app/commands/decidim/templates/admin/create_proposal_answer_template.rb +47 -0
  8. data/app/commands/decidim/templates/admin/create_questionnaire_template.rb +6 -19
  9. data/app/commands/decidim/templates/admin/create_template.rb +54 -0
  10. data/app/commands/decidim/templates/admin/destroy_questionnaire_template.rb +22 -0
  11. data/app/commands/decidim/templates/admin/update_proposal_answer_template.rb +51 -0
  12. data/app/commands/decidim/templates/admin/update_template.rb +6 -0
  13. data/app/controllers/decidim/templates/admin/application_controller.rb +0 -8
  14. data/app/controllers/decidim/templates/admin/block_user_templates_controller.rb +124 -0
  15. data/app/controllers/decidim/templates/admin/concerns/templatable.rb +1 -1
  16. data/app/controllers/decidim/templates/admin/proposal_answer_templates_controller.rb +173 -0
  17. data/app/controllers/decidim/templates/admin/questionnaire_templates_controller.rb +4 -6
  18. data/app/forms/decidim/templates/admin/proposal_answer_template_form.rb +23 -0
  19. data/app/helpers/decidim/templates/admin/application_helper.rb +18 -0
  20. data/app/models/decidim/templates/template.rb +0 -6
  21. data/app/packs/entrypoints/decidim_templates_admin.js +2 -0
  22. data/app/packs/src/decidim/templates/admin/block_user_template_chooser.js +20 -0
  23. data/app/packs/src/decidim/templates/admin/choose_template.js +4 -10
  24. data/app/packs/src/decidim/templates/admin/proposal_answer_template_chooser.js +31 -0
  25. data/app/packs/stylesheets/decidim/templates/templates.scss +3 -12
  26. data/app/presenters/decidim/templates/admin_log/template_presenter.rb +2 -2
  27. data/app/views/decidim/templates/admin/block_user_templates/_form.html.erb +13 -0
  28. data/app/views/decidim/templates/admin/block_user_templates/_template_chooser.html.erb +12 -0
  29. data/app/views/decidim/templates/admin/block_user_templates/edit.html.erb +18 -0
  30. data/app/views/decidim/templates/admin/block_user_templates/index.html.erb +45 -0
  31. data/app/views/decidim/templates/admin/block_user_templates/new.html.erb +18 -0
  32. data/app/views/decidim/templates/admin/proposal_answer_templates/_form.html.erb +38 -0
  33. data/app/views/decidim/templates/admin/proposal_answer_templates/_template_chooser.html.erb +16 -0
  34. data/app/views/decidim/templates/admin/proposal_answer_templates/edit.html.erb +18 -0
  35. data/app/views/decidim/templates/admin/proposal_answer_templates/index.html.erb +51 -0
  36. data/app/views/decidim/templates/admin/proposal_answer_templates/new.html.erb +18 -0
  37. data/app/views/decidim/templates/admin/questionnaire_templates/_choose.html.erb +35 -35
  38. data/app/views/decidim/templates/admin/questionnaire_templates/_form.html.erb +9 -12
  39. data/app/views/decidim/templates/admin/questionnaire_templates/_preview.html.erb +52 -60
  40. data/app/views/decidim/templates/admin/questionnaire_templates/edit.html.erb +31 -16
  41. data/app/views/decidim/templates/admin/questionnaire_templates/index.html.erb +6 -8
  42. data/app/views/decidim/templates/admin/questionnaire_templates/new.html.erb +18 -7
  43. data/app/views/decidim/templates/admin/questionnaire_templates/preview.js.erb +3 -0
  44. data/app/views/layouts/decidim/admin/templates.html.erb +1 -9
  45. data/config/assets.rb +2 -1
  46. data/config/environment.rb +3 -0
  47. data/config/locales/ar.yml +8 -2
  48. data/config/locales/ca.yml +47 -8
  49. data/config/locales/cs.yml +47 -8
  50. data/config/locales/de.yml +47 -8
  51. data/config/locales/en.yml +47 -8
  52. data/config/locales/es-MX.yml +47 -8
  53. data/config/locales/es-PY.yml +47 -8
  54. data/config/locales/es.yml +47 -8
  55. data/config/locales/eu.yml +53 -14
  56. data/config/locales/fi-plain.yml +47 -8
  57. data/config/locales/fi.yml +47 -8
  58. data/config/locales/fr-CA.yml +33 -8
  59. data/config/locales/fr.yml +47 -8
  60. data/config/locales/ga-IE.yml +6 -2
  61. data/config/locales/gl.yml +6 -10
  62. data/config/locales/hu.yml +6 -10
  63. data/config/locales/it.yml +6 -10
  64. data/config/locales/ja.yml +28 -8
  65. data/config/locales/kaa.yml +4 -1
  66. data/config/locales/lt.yml +19 -8
  67. data/config/locales/nl.yml +6 -11
  68. data/config/locales/no.yml +6 -10
  69. data/config/locales/pl.yml +6 -10
  70. data/config/locales/pt-BR.yml +6 -10
  71. data/config/locales/pt.yml +6 -10
  72. data/config/locales/ro-RO.yml +18 -8
  73. data/config/locales/sq-AL.yml +1 -0
  74. data/config/locales/sv.yml +6 -2
  75. data/config/locales/th-TH.yml +1 -0
  76. data/config/locales/tr-TR.yml +8 -10
  77. data/config/locales/zh-CN.yml +6 -11
  78. data/config/locales/zh-TW.yml +18 -8
  79. data/db/migrate/20221006055954_add_field_values_and_target_to_decidim_templates.rb +21 -0
  80. data/db/seeds.rb +6 -6
  81. data/lib/decidim/templates/admin_engine.rb +23 -24
  82. data/lib/decidim/templates/engine.rb +4 -0
  83. data/lib/decidim/templates/menu.rb +48 -0
  84. data/lib/decidim/templates/test/factories.rb +16 -1
  85. data/lib/decidim/templates/test/shared_examples/copies_all_questionnaire_contents_examples.rb +3 -3
  86. data/lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb +8 -6
  87. data/lib/decidim/templates/version.rb +1 -1
  88. metadata +49 -16
@@ -6,11 +6,26 @@ require "decidim/dev"
6
6
  FactoryBot.define do
7
7
  factory :template, class: "Decidim::Templates::Template" do
8
8
  organization
9
- templatable { build(:dummy_resource) }
10
9
  name { Decidim::Faker::Localized.sentence }
10
+ description { Decidim::Faker::Localized.sentence }
11
+ target { "generic-template" }
12
+ templatable { build(:dummy_resource) }
13
+
14
+ trait :user_block do
15
+ templatable { organization }
16
+ target { :user_block }
17
+ end
18
+
19
+ trait :proposal_answer do
20
+ templatable { organization }
21
+ target { :proposal_answer }
22
+ field_values { { internal_state: :accepted } }
23
+ end
11
24
 
12
25
  ## Questionnaire templates
13
26
  factory :questionnaire_template do
27
+ target { "questionnaire" }
28
+
14
29
  trait :with_questions do
15
30
  after(:create) do |template|
16
31
  template.templatable = create(:questionnaire, :with_questions, questionnaire_for: template)
@@ -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.size).to eq(new_question.answer_options.size)
34
+ expect(source_question.answer_options.count).to eq(new_question.answer_options.count)
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.size).to eq(new_question.matrix_rows.size)
44
+ expect(source_question.matrix_rows.count).to eq(new_question.matrix_rows.count)
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.size).to eq(new_display_conditions.size)
55
+ expect(source_display_conditions.count).to eq(new_display_conditions.count)
56
56
 
57
57
  source_display_conditions.each_with_index do |source_matrix_row, idx|
58
58
  new_matrix_row = new_display_conditions[idx]
@@ -14,8 +14,8 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
14
14
  )
15
15
  end
16
16
 
17
- it "doesn't show the template selection screen" do
18
- expect(page).to have_no_content("Choose template")
17
+ it "does not show the template selection screen" do
18
+ expect(page).not_to have_content("Choose template")
19
19
  end
20
20
  end
21
21
 
@@ -32,8 +32,8 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
32
32
  )
33
33
  end
34
34
 
35
- it "doesn't show the template selection screen" do
36
- expect(page).to have_no_content("Choose template")
35
+ it "does not show the template selection screen" do
36
+ expect(page).not_to have_content("Choose template")
37
37
  end
38
38
  end
39
39
 
@@ -91,9 +91,11 @@ shared_examples_for "uses questionnaire templates" do |_questionnaire_for|
91
91
 
92
92
  select(template.name["en"], from: "select-template")
93
93
 
94
- within ".create-from-template" do
95
- find("*[type=submit]").click
94
+ within ".questionnaire-template-preview" do
95
+ expect(page).to have_content(template.templatable.title["en"])
96
96
  end
97
+
98
+ click_button "Create from template"
97
99
  end
98
100
 
99
101
  it "copies the template data to the questionnaire on submit" do
@@ -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.27.4"
7
+ "0.28.0.rc5"
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.27.4
4
+ version: 0.28.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vera Rojman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-27 00:00:00.000000000 Z
11
+ date: 2023-12-18 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.27.4
19
+ version: 0.28.0.rc5
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.27.4
26
+ version: 0.28.0.rc5
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.27.4
33
+ version: 0.28.0.rc5
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.27.4
40
+ version: 0.28.0.rc5
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.27.4
47
+ version: 0.28.0.rc5
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.27.4
54
+ version: 0.28.0.rc5
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.27.4
61
+ version: 0.28.0.rc5
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.27.4
68
+ version: 0.28.0.rc5
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:
@@ -78,28 +78,52 @@ files:
78
78
  - README.md
79
79
  - Rakefile
80
80
  - app/commands/decidim/templates/admin/apply_questionnaire_template.rb
81
+ - app/commands/decidim/templates/admin/copy_proposal_answer_template.rb
81
82
  - app/commands/decidim/templates/admin/copy_questionnaire_template.rb
83
+ - app/commands/decidim/templates/admin/copy_template.rb
84
+ - app/commands/decidim/templates/admin/create_block_user_template.rb
85
+ - app/commands/decidim/templates/admin/create_proposal_answer_template.rb
82
86
  - app/commands/decidim/templates/admin/create_questionnaire_template.rb
87
+ - app/commands/decidim/templates/admin/create_template.rb
88
+ - app/commands/decidim/templates/admin/destroy_questionnaire_template.rb
83
89
  - app/commands/decidim/templates/admin/destroy_template.rb
84
90
  - app/commands/decidim/templates/admin/questionnaire_copier.rb
91
+ - app/commands/decidim/templates/admin/update_proposal_answer_template.rb
85
92
  - app/commands/decidim/templates/admin/update_template.rb
86
93
  - app/controllers/decidim/templates/admin/application_controller.rb
94
+ - app/controllers/decidim/templates/admin/block_user_templates_controller.rb
87
95
  - app/controllers/decidim/templates/admin/concerns/templatable.rb
96
+ - app/controllers/decidim/templates/admin/proposal_answer_templates_controller.rb
88
97
  - app/controllers/decidim/templates/admin/questionnaire_templates/questionnaires_controller.rb
89
98
  - app/controllers/decidim/templates/admin/questionnaire_templates_controller.rb
90
99
  - app/controllers/decidim/templates/application_controller.rb
100
+ - app/forms/decidim/templates/admin/proposal_answer_template_form.rb
91
101
  - app/forms/decidim/templates/admin/template_form.rb
102
+ - app/helpers/decidim/templates/admin/application_helper.rb
92
103
  - app/helpers/decidim/templates/application_helper.rb
93
104
  - app/models/concerns/decidim/templates/templatable.rb
94
105
  - app/models/decidim/templates/application_record.rb
95
106
  - app/models/decidim/templates/template.rb
96
107
  - app/packs/entrypoints/decidim_templates.js
97
108
  - app/packs/entrypoints/decidim_templates.scss
109
+ - app/packs/entrypoints/decidim_templates_admin.js
98
110
  - app/packs/images/decidim/templates/decidim_templates.svg
111
+ - app/packs/src/decidim/templates/admin/block_user_template_chooser.js
99
112
  - app/packs/src/decidim/templates/admin/choose_template.js
113
+ - app/packs/src/decidim/templates/admin/proposal_answer_template_chooser.js
100
114
  - app/packs/stylesheets/decidim/templates/templates.scss
101
115
  - app/permissions/decidim/templates/admin/permissions.rb
102
116
  - app/presenters/decidim/templates/admin_log/template_presenter.rb
117
+ - app/views/decidim/templates/admin/block_user_templates/_form.html.erb
118
+ - app/views/decidim/templates/admin/block_user_templates/_template_chooser.html.erb
119
+ - app/views/decidim/templates/admin/block_user_templates/edit.html.erb
120
+ - app/views/decidim/templates/admin/block_user_templates/index.html.erb
121
+ - app/views/decidim/templates/admin/block_user_templates/new.html.erb
122
+ - app/views/decidim/templates/admin/proposal_answer_templates/_form.html.erb
123
+ - app/views/decidim/templates/admin/proposal_answer_templates/_template_chooser.html.erb
124
+ - app/views/decidim/templates/admin/proposal_answer_templates/edit.html.erb
125
+ - app/views/decidim/templates/admin/proposal_answer_templates/index.html.erb
126
+ - app/views/decidim/templates/admin/proposal_answer_templates/new.html.erb
103
127
  - app/views/decidim/templates/admin/questionnaire_templates/_choose.html.erb
104
128
  - app/views/decidim/templates/admin/questionnaire_templates/_form.html.erb
105
129
  - app/views/decidim/templates/admin/questionnaire_templates/_preview.html.erb
@@ -163,9 +187,11 @@ files:
163
187
  - config/locales/sk.yml
164
188
  - config/locales/sl.yml
165
189
  - config/locales/so-SO.yml
190
+ - config/locales/sq-AL.yml
166
191
  - config/locales/sr-CS.yml
167
192
  - config/locales/sv.yml
168
193
  - config/locales/sw-KE.yml
194
+ - config/locales/th-TH.yml
169
195
  - config/locales/ti-ER.yml
170
196
  - config/locales/tr-TR.yml
171
197
  - config/locales/uk.yml
@@ -175,19 +201,26 @@ files:
175
201
  - config/locales/zh-CN.yml
176
202
  - config/locales/zh-TW.yml
177
203
  - db/migrate/20200518093819_create_decidim_templates.rb
204
+ - db/migrate/20221006055954_add_field_values_and_target_to_decidim_templates.rb
178
205
  - db/seeds.rb
179
206
  - lib/decidim/templates.rb
180
207
  - lib/decidim/templates/admin.rb
181
208
  - lib/decidim/templates/admin_engine.rb
182
209
  - lib/decidim/templates/engine.rb
210
+ - lib/decidim/templates/menu.rb
183
211
  - lib/decidim/templates/test/factories.rb
184
212
  - lib/decidim/templates/test/shared_examples/copies_all_questionnaire_contents_examples.rb
185
213
  - lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb
186
214
  - lib/decidim/templates/version.rb
187
- homepage: https://github.com/decidim/decidim-module-templates
215
+ homepage: https://decidim.org
188
216
  licenses:
189
217
  - AGPL-3.0
190
- metadata: {}
218
+ metadata:
219
+ bug_tracker_uri: https://github.com/decidim/decidim/issues
220
+ documentation_uri: https://docs.decidim.org/
221
+ funding_uri: https://opencollective.com/decidim
222
+ homepage_uri: https://decidim.org
223
+ source_code_uri: https://github.com/decidim/decidim
191
224
  post_install_message:
192
225
  rdoc_options: []
193
226
  require_paths:
@@ -196,14 +229,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
229
  requirements:
197
230
  - - ">="
198
231
  - !ruby/object:Gem::Version
199
- version: '3.0'
232
+ version: '3.1'
200
233
  required_rubygems_version: !ruby/object:Gem::Requirement
201
234
  requirements:
202
- - - ">="
235
+ - - ">"
203
236
  - !ruby/object:Gem::Version
204
- version: '0'
237
+ version: 1.3.1
205
238
  requirements: []
206
- rubygems_version: 3.2.22
239
+ rubygems_version: 3.4.22
207
240
  signing_key:
208
241
  specification_version: 4
209
242
  summary: A decidim templates module