decidim-templates 0.27.5 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) 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 -4
  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/proposal_answer_template_chooser.js +31 -0
  24. data/app/packs/stylesheets/decidim/templates/templates.scss +3 -12
  25. data/app/presenters/decidim/templates/admin_log/template_presenter.rb +2 -2
  26. data/app/views/decidim/templates/admin/block_user_templates/_form.html.erb +13 -0
  27. data/app/views/decidim/templates/admin/block_user_templates/_template_chooser.html.erb +12 -0
  28. data/app/views/decidim/templates/admin/block_user_templates/edit.html.erb +18 -0
  29. data/app/views/decidim/templates/admin/block_user_templates/index.html.erb +45 -0
  30. data/app/views/decidim/templates/admin/block_user_templates/new.html.erb +18 -0
  31. data/app/views/decidim/templates/admin/proposal_answer_templates/_form.html.erb +38 -0
  32. data/app/views/decidim/templates/admin/proposal_answer_templates/_template_chooser.html.erb +16 -0
  33. data/app/views/decidim/templates/admin/proposal_answer_templates/edit.html.erb +18 -0
  34. data/app/views/decidim/templates/admin/proposal_answer_templates/index.html.erb +51 -0
  35. data/app/views/decidim/templates/admin/proposal_answer_templates/new.html.erb +18 -0
  36. data/app/views/decidim/templates/admin/questionnaire_templates/_choose.html.erb +35 -35
  37. data/app/views/decidim/templates/admin/questionnaire_templates/_form.html.erb +9 -12
  38. data/app/views/decidim/templates/admin/questionnaire_templates/_preview.html.erb +52 -60
  39. data/app/views/decidim/templates/admin/questionnaire_templates/edit.html.erb +31 -16
  40. data/app/views/decidim/templates/admin/questionnaire_templates/index.html.erb +6 -8
  41. data/app/views/decidim/templates/admin/questionnaire_templates/new.html.erb +18 -7
  42. data/app/views/decidim/templates/admin/questionnaire_templates/preview.js.erb +3 -0
  43. data/app/views/layouts/decidim/admin/templates.html.erb +1 -9
  44. data/config/assets.rb +2 -1
  45. data/config/locales/ar.yml +8 -2
  46. data/config/locales/ca.yml +47 -8
  47. data/config/locales/cs.yml +47 -8
  48. data/config/locales/de.yml +47 -8
  49. data/config/locales/en.yml +47 -8
  50. data/config/locales/es-MX.yml +47 -8
  51. data/config/locales/es-PY.yml +47 -8
  52. data/config/locales/es.yml +47 -8
  53. data/config/locales/eu.yml +47 -8
  54. data/config/locales/fi-plain.yml +47 -8
  55. data/config/locales/fi.yml +47 -8
  56. data/config/locales/fr-CA.yml +33 -8
  57. data/config/locales/fr.yml +47 -8
  58. data/config/locales/ga-IE.yml +6 -2
  59. data/config/locales/gl.yml +6 -10
  60. data/config/locales/hu.yml +6 -10
  61. data/config/locales/it.yml +6 -10
  62. data/config/locales/ja.yml +28 -8
  63. data/config/locales/kaa.yml +4 -1
  64. data/config/locales/lt.yml +18 -8
  65. data/config/locales/nl.yml +6 -11
  66. data/config/locales/no.yml +6 -10
  67. data/config/locales/pl.yml +6 -10
  68. data/config/locales/pt-BR.yml +6 -13
  69. data/config/locales/pt.yml +6 -10
  70. data/config/locales/ro-RO.yml +18 -8
  71. data/config/locales/sv.yml +6 -2
  72. data/config/locales/tr-TR.yml +8 -10
  73. data/config/locales/zh-CN.yml +6 -11
  74. data/config/locales/zh-TW.yml +18 -8
  75. data/db/migrate/20221006055954_add_field_values_and_target_to_decidim_templates.rb +21 -0
  76. data/db/seeds.rb +6 -6
  77. data/lib/decidim/templates/admin_engine.rb +22 -17
  78. data/lib/decidim/templates/engine.rb +4 -0
  79. data/lib/decidim/templates/menu.rb +48 -0
  80. data/lib/decidim/templates/test/factories.rb +16 -1
  81. data/lib/decidim/templates/test/shared_examples/copies_all_questionnaire_contents_examples.rb +3 -3
  82. data/lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb +8 -6
  83. data/lib/decidim/templates/version.rb +1 -1
  84. metadata +47 -17
  85. data/config/environment.rb +0 -3
