decidim-debates 0.21.0 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/gamification/badges/commented_debates.svg +1 -78
  3. data/app/cells/decidim/debates/debate_activity_cell.rb +4 -0
  4. data/app/cells/decidim/debates/debate_m/data.erb +10 -8
  5. data/app/cells/decidim/debates/debate_m/footer.erb +6 -1
  6. data/app/cells/decidim/debates/debate_m/multiple_dates.erb +1 -1
  7. data/app/cells/decidim/debates/debate_m_cell.rb +24 -2
  8. data/app/commands/decidim/debates/admin/close_debate.rb +54 -0
  9. data/app/commands/decidim/debates/admin/create_debate.rb +4 -2
  10. data/app/commands/decidim/debates/admin/update_debate.rb +5 -2
  11. data/app/commands/decidim/debates/close_debate.rb +58 -0
  12. data/app/commands/decidim/debates/create_debate.rb +17 -12
  13. data/app/commands/decidim/debates/update_debate.rb +56 -0
  14. data/app/controllers/decidim/debates/admin/debate_closes_controller.rb +43 -0
  15. data/app/controllers/decidim/debates/admin/debates_controller.rb +4 -2
  16. data/app/controllers/decidim/debates/debates_controller.rb +70 -9
  17. data/app/controllers/decidim/debates/orderable.rb +41 -0
  18. data/app/controllers/decidim/debates/versions_controller.rb +16 -0
  19. data/app/controllers/decidim/debates/widgets_controller.rb +19 -0
  20. data/app/events/decidim/debates/close_debate_event.rb +15 -0
  21. data/app/events/decidim/debates/create_debate_event.rb +0 -2
  22. data/app/forms/decidim/debates/admin/close_debate_form.rb +34 -0
  23. data/app/forms/decidim/debates/admin/debate_form.rb +5 -1
  24. data/app/forms/decidim/debates/close_debate_form.rb +39 -0
  25. data/app/forms/decidim/debates/debate_form.rb +27 -1
  26. data/app/helpers/decidim/debates/admin/application_helper.rb +13 -0
  27. data/app/helpers/decidim/debates/application_helper.rb +37 -1
  28. data/app/models/decidim/debates/debate.rb +67 -12
  29. data/app/permissions/decidim/debates/admin/permissions.rb +3 -1
  30. data/app/permissions/decidim/debates/permissions.rb +28 -0
  31. data/app/presenters/decidim/debates/admin_log/debate_presenter.rb +6 -2
  32. data/app/presenters/decidim/debates/admin_log/value_types/debate_title_description_presenter.rb +20 -0
  33. data/app/presenters/decidim/debates/debate_presenter.rb +62 -7
  34. data/app/presenters/decidim/debates/log/resource_presenter.rb +18 -0
  35. data/app/presenters/decidim/debates/official_author_presenter.rb +1 -29
  36. data/app/queries/decidim/debates/metrics/debates_metric_manage.rb +2 -8
  37. data/app/services/decidim/debates/debate_search.rb +13 -23
  38. data/app/services/decidim/debates/diff_renderer.rb +27 -0
  39. data/app/views/decidim/debates/admin/debate_closes/edit.html.erb +17 -0
  40. data/app/views/decidim/debates/admin/debates/_form.html.erb +5 -5
  41. data/app/views/decidim/debates/admin/debates/index.html.erb +7 -1
  42. data/app/views/decidim/debates/debates/_close_debate_modal.html.erb +13 -0
  43. data/app/views/decidim/debates/debates/_debates.html.erb +7 -0
  44. data/app/views/decidim/debates/debates/_filters.html.erb +20 -6
  45. data/app/views/decidim/debates/debates/_form.html.erb +19 -0
  46. data/app/views/decidim/debates/debates/edit.html.erb +24 -0
  47. data/app/views/decidim/debates/debates/index.html.erb +4 -5
  48. data/app/views/decidim/debates/debates/new.html.erb +7 -26
  49. data/app/views/decidim/debates/debates/show.html.erb +87 -9
  50. data/app/views/decidim/debates/versions/index.html.erb +8 -0
  51. data/app/views/decidim/debates/versions/show.html.erb +10 -0
  52. data/config/locales/am-ET.yml +1 -0
  53. data/config/locales/ar.yml +2 -1
  54. data/config/locales/bg-BG.yml +7 -0
  55. data/config/locales/bg.yml +15 -0
  56. data/config/locales/ca.yml +73 -1
  57. data/config/locales/cs.yml +112 -40
  58. data/config/locales/da-DK.yml +1 -0
  59. data/config/locales/da.yml +1 -0
  60. data/config/locales/de.yml +95 -23
  61. data/config/locales/el.yml +154 -0
  62. data/config/locales/en.yml +73 -1
  63. data/config/locales/eo.yml +1 -0
  64. data/config/locales/es-MX.yml +73 -1
  65. data/config/locales/es-PY.yml +73 -1
  66. data/config/locales/es.yml +73 -1
  67. data/config/locales/et-EE.yml +1 -0
  68. data/config/locales/et.yml +1 -0
  69. data/config/locales/eu.yml +2 -1
  70. data/config/locales/fi-plain.yml +73 -1
  71. data/config/locales/fi.yml +78 -6
  72. data/config/locales/fr-CA.yml +223 -0
  73. data/config/locales/fr.yml +73 -1
  74. data/config/locales/ga-IE.yml +1 -0
  75. data/config/locales/gl.yml +7 -1
  76. data/config/locales/hr-HR.yml +1 -0
  77. data/config/locales/hr.yml +1 -0
  78. data/config/locales/hu.yml +26 -1
  79. data/config/locales/id-ID.yml +2 -1
  80. data/config/locales/is-IS.yml +2 -1
  81. data/config/locales/is.yml +102 -0
  82. data/config/locales/it.yml +45 -10
  83. data/config/locales/ja-JP.yml +195 -0
  84. data/config/locales/ja.yml +221 -0
  85. data/config/locales/ko-KR.yml +1 -0
  86. data/config/locales/ko.yml +1 -0
  87. data/config/locales/lt-LT.yml +1 -0
  88. data/config/locales/lt.yml +1 -0
  89. data/config/locales/lv.yml +135 -0
  90. data/config/locales/mt-MT.yml +1 -0
  91. data/config/locales/mt.yml +1 -0
  92. data/config/locales/nl.yml +50 -2
  93. data/config/locales/no.yml +117 -71
  94. data/config/locales/om-ET.yml +1 -0
  95. data/config/locales/pl.yml +100 -45
  96. data/config/locales/pt-BR.yml +3 -4
  97. data/config/locales/pt.yml +56 -36
  98. data/config/locales/ro-RO.yml +173 -0
  99. data/config/locales/ru.yml +2 -1
  100. data/config/locales/si-LK.yml +1 -0
  101. data/config/locales/sk-SK.yml +156 -0
  102. data/config/locales/sk.yml +157 -0
  103. data/config/locales/sl.yml +22 -0
  104. data/config/locales/so-SO.yml +1 -0
  105. data/config/locales/sr-CS.yml +6 -0
  106. data/config/locales/sv.yml +60 -1
  107. data/config/locales/sw-KE.yml +1 -0
  108. data/config/locales/ti-ER.yml +1 -0
  109. data/config/locales/tr-TR.yml +103 -31
  110. data/config/locales/uk.yml +2 -1
  111. data/config/locales/vi-VN.yml +1 -0
  112. data/config/locales/vi.yml +1 -0
  113. data/config/locales/zh-CN.yml +218 -0
  114. data/config/locales/zh-TW.yml +1 -0
  115. data/db/migrate/20200320105918_index_foreign_keys_in_decidim_debates_debates.rb +7 -0
  116. data/db/migrate/20200703134657_close_debates.rb +9 -0
  117. data/db/migrate/20200708072042_fix_debates_i18n_fields.rb +48 -0
  118. data/db/migrate/20200716143929_add_endorsable_to_debates.rb +8 -0
  119. data/db/migrate/20200827154116_add_commentable_counter_cache_to_debates.rb +14 -0
  120. data/db/migrate/20200902133452_add_cached_comment_metadata_to_debates.rb +23 -0
  121. data/lib/decidim/debates/admin_engine.rb +3 -1
  122. data/lib/decidim/debates/component.rb +44 -1
  123. data/lib/decidim/debates/engine.rb +7 -1
  124. data/lib/decidim/debates/test/factories.rb +62 -6
  125. data/lib/decidim/debates/version.rb +1 -1
  126. metadata +85 -17
@@ -93,12 +93,13 @@ uk:
93
93
  filter: Відібрати
94
94
  filter_by: 'Відібрати за ознакою:'
95
95
  unfold: Розгорнути
96
+ form:
97
+ select_a_category: Будь ласка, виберіть категорію
96
98
  index:
97
99
  new_debate: Додати обговорення
98
100
  new:
99
101
  back: Повернутись
100
102
  create: Започаткувати
101
- select_a_category: Будь ласка, виберіть категорію
102
103
  title: Додати обговорення
103
104
  models:
104
105
  debate:
@@ -0,0 +1 @@
1
+ vi:
@@ -0,0 +1 @@
1
+ vi:
@@ -0,0 +1,218 @@
1
+ zh-CN:
2
+ activemodel:
3
+ attributes:
4
+ debate:
5
+ category_id: 类别
6
+ closed_at: 关闭于
7
+ conclusions: 四. 结论
8
+ decidim_category_id: 类别
9
+ description: 描述
10
+ end_time: 结束于
11
+ information_updates: 信息更新
12
+ instructions: 参与说明
13
+ start_time: 开始于
14
+ title: 标题
15
+ user_group_id: 创建辩论为
16
+ models:
17
+ decidim/debates/close_debate_event: 辩论结束
18
+ decidim/debates/create_debate_event: B. 辩论
19
+ decidim/debates/creation_disabled_event: 已禁用辩论
20
+ decidim/debates/creation_enabled_event: 辩论已启用
21
+ activerecord:
22
+ models:
23
+ decidim/debates/debate:
24
+ other: 辩论
25
+ decidim:
26
+ components:
27
+ debates:
28
+ actions:
29
+ create: 创建
30
+ endorse: 批准
31
+ name: 辩论
32
+ settings:
33
+ global:
34
+ announcement: 通 知
35
+ comments_enabled: 评论已启用
36
+ comments_max_length: 评论最大长度 (默认值留0)
37
+ scope_id: 范围
38
+ scopes_enabled: 范围已启用
39
+ step:
40
+ announcement: 通 知
41
+ comments_blocked: 评论已阻止
42
+ creation_enabled: 参与者创建辩论已启用
43
+ endorsements_blocked: 已阻止授权
44
+ endorsements_enabled: 授权已启用
45
+ debates:
46
+ actions:
47
+ close: 关闭
48
+ confirm_destroy: 您确定吗?
49
+ destroy: 删除
50
+ edit: 编辑
51
+ new: 新建 %{name}
52
+ title: 行动
53
+ admin:
54
+ debate_closes:
55
+ edit:
56
+ close: 关闭
57
+ title: 结束辩论
58
+ debates:
59
+ create:
60
+ invalid: 有一个问题是如何建立辩论。
61
+ success: 辩论成功创建。
62
+ destroy:
63
+ success: 辩论已成功删除。
64
+ edit:
65
+ title: 编辑辩论
66
+ update: 更新辩论
67
+ index:
68
+ title: 辩论
69
+ new:
70
+ create: 创建辩论
71
+ title: 新的辩论
72
+ update:
73
+ invalid: 在更新这次辩论时遇到了问题。
74
+ success: 辩论已成功更新。
75
+ models:
76
+ debate:
77
+ name: B. 辩论
78
+ admin_log:
79
+ debate:
80
+ close: "%{user_name} 关闭了 %{resource_name} 场内的 %{space_name} 个辩论"
81
+ create: "%{user_name} 在 %{space_name} 空间上创建了 %{resource_name} 辩论"
82
+ update: "%{user_name} 更新了 %{resource_name} 场关于 %{space_name} 空间的辩论"
83
+ debate_m:
84
+ commented_time_ago: '%{time} 前发表了评论'
85
+ debates:
86
+ close:
87
+ invalid: 辩论结束时遇到问题。
88
+ success: 辩论已成功结束。
89
+ close_debate_modal:
90
+ close: 关闭
91
+ description: 这次辩论的总结或结束是什么?
92
+ send: 结束辩论
93
+ closed: 已关闭
94
+ count:
95
+ debates_count:
96
+ other: "%{count} 次辩论"
97
+ create:
98
+ invalid: 有一个问题是如何建立辩论。
99
+ success: 辩论成功创建。
100
+ debate:
101
+ participate: 参与
102
+ edit:
103
+ back: 后退
104
+ save: 保存更改
105
+ title: 编辑辩论
106
+ filters:
107
+ activity: 我的活动
108
+ all: 所有的
109
+ category: 类别
110
+ category_prompt: 选择一个类别
111
+ citizens: Citizens
112
+ commented: 已评论
113
+ my_debates: 我的辩论
114
+ official: 官方的
115
+ origin: 始发地
116
+ scope: 范围
117
+ search: 搜索
118
+ state: 状态
119
+ state_values:
120
+ closed: 已关闭
121
+ open: 打开
122
+ user_groups: 群組
123
+ filters_small_view:
124
+ close_modal: 关闭模式
125
+ filter: 筛选器
126
+ filter_by: 筛选方式
127
+ unfold: 展开...
128
+ index:
129
+ new_debate: 新的辩论
130
+ new:
131
+ back: 后退
132
+ create: 创建
133
+ title: 新的辩论
134
+ orders:
135
+ commented: 最多评论
136
+ label: 排序由
137
+ random: 随机顺序
138
+ recent: 最新的
139
+ updated: 最近更新
140
+ show:
141
+ back: 返回列表
142
+ close_debate: 结束辩论
143
+ date: 日期
144
+ debate_closed: 已关闭
145
+ debate_conclusions_are: '辩论在 %{date} 结束后得出以下结论:'
146
+ edit_conclusions: 编辑结论
147
+ edit_debate: 编辑辩论
148
+ groups_count: 群組
149
+ last_comment_by: 最后评论者
150
+ no_comments_yet: 尚无评论
151
+ participants_count: 参加者
152
+ update:
153
+ invalid: 有人在更新辩论时遇到问题。
154
+ success: 辩论已成功更新。
155
+ versions:
156
+ debates:
157
+ back_to_resource: 回到辩论
158
+ index:
159
+ title: 版本
160
+ versions_list:
161
+ back_to_resource: 回到辩论
162
+ last_activity:
163
+ new_debate_at_html: "<span>在 %{link}进行新的辩论</span>"
164
+ models:
165
+ debate:
166
+ fields:
167
+ end_time: 结束日期
168
+ official_debate: 正式辩论
169
+ start_time: 开始日期
170
+ title: 标题
171
+ events:
172
+ debates:
173
+ create_debate_event:
174
+ space_followers:
175
+ email_intro: |-
176
+ 您好,
177
+ 在参与性的 %{space_title} 空间上创建了一个新的辩论"%{resource_title}"。查看它并做出贡献:
178
+ email_outro: 您收到此通知是因为您正在关注 %{space_title} 个参与性空间。您可以停止收到跟随上一个链接的通知。
179
+ email_subject: 在%{resource_title}上的新辩论 " %{space_title}
180
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> 辩论是在 <a href="%{space_path}">%{space_title}</a> 创建的。
181
+ user_followers:
182
+ email_intro: |-
183
+ 你好,
184
+ %{author_name} %{author_nickname}, 你关注的人已经创建了一个新的辩论"%{resource_title}"。看看它并做出贡献:
185
+ email_outro: 您收到此通知是因为您正在关注 %{author_nickname}。您可以停止收到跟随上一个链接的通知。
186
+ email_subject: '%{resource_title}的 %{author_nickname} 新辩论'
187
+ notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> 创建了 <a href="%{resource_path}">%{resource_title}</a> 辩论。
188
+ creation_disabled:
189
+ email_intro: '辩论创建在 %{participatory_space_title}已不再活跃。您仍然可以从这个页面参与公开辩论:'
190
+ email_outro: 您收到此通知是因为您正在关注 %{participatory_space_title}。您可以停止收到跟随上一个链接的通知。
191
+ email_subject: 在 %{participatory_space_title} 中禁用了辩论创建
192
+ notification_title: 辩论创建已在 <a href="%{participatory_space_url}">%{participatory_space_title}禁用</a>
193
+ creation_enabled:
194
+ email_intro: '您现在可以在 %{participatory_space_title}开始新的辩论!开始参与这个页面:'
195
+ email_outro: 您收到此通知是因为您正在关注 %{participatory_space_title}。您可以停止收到跟随上一个链接的通知。
196
+ email_subject: 在 %{participatory_space_title} 中可以使用的辩论
197
+ debate_closed:
198
+ email_intro: '"%{resource_title}"辩论已经关闭。您可以从其页面阅读结论:'
199
+ email_outro: 您收到此通知是因为您正在关注"%{resource_title}"的辩论。您可以从上一个链接取消跟进。
200
+ email_subject: '"%{resource_title}"辩论已关闭'
201
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> 辩论已经结束。
202
+ gamification:
203
+ badges:
204
+ commented_debates:
205
+ conditions:
206
+ - 选择要参与的公开辩论
207
+ description: 当你通过留下评论积极参与不同的辩论时,这个徽章将被授予。
208
+ description_another: 此参与者已经参加了 %{score} 场辩论。
209
+ description_own: 您已经参加了 %{score} 次辩论。
210
+ name: 辩论
211
+ next_level_in: 参加更多的 %{score} 次辩论,以达到下一级!
212
+ unearned_another: 这位与会者尚未参加任何辩论。
213
+ unearned_own: 你还没有参与任何辩论。
214
+ metrics:
215
+ debates:
216
+ description: 创建的辩论数
217
+ object: 辩论情况
218
+ title: 辩论
@@ -0,0 +1 @@
1
+ zh-TW:
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class IndexForeignKeysInDecidimDebatesDebates < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_index :decidim_debates_debates, :decidim_user_group_id
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CloseDebates < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_debates_debates, :closed_at, :datetime
6
+ add_column :decidim_debates_debates, :conclusions, :jsonb
7
+ add_index :decidim_debates_debates, :closed_at
8
+ end
9
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ class FixDebatesI18nFields < ActiveRecord::Migration[5.2]
4
+ class User < ApplicationRecord
5
+ self.table_name = :decidim_users
6
+ end
7
+
8
+ class Debate < ApplicationRecord
9
+ self.table_name = :decidim_debates_debates
10
+ end
11
+
12
+ class Organization < ApplicationRecord
13
+ self.table_name = :decidim_organizations
14
+ end
15
+
16
+ def change
17
+ reset_column_information
18
+
19
+ debates.find_each do |debate|
20
+ locale, org_id = User.where(id: debate.decidim_author_id).pluck(:locale, :decidim_organization_id).first
21
+ locale = locale.presence || Organization.find(org_id).default_locale
22
+ locale = locale.to_s
23
+
24
+ debate.title = {
25
+ locale => debate.title[locale]
26
+ }
27
+ debate.description = {
28
+ locale => debate.description[locale]
29
+ }
30
+
31
+ debate.save!(validate: false)
32
+ end
33
+
34
+ reset_column_information
35
+ end
36
+
37
+ def debates
38
+ Debate
39
+ .where.not(decidim_author_type: "Decidim::Organization")
40
+ .select(:id, :decidim_author_id, :title, :description)
41
+ end
42
+
43
+ def reset_column_information
44
+ User.reset_column_information
45
+ Debate.reset_column_information
46
+ Organization.reset_column_information
47
+ end
48
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddEndorsableToDebates < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_debates_debates, :endorsements_count, :integer, null: false, default: 0
6
+ add_index :decidim_debates_debates, :endorsements_count, name: "idx_decidim_debates_debates_on_endorsemnts_count"
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddCommentableCounterCacheToDebates < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_debates_debates, :comments_count, :integer, null: false, default: 0, index: true
6
+ Decidim::Debates::Debate.reset_column_information
7
+
8
+ # rubocop:disable Rails/SkipsModelValidations
9
+ Decidim::Debates::Debate.includes(:comments).find_each do |debate|
10
+ debate.update_columns(comments_count: debate.comments.not_hidden.count)
11
+ end
12
+ # rubocop:enable Rails/SkipsModelValidations
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddCachedCommentMetadataToDebates < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_debates_debates, :last_comment_at, :datetime
6
+ add_column :decidim_debates_debates, :last_comment_by_id, :integer
7
+ add_column :decidim_debates_debates, :last_comment_by_type, :string
8
+
9
+ # rubocop:disable Rails/SkipsModelValidations
10
+ Decidim::Debates::Debate.reset_column_information
11
+ Decidim::Debates::Debate.includes(comments: [:author, :user_group]).find_each do |debate|
12
+ last_comment = debate.comments.order("created_at DESC").first
13
+ next unless last_comment
14
+
15
+ debate.update_columns(
16
+ last_comment_at: last_comment.created_at,
17
+ last_comment_by_id: last_comment.decidim_author_id,
18
+ last_comment_by_type: last_comment.decidim_author_type
19
+ )
20
+ end
21
+ # rubocop:enable Rails/SkipsModelValidations
22
+ end
23
+ end
@@ -12,7 +12,9 @@ module Decidim
12
12
  paths["lib/tasks"] = nil
13
13
 
14
14
  routes do
15
- resources :debates
15
+ resources :debates do
16
+ resources :debate_closes, only: [:edit, :update]
17
+ end
16
18
  root to: "debates#index"
17
19
  end
18
20
 
@@ -18,11 +18,16 @@ Decidim.register_component(:debates) do |component|
18
18
  end
19
19
 
20
20
  component.settings(:global) do |settings|
21
+ settings.attribute :scopes_enabled, type: :boolean, default: false
22
+ settings.attribute :scope_id, type: :scope
21
23
  settings.attribute :comments_enabled, type: :boolean, default: true
24
+ settings.attribute :comments_max_length, type: :integer, required: false
22
25
  settings.attribute :announcement, type: :text, translated: true, editor: true
23
26
  end
24
27
 
25
28
  component.settings(:step) do |settings|
29
+ settings.attribute :endorsements_enabled, type: :boolean, default: true
30
+ settings.attribute :endorsements_blocked, type: :boolean
26
31
  settings.attribute :creation_enabled, type: :boolean, default: false
27
32
  settings.attribute :comments_blocked, type: :boolean, default: false
28
33
  settings.attribute :announcement, type: :text, translated: true, editor: true
@@ -37,13 +42,19 @@ Decidim.register_component(:debates) do |component|
37
42
  Decidim::Follow.where(decidim_followable_type: "Decidim::Debates::Debate", decidim_followable_id: debates_ids).count
38
43
  end
39
44
 
45
+ component.register_stat :endorsements_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |components, _start_at, _end_at|
46
+ debates_ids = Decidim::Debates::Debate.where(component: components).not_hidden.pluck(:id)
47
+ Decidim::Endorsement.where(resource_id: debates_ids, resource_type: Decidim::Debates::Debate.name).count
48
+ end
49
+
40
50
  component.register_resource(:debate) do |resource|
41
51
  resource.model_class_name = "Decidim::Debates::Debate"
42
52
  resource.card = "decidim/debates/debate"
43
53
  resource.searchable = true
54
+ resource.actions = %w(create endorse)
44
55
  end
45
56
 
46
- component.actions = %w(create)
57
+ component.actions = %w(create endorse)
47
58
 
48
59
  component.seeds do |participatory_space|
49
60
  admin_user = Decidim::User.find_by(
@@ -51,6 +62,11 @@ Decidim.register_component(:debates) do |component|
51
62
  email: "admin@example.org"
52
63
  )
53
64
 
65
+ user = Decidim::User.find_by(
66
+ organization: participatory_space.organization,
67
+ email: "user@example.org"
68
+ )
69
+
54
70
  params = {
55
71
  name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :debates).i18n_name,
56
72
  manifest_name: :debates,
@@ -92,5 +108,32 @@ Decidim.register_component(:debates) do |component|
92
108
 
93
109
  Decidim::Comments::Seed.comments_for(debate)
94
110
  end
111
+
112
+ closed_debate = Decidim::Debates::Debate.last
113
+ closed_debate.conclusions = Decidim::Faker::Localized.wrapped("<p>", "</p>") do
114
+ Decidim::Faker::Localized.paragraph(3)
115
+ end
116
+ closed_debate.closed_at = Time.current
117
+ closed_debate.save!
118
+
119
+ params = {
120
+ component: component,
121
+ category: participatory_space.categories.sample,
122
+ title: Decidim::Faker::Localized.sentence(2),
123
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
124
+ Decidim::Faker::Localized.paragraph(3)
125
+ end,
126
+ instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
127
+ Decidim::Faker::Localized.paragraph(3)
128
+ end,
129
+ author: user
130
+ }
131
+
132
+ Decidim.traceability.create!(
133
+ Decidim::Debates::Debate,
134
+ user,
135
+ params,
136
+ visibility: "all"
137
+ )
95
138
  end
96
139
  end