decidim-accountability 0.29.5 → 0.30.0.rc1
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/cells/decidim/accountability/project/show.erb +6 -0
- data/app/cells/decidim/accountability/project_cell.rb +23 -42
- data/app/cells/decidim/accountability/result_history_cell.rb +57 -0
- data/app/cells/decidim/accountability/result_metadata_cell.rb +17 -17
- data/app/cells/decidim/accountability/status_cell.rb +9 -13
- data/app/commands/decidim/accountability/admin/create_imported_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/create_result.rb +3 -2
- data/app/commands/decidim/accountability/admin/import_component_to_accountability.rb +47 -0
- data/app/commands/decidim/accountability/admin/update_imported_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/update_result.rb +3 -2
- data/app/commands/decidim/accountability/admin/update_result_dates.rb +56 -0
- data/app/commands/decidim/accountability/admin/update_result_status.rb +61 -0
- data/app/commands/decidim/accountability/admin/update_result_taxonomies.rb +18 -0
- data/app/controllers/concerns/decidim/accountability/admin/filterable.rb +8 -6
- data/app/controllers/decidim/accountability/admin/import_components_controller.rb +36 -0
- data/app/controllers/decidim/accountability/admin/results_bulk_actions_controller.rb +102 -0
- data/app/controllers/decidim/accountability/admin/results_controller.rb +21 -11
- data/app/controllers/decidim/accountability/results_controller.rb +10 -7
- data/app/forms/decidim/accountability/admin/import_component_form.rb +98 -0
- data/app/forms/decidim/accountability/admin/result_bulk_actions_form.rb +18 -0
- data/app/forms/decidim/accountability/admin/result_form.rb +17 -23
- data/app/helpers/decidim/accountability/admin/application_helper.rb +0 -1
- data/app/helpers/decidim/accountability/application_helper.rb +1 -32
- data/app/helpers/decidim/accountability/breadcrumb_helper.rb +10 -14
- data/app/jobs/decidim/accountability/admin/import_projects_job.rb +5 -3
- data/app/jobs/decidim/accountability/admin/import_proposals_job.rb +70 -0
- data/app/mailers/decidim/accountability/import_proposals_mailer.rb +28 -0
- data/app/models/decidim/accountability/result.rb +23 -1
- data/app/models/decidim/accountability/status.rb +4 -0
- data/app/packs/entrypoints/decidim_accountability_admin_form.js +1 -0
- data/app/packs/src/decidim/accountability/admin/imports.js +37 -14
- data/app/packs/src/decidim/accountability/admin/index/action_button.js +42 -0
- data/app/packs/src/decidim/accountability/admin/index/action_form.js +46 -0
- data/app/packs/src/decidim/accountability/admin/index/action_selector.js +37 -0
- data/app/packs/src/decidim/accountability/admin/index/counter.js +40 -0
- data/app/packs/src/decidim/accountability/admin/index/select_all.js +29 -0
- data/app/packs/src/decidim/accountability/admin/index.js +17 -7
- data/app/packs/src/decidim/accountability/admin/result_form.js +21 -0
- data/app/packs/stylesheets/accountability.scss +5 -0
- data/app/permissions/decidim/accountability/admin/permissions.rb +3 -2
- data/app/presenters/decidim/accountability/admin_log/result_presenter.rb +1 -1
- data/app/presenters/decidim/accountability/result_presenter.rb +30 -0
- data/app/queries/decidim/accountability/metrics/results_metric_manage.rb +6 -6
- data/app/services/decidim/accountability/results_calculator.rb +4 -6
- data/app/services/decidim/accountability/results_csv_importer.rb +1 -1
- data/app/views/decidim/accountability/admin/import_components/_filters.html.erb +26 -0
- data/app/views/decidim/accountability/admin/import_components/_form.html.erb +26 -0
- data/app/views/decidim/accountability/admin/import_components/new.html.erb +14 -0
- data/app/views/decidim/accountability/admin/results/_actions.html.erb +29 -0
- data/app/views/decidim/accountability/admin/results/_form.html.erb +15 -8
- data/app/views/decidim/accountability/admin/results/_result-tr.html.erb +32 -0
- data/app/views/decidim/accountability/admin/results/_results-thead.html.erb +26 -0
- data/app/views/decidim/accountability/admin/results/bulk_actions/_dates_form.html.erb +19 -0
- data/app/views/decidim/accountability/admin/results/bulk_actions/_dropdown.html.erb +40 -0
- data/app/views/decidim/accountability/admin/results/bulk_actions/_status_form.html.erb +16 -0
- data/app/views/decidim/accountability/admin/results/bulk_actions/_submit_buttons.html.erb +4 -0
- data/app/views/decidim/accountability/admin/results/bulk_actions/_taxonomies_form.html.erb +18 -0
- data/app/views/decidim/accountability/admin/results/edit.html.erb +2 -2
- data/app/views/decidim/accountability/admin/results/index.html.erb +50 -111
- data/app/views/decidim/accountability/admin/results/manage_trash.html.erb +26 -0
- data/app/views/decidim/accountability/admin/results/new.html.erb +2 -2
- data/app/views/decidim/accountability/import_proposals_mailer/import.html.erb +2 -0
- data/app/views/decidim/accountability/results/{_home_categories.html.erb → _home_taxonomies.html.erb} +6 -8
- data/app/views/decidim/accountability/results/_project.html.erb +1 -3
- data/app/views/decidim/accountability/results/_projects_aside.html.erb +9 -7
- data/app/views/decidim/accountability/results/home.html.erb +18 -6
- data/app/views/decidim/accountability/results/index.html.erb +8 -2
- data/app/views/decidim/accountability/results/show.html.erb +5 -5
- data/config/assets.rb +3 -2
- data/config/locales/ar.yml +101 -57
- data/config/locales/bg.yml +2 -50
- data/config/locales/bs-BA.yml +0 -18
- data/config/locales/ca.yml +128 -40
- data/config/locales/cs.yml +149 -58
- data/config/locales/da.yml +2 -25
- data/config/locales/de.yml +130 -43
- data/config/locales/el.yml +2 -48
- data/config/locales/en.yml +128 -40
- data/config/locales/es-MX.yml +129 -41
- data/config/locales/es-PY.yml +129 -41
- data/config/locales/es.yml +129 -41
- data/config/locales/eu.yml +141 -54
- data/config/locales/fi-plain.yml +136 -49
- data/config/locales/fi.yml +136 -49
- data/config/locales/fr-CA.yml +112 -58
- data/config/locales/fr.yml +112 -58
- data/config/locales/ga-IE.yml +2 -15
- data/config/locales/gl.yml +2 -19
- data/config/locales/gn-PY.yml +1 -12
- data/config/locales/he-IL.yml +47 -54
- data/config/locales/hu.yml +2 -50
- data/config/locales/id-ID.yml +2 -18
- data/config/locales/is-IS.yml +2 -19
- data/config/locales/it.yml +2 -92
- data/config/locales/ja.yml +132 -47
- data/config/locales/kaa.yml +5 -8
- data/config/locales/ko.yml +2 -47
- data/config/locales/lb.yml +3 -20
- data/config/locales/lt.yml +2 -50
- data/config/locales/lv.yml +2 -21
- data/config/locales/nl.yml +2 -17
- data/config/locales/no.yml +2 -17
- data/config/locales/pl.yml +2 -47
- data/config/locales/pt-BR.yml +7 -56
- data/config/locales/pt.yml +37 -24
- data/config/locales/ro-RO.yml +4 -31
- data/config/locales/ru.yml +3 -19
- data/config/locales/si-LK.yml +2 -16
- data/config/locales/sk.yml +2 -21
- data/config/locales/sl.yml +2 -19
- data/config/locales/sq-AL.yml +2 -50
- data/config/locales/sr-CS.yml +2 -20
- data/config/locales/sv.yml +125 -37
- data/config/locales/th-TH.yml +1 -53
- data/config/locales/tr-TR.yml +3 -54
- data/config/locales/uk.yml +2 -21
- data/config/locales/zh-CN.yml +2 -22
- data/config/locales/zh-TW.yml +2 -47
- data/db/migrate/20200827154103_add_commentable_counter_cache_to_results.rb +1 -1
- data/db/migrate/20240828103202_add_deleted_at_to_decidim_accountability_results.rb +8 -0
- data/db/migrate/20240916112128_add_geolocation_fields_to_results.rb +9 -0
- data/decidim-accountability.gemspec +1 -1
- data/lib/decidim/accountability/admin_engine.rb +16 -2
- data/lib/decidim/accountability/component.rb +3 -3
- data/lib/decidim/accountability/result_serializer.rb +9 -13
- data/lib/decidim/accountability/seeds.rb +28 -21
- data/lib/decidim/accountability/test/factories.rb +6 -4
- data/lib/decidim/accountability/version.rb +1 -1
- data/lib/decidim/api/accountability_type.rb +4 -5
- data/lib/decidim/api/result_type.rb +10 -13
- data/lib/decidim/api/status_type.rb +3 -4
- data/lib/decidim/api/timeline_entry_type.rb +5 -6
- metadata +58 -31
- data/app/commands/decidim/accountability/admin/import_projects_to_accountability.rb +0 -37
- data/app/controllers/decidim/accountability/admin/projects_import_controller.rb +0 -31
- data/app/forms/decidim/accountability/admin/result_import_projects_form.rb +0 -51
- data/app/views/decidim/accountability/admin/projects_import/new.html.erb +0 -45
- data/app/views/decidim/accountability/results/_nav_breadcrumb.html.erb +0 -37
- data/app/views/decidim/accountability/results/_scope_filters.html.erb +0 -31
- data/config/locales/ca-IT.yml +0 -292
- /data/app/packs/entrypoints/{decidim_accountability_admin.js → decidim_accountability_admin_index.js} +0 -0
data/config/locales/uk.yml
CHANGED
@@ -9,8 +9,6 @@ uk:
|
|
9
9
|
description: Опис
|
10
10
|
end_date: Дата закінчення
|
11
11
|
progress: Перебіг
|
12
|
-
project_ids: Включені проекти
|
13
|
-
proposals: Включені пропозиції
|
14
12
|
start_date: Дата початку
|
15
13
|
title: Назва
|
16
14
|
updated_at: 'Оновлено:'
|
@@ -21,7 +19,7 @@ uk:
|
|
21
19
|
progress: Перебіг
|
22
20
|
timeline_entry:
|
23
21
|
description: Опис
|
24
|
-
|
22
|
+
entry_date: Дата
|
25
23
|
models:
|
26
24
|
decidim/accountability/proposal_linked_event: Пропозиція, включена до підсумку
|
27
25
|
activerecord:
|
@@ -89,10 +87,8 @@ uk:
|
|
89
87
|
models:
|
90
88
|
result:
|
91
89
|
fields:
|
92
|
-
category: Категорія
|
93
90
|
end_date: Дата закінчення
|
94
91
|
progress: Перебіг
|
95
|
-
scope: Обсяг
|
96
92
|
start_date: Дата початку
|
97
93
|
status: Стан
|
98
94
|
title: Назва
|
@@ -104,7 +100,7 @@ uk:
|
|
104
100
|
progress: Перебіг
|
105
101
|
timeline_entry:
|
106
102
|
fields:
|
107
|
-
|
103
|
+
entry_date: Дата
|
108
104
|
results:
|
109
105
|
count:
|
110
106
|
results_count:
|
@@ -112,12 +108,8 @@ uk:
|
|
112
108
|
few: "%{count} підсумків"
|
113
109
|
many: "%{count} підсумків"
|
114
110
|
other: "%{count} підсумків"
|
115
|
-
filters:
|
116
|
-
all: Усі
|
117
111
|
home_header:
|
118
112
|
global_status: Загальний стан виконання
|
119
|
-
nav_breadcrumb:
|
120
|
-
global: Загальне виконання
|
121
113
|
search:
|
122
114
|
search: Пошук дій
|
123
115
|
show:
|
@@ -125,13 +117,6 @@ uk:
|
|
125
117
|
back_to_resource: Повернутися до підсумків
|
126
118
|
timeline:
|
127
119
|
title: Розвиток проекту
|
128
|
-
admin:
|
129
|
-
filters:
|
130
|
-
results:
|
131
|
-
category_id_eq:
|
132
|
-
label: Категорія
|
133
|
-
scope_id_eq:
|
134
|
-
label: Обсяг
|
135
120
|
components:
|
136
121
|
accountability:
|
137
122
|
name: Звітність
|
@@ -140,7 +125,6 @@ uk:
|
|
140
125
|
comments_enabled: Коментарі увімкнено
|
141
126
|
display_progress_enabled: Показувати перебіг
|
142
127
|
intro: Вступ
|
143
|
-
scope_id: Обсяг
|
144
128
|
step:
|
145
129
|
comments_blocked: Коментарі вимкнено
|
146
130
|
events:
|
@@ -150,9 +134,6 @@ uk:
|
|
150
134
|
email_outro: Ви отримали це сповіщення, тому що ви стежите за "%{proposal_title}". Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
|
151
135
|
email_subject: Оновлення до %{proposal_title}
|
152
136
|
notification_title: Пропозиція <a href="%{proposal_path}">%{proposal_title}</a> була включена до підсумку <a href="%{resource_path}">%{resource_title}</a>.
|
153
|
-
metrics:
|
154
|
-
results:
|
155
|
-
title: Підсумки
|
156
137
|
resource_links:
|
157
138
|
included_projects:
|
158
139
|
result_project: Проекти, включені до цих підсумків
|
data/config/locales/zh-CN.yml
CHANGED
@@ -9,8 +9,6 @@ zh-CN:
|
|
9
9
|
description: 描述
|
10
10
|
end_date: 结束日期
|
11
11
|
progress: 进展情况
|
12
|
-
project_ids: 包括项目
|
13
|
-
proposals: 包括的建议
|
14
12
|
start_date: 开始日期
|
15
13
|
title: 标题
|
16
14
|
updated_at: 更新于
|
@@ -21,7 +19,7 @@ zh-CN:
|
|
21
19
|
progress: 进展情况
|
22
20
|
timeline_entry:
|
23
21
|
description: 描述
|
24
|
-
|
22
|
+
entry_date: 日期
|
25
23
|
models:
|
26
24
|
decidim/accountability/proposal_linked_event: 结果中包括的提案
|
27
25
|
decidim/accountability/result_progress_updated_event: 结果进度更新
|
@@ -49,9 +47,6 @@ zh-CN:
|
|
49
47
|
name: 结果
|
50
48
|
status:
|
51
49
|
name: 状态
|
52
|
-
projects_import:
|
53
|
-
new:
|
54
|
-
create: 导入
|
55
50
|
results:
|
56
51
|
edit:
|
57
52
|
title: 编辑结果
|
@@ -99,10 +94,8 @@ zh-CN:
|
|
99
94
|
models:
|
100
95
|
result:
|
101
96
|
fields:
|
102
|
-
category: 类别
|
103
97
|
end_date: 结束日期
|
104
98
|
progress: 进展情况
|
105
|
-
scope: 范围
|
106
99
|
start_date: 开始日期
|
107
100
|
status: 状态
|
108
101
|
title: 标题
|
@@ -114,17 +107,13 @@ zh-CN:
|
|
114
107
|
progress: 进展情况
|
115
108
|
timeline_entry:
|
116
109
|
fields:
|
117
|
-
|
110
|
+
entry_date: 日期
|
118
111
|
results:
|
119
112
|
count:
|
120
113
|
results_count:
|
121
114
|
other: "%{count} 个结果"
|
122
|
-
filters:
|
123
|
-
all: 所有的
|
124
115
|
home_header:
|
125
116
|
global_status: 全局执行状态
|
126
|
-
nav_breadcrumb:
|
127
|
-
global: 全局执行
|
128
117
|
search:
|
129
118
|
search: 搜索操作
|
130
119
|
show:
|
@@ -132,13 +121,6 @@ zh-CN:
|
|
132
121
|
back_to_resource: 返回结果
|
133
122
|
timeline:
|
134
123
|
title: 项目进化
|
135
|
-
admin:
|
136
|
-
filters:
|
137
|
-
results:
|
138
|
-
category_id_eq:
|
139
|
-
label: 类别
|
140
|
-
scope_id_eq:
|
141
|
-
label: 范围
|
142
124
|
components:
|
143
125
|
accountability:
|
144
126
|
name: 问责制
|
@@ -148,8 +130,6 @@ zh-CN:
|
|
148
130
|
comments_max_length: 评论最大长度 (默认值留0)
|
149
131
|
display_progress_enabled: 显示进度
|
150
132
|
intro: 简介
|
151
|
-
scope_id: 范围
|
152
|
-
scopes_enabled: 范围已启用
|
153
133
|
step:
|
154
134
|
comments_blocked: 评论已阻止
|
155
135
|
events:
|
data/config/locales/zh-TW.yml
CHANGED
@@ -8,10 +8,7 @@ zh-TW:
|
|
8
8
|
decidim_scope_id: 範圍
|
9
9
|
description: 說明
|
10
10
|
end_date: 結束日期
|
11
|
-
meetings_ids: 包含的會議
|
12
11
|
progress: 進度
|
13
|
-
project_ids: 包含的專案
|
14
|
-
proposals: 包含的建議
|
15
12
|
start_date: 開始日期
|
16
13
|
title: 標題
|
17
14
|
updated_at: 更新時間
|
@@ -22,6 +19,7 @@ zh-TW:
|
|
22
19
|
progress: 進度
|
23
20
|
timeline_entry:
|
24
21
|
description: 說明
|
22
|
+
entry_date: 日期
|
25
23
|
title: 標題
|
26
24
|
models:
|
27
25
|
decidim/accountability/proposal_linked_event: 在結果的建議
|
@@ -49,27 +47,6 @@ zh-TW:
|
|
49
47
|
new:
|
50
48
|
download_export: 匯出成 CSV
|
51
49
|
import: 匯入
|
52
|
-
info: |
|
53
|
-
<p>建議透過下面步驟:</p>
|
54
|
-
<ol>
|
55
|
-
<li><a href='%{link_new_status}' target='_blank'>建立結果的狀態</a></li>
|
56
|
-
<li><a href='%{link_new_result}' target='_blank'>手動建立至少一個結果</a> 在這個管理介面,這樣一來在匯入前可以先理解需要填寫的格式</li>
|
57
|
-
<li>%{link_export_csv}</li>
|
58
|
-
<li>下載後在電腦調整,只能夠調整 CSV 檔案的下面欄位:
|
59
|
-
<ul>
|
60
|
-
<li><b>category/id:</b> 類別編號</li>
|
61
|
-
<li><b>scope/id:</b> 範圍編號</li>
|
62
|
-
<li><b>parent/id:</b> 上層編號 (相關結果),選填</li>
|
63
|
-
<li><b>title/en:</b> 英文標題,這會依據語言設定不同</li>
|
64
|
-
<li><b>description/en:</b> 英文說明,這會依據語言設定不同</li>
|
65
|
-
<li><b>start_date:</b> 結果開始執行時間 (格式 YYYY-MM-DD)</li>
|
66
|
-
<li><b>end_date:</b> 結果結束執行時間 (格式 YYYY-MM-DD)</li>
|
67
|
-
<li><b>status/id:</b> 這個結果的狀態編號</li>
|
68
|
-
<li><b>progress:</b> 執行率百分比 (從 0 到 100) </li>
|
69
|
-
<li><b>proposals_ids:</b> 相關提案的內部編號 (逗點分隔),會自動轉換為 <span class='attribute-name'>proposal_url</span></li>
|
70
|
-
</ul>
|
71
|
-
</li>
|
72
|
-
</ol>
|
73
50
|
imports:
|
74
51
|
create:
|
75
52
|
success: 檔案開始匯入,執行完成後會寄發 email 說明匯入結果.
|
@@ -78,21 +55,10 @@ zh-TW:
|
|
78
55
|
name: 結果
|
79
56
|
status:
|
80
57
|
name: 狀態
|
81
|
-
projects_import:
|
82
|
-
create:
|
83
|
-
invalid: 匯入專案到結果時發生錯誤,請確實依照說明小心操作,以及確認已經選擇要實做的專案
|
84
|
-
new:
|
85
|
-
create: 匯入
|
86
|
-
import_all_selected_projects: 匯入所有選擇的專案來實現
|
87
|
-
no_components: 在這個參與空間沒有預算元件來匯入專案到結果
|
88
|
-
success:
|
89
|
-
other: "%{count} 個專案已經排程匯入,完成後會寄送 email 通知."
|
90
58
|
results:
|
91
59
|
create:
|
92
60
|
invalid: 建立結果時發生錯誤.
|
93
61
|
success: 結果成功建立.
|
94
|
-
destroy:
|
95
|
-
success: 結果成功刪除.
|
96
62
|
edit:
|
97
63
|
title: 編輯結果
|
98
64
|
update: 更新結果
|
@@ -178,12 +144,10 @@ zh-TW:
|
|
178
144
|
models:
|
179
145
|
result:
|
180
146
|
fields:
|
181
|
-
category: 類別
|
182
147
|
created_at: 建立時間
|
183
148
|
end_date: 結束日期
|
184
149
|
id: 編號
|
185
150
|
progress: 進度
|
186
|
-
scope: 範圍
|
187
151
|
start_date: 開始日期
|
188
152
|
status: 狀態
|
189
153
|
title: 標題
|
@@ -195,17 +159,14 @@ zh-TW:
|
|
195
159
|
progress: 進度
|
196
160
|
timeline_entry:
|
197
161
|
fields:
|
162
|
+
entry_date: 日期
|
198
163
|
title: 標題
|
199
164
|
results:
|
200
165
|
count:
|
201
166
|
results_count:
|
202
167
|
other: "%{count} 個結果"
|
203
|
-
filters:
|
204
|
-
all: 全部
|
205
168
|
home_header:
|
206
169
|
global_status: 全域執行狀態
|
207
|
-
nav_breadcrumb:
|
208
|
-
global: 全域執行
|
209
170
|
search:
|
210
171
|
search: 搜尋操作
|
211
172
|
show:
|
@@ -216,10 +177,6 @@ zh-TW:
|
|
216
177
|
admin:
|
217
178
|
filters:
|
218
179
|
results:
|
219
|
-
category_id_eq:
|
220
|
-
label: 類別
|
221
|
-
scope_id_eq:
|
222
|
-
label: 範圍
|
223
180
|
status_id_eq:
|
224
181
|
label: 狀態
|
225
182
|
components:
|
@@ -233,8 +190,6 @@ zh-TW:
|
|
233
190
|
comments_max_length: 留言字數上限 (0 表示使用預設)
|
234
191
|
display_progress_enabled: 顯示進度
|
235
192
|
intro: 介紹
|
236
|
-
scope_id: 範圍
|
237
|
-
scopes_enabled: 啟用的範圍
|
238
193
|
step:
|
239
194
|
comments_blocked: 留言已封鎖
|
240
195
|
events:
|
@@ -4,6 +4,6 @@ class AddCommentableCounterCacheToResults < ActiveRecord::Migration[5.2]
|
|
4
4
|
def change
|
5
5
|
add_column :decidim_accountability_results, :comments_count, :integer, null: false, default: 0, index: true
|
6
6
|
Decidim::Accountability::Result.reset_column_information
|
7
|
-
Decidim::Accountability::Result.find_each(&:update_comments_count)
|
7
|
+
Decidim::Accountability::Result.unscoped.find_each(&:update_comments_count)
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddGeolocationFieldsToResults < ActiveRecord::Migration[6.1]
|
4
|
+
def change
|
5
|
+
add_column :decidim_accountability_results, :address, :text
|
6
|
+
add_column :decidim_accountability_results, :latitude, :float
|
7
|
+
add_column :decidim_accountability_results, :longitude, :float
|
8
|
+
end
|
9
|
+
end
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"homepage_uri" => "https://decidim.org",
|
20
20
|
"source_code_uri" => "https://github.com/decidim/decidim"
|
21
21
|
}
|
22
|
-
s.required_ruby_version = "~> 3.
|
22
|
+
s.required_ruby_version = "~> 3.3.0"
|
23
23
|
|
24
24
|
s.name = "decidim-accountability"
|
25
25
|
s.summary = "Decidim accountability module"
|
@@ -13,14 +13,28 @@ module Decidim
|
|
13
13
|
|
14
14
|
routes do
|
15
15
|
resources :statuses
|
16
|
-
resources :results, except: [:show] do
|
16
|
+
resources :results, except: [:show, :destroy] do
|
17
|
+
member do
|
18
|
+
patch :soft_delete
|
19
|
+
patch :restore
|
20
|
+
end
|
21
|
+
|
22
|
+
collection do
|
23
|
+
post :update_taxonomies, controller: "results_bulk_actions"
|
24
|
+
post :update_status, controller: "results_bulk_actions"
|
25
|
+
post :update_dates, controller: "results_bulk_actions"
|
26
|
+
end
|
27
|
+
|
17
28
|
get :proposals_picker, on: :collection
|
29
|
+
get :manage_trash, on: :collection
|
18
30
|
|
19
31
|
resources :attachment_collections, except: [:show]
|
20
32
|
resources :attachments, except: [:show]
|
21
33
|
resources :timeline_entries, except: [:show]
|
22
34
|
end
|
23
|
-
resources :
|
35
|
+
resources :import_components, only: [:new, :create] do
|
36
|
+
get :preview, on: :collection
|
37
|
+
end
|
24
38
|
get :import_results, to: "import_results#new"
|
25
39
|
post :import_results, to: "import_results#create"
|
26
40
|
root to: "results#index"
|
@@ -25,12 +25,12 @@ Decidim.register_component(:accountability) do |component|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
component.settings(:global) do |settings|
|
28
|
-
settings.attribute :
|
29
|
-
settings.attribute :scope_id, type: :scope
|
28
|
+
settings.attribute :taxonomy_filters, type: :taxonomy_filters
|
30
29
|
settings.attribute :comments_enabled, type: :boolean, default: true
|
31
30
|
settings.attribute :comments_max_length, type: :integer, required: true
|
32
31
|
settings.attribute :intro, type: :text, translated: true, editor: true
|
33
32
|
settings.attribute :display_progress_enabled, type: :boolean, default: true
|
33
|
+
settings.attribute :geocoding_enabled, type: :boolean, default: false
|
34
34
|
end
|
35
35
|
|
36
36
|
component.register_stat :results_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, _start_at, _end_at|
|
@@ -45,7 +45,7 @@ Decidim.register_component(:accountability) do |component|
|
|
45
45
|
exports.collection do |component_instance|
|
46
46
|
Decidim::Accountability::Result
|
47
47
|
.where(component: component_instance)
|
48
|
-
.includes(:
|
48
|
+
.includes(:taxonomies, :status, component: { participatory_space: :organization })
|
49
49
|
end
|
50
50
|
|
51
51
|
exports.include_in_open_data = true
|
@@ -17,14 +17,7 @@ module Decidim
|
|
17
17
|
def serialize
|
18
18
|
{
|
19
19
|
id: result.id,
|
20
|
-
|
21
|
-
id: result.category.try(:id),
|
22
|
-
name: result.category.try(:name) || empty_translatable
|
23
|
-
},
|
24
|
-
scope: {
|
25
|
-
id: result.scope.try(:id),
|
26
|
-
name: result.scope.try(:name) || empty_translatable
|
27
|
-
},
|
20
|
+
taxonomies:,
|
28
21
|
parent: {
|
29
22
|
id: result.parent.try(:id)
|
30
23
|
},
|
@@ -39,9 +32,16 @@ module Decidim
|
|
39
32
|
},
|
40
33
|
progress: result.progress,
|
41
34
|
created_at: result.created_at,
|
35
|
+
updated_at: result.updated_at,
|
42
36
|
url:,
|
43
37
|
component: { id: component.id },
|
44
|
-
proposal_urls: proposals
|
38
|
+
proposal_urls: proposals,
|
39
|
+
reference: result.reference,
|
40
|
+
children_count: result.children_count,
|
41
|
+
comments_count: result.comments_count,
|
42
|
+
address: result.address,
|
43
|
+
latitude: result.latitude,
|
44
|
+
longitude: result.longitude
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
@@ -50,10 +50,6 @@ module Decidim
|
|
50
50
|
attr_reader :result
|
51
51
|
alias resource result
|
52
52
|
|
53
|
-
def component
|
54
|
-
result.component
|
55
|
-
end
|
56
|
-
|
57
53
|
def proposals
|
58
54
|
result.linked_resources(:proposals, "included_proposals").map do |proposal|
|
59
55
|
Decidim::ResourceLocatorPresenter.new(proposal).url
|
@@ -17,10 +17,10 @@ module Decidim
|
|
17
17
|
create_statuses!(component:)
|
18
18
|
|
19
19
|
3.times do
|
20
|
-
|
20
|
+
taxonomies = create_taxonomies!
|
21
21
|
|
22
|
-
|
23
|
-
create_result!(component:,
|
22
|
+
taxonomies.each do |taxonomy|
|
23
|
+
create_result!(component:, taxonomy:)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -33,8 +33,7 @@ module Decidim
|
|
33
33
|
participatory_space:,
|
34
34
|
settings: {
|
35
35
|
intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(word_count: 4) },
|
36
|
-
|
37
|
-
scope_id: participatory_space.scope&.id
|
36
|
+
taxonomy_filters: create_filters!.pluck(:id)
|
38
37
|
}
|
39
38
|
}
|
40
39
|
|
@@ -53,36 +52,44 @@ module Decidim
|
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
55
|
+
def root_taxonomy
|
56
|
+
@root_taxonomy ||= participatory_space.organization.taxonomies.roots.find_by("name->>'#{I18n.locale}'= ?",
|
57
|
+
"Categories") || participatory_space.organization.taxonomies.roots.sample
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_taxonomies!
|
61
|
+
parent_taxonomy = root_taxonomy.children.sample || root_taxonomy.children.create!(name: Decidim::Faker::Localized.sentence(word_count: 5))
|
62
|
+
taxonomies = [parent_taxonomy]
|
59
63
|
|
60
64
|
2.times do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
parent: parent_category,
|
67
|
-
participatory_space:
|
68
|
-
)
|
65
|
+
taxonomies << if parent_taxonomy.children.count > 1
|
66
|
+
parent_taxonomy.children.sample
|
67
|
+
else
|
68
|
+
parent_taxonomy.children.create!(name: Decidim::Faker::Localized.sentence(word_count: 5))
|
69
|
+
end
|
69
70
|
end
|
70
71
|
|
71
|
-
|
72
|
+
taxonomies
|
73
|
+
end
|
74
|
+
|
75
|
+
def create_filters!
|
76
|
+
root_taxonomy.taxonomy_filters || [create_taxonomy_filter!(root_taxonomy:, taxonomies: root_taxonomy.all_children)]
|
72
77
|
end
|
73
78
|
|
74
|
-
def create_result!(component:,
|
79
|
+
def create_result!(component:, taxonomy:)
|
75
80
|
result = Decidim.traceability.create!(
|
76
81
|
Decidim::Accountability::Result,
|
77
82
|
admin_user,
|
78
83
|
{
|
79
84
|
component:,
|
80
|
-
|
81
|
-
category:,
|
85
|
+
taxonomies: [taxonomy],
|
82
86
|
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
83
87
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
84
88
|
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
85
|
-
end
|
89
|
+
end,
|
90
|
+
address: "#{::Faker::Address.street_address} #{::Faker::Address.zip} #{::Faker::Address.city}",
|
91
|
+
latitude: ::Faker::Address.latitude,
|
92
|
+
longitude: ::Faker::Address.longitude
|
86
93
|
},
|
87
94
|
visibility: "all"
|
88
95
|
)
|
@@ -17,9 +17,7 @@ FactoryBot.define do
|
|
17
17
|
participatory_space { create(:participatory_process, :with_steps, organization:, skip_injection:) }
|
18
18
|
settings do
|
19
19
|
{
|
20
|
-
intro: generate_localized_description(:accountability_component_intro, skip_injection:)
|
21
|
-
scopes_enabled: true,
|
22
|
-
scope_id: participatory_space.scope&.id
|
20
|
+
intro: generate_localized_description(:accountability_component_intro, skip_injection:)
|
23
21
|
}
|
24
22
|
end
|
25
23
|
end
|
@@ -44,8 +42,12 @@ FactoryBot.define do
|
|
44
42
|
description { generate_localized_description(:result_description, skip_injection:) }
|
45
43
|
start_date { "12/7/2017" }
|
46
44
|
end_date { "30/9/2017" }
|
47
|
-
status { create
|
45
|
+
status { create(:status, component:, skip_injection:) }
|
48
46
|
progress { rand(1..100) }
|
47
|
+
deleted_at { nil }
|
48
|
+
address { Faker::Lorem.sentence(word_count: 3) }
|
49
|
+
latitude { Faker::Address.latitude }
|
50
|
+
longitude { Faker::Address.longitude }
|
49
51
|
end
|
50
52
|
|
51
53
|
factory :timeline_entry, class: "Decidim::Accountability::TimelineEntry" do
|
@@ -6,16 +6,15 @@ module Decidim
|
|
6
6
|
graphql_name "Accountability"
|
7
7
|
description "An accountability component of a participatory space."
|
8
8
|
|
9
|
-
field :
|
9
|
+
field :result, Decidim::Accountability::ResultType, "A single Result object", null: true do
|
10
|
+
argument :id, ID, "The id of the Result requested", required: true
|
11
|
+
end
|
12
|
+
field :results, Decidim::Accountability::ResultType.connection_type, "A collection of Results", null: true, connection: true
|
10
13
|
|
11
14
|
def results
|
12
15
|
Result.where(component: object).includes(:component)
|
13
16
|
end
|
14
17
|
|
15
|
-
field :result, Decidim::Accountability::ResultType, null: true do
|
16
|
-
argument :id, ID, required: true
|
17
|
-
end
|
18
|
-
|
19
18
|
def result(**args)
|
20
19
|
Result.where(component: object).find_by(id: args[:id])
|
21
20
|
end
|
@@ -3,29 +3,26 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
class ResultType < Decidim::Api::Types::BaseObject
|
6
|
-
implements Decidim::Core::
|
6
|
+
implements Decidim::Core::TaxonomizableInterface
|
7
|
+
implements Decidim::Core::TimestampsInterface
|
7
8
|
implements Decidim::Comments::CommentableInterface
|
8
|
-
implements Decidim::Core::ScopableInterface
|
9
9
|
|
10
10
|
description "A result"
|
11
11
|
|
12
|
-
field :
|
13
|
-
field :
|
12
|
+
field :children, [Decidim::Accountability::ResultType, { null: true }], "The children's results", null: true
|
13
|
+
field :children_count, GraphQL::Types::Int, "The number of children results", null: true
|
14
14
|
field :description, Decidim::Core::TranslatedFieldType, "The description for this result", null: true
|
15
|
-
field :reference, GraphQL::Types::String, "The reference for this result", null: true
|
16
|
-
field :start_date, Decidim::Core::DateType, "The start date for this result", null: true
|
17
15
|
field :end_date, Decidim::Core::DateType, "The end date for this result", null: true
|
18
|
-
field :progress, GraphQL::Types::Float, "The progress for this result", null: true
|
19
|
-
field :created_at, Decidim::Core::DateTimeType, "When this result was created", null: true
|
20
|
-
field :updated_at, Decidim::Core::DateTimeType, "When this result was updated", null: true
|
21
|
-
field :children_count, GraphQL::Types::Int, "The number of children results", null: true
|
22
|
-
field :weight, GraphQL::Types::Int, "The order of this result", null: false
|
23
16
|
field :external_id, GraphQL::Types::String, "The external ID for this result", null: true
|
24
|
-
|
25
|
-
field :children, [Decidim::Accountability::ResultType, { null: true }], "The children's results", null: true
|
17
|
+
field :id, GraphQL::Types::ID, "The internal ID for this result", null: false
|
26
18
|
field :parent, Decidim::Accountability::ResultType, "The parent result", null: true
|
19
|
+
field :progress, GraphQL::Types::Float, "The progress for this result", null: true
|
20
|
+
field :reference, GraphQL::Types::String, "The reference for this result", null: true
|
21
|
+
field :start_date, Decidim::Core::DateType, "The start date for this result", null: true
|
27
22
|
field :status, Decidim::Accountability::StatusType, "The status for this result", null: true
|
28
23
|
field :timeline_entries, [Decidim::Accountability::TimelineEntryType, { null: true }], "The timeline entries for this result", null: true
|
24
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this result", null: true
|
25
|
+
field :weight, GraphQL::Types::Int, "The order of this result", null: false
|
29
26
|
end
|
30
27
|
end
|
31
28
|
end
|
@@ -3,16 +3,15 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
class StatusType < Decidim::Api::Types::BaseObject
|
6
|
+
implements Decidim::Core::TimestampsInterface
|
7
|
+
|
6
8
|
description "A status"
|
7
9
|
|
10
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this status", null: true
|
8
11
|
field :id, GraphQL::Types::ID, "The internal ID for this status", null: false
|
9
12
|
field :key, GraphQL::Types::String, "The key for this status", null: true
|
10
13
|
field :name, Decidim::Core::TranslatedFieldType, "The name for this status", null: true
|
11
|
-
field :created_at, Decidim::Core::DateType, "When this status was created", null: true
|
12
|
-
field :updated_at, Decidim::Core::DateType, "When this status was updated", null: true
|
13
|
-
field :description, Decidim::Core::TranslatedFieldType, "The description for this status", null: true
|
14
14
|
field :progress, GraphQL::Types::Int, "The progress for this status", null: true
|
15
|
-
|
16
15
|
field :results, [Decidim::Accountability::ResultType, { null: true }], "The results for this status", null: true
|
17
16
|
end
|
18
17
|
end
|
@@ -3,16 +3,15 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
class TimelineEntryType < Decidim::Api::Types::BaseObject
|
6
|
+
implements Decidim::Core::TimestampsInterface
|
7
|
+
|
6
8
|
description "A Timeline Entry"
|
7
9
|
|
8
|
-
field :id, GraphQL::Types::ID, "The internal ID for this timeline entry", null: false
|
9
|
-
field :entry_date, Decidim::Core::DateType, "The entry date for this timeline entry", null: true
|
10
|
-
field :title, Decidim::Core::TranslatedFieldType, "The title for this timeline entry", null: true
|
11
10
|
field :description, Decidim::Core::TranslatedFieldType, "The description for this timeline entry", null: true
|
12
|
-
field :
|
13
|
-
field :
|
14
|
-
|
11
|
+
field :entry_date, Decidim::Core::DateType, "The entry date for this timeline entry", null: true
|
12
|
+
field :id, GraphQL::Types::ID, "The internal ID for this timeline entry", null: false
|
15
13
|
field :result, Decidim::Accountability::ResultType, "The result for this timeline entry", null: true
|
14
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this timeline entry", null: true
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|