@@ -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.5"
7
+ "0.28.0.rc4"
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.5
4
+ version: 0.28.0.rc4
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-12-20 00:00:00.000000000 Z
11
+ date: 2023-12-11 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.5
19
+ version: 0.28.0.rc4
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.5
26
+ version: 0.28.0.rc4
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.5
33
+ version: 0.28.0.rc4
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.5
40
+ version: 0.28.0.rc4
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.5
47
+ version: 0.28.0.rc4
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.5
54
+ version: 0.28.0.rc4
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.5
61
+ version: 0.28.0.rc4
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.5
68
+ version: 0.28.0.rc4
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
@@ -109,7 +133,6 @@ files:
109
133
  - app/views/decidim/templates/admin/questionnaire_templates/preview.js.erb
110
134
  - app/views/layouts/decidim/admin/templates.html.erb
111
135
  - config/assets.rb
112
- - config/environment.rb
113
136
  - config/locales/am-ET.yml
114
137
  - config/locales/ar.yml
115
138
  - config/locales/bg.yml
@@ -177,19 +200,26 @@ files:
177
200
  - config/locales/zh-CN.yml
178
201
  - config/locales/zh-TW.yml
179
202
  - db/migrate/20200518093819_create_decidim_templates.rb
203
+ - db/migrate/20221006055954_add_field_values_and_target_to_decidim_templates.rb
180
204
  - db/seeds.rb
181
205
  - lib/decidim/templates.rb
182
206
  - lib/decidim/templates/admin.rb
183
207
  - lib/decidim/templates/admin_engine.rb
184
208
  - lib/decidim/templates/engine.rb
209
+ - lib/decidim/templates/menu.rb
185
210
  - lib/decidim/templates/test/factories.rb
186
211
  - lib/decidim/templates/test/shared_examples/copies_all_questionnaire_contents_examples.rb
187
212
  - lib/decidim/templates/test/shared_examples/uses_questionnaire_templates.rb
188
213
  - lib/decidim/templates/version.rb
189
- homepage: https://github.com/decidim/decidim-module-templates
214
+ homepage: https://decidim.org
190
215
  licenses:
191
216
  - AGPL-3.0
192
- metadata: {}
217
+ metadata:
218
+ bug_tracker_uri: https://github.com/decidim/decidim/issues
219
+ documentation_uri: https://docs.decidim.org/
220
+ funding_uri: https://opencollective.com/decidim
221
+ homepage_uri: https://decidim.org
222
+ source_code_uri: https://github.com/decidim/decidim
193
223
  post_install_message:
194
224
  rdoc_options: []
195
225
  require_paths:
@@ -198,14 +228,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
228
  requirements:
199
229
  - - ">="
200
230
  - !ruby/object:Gem::Version
201
- version: '3.0'
231
+ version: '3.1'
202
232
  required_rubygems_version: !ruby/object:Gem::Requirement
203
233
  requirements:
204
- - - ">="
234
+ - - ">"
205
235
  - !ruby/object:Gem::Version
206
- version: '0'
236
+ version: 1.3.1
207
237
  requirements: []
208
- rubygems_version: 3.4.22
238
+ rubygems_version: 3.4.20
209
239
  signing_key:
210
240
  specification_version: 4
211
241
  summary: A decidim templates module
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails