decidim-debates 0.27.7 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/debates/debate_activity_cell.rb +1 -12
  3. data/app/cells/decidim/debates/debate_card_metadata_cell.rb +43 -0
  4. data/app/cells/decidim/debates/debate_cell.rb +6 -1
  5. data/app/cells/decidim/debates/debate_l_cell.rb +49 -0
  6. data/app/cells/decidim/debates/debate_s_cell.rb +21 -0
  7. data/app/commands/decidim/debates/admin/close_debate.rb +1 -1
  8. data/app/commands/decidim/debates/close_debate.rb +1 -1
  9. data/app/commands/decidim/debates/create_debate.rb +13 -4
  10. data/app/commands/decidim/debates/update_debate.rb +15 -2
  11. data/app/controllers/decidim/debates/admin/debate_closes_controller.rb +2 -2
  12. data/app/controllers/decidim/debates/admin/debates_controller.rb +5 -5
  13. data/app/controllers/decidim/debates/debates_controller.rb +7 -9
  14. data/app/events/decidim/debates/close_debate_event.rb +1 -1
  15. data/app/events/decidim/debates/create_debate_event.rb +15 -1
  16. data/app/forms/decidim/debates/admin/close_debate_form.rb +1 -1
  17. data/app/forms/decidim/debates/close_debate_form.rb +2 -2
  18. data/app/forms/decidim/debates/debate_form.rb +2 -2
  19. data/app/helpers/decidim/debates/application_helper.rb +42 -17
  20. data/app/jobs/decidim/debates/hide_all_created_by_author_job.rb +13 -0
  21. data/app/jobs/decidim/debates/settings_change_job.rb +2 -2
  22. data/app/models/decidim/debates/debate.rb +4 -10
  23. data/app/packs/entrypoints/decidim_debates.js +2 -0
  24. data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_commented_debates.svg +42 -1
  25. data/app/permissions/decidim/debates/permissions.rb +0 -6
  26. data/app/presenters/decidim/debates/admin_log/debate_presenter.rb +6 -2
  27. data/app/presenters/decidim/debates/admin_log/value_types/debate_title_description_presenter.rb +1 -1
  28. data/app/presenters/decidim/debates/log/resource_presenter.rb +18 -0
  29. data/app/views/decidim/debates/admin/debate_closes/edit.html.erb +26 -14
  30. data/app/views/decidim/debates/admin/debates/_form.html.erb +40 -39
  31. data/app/views/decidim/debates/admin/debates/edit.html.erb +16 -6
  32. data/app/views/decidim/debates/admin/debates/index.html.erb +60 -58
  33. data/app/views/decidim/debates/admin/debates/new.html.erb +16 -6
  34. data/app/views/decidim/debates/debates/_close_debate_modal.html.erb +22 -11
  35. data/app/views/decidim/debates/debates/_debates.html.erb +5 -6
  36. data/app/views/decidim/debates/debates/_form.html.erb +10 -19
  37. data/app/views/decidim/debates/debates/edit.html.erb +16 -20
  38. data/app/views/decidim/debates/debates/index.html.erb +19 -23
  39. data/app/views/decidim/debates/debates/index.js.erb +3 -4
  40. data/app/views/decidim/debates/debates/new.html.erb +16 -20
  41. data/app/views/decidim/debates/debates/show.html.erb +106 -109
  42. data/app/views/decidim/debates/versions/show.html.erb +14 -5
  43. data/config/locales/ar.yml +7 -17
  44. data/config/locales/bg.yml +0 -231
  45. data/config/locales/ca.yml +14 -35
  46. data/config/locales/cs.yml +13 -34
  47. data/config/locales/de.yml +14 -35
  48. data/config/locales/el.yml +10 -28
  49. data/config/locales/en.yml +13 -34
  50. data/config/locales/es-MX.yml +12 -33
  51. data/config/locales/es-PY.yml +13 -34
  52. data/config/locales/es.yml +15 -36
  53. data/config/locales/eu.yml +16 -37
  54. data/config/locales/fi-plain.yml +12 -33
  55. data/config/locales/fi.yml +12 -33
  56. data/config/locales/fr-CA.yml +14 -35
  57. data/config/locales/fr.yml +14 -35
  58. data/config/locales/ga-IE.yml +0 -15
  59. data/config/locales/gl.yml +7 -16
  60. data/config/locales/hu.yml +13 -32
  61. data/config/locales/id-ID.yml +7 -15
  62. data/config/locales/is-IS.yml +3 -9
  63. data/config/locales/it.yml +7 -31
  64. data/config/locales/ja.yml +13 -37
  65. data/config/locales/lb.yml +7 -25
  66. data/config/locales/lt.yml +14 -29
  67. data/config/locales/lv.yml +6 -17
  68. data/config/locales/nl.yml +7 -28
  69. data/config/locales/no.yml +7 -31
  70. data/config/locales/pl.yml +12 -38
  71. data/config/locales/pt-BR.yml +7 -39
  72. data/config/locales/pt.yml +7 -31
  73. data/config/locales/ro-RO.yml +10 -29
  74. data/config/locales/ru.yml +3 -12
  75. data/config/locales/sk.yml +6 -17
  76. data/config/locales/sl.yml +0 -3
  77. data/config/locales/sr-CS.yml +0 -6
  78. data/config/locales/sv.yml +11 -31
  79. data/config/locales/tr-TR.yml +6 -38
  80. data/config/locales/uk.yml +3 -12
  81. data/config/locales/zh-CN.yml +7 -29
  82. data/config/locales/zh-TW.yml +9 -28
  83. data/lib/decidim/debates/component.rb +4 -88
  84. data/lib/decidim/debates/engine.rb +29 -7
  85. data/lib/decidim/debates/seeds.rb +104 -0
  86. data/lib/decidim/debates/test/factories.rb +19 -14
  87. data/lib/decidim/debates/version.rb +1 -1
  88. metadata +29 -30
  89. data/app/cells/decidim/debates/debate_m/data.erb +0 -10
  90. data/app/cells/decidim/debates/debate_m/footer.erb +0 -10
  91. data/app/cells/decidim/debates/debate_m/multiple_dates.erb +0 -17
  92. data/app/cells/decidim/debates/debate_m/open_date.erb +0 -7
  93. data/app/cells/decidim/debates/debate_m/single_date.erb +0 -9
  94. data/app/cells/decidim/debates/debate_m/tags.erb +0 -1
  95. data/app/cells/decidim/debates/debate_m_cell.rb +0 -86
  96. data/app/controllers/decidim/debates/widgets_controller.rb +0 -29
  97. data/app/views/decidim/debates/debates/_count.html.erb +0 -1
  98. data/app/views/decidim/debates/debates/_filters.html.erb +0 -34
  99. data/app/views/decidim/debates/debates/_filters_small_view.html.erb +0 -18
  100. data/config/locales/he-IL.yml +0 -1
  101. data/decidim-debates.gemspec +0 -32
