decidim-debates 0.23.3 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/config/admin/decidim_debates_manifest.js +1 -0
- data/app/assets/javascripts/decidim/debates/admin/debates.js.es6 +25 -0
- data/app/cells/decidim/debates/debate_activity_cell.rb +13 -5
- data/app/cells/decidim/debates/debate_m/open_date.erb +7 -0
- data/app/cells/decidim/debates/debate_m_cell.rb +1 -1
- data/app/cells/decidim/debates/reported_content/show.erb +4 -0
- data/app/cells/decidim/debates/reported_content_cell.rb +13 -0
- data/app/commands/decidim/debates/admin/create_debate.rb +3 -2
- data/app/commands/decidim/debates/admin/update_debate.rb +2 -1
- data/app/commands/decidim/debates/create_debate.rb +1 -0
- data/app/commands/decidim/debates/update_debate.rb +2 -1
- data/app/controllers/decidim/debates/debates_controller.rb +1 -5
- data/app/forms/decidim/debates/admin/close_debate_form.rb +1 -1
- data/app/forms/decidim/debates/admin/debate_form.rb +30 -2
- data/app/forms/decidim/debates/close_debate_form.rb +1 -1
- data/app/forms/decidim/debates/debate_form.rb +17 -0
- data/app/models/decidim/debates/debate.rb +11 -1
- data/app/permissions/decidim/debates/admin/permissions.rb +8 -1
- data/app/views/decidim/debates/admin/debates/_form.html.erb +15 -2
- data/app/views/decidim/debates/admin/debates/index.html.erb +10 -2
- data/app/views/decidim/debates/debates/_filters.html.erb +1 -1
- data/app/views/decidim/debates/debates/_filters_small_view.html.erb +1 -1
- data/app/views/decidim/debates/debates/_form.html.erb +6 -0
- data/app/views/decidim/debates/debates/show.html.erb +5 -21
- data/config/locales/ca.yml +18 -4
- data/config/locales/cs.yml +19 -5
- data/config/locales/de.yml +18 -4
- data/config/locales/en.yml +18 -4
- data/config/locales/es-MX.yml +18 -4
- data/config/locales/es-PY.yml +18 -4
- data/config/locales/es.yml +18 -4
- data/config/locales/fi-plain.yml +18 -4
- data/config/locales/fi.yml +18 -4
- data/config/locales/fr-CA.yml +18 -4
- data/config/locales/fr.yml +18 -4
- data/config/locales/gl.yml +11 -4
- data/config/locales/ja.yml +10 -4
- data/config/locales/nl.yml +18 -4
- data/config/locales/no.yml +10 -4
- data/config/locales/pl.yml +37 -6
- data/config/locales/ro-RO.yml +64 -0
- data/config/locales/sv.yml +28 -4
- data/config/locales/tr-TR.yml +17 -4
- data/config/locales/zh-CN.yml +10 -4
- data/db/migrate/20200930145546_add_scope_to_debates_debate.rb +7 -0
- data/db/migrate/20201126112752_archive_debates.rb +8 -0
- data/db/migrate/20210125101735_revert_archive_debates.rb +8 -0
- data/db/migrate/20210310120652_add_followable_counter_cache_to_debates.rb +16 -0
- data/lib/decidim/api/debate_type.rb +26 -0
- data/lib/decidim/api/debates_type.rb +26 -0
- data/lib/decidim/debates.rb +1 -0
- data/lib/decidim/debates/admin_engine.rb +4 -0
- data/lib/decidim/debates/api.rb +8 -0
- data/lib/decidim/debates/component.rb +22 -10
- data/lib/decidim/debates/test/factories.rb +1 -1
- data/lib/decidim/debates/version.rb +1 -1
- metadata +24 -14
- data/app/types/decidim/debates/debate_type.rb +0 -28
- data/app/types/decidim/debates/debates_type.rb +0 -32
data/config/locales/ro-RO.yml
CHANGED
@@ -3,6 +3,8 @@ ro:
|
|
3
3
|
attributes:
|
4
4
|
debate:
|
5
5
|
category_id: Categorie
|
6
|
+
closed_at: Închisă la
|
7
|
+
conclusions: Concluzii
|
6
8
|
decidim_category_id: Categorie
|
7
9
|
description: Descriere
|
8
10
|
end_time: Se termină la
|
@@ -12,6 +14,7 @@ ro:
|
|
12
14
|
title: Titlu
|
13
15
|
user_group_id: Creează o dezbatere ca
|
14
16
|
models:
|
17
|
+
decidim/debates/close_debate_event: Dezbatere închisă
|
15
18
|
decidim/debates/create_debate_event: Dezbatere
|
16
19
|
decidim/debates/creation_disabled_event: Dezbateri dezactivate
|
17
20
|
decidim/debates/creation_enabled_event: Dezbateri activate
|
@@ -26,24 +29,34 @@ ro:
|
|
26
29
|
debates:
|
27
30
|
actions:
|
28
31
|
create: Crează
|
32
|
+
endorse: Aprobare
|
29
33
|
name: Dezbateri
|
30
34
|
settings:
|
31
35
|
global:
|
32
36
|
announcement: Anunţ
|
33
37
|
comments_enabled: Comentarii activate
|
34
38
|
comments_max_length: Lungimea maximă a comentariilor (Leave 0 pentru valoarea implicită)
|
39
|
+
scope_id: Domeniu de interes
|
40
|
+
scopes_enabled: Domenii de interes activate
|
35
41
|
step:
|
36
42
|
announcement: Anunţ
|
37
43
|
comments_blocked: Comentarii blocate
|
38
44
|
creation_enabled: Crearea de dezbateri de către participanți este activată
|
45
|
+
endorsements_blocked: Aprobări blocate
|
46
|
+
endorsements_enabled: Aprobări activate
|
39
47
|
debates:
|
40
48
|
actions:
|
49
|
+
close: Închide
|
41
50
|
confirm_destroy: Ești sigur?
|
42
51
|
destroy: Ștergere
|
43
52
|
edit: Editare
|
44
53
|
new: '%{name} nou'
|
45
54
|
title: Acțiuni
|
46
55
|
admin:
|
56
|
+
debate_closes:
|
57
|
+
edit:
|
58
|
+
close: Inchide
|
59
|
+
title: Închide dezbaterea
|
47
60
|
debates:
|
48
61
|
create:
|
49
62
|
invalid: A existat o problemă la crearea dezbaterii.
|
@@ -53,6 +66,10 @@ ro:
|
|
53
66
|
edit:
|
54
67
|
title: Editare dezbatere
|
55
68
|
update: Actualizează dezbaterea
|
69
|
+
form:
|
70
|
+
debate_type: Tip de dezbatere
|
71
|
+
finite: Finit (cu timp de început și sfârșit)
|
72
|
+
open: Deschis (fără timp de început sau sfârșit)
|
56
73
|
index:
|
57
74
|
title: Dezbateri
|
58
75
|
new:
|
@@ -61,14 +78,27 @@ ro:
|
|
61
78
|
update:
|
62
79
|
invalid: A apărut o problemă la actualizarea acestei dezbateri.
|
63
80
|
success: Dezbatere actualizata cu succes.
|
81
|
+
exports:
|
82
|
+
comments: Comentarii
|
64
83
|
models:
|
65
84
|
debate:
|
66
85
|
name: Dezbatere
|
67
86
|
admin_log:
|
68
87
|
debate:
|
88
|
+
close: "%{user_name} a închis dezbaterea %{resource_name} cu privire la spațiul %{space_name}"
|
69
89
|
create: "%{user_name} a creat dezbaterea %{resource_name} pentru spațiul %{space_name}"
|
70
90
|
update: "%{user_name} a actualizat dezbaterea %{resource_name} cu privire la spațiul %{space_name}"
|
91
|
+
debate_m:
|
92
|
+
commented_time_ago: Comentat acum %{time}
|
71
93
|
debates:
|
94
|
+
close:
|
95
|
+
invalid: A existat o problemă la închiderea dezbaterii.
|
96
|
+
success: Dezbatere închisă.
|
97
|
+
close_debate_modal:
|
98
|
+
close: Închide
|
99
|
+
description: Care este rezumatul sau concluzia acestei dezbateri?
|
100
|
+
send: Închide dezbaterea
|
101
|
+
closed: Închis
|
72
102
|
count:
|
73
103
|
debates_count:
|
74
104
|
one: "%{count} dezbatere"
|
@@ -84,13 +114,22 @@ ro:
|
|
84
114
|
save: Salvează modificările
|
85
115
|
title: Editare dezbatere
|
86
116
|
filters:
|
117
|
+
activity: Activitatea mea
|
87
118
|
all: Toate
|
88
119
|
category: Categorie
|
89
120
|
category_prompt: Selectați o categorie
|
90
121
|
citizens: Cetățeni
|
122
|
+
commented: Comentat
|
123
|
+
my_debates: Dezbaterile mele
|
91
124
|
official: Oficial
|
92
125
|
origin: Origine
|
126
|
+
scope: Domeniu de interes
|
93
127
|
search: Caută
|
128
|
+
state: Stare
|
129
|
+
state_values:
|
130
|
+
closed: Inchide
|
131
|
+
open: Deschide
|
132
|
+
user_groups: Grupuri
|
94
133
|
filters_small_view:
|
95
134
|
close_modal: Închide fereastra
|
96
135
|
filter: Filtrare
|
@@ -104,10 +143,25 @@ ro:
|
|
104
143
|
back: Înapoi
|
105
144
|
create: Crează
|
106
145
|
title: Dezbatere nouă
|
146
|
+
orders:
|
147
|
+
commented: Cele mai comentate
|
148
|
+
label: Dezbateri de ordine
|
149
|
+
random: Ordine aleatorie
|
150
|
+
recent: Cele mai recente
|
151
|
+
updated: Actualizate recent
|
107
152
|
show:
|
108
153
|
back: Înapoi la listă
|
154
|
+
close_debate: Închide dezbaterea
|
109
155
|
date: Data
|
156
|
+
debate_closed: Inchide
|
157
|
+
debate_conclusions_are: 'Dezbaterea s-a încheiat la %{date} cu următoarele concluzii:'
|
158
|
+
edit_conclusions: Editați concluziile
|
110
159
|
edit_debate: Editare dezbatere
|
160
|
+
groups_count: Grupuri
|
161
|
+
last_comment_by: Ultimul comentariu din partea
|
162
|
+
no_comments_yet: Încă nu există comentarii
|
163
|
+
open: Dezbatere deschisă
|
164
|
+
participants_count: Participanţi
|
111
165
|
update:
|
112
166
|
invalid: A apărut o problemă la actualizarea dezbaterii.
|
113
167
|
success: Dezbatere actualizata cu succes.
|
@@ -119,6 +173,7 @@ ro:
|
|
119
173
|
versions_list:
|
120
174
|
back_to_resource: Revenire la dezbatere
|
121
175
|
last_activity:
|
176
|
+
debate_updated_at_html: "<span>Dezbatere actualizată la %{link}</span>"
|
122
177
|
new_debate_at_html: "<span>Noua dezbatere la %{link}</span>"
|
123
178
|
models:
|
124
179
|
debate:
|
@@ -154,6 +209,15 @@ ro:
|
|
154
209
|
email_outro: Ați primit această notificare deoarece urmăriți %{participatory_space_title}. Puteți înceta să primiți notificări urmând linkul anterior.
|
155
210
|
email_subject: Dezbaterile sunt acum disponibile în %{participatory_space_title}
|
156
211
|
notification_title: Acum poți începe <a href="%{resource_path}">noi dezbateri</a> în <a href="%{participatory_space_url}">%{participatory_space_title}</a>
|
212
|
+
debate_closed:
|
213
|
+
affected_user:
|
214
|
+
email_intro: 'Dezbaterea pentru "%{resource_title}” a fost închisă. Puteți citi concluziile pe pagina sa:'
|
215
|
+
email_subject: Dezbaterea pentru "%{resource_title}” a fost închisă
|
216
|
+
notification_title: Dezbaterea pentru <a href="%{resource_path}">%{resource_title}</a> a fost închisă.
|
217
|
+
follower:
|
218
|
+
email_intro: 'Dezbaterea pentru "%{resource_title}” a fost închisă. Puteți citi concluziile pe pagina sa:'
|
219
|
+
email_subject: Dezbaterea pentru "%{resource_title}” a fost închisă
|
220
|
+
notification_title: Dezbaterea pentru <a href="%{resource_path}">%{resource_title}</a> a fost închisă.
|
157
221
|
gamification:
|
158
222
|
badges:
|
159
223
|
commented_debates:
|
data/config/locales/sv.yml
CHANGED
@@ -35,6 +35,8 @@ sv:
|
|
35
35
|
announcement: Meddelande
|
36
36
|
comments_enabled: Kommentarer aktiverade
|
37
37
|
comments_max_length: Maximal längd för kommentarer (Lämna 0 för standardvärde)
|
38
|
+
scope_id: Omfång
|
39
|
+
scopes_enabled: Omfång aktiverade
|
38
40
|
step:
|
39
41
|
announcement: Meddelande
|
40
42
|
comments_blocked: Kommentarer blockerade
|
@@ -63,6 +65,10 @@ sv:
|
|
63
65
|
edit:
|
64
66
|
title: Redigera debatt
|
65
67
|
update: Uppdatera debatt
|
68
|
+
form:
|
69
|
+
debate_type: Typ av debatt
|
70
|
+
finite: Tidsbegränsad (med start- och sluttider)
|
71
|
+
open: Oendlig (inga start- eller slutdatum)
|
66
72
|
index:
|
67
73
|
title: Debatter
|
68
74
|
new:
|
@@ -71,6 +77,8 @@ sv:
|
|
71
77
|
update:
|
72
78
|
invalid: Det gick inte att uppdatera debatten.
|
73
79
|
success: Debatten uppdaterades.
|
80
|
+
exports:
|
81
|
+
comments: Kommentarer
|
74
82
|
models:
|
75
83
|
debate:
|
76
84
|
name: Debatt
|
@@ -102,13 +110,22 @@ sv:
|
|
102
110
|
save: Spara ändringar
|
103
111
|
title: Redigera debatt
|
104
112
|
filters:
|
113
|
+
activity: Min aktivitet
|
105
114
|
all: Alla
|
106
115
|
category: Kategori
|
107
116
|
category_prompt: Välj en kategori
|
108
117
|
citizens: Medborgare
|
118
|
+
commented: Kommenterade
|
119
|
+
my_debates: Mina debatter
|
109
120
|
official: Officiell
|
110
121
|
origin: Ursprung
|
122
|
+
scope: Omfång
|
111
123
|
search: Sök
|
124
|
+
state: Status
|
125
|
+
state_values:
|
126
|
+
closed: Stängda
|
127
|
+
open: Öppna
|
128
|
+
user_groups: Grupper
|
112
129
|
filters_small_view:
|
113
130
|
close_modal: Stäng fönstret
|
114
131
|
filter: Filtrera
|
@@ -139,6 +156,7 @@ sv:
|
|
139
156
|
groups_count: Grupper
|
140
157
|
last_comment_by: Senaste kommentar av
|
141
158
|
no_comments_yet: Inga kommentarer ännu
|
159
|
+
open: Öppna debatt
|
142
160
|
participants_count: Deltagare
|
143
161
|
update:
|
144
162
|
invalid: Det gick inte att uppdatera debatten.
|
@@ -187,10 +205,16 @@ sv:
|
|
187
205
|
email_subject: Debatter är nu tillgängliga i %{participatory_space_title}
|
188
206
|
notification_title: Nu kan du starta <a href="%{resource_path}">nya debatter</a> i <a href="%{participatory_space_url}">%{participatory_space_title}</a>
|
189
207
|
debate_closed:
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
208
|
+
affected_user:
|
209
|
+
email_intro: 'Debatten "%{resource_title}" stängdes. Du kan läsa slutsatserna från dess sida:'
|
210
|
+
email_outro: Du har fått det här meddelandet eftersom du följer debatten "%{resource_title}". Du kan sluta följa det på föregående länk.
|
211
|
+
email_subject: Debatten "%{resource_title}" stängdes
|
212
|
+
notification_title: Debatten <a href="%{resource_path}">%{resource_title}</a> stängdes.
|
213
|
+
follower:
|
214
|
+
email_intro: 'Debatten "%{resource_title}" stängdes. Du kan läsa slutsatserna från dess sida:'
|
215
|
+
email_outro: Du har fått det här meddelandet eftersom du följer debatten "%{resource_title}". Du kan sluta följa det på föregående länk.
|
216
|
+
email_subject: Debatten "%{resource_title}" stängdes
|
217
|
+
notification_title: Debatten <a href="%{resource_path}">%{resource_title}</a> stängdes.
|
194
218
|
gamification:
|
195
219
|
badges:
|
196
220
|
commented_debates:
|
data/config/locales/tr-TR.yml
CHANGED
@@ -65,6 +65,10 @@ tr:
|
|
65
65
|
edit:
|
66
66
|
title: Tartışmayı düzenle
|
67
67
|
update: Tartışmayı güncelle
|
68
|
+
form:
|
69
|
+
debate_type: Tartışma türü
|
70
|
+
finite: Sonlu (Başlangıç ve bitiş saatleri ile)
|
71
|
+
open: Açık (Başlangıç veya bitiş zamanı yok)
|
68
72
|
index:
|
69
73
|
title: Tartışmalar
|
70
74
|
new:
|
@@ -73,6 +77,8 @@ tr:
|
|
73
77
|
update:
|
74
78
|
invalid: Bu tartışmayı güncellerken bir sorun oluştu.
|
75
79
|
success: Tartışma başarıyla güncellendi.
|
80
|
+
exports:
|
81
|
+
comments: Yorumlar
|
76
82
|
models:
|
77
83
|
debate:
|
78
84
|
name: Tartışma
|
@@ -152,6 +158,7 @@ tr:
|
|
152
158
|
groups_count: Gruplar
|
153
159
|
last_comment_by: Son yorum
|
154
160
|
no_comments_yet: Henüz yorum yok
|
161
|
+
open: Açık tartışma
|
155
162
|
participants_count: Katılımcılar
|
156
163
|
update:
|
157
164
|
invalid: Bu tartışmayı güncellerken bir sorun oluştu.
|
@@ -200,10 +207,16 @@ tr:
|
|
200
207
|
email_subject: Tartışmalar artık %{participatory_space_title} içinde mevcut
|
201
208
|
notification_title: Artık <a href="%{participatory_space_url}">%{participatory_space_title} </a> ’de <a href="%{resource_path}"> yeni tartışmalar </a> başlatabilirsiniz
|
202
209
|
debate_closed:
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
210
|
+
affected_user:
|
211
|
+
email_intro: '"%{resource_title}" tartışması kapatıldı. Sonuçları sayfasından okuyabilirsiniz:'
|
212
|
+
email_outro: Bu bildirimi, "%{resource_title}" tartışmasını takip ettiğiniz için aldınız. Önceki bağlantıdan takibini bırakabilirsiniz.
|
213
|
+
email_subject: '"%{resource_title}" tartışması kapatıldı'
|
214
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> tartışması kapatıldı.
|
215
|
+
follower:
|
216
|
+
email_intro: '"%{resource_title}" tartışması kapatıldı. Sonuçları sayfasından okuyabilirsiniz:'
|
217
|
+
email_outro: Bu bildirimi, "%{resource_title}" tartışmasını takip ettiğiniz için aldınız. Önceki bağlantıdan takibini bırakabilirsiniz.
|
218
|
+
email_subject: '"%{resource_title}" tartışması kapatıldı'
|
219
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> tartışması kapatıldı.
|
207
220
|
gamification:
|
208
221
|
badges:
|
209
222
|
commented_debates:
|
data/config/locales/zh-CN.yml
CHANGED
@@ -195,10 +195,16 @@ zh-CN:
|
|
195
195
|
email_outro: 您收到此通知是因为您正在关注 %{participatory_space_title}。您可以停止收到跟随上一个链接的通知。
|
196
196
|
email_subject: 在 %{participatory_space_title} 中可以使用的辩论
|
197
197
|
debate_closed:
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
198
|
+
affected_user:
|
199
|
+
email_intro: '"%{resource_title}"辩论已经关闭。您可以从其页面阅读结论:'
|
200
|
+
email_outro: 您收到此通知是因为您正在关注"%{resource_title}"的辩论。您可以从上一个链接取消跟进。
|
201
|
+
email_subject: '"%{resource_title}"辩论已关闭'
|
202
|
+
notification_title: <a href="%{resource_path}">%{resource_title}</a> 辩论已经结束。
|
203
|
+
follower:
|
204
|
+
email_intro: '"%{resource_title}"辩论已经关闭。您可以从其页面阅读结论:'
|
205
|
+
email_outro: 您收到此通知是因为您正在关注"%{resource_title}"的辩论。您可以从上一个链接取消跟进。
|
206
|
+
email_subject: '"%{resource_title}"辩论已关闭'
|
207
|
+
notification_title: <a href="%{resource_path}">%{resource_title}</a> 辩论已经结束。
|
202
208
|
gamification:
|
203
209
|
badges:
|
204
210
|
commented_debates:
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddFollowableCounterCacheToDebates < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_debates_debates, :follows_count, :integer, null: false, default: 0, index: true
|
6
|
+
|
7
|
+
reversible do |dir|
|
8
|
+
dir.up do
|
9
|
+
Decidim::Debates::Debate.reset_column_information
|
10
|
+
Decidim::Debates::Debate.find_each do |record|
|
11
|
+
record.class.reset_counters(record.id, :follows)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Debates
|
5
|
+
class DebateType < Decidim::Api::Types::BaseObject
|
6
|
+
implements Decidim::Core::CategorizableInterface
|
7
|
+
implements Decidim::Comments::CommentableInterface
|
8
|
+
implements Decidim::Core::AuthorableInterface
|
9
|
+
implements Decidim::Core::ScopableInterface
|
10
|
+
|
11
|
+
description "A debate"
|
12
|
+
|
13
|
+
field :id, GraphQL::Types::ID, "The internal ID for this debate", null: false
|
14
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this debate", null: true
|
15
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this debate", null: true
|
16
|
+
field :instructions, Decidim::Core::TranslatedFieldType, "The instructions for this debate", null: true
|
17
|
+
field :start_time, Decidim::Core::DateTimeType, "The start time for this debate", null: true
|
18
|
+
field :end_time, Decidim::Core::DateTimeType, "The end time for this debate", null: true
|
19
|
+
field :image, GraphQL::Types::String, "The image of this debate", null: true
|
20
|
+
field :created_at, Decidim::Core::DateTimeType, "When this debate was created", null: true
|
21
|
+
field :updated_at, Decidim::Core::DateTimeType, "When this debate was updated", null: true
|
22
|
+
field :information_updates, Decidim::Core::TranslatedFieldType, "The information updates for this debate", null: true
|
23
|
+
field :reference, GraphQL::Types::String, "The reference for this debate", null: true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Debates
|
5
|
+
class DebatesType < Decidim::Api::Types::BaseObject
|
6
|
+
implements Decidim::Core::ComponentInterface
|
7
|
+
|
8
|
+
graphql_name "Debates"
|
9
|
+
description "A debates component of a participatory space."
|
10
|
+
|
11
|
+
field :debates, Decidim::Debates::DebateType.connection_type, null: true, connection: true
|
12
|
+
|
13
|
+
def debates
|
14
|
+
Debate.where(component: object).includes(:component)
|
15
|
+
end
|
16
|
+
|
17
|
+
field :debate, Decidim::Debates::DebateType, null: true do
|
18
|
+
argument :id, GraphQL::Types::ID, required: true
|
19
|
+
end
|
20
|
+
|
21
|
+
def debate(**args)
|
22
|
+
Debate.where(component: object).find_by(id: args[:id])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/decidim/debates.rb
CHANGED
@@ -50,12 +50,23 @@ Decidim.register_component(:debates) do |component|
|
|
50
50
|
component.register_resource(:debate) do |resource|
|
51
51
|
resource.model_class_name = "Decidim::Debates::Debate"
|
52
52
|
resource.card = "decidim/debates/debate"
|
53
|
+
resource.reported_content_cell = "decidim/debates/reported_content"
|
53
54
|
resource.searchable = true
|
54
55
|
resource.actions = %w(create endorse)
|
55
56
|
end
|
56
57
|
|
57
58
|
component.actions = %w(create endorse)
|
58
59
|
|
60
|
+
component.exports :comments do |exports|
|
61
|
+
exports.collection do |component_instance|
|
62
|
+
Decidim::Comments::Export.comments_for_resource(
|
63
|
+
Decidim::Debates::Debate, component_instance
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
exports.serializer Decidim::Comments::CommentSerializer
|
68
|
+
end
|
69
|
+
|
59
70
|
component.seeds do |participatory_space|
|
60
71
|
admin_user = Decidim::User.find_by(
|
61
72
|
organization: participatory_space.organization,
|
@@ -83,19 +94,20 @@ Decidim.register_component(:debates) do |component|
|
|
83
94
|
Decidim::Component.create!(params)
|
84
95
|
end
|
85
96
|
|
86
|
-
|
97
|
+
5.times do |x|
|
98
|
+
finite = x != 2
|
87
99
|
params = {
|
88
100
|
component: component,
|
89
101
|
category: participatory_space.categories.sample,
|
90
|
-
title: Decidim::Faker::Localized.sentence(2),
|
102
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
91
103
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
92
|
-
Decidim::Faker::Localized.paragraph(3)
|
104
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
93
105
|
end,
|
94
106
|
instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
95
|
-
Decidim::Faker::Localized.paragraph(3)
|
107
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
96
108
|
end,
|
97
|
-
start_time: 3.weeks.from_now,
|
98
|
-
end_time: 3.weeks.from_now + 4.hours,
|
109
|
+
start_time: (3.weeks.from_now if finite),
|
110
|
+
end_time: (3.weeks.from_now + 4.hours if finite),
|
99
111
|
author: component.organization
|
100
112
|
}
|
101
113
|
|
@@ -111,7 +123,7 @@ Decidim.register_component(:debates) do |component|
|
|
111
123
|
|
112
124
|
closed_debate = Decidim::Debates::Debate.last
|
113
125
|
closed_debate.conclusions = Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
114
|
-
Decidim::Faker::Localized.paragraph(3)
|
126
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
115
127
|
end
|
116
128
|
closed_debate.closed_at = Time.current
|
117
129
|
closed_debate.save!
|
@@ -119,12 +131,12 @@ Decidim.register_component(:debates) do |component|
|
|
119
131
|
params = {
|
120
132
|
component: component,
|
121
133
|
category: participatory_space.categories.sample,
|
122
|
-
title: Decidim::Faker::Localized.sentence(2),
|
134
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
123
135
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
124
|
-
Decidim::Faker::Localized.paragraph(3)
|
136
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
125
137
|
end,
|
126
138
|
instructions: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
127
|
-
Decidim::Faker::Localized.paragraph(3)
|
139
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
128
140
|
end,
|
129
141
|
author: user
|
130
142
|
}
|