@@ -48,7 +48,7 @@ tr:
48
48
  confirm_destroy: Emin misiniz?
49
49
  destroy: Sil
50
50
  edit: Düzenle
51
- new: Yeni %{name}
51
+ new: Yeni Tartışma
52
52
  title: Eylemler
53
53
  admin:
54
54
  debate_closes:
@@ -78,9 +78,6 @@ tr:
78
78
  success: Tartışma başarıyla güncellendi.
79
79
  exports:
80
80
  comments: Yorumlar
81
- models:
82
- debate:
83
- name: tartışma
84
81
  admin_log:
85
82
  debate:
86
83
  close: "%{user_name}, %{space_name} alanındaki %{resource_name} tartışmasını kapattı"
@@ -93,10 +90,8 @@ tr:
93
90
  invalid: Tartışmayı kapatırken bir sorun oluştu.
94
91
  success: Tartışma başarıyla sonuçlandı.
95
92
  close_debate_modal:
96
- close: Kapat
97
93
  description: Bu tartışmanın özeti veya sonucu nedir?
98
94
  send: Tartışmayı kapat
99
- closed: Kapalı
100
95
  count:
101
96
  debates_count:
102
97
  one: "%{count} tartışma"
@@ -104,11 +99,6 @@ tr:
104
99
  create:
105
100
  invalid: Tartışmayı oluştururken bir sorun oluştu.
106
101
  success: Tartışma başarıyla oluşturuldu.
107
- debate:
108
- participate: Katıl
109
- debates:
110
- empty: Henüz herhangi bir tartışma yok.
111
- empty_filters: Bu kritere uyan bir tartışma yok.
112
102
  edit:
113
103
  back: Geri
114
104
  save: Değişiklikleri kaydet
@@ -122,18 +112,11 @@ tr:
122
112
  my_debates: Tartışmalarım
123
113
  official: Resmi
124
114
  origin: Orijin
125
- scope: Kapsam
126
115
  search: Arama
127
116
  state: Statü
128
117
  state_values:
129
118
  closed: Kapalı
130
119
  open: Açık
131
- user_groups: Gruplar
132
- filters_small_view:
133
- close_modal: Pencereyi kapat
134
- filter: Filtrele
135
- filter_by: Şuna göre filtrele
136
- unfold: Aç
137
120
  form:
138
121
  select_a_category: Lütfen bir kategori seçin
139
122
  index:
@@ -149,30 +132,17 @@ tr:
149
132
  recent: En yeni
150
133
  updated: Yeni güncellenmiş
151
134
  show:
152
- back: Listeye geri dön
153
135
  close_debate: Tartışmayı kapat
154
- date: Tarih
155
136
  debate_closed: Kapalı
156
137
  debate_conclusions_are: 'Tartışma bu sonuçlarla %{date} tarihinde kapatıldı:'
157
138
  edit_conclusions: Sonuçları düzenleyin
158
139
  edit_debate: Tartışmayı düzenle
159
140
  groups_count: Gruplar
160
- last_comment_by: Son yorum
161
- no_comments_yet: Henüz yorum yok
162
141
  open: Açık tartışma
163
142
  participants_count: Katılımcılar
164
143
  update:
165
144
  invalid: Bu tartışmayı güncellerken bir sorun oluştu.
166
145
  success: Tartışma başarıyla güncellendi.
167
- versions:
168
- debates:
169
- back_to_resource: Tartışmaya geri dön
170
- index:
171
- title: Sürümler
172
- versions_list:
173
- back_to_resource: Tartışmaya geri dön
174
- last_activity:
175
- new_debate_at_html: "<span> %{link}</span> linkinde yeni tartışma"
176
146
  models:
177
147
  debate:
178
148
  fields:
@@ -185,11 +155,11 @@ tr:
185
155
  create_debate_event:
186
156
  space_followers:
187
157
  email_intro: |-
188
- Merhaba
189
- %{participatory_space_title} katılımcı alanında yeni bir "%{resource_title}" tartışma başlığı oluşturuldu. İnceleyerek katkıda bulunabilirsiniz.
190
- email_outro: Bu bildirimi %{participatory_space_title} katılımcılık Başlıklı alanını takip ettiğiniz için aldınız. Bildirim almayı önceki bağlantı linkini izleyerek durdurabilirsiniz.
191
- email_subject: '%{participatory_space_title} başlıpı ile ilgili yeni tartışma "%{resource_title}"'
192
- notification_title: <a href="%{resource_path}">%{resource_title</a> tartışması <a href="%{participatory_space_url}">%{participatory_space_title</a> tarihinde oluşturuldu.
158
+ Merhaba,
159
+ %{space_title} katılımcı alanda yeni bir "%{resource_title}" tartışması oluşturuldu, inceleyin ve katkıda bulunun:
160
+ email_outro: '%{space_title} katılımcı alanı takip ettiğiniz için bu bildirimi aldınız. Önceki bağlantıyı takip ederek bildirim almayı durdurabilirsiniz.'
161
+ email_subject: '%{space_title} üzerinde yeni tartışma "%{resource_title}"'
162
+ notification_title: <a href="%{resource_path}">%{resource_title} </a> tartışması <a href="%{space_path}">%{space_title} </a> adresinde oluşturuldu.
193
163
  user_followers:
194
164
  email_intro: |-
195
165
  Merhaba,
@@ -206,7 +176,6 @@ tr:
206
176
  email_intro: 'Artık %{participatory_space_title} içinde yeni tartışmalar başlatabilirsiniz! Bu sayfaya katılmaya başlayın:'
207
177
  email_outro: Bu bildirimi, %{participatory_space_title} adlı kişiyi takip ettiğiniz için aldınız. Önceki bağlantıyı izleyerek bildirim almayı durdurabilirsiniz.
208
178
  email_subject: Tartışmalar artık %{participatory_space_title} içinde mevcut
209
- notification_title: Artık <a href="%{participatory_space_url}">%{participatory_space_title} </a> ’de <a href="%{resource_path}"> yeni tartışmalar </a> başlatabilirsiniz
210
179
  debate_closed:
211
180
  affected_user:
212
181
  email_intro: '"%{resource_title}" tartışması kapatıldı. Sonuçları sayfasından okuyabilirsiniz:'
@@ -229,7 +198,6 @@ tr:
229
198
  name: Tartışmalar
230
199
  next_level_in: Bir sonraki seviyeye ulaşmak için %{score} tartışmaya katılın!
231
200
  unearned_another: Bu katılımcı henüz bir tartışmada yer almadı.
232
- unearned_own: Henüz herhangi bir tartışmaya katılamadınız.
233
201
  metrics:
234
202
  debates:
235
203
  description: Oluşturulan tartışmaların sayısı
@@ -40,7 +40,6 @@ uk:
40
40
  confirm_destroy: Ви впевнені?
41
41
  destroy: Видалити
42
42
  edit: Редагувати
43
- new: Додати %{name}
44
43
  title: Дії
45
44
  admin:
46
45
  debates:
@@ -60,9 +59,6 @@ uk:
60
59
  update:
61
60
  invalid: При спробі оновити обговорення сталася помилка.
62
61
  success: Обговорення успішно оновлено.
63
- models:
64
- debate:
65
- name: Обговорення
66
62
  admin_log:
67
63
  debate:
68
64
  create: "%{user_name} започаткував обговорення %{resource_name} у просторі %{space_name}"
@@ -77,8 +73,6 @@ uk:
77
73
  create:
78
74
  invalid: При спробі започаткувати обговорення сталася помилка.
79
75
  success: Обговорення успішно започатковано.
80
- debate:
81
- participate: Взяти участь
82
76
  filters:
83
77
  all: Усі
84
78
  category: Категорія
@@ -86,11 +80,6 @@ uk:
86
80
  official: Службове
87
81
  origin: Джерело
88
82
  search: Шукати
89
- filters_small_view:
90
- close_modal: Закрити віконце
91
- filter: Відібрати
92
- filter_by: 'Відібрати за ознакою:'
93
- unfold: Розгорнути
94
83
  form:
95
84
  select_a_category: Будь ласка, виберіть категорію
96
85
  index:
@@ -109,6 +98,9 @@ uk:
109
98
  events:
110
99
  debates:
111
100
  create_debate_event:
101
+ space_followers:
102
+ email_outro: Ви отримали це сповіщення, тому що ви стежите за простором співучасті %{space_title}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
103
+ notification_title: <a href="%{space_path}">%{space_title} </a> розпочав обговорення у <a href="%{resource_path}">%{resource_title}</a>.
112
104
  user_followers:
113
105
  email_outro: Ви отримали це сповіщення, тому що ви стежите за %{author_nickname}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
114
106
  creation_disabled:
@@ -120,4 +112,3 @@ uk:
120
112
  email_intro: 'Тепер в %{participatory_space_title} з''явилась можливість започатковувати нові обговорення! Почніть брати участь зі сторінки:'
121
113
  email_outro: Ви отримали це сповіщення, тому що ви стежите за %{participatory_space_title}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
122
114
  email_subject: В %{participatory_space_title} почалось обговорення
123
- notification_title: Тепер ви можете започатковувати <a href="%{resource_path}">нові обговорення</a> в <a href="%{participatory_space_url}">%{participatory_space_title}</a>
@@ -47,7 +47,6 @@ zh-CN:
47
47
  confirm_destroy: 您确定吗?
48
48
  destroy: 删除
49
49
  edit: 编辑
50
- new: 新建 %{name}
51
50
  title: 行动
52
51
  admin:
53
52
  debate_closes:
@@ -71,9 +70,6 @@ zh-CN:
71
70
  update:
72
71
  invalid: 在更新这次辩论时遇到了问题。
73
72
  success: 辩论已成功更新。
74
- models:
75
- debate:
76
- name: B. 辩论
77
73
  admin_log:
78
74
  debate:
79
75
  close: "%{user_name} 关闭了 %{resource_name} 场内的 %{space_name} 个辩论"
@@ -86,18 +82,14 @@ zh-CN:
86
82
  invalid: 辩论结束时遇到问题。
87
83
  success: 辩论已成功结束。
88
84
  close_debate_modal:
89
- close: 关闭
90
85
  description: 这次辩论的总结或结束是什么?
91
86
  send: 结束辩论
92
- closed: 已关闭
93
87
  count:
94
88
  debates_count:
95
89
  other: "%{count} 次辩论"
96
90
  create:
97
91
  invalid: 有一个问题是如何建立辩论。
98
92
  success: 辩论成功创建。
99
- debate:
100
- participate: 参与
101
93
  edit:
102
94
  back: 后退
103
95
  save: 保存更改
@@ -111,18 +103,11 @@ zh-CN:
111
103
  my_debates: 我的辩论
112
104
  official: 官方的
113
105
  origin: 始发地
114
- scope: 范围
115
106
  search: 搜索
116
107
  state: 状态
117
108
  state_values:
118
109
  closed: 已关闭
119
110
  open: 打开
120
- user_groups: 群組
121
- filters_small_view:
122
- close_modal: 关闭模式
123
- filter: 筛选器
124
- filter_by: 筛选方式
125
- unfold: 展开...
126
111
  index:
127
112
  new_debate: 新的辩论
128
113
  new:
@@ -136,29 +121,16 @@ zh-CN:
136
121
  recent: 最新的
137
122
  updated: 最近更新
138
123
  show:
139
- back: 返回列表
140
124
  close_debate: 结束辩论
141
- date: 日期
142
125
  debate_closed: 已关闭
143
126
  debate_conclusions_are: '辩论在 %{date} 结束后得出以下结论:'
144
127
  edit_conclusions: 编辑结论
145
128
  edit_debate: 编辑辩论
146
129
  groups_count: 群組
147
- last_comment_by: 最后评论者
148
- no_comments_yet: 尚无评论
149
130
  participants_count: 参加者
150
131
  update:
151
132
  invalid: 有人在更新辩论时遇到问题。
152
133
  success: 辩论已成功更新。
153
- versions:
154
- debates:
155
- back_to_resource: 回到辩论
156
- index:
157
- title: 版本
158
- versions_list:
159
- back_to_resource: 回到辩论
160
- last_activity:
161
- new_debate_at_html: "<span>在 %{link}进行新的辩论</span>"
162
134
  models:
163
135
  debate:
164
136
  fields:
@@ -169,6 +141,13 @@ zh-CN:
169
141
  events:
170
142
  debates:
171
143
  create_debate_event:
144
+ space_followers:
145
+ email_intro: |-
146
+ 您好,
147
+ 在参与性的 %{space_title} 空间上创建了一个新的辩论"%{resource_title}"。查看它并做出贡献:
148
+ email_outro: 您收到此通知是因为您正在关注 %{space_title} 个参与性空间。您可以停止收到跟随上一个链接的通知。
149
+ email_subject: 在%{resource_title}上的新辩论 " %{space_title}
150
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> 辩论是在 <a href="%{space_path}">%{space_title}</a> 创建的。
172
151
  user_followers:
173
152
  email_intro: |-
174
153
  你好,
@@ -207,7 +186,6 @@ zh-CN:
207
186
  name: 辩论
208
187
  next_level_in: 参加更多的 %{score} 次辩论,以达到下一级!
209
188
  unearned_another: 这位与会者尚未参加任何辩论。
210
- unearned_own: 你还没有参与任何辩论。
211
189
  metrics:
212
190
  debates:
213
191
  description: 创建的辩论数
@@ -51,7 +51,6 @@ zh-TW:
51
51
  confirm_destroy: 您確定嗎?
52
52
  destroy: 刪除
53
53
  edit: 編輯
54
- new: 新增 %{name}
55
54
  title: 操作
56
55
  admin:
57
56
  debate_closes:
@@ -81,9 +80,6 @@ zh-TW:
81
80
  success: 辯論已成功更新
82
81
  exports:
83
82
  comments: 評論
84
- models:
85
- debate:
86
- name: 辯論
87
83
  admin_log:
88
84
  debate:
89
85
  close: "%{user_name} 在 %{space_name} 空間關閉了 %{resource_name} 辯論。"
@@ -96,18 +92,14 @@ zh-TW:
96
92
  invalid: 關閉辯論時出現問題
97
93
  success: 辯論成功關閉
98
94
  close_debate_modal:
99
- close: 關閉
100
95
  description: 這場辯論的總結或結論是什麼?
101
96
  send: 關閉辯論
102
- closed: 關閉
103
97
  count:
104
98
  debates_count:
105
99
  other: "%{count} 場辯論"
106
100
  create:
107
101
  invalid: 建立辯論時出現問題。
108
102
  success: 辯論建立成功。
109
- debate:
110
- participate: 參與
111
103
  edit:
112
104
  back: 返回
113
105
  save: 保存更改
@@ -122,18 +114,11 @@ zh-TW:
122
114
  official: 官方
123
115
  origin: 起源
124
116
  participants: 參與者
125
- scope: 範圍
126
117
  search: 搜尋
127
118
  state: 狀態
128
119
  state_values:
129
120
  closed: 關閉
130
121
  open: 開啟
131
- user_groups: 群組
132
- filters_small_view:
133
- close_modal: 關閉視窗
134
- filter: 篩選
135
- filter_by: 篩選條件
136
- unfold: 展開
137
122
  form:
138
123
  select_a_category: 請選擇一個類別
139
124
  index:
@@ -149,31 +134,20 @@ zh-TW:
149
134
  recent: 最近
150
135
  updated: 最近更新
151
136
  show:
152
- back: 返回列表
153
137
  close_debate: 關閉辯論
154
- date: 日期
155
138
  debate_closed: 關閉
156
139
  debate_conclusions_are: '此辯論已於 %{date} 結束,以下是總結結論:'
157
140
  edit_conclusions: 修改結論
158
141
  edit_debate: 編輯辯論
159
142
  groups_count: 群組
160
- last_comment_by: 最後評論
161
- no_comments_yet: 尚無留言
162
143
  open: 開放性辯論
163
144
  participants_count: 參與者
164
145
  update:
165
146
  invalid: 更新此辯論時發生問題。
166
147
  success: 辯論已成功更新
167
- versions:
168
- debates:
169
- back_to_resource: 返回辯論
170
- index:
171
- title: 版本
172
- versions_list:
173
- back_to_resource: 返回辯論
174
148
  last_activity:
175
- debate_updated_at_html: "<span>辯論已更新,連結網址為 %{link}</span>"
176
- new_debate_at_html: "<span>新的辯論,連結網址為 %{link}</span>"
149
+ debate_updated: '辯論已更新:'
150
+ new_debate: '新辯論:'
177
151
  models:
178
152
  debate:
179
153
  fields:
@@ -184,6 +158,13 @@ zh-TW:
184
158
  events:
185
159
  debates:
186
160
  create_debate_event:
161
+ space_followers:
162
+ email_intro: |-
163
+ 你好,
164
+ 一個新的辯論「%{resource_title}」已經在 %{space_title} 參與空間中建立,請查看並參與:
165
+ email_outro: 您收到此通知,是因為您正在追蹤 %{space_title} 參與空間。您可以按照上述連結停止接收通知。
166
+ email_subject: '%{space_title} 參與空間上有新辯論主題%{resource_title}'
167
+ notification_title: 在<a href="%{space_path}">%{space_title}</a>上建立了辯論主題<a href="%{resource_path}">%{resource_title}</a>。
187
168
  user_followers:
188
169
  email_intro: |-
189
170
  嗨,
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "decidim/components/namer"
4
-
5
3
  Decidim.register_component(:debates) do |component|
6
4
  component.engine = Decidim::Debates::Engine
7
5
  component.admin_engine = Decidim::Debates::AdminEngine
8
6
  component.icon = "media/images/decidim_debates.svg"
7
+ component.icon_key = "discuss-line"
9
8
  component.permissions_class_name = "Decidim::Debates::Permissions"
10
9
 
11
10
  component.query_type = "Decidim::Debates::DebatesType"
@@ -14,7 +13,7 @@ Decidim.register_component(:debates) do |component|
14
13
  component.newsletter_participant_entities = ["Decidim::Debates::Debate"]
15
14
 
16
15
  component.on(:before_destroy) do |instance|
17
- raise StandardError, "Can't remove this component" if Decidim::Debates::Debate.where(component: instance).any?
16
+ raise StandardError, "Cannot remove this component" if Decidim::Debates::Debate.where(component: instance).any?
18
17
  end
19
18
 
20
19
  component.settings(:global) do |settings|
@@ -68,91 +67,8 @@ Decidim.register_component(:debates) do |component|
68
67
  end
69
68
 
70
69
  component.seeds do |participatory_space|
71
- admin_user = Decidim::User.find_by(
72
- organization: participatory_space.organization,
73
- email: "admin@example.org"
74
- )
75
-
76
- user = Decidim::User.find_by(
77
- organization: participatory_space.organization,
78
- email: "user@example.org"
79
- )
80
-
81
- params = {
82
- name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :debates).i18n_name,
83
- manifest_name: :debates,
84
- published_at: Time.current,
85
- participatory_space: participatory_space
86
- }
87
-
88
- component = Decidim.traceability.perform_action!(
89
- "publish",
90
- Decidim::Component,
91
- admin_user,
92
- visibility: "all"
93
- ) do
94
- Decidim::Component.create!(params)
95
- end
96
-
97
- 5.times do |x|
98
- finite = x != 2
99
- if finite
100
- start_time = [rand(1..20).weeks.from_now, rand(1..20).weeks.ago].sample
101
- end_time = start_time + [rand(1..4).hours, rand(1..20).days].sample
102
- else
103
- start_time = nil
104
- end_time = nil
105
- end
106
- params = {
107
- component: component,
108
- category: participatory_space.categories.sample,
109
- title: Decidim::Faker::Localized.sentence(word_count: 2),
110
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
111
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
112
- end,
113
- instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
114
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
115
- end,
116
- start_time: start_time,
117
- end_time: end_time,
118
- author: component.organization
119
- }
120
-
121
- debate = Decidim.traceability.create!(
122
- Decidim::Debates::Debate,
123
- admin_user,
124
- params,
125
- visibility: "all"
126
- )
127
-
128
- Decidim::Comments::Seed.comments_for(debate)
129
- end
130
-
131
- closed_debate = Decidim::Debates::Debate.last
132
- closed_debate.conclusions = Decidim::Faker::Localized.wrapped("<p>", "</p>") do
133
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
134
- end
135
- closed_debate.closed_at = Time.current
136
- closed_debate.save!
137
-
138
- params = {
139
- component: component,
140
- category: participatory_space.categories.sample,
141
- title: Decidim::Faker::Localized.sentence(word_count: 2),
142
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
143
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
144
- end,
145
- instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
146
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
147
- end,
148
- author: user
149
- }
70
+ require "decidim/debates/seeds"
150
71
 
151
- Decidim.traceability.create!(
152
- Decidim::Debates::Debate,
153
- user,
154
- params,
155
- visibility: "all"
156
- )
72
+ Decidim::Debates::Seeds.new(participatory_space:).call
157
73
  end
158
74
  end
@@ -13,13 +13,19 @@ module Decidim
13
13
  member do
14
14
  post :close
15
15
  end
16
- resources :versions, only: [:show, :index]
17
- resource :widget, only: :show, path: "embed"
16
+ resources :versions, only: [:show]
18
17
  end
19
- root to: "debates#index"
18
+ scope "/debates" do
19
+ root to: "debates#index"
20
+ end
21
+ get "/", to: redirect("debates", status: 301)
22
+ end
23
+
24
+ initializer "decidim_debates.register_icons" do
25
+ Decidim.icons.register(name: "Decidim::Debates::Debate", icon: "discuss-line", description: "Debate", category: "activity", engine: :debates)
20
26
  end
21
27
 
22
- initializer "decidim_changes" do
28
+ initializer "decidim_debates.settings_changes" do
23
29
  config.to_prepare do
24
30
  Decidim::SettingsChange.subscribe "debates" do |changes|
25
31
  Decidim::Debates::SettingsChangeJob.perform_later(
@@ -31,12 +37,12 @@ module Decidim
31
37
  end
32
38
  end
33
39
 
34
- initializer "decidim_meetings.add_cells_view_paths" do
40
+ initializer "decidim_debates.add_cells_view_paths" do
35
41
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Debates::Engine.root}/app/cells")
36
42
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Debates::Engine.root}/app/views") # for partials
37
43
  end
38
44
 
39
- initializer "decidim.debates.commented_debates_badge" do
45
+ initializer "decidim_debates.commented_debates_badge" do
40
46
  Decidim::Gamification.register_badge(:commented_debates) do |badge|
41
47
  badge.levels = [1, 5, 10, 30, 50]
42
48
 
@@ -45,7 +51,7 @@ module Decidim
45
51
  badge.reset = lambda do |user|
46
52
  debates = Decidim::Comments::Comment.where(
47
53
  author: user,
48
- decidim_root_commentable_type: "Decidim::Debates::Debate"\
54
+ decidim_root_commentable_type: "Decidim::Debates::Debate"
49
55
  )
50
56
  debates.pluck(:decidim_root_commentable_id).uniq.count
51
57
  end
@@ -101,6 +107,22 @@ module Decidim
101
107
  initializer "decidim_debates.webpacker.assets_path" do
102
108
  Decidim.register_assets_path File.expand_path("app/packs", root)
103
109
  end
110
+
111
+ initializer "decidim_debates.authorization_transfer" do
112
+ config.to_prepare do
113
+ Decidim::AuthorizationTransfer.register(:debates) do |transfer|
114
+ transfer.move_records(Decidim::Debates::Debate, :decidim_author_id)
115
+ end
116
+ end
117
+ end
118
+
119
+ initializer "decidim_debates.moderation_content" do
120
+ config.to_prepare do
121
+ ActiveSupport::Notifications.subscribe("decidim.admin.block_user:after") do |_event_name, data|
122
+ Decidim::Debates::HideAllCreatedByAuthorJob.perform_later(**data)
123
+ end
124
+ end
125
+ end
104
126
  end
105
127
  end
106
128
  end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "decidim/components/namer"
4
+
5
+ module Decidim
6
+ module Debates
7
+ class Seeds
8
+ attr_reader :participatory_space
9
+
10
+ def initialize(participatory_space:)
11
+ @participatory_space = participatory_space
12
+ end
13
+
14
+ def call
15
+ admin_user = Decidim::User.find_by(
16
+ organization: participatory_space.organization,
17
+ email: "admin@example.org"
18
+ )
19
+
20
+ user = Decidim::User.find_by(
21
+ organization: participatory_space.organization,
22
+ email: "user@example.org"
23
+ )
24
+
25
+ params = {
26
+ name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :debates).i18n_name,
27
+ manifest_name: :debates,
28
+ published_at: Time.current,
29
+ participatory_space:
30
+ }
31
+
32
+ component = Decidim.traceability.perform_action!(
33
+ "publish",
34
+ Decidim::Component,
35
+ admin_user,
36
+ visibility: "all"
37
+ ) do
38
+ Decidim::Component.create!(params)
39
+ end
40
+
41
+ 5.times do |x|
42
+ finite = x != 2
43
+ if finite
44
+ start_time = [rand(1..20).weeks.from_now, rand(1..20).weeks.ago].sample
45
+ end_time = start_time + [rand(1..4).hours, rand(1..20).days].sample
46
+ else
47
+ start_time = nil
48
+ end_time = nil
49
+ end
50
+ params = {
51
+ component:,
52
+ category: participatory_space.categories.sample,
53
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
54
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
55
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
56
+ end,
57
+ instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
58
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
59
+ end,
60
+ start_time:,
61
+ end_time:,
62
+ author: component.organization
63
+ }
64
+
65
+ debate = Decidim.traceability.create!(
66
+ Decidim::Debates::Debate,
67
+ admin_user,
68
+ params,
69
+ visibility: "all"
70
+ )
71
+
72
+ Decidim::Comments::Seed.comments_for(debate)
73
+ end
74
+
75
+ closed_debate = Decidim::Debates::Debate.last
76
+ closed_debate.conclusions = Decidim::Faker::Localized.wrapped("<p>", "</p>") do
77
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
78
+ end
79
+ closed_debate.closed_at = Time.current
80
+ closed_debate.save!
81
+
82
+ params = {
83
+ component:,
84
+ category: participatory_space.categories.sample,
85
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
86
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
87
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
88
+ end,
89
+ instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
90
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
91
+ end,
92
+ author: user
93
+ }
94
+
95
+ Decidim.traceability.create!(
96
+ Decidim::Debates::Debate,
97
+ user,
98
+ params,
99
+ visibility: "all"
100
+ )
101
+ end
102
+ end
103
+ end
104
+ end