decidim-budgets 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/budgets/budget_list_item/vote_action.erb +2 -2
- data/app/cells/decidim/budgets/budgets_list/main_list.erb +1 -1
- data/app/cells/decidim/budgets/budgets_list/show.erb +1 -1
- data/app/cells/decidim/budgets/project_history_cell.rb +48 -0
- data/app/cells/decidim/budgets/project_metadata_cell.rb +3 -3
- data/app/cells/decidim/budgets/project_vote_button/show.erb +4 -2
- data/app/cells/decidim/budgets/project_vote_button_cell.rb +4 -0
- data/app/commands/decidim/budgets/admin/create_budget.rb +1 -1
- data/app/commands/decidim/budgets/admin/create_project.rb +1 -1
- data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +1 -8
- data/app/commands/decidim/budgets/admin/update_budget.rb +1 -1
- data/app/commands/decidim/budgets/admin/update_project.rb +2 -2
- data/app/commands/decidim/budgets/admin/update_project_selection.rb +1 -1
- data/app/controllers/concerns/decidim/budgets/admin/filterable.rb +7 -11
- data/app/controllers/decidim/budgets/admin/budgets_controller.rb +12 -15
- data/app/controllers/decidim/budgets/admin/projects_controller.rb +61 -85
- data/app/controllers/decidim/budgets/orders_controller.rb +7 -3
- data/app/controllers/decidim/budgets/projects_controller.rb +7 -16
- data/app/forms/decidim/budgets/admin/budget_form.rb +0 -17
- data/app/forms/decidim/budgets/admin/order_reminder_form.rb +1 -2
- data/app/forms/decidim/budgets/admin/project_form.rb +7 -33
- data/app/forms/decidim/budgets/admin/project_import_proposals_form.rb +0 -11
- data/app/helpers/decidim/budgets/projects_helper.rb +6 -31
- data/app/models/decidim/budgets/budget.rb +2 -0
- data/app/models/decidim/budgets/project.rb +21 -1
- data/app/packs/stylesheets/budgets.scss +2 -8
- data/app/permissions/decidim/budgets/admin/permissions.rb +4 -4
- data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +1 -1
- data/app/presenters/decidim/budgets/admin_log/project_presenter.rb +1 -1
- data/app/presenters/decidim/budgets/project_presenter.rb +28 -0
- data/app/queries/decidim/budgets/filtered_projects.rb +2 -2
- data/app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb +2 -2
- data/app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb +2 -2
- data/app/serializers/decidim/budgets/download_your_data_budgets_order_serializer.rb +2 -2
- data/app/views/decidim/budgets/admin/budgets/_actions.html.erb +21 -0
- data/app/views/decidim/budgets/admin/budgets/_budget-tr.html.erb +18 -0
- data/app/views/decidim/budgets/admin/budgets/_budgets-thead.html.erb +8 -0
- data/app/views/decidim/budgets/admin/budgets/_form.html.erb +0 -6
- data/app/views/decidim/budgets/admin/budgets/index.html.erb +16 -48
- data/app/views/decidim/budgets/admin/budgets/manage_trash.html.erb +19 -0
- data/app/views/decidim/budgets/admin/projects/_actions.html.erb +27 -0
- data/app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb +0 -2
- data/app/views/decidim/budgets/admin/projects/_form.html.erb +6 -8
- data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +2 -27
- data/app/views/decidim/budgets/admin/projects/_projects-thead.html.erb +14 -0
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_dropdown.html.erb +7 -10
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_taxonomy_change.html.erb +23 -0
- data/app/views/decidim/budgets/admin/projects/index.html.erb +19 -21
- data/app/views/decidim/budgets/admin/projects/manage_trash.html.erb +26 -0
- data/app/views/decidim/budgets/admin/projects/update_attribute.js.erb +1 -1
- data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +0 -5
- data/app/views/decidim/budgets/budgets/index.html.erb +7 -2
- data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +0 -10
- data/app/views/decidim/budgets/orders/status.html.erb +52 -0
- data/app/views/decidim/budgets/projects/_order.html.erb +1 -1
- data/app/views/decidim/budgets/projects/_order_progress_summary_content.html.erb +4 -4
- data/app/views/decidim/budgets/projects/index.html.erb +2 -17
- data/app/views/decidim/budgets/projects/index.js.erb +1 -1
- data/app/views/decidim/budgets/projects/show.html.erb +23 -20
- data/config/locales/ar.yml +5 -12
- data/config/locales/bg.yml +3 -43
- data/config/locales/ca.yml +96 -43
- data/config/locales/cs.yml +101 -42
- data/config/locales/de.yml +96 -43
- data/config/locales/el.yml +3 -39
- data/config/locales/en.yml +95 -42
- data/config/locales/es-MX.yml +95 -42
- data/config/locales/es-PY.yml +95 -42
- data/config/locales/es.yml +95 -42
- data/config/locales/eu.yml +100 -47
- data/config/locales/fi-plain.yml +96 -43
- data/config/locales/fi.yml +95 -42
- data/config/locales/fr-CA.yml +38 -44
- data/config/locales/fr.yml +38 -44
- data/config/locales/ga-IE.yml +0 -3
- data/config/locales/gl.yml +3 -7
- data/config/locales/hu.yml +3 -40
- data/config/locales/id-ID.yml +3 -7
- data/config/locales/is-IS.yml +0 -7
- data/config/locales/it.yml +3 -28
- data/config/locales/ja.yml +92 -42
- data/config/locales/kaa.yml +0 -1
- data/config/locales/ko.yml +0 -22
- data/config/locales/lb.yml +4 -6
- data/config/locales/lt.yml +3 -41
- data/config/locales/lv.yml +3 -7
- data/config/locales/nl.yml +4 -25
- data/config/locales/no.yml +3 -8
- data/config/locales/pl.yml +5 -43
- data/config/locales/pt-BR.yml +4 -43
- data/config/locales/pt.yml +4 -6
- data/config/locales/ro-RO.yml +3 -17
- data/config/locales/ru.yml +3 -7
- data/config/locales/sk.yml +3 -7
- data/config/locales/sq-AL.yml +0 -16
- data/config/locales/sv.yml +99 -46
- data/config/locales/tr-TR.yml +3 -7
- data/config/locales/uk.yml +3 -7
- data/config/locales/zh-CN.yml +3 -6
- data/config/locales/zh-TW.yml +3 -39
- data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +1 -1
- data/db/migrate/20210310120613_add_followable_counter_cache_to_budgets.rb +1 -1
- data/db/migrate/20240828103724_add_deleted_at_to_decidim_budgets_budgets.rb +8 -0
- data/db/migrate/20240916135141_add_deleted_at_to_decidim_budgets_projects.rb +8 -0
- data/decidim-budgets.gemspec +1 -1
- data/lib/decidim/api/budget_type.rb +3 -6
- data/lib/decidim/api/budgets_type.rb +4 -5
- data/lib/decidim/api/project_type.rb +6 -8
- data/lib/decidim/budgets/admin_engine.rb +16 -2
- data/lib/decidim/budgets/component.rb +4 -5
- data/lib/decidim/budgets/engine.rb +1 -0
- data/lib/decidim/budgets/project_serializer.rb +16 -14
- data/lib/decidim/budgets/seeds.rb +0 -2
- data/lib/decidim/budgets/version.rb +1 -1
- metadata +27 -23
- data/app/cells/decidim/budgets/project_tags/show.erb +0 -5
- data/app/cells/decidim/budgets/project_tags_cell.rb +0 -18
- data/app/commands/decidim/budgets/admin/destroy_budget.rb +0 -17
- data/app/commands/decidim/budgets/admin/update_project_category.rb +0 -48
- data/app/commands/decidim/budgets/admin/update_project_scope.rb +0 -54
- data/app/helpers/decidim/budgets/admin/application_helper.rb +0 -13
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb +0 -15
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb +0 -22
- data/config/locales/ca-IT.yml +0 -388
data/config/locales/uk.yml
CHANGED
@@ -3,7 +3,6 @@ uk:
|
|
3
3
|
activemodel:
|
4
4
|
attributes:
|
5
5
|
project:
|
6
|
-
decidim_category_id: Категорія
|
7
6
|
description: Опис
|
8
7
|
proposal_ids: Супутні пропозиції
|
9
8
|
title: Назва
|
@@ -19,15 +18,12 @@ uk:
|
|
19
18
|
actions:
|
20
19
|
attachment_collections: Теки
|
21
20
|
attachments: Вкладені файли
|
22
|
-
destroy: Видалити
|
23
21
|
edit: Редагувати
|
24
22
|
import: Внести до проектів запозичені пропозиції
|
25
23
|
preview: Попередній перегляд
|
26
24
|
title: Дії
|
27
25
|
admin:
|
28
26
|
models:
|
29
|
-
budget:
|
30
|
-
name: Бюджет
|
31
27
|
project:
|
32
28
|
name: Проект
|
33
29
|
projects:
|
@@ -55,6 +51,9 @@ uk:
|
|
55
51
|
project:
|
56
52
|
fields:
|
57
53
|
title: Назва
|
54
|
+
order:
|
55
|
+
status:
|
56
|
+
title: Ваш голос успішно прийнято
|
58
57
|
projects:
|
59
58
|
budget_confirm:
|
60
59
|
cancel: Скасувати
|
@@ -77,7 +76,6 @@ uk:
|
|
77
76
|
many: "%{count} проектів"
|
78
77
|
other: "%{count} проектів"
|
79
78
|
filters:
|
80
|
-
category: Категорія
|
81
79
|
search: Шукати
|
82
80
|
project_budget_button:
|
83
81
|
added: Додано
|
@@ -101,7 +99,5 @@ uk:
|
|
101
99
|
show_votes: Показати голоси
|
102
100
|
votes_choices:
|
103
101
|
enabled: Голосування увімкнене
|
104
|
-
statistics:
|
105
|
-
projects_count: Проекти
|
106
102
|
index:
|
107
103
|
confirmed_orders_count: Кількість голосів
|
data/config/locales/zh-CN.yml
CHANGED
@@ -8,7 +8,6 @@ zh-CN:
|
|
8
8
|
total_budget: 预算总额
|
9
9
|
project:
|
10
10
|
budget_amount: 预算金额
|
11
|
-
decidim_category_id: 类别
|
12
11
|
description: 描述
|
13
12
|
proposal_ids: 有关提议
|
14
13
|
title: 标题
|
@@ -21,7 +20,6 @@ zh-CN:
|
|
21
20
|
actions:
|
22
21
|
attachment_collections: 文件夹
|
23
22
|
attachments: 附件
|
24
|
-
destroy: 删除
|
25
23
|
edit: 编辑
|
26
24
|
edit_projects: 管理项目
|
27
25
|
import: 导入提案到项目
|
@@ -88,6 +86,9 @@ zh-CN:
|
|
88
86
|
project:
|
89
87
|
fields:
|
90
88
|
title: 标题
|
89
|
+
order:
|
90
|
+
status:
|
91
|
+
title: 您的投票已被接受
|
91
92
|
order_summary_mailer:
|
92
93
|
order_summary:
|
93
94
|
selected_projects: '您选择的项目是:'
|
@@ -113,7 +114,6 @@ zh-CN:
|
|
113
114
|
projects_count:
|
114
115
|
other: "%{count} 个项目"
|
115
116
|
filters:
|
116
|
-
category: 类别
|
117
117
|
search: 搜索
|
118
118
|
status: 状态
|
119
119
|
status_values:
|
@@ -150,7 +150,6 @@ zh-CN:
|
|
150
150
|
landing_page_content: 预算登陆页
|
151
151
|
more_information_modal: 更多信息模式
|
152
152
|
projects_per_page: 每页项目数
|
153
|
-
scopes_enabled: 范围已启用
|
154
153
|
title: 标题
|
155
154
|
total_budget: 预算总额
|
156
155
|
vote_minimum_budget_projects_number: 要投票的项目最小数量
|
@@ -181,7 +180,5 @@ zh-CN:
|
|
181
180
|
email_outro: 您收到此通知是因为您正在关注 %{participatory_space_title}。您可以停止收到跟随上一个链接的通知。
|
182
181
|
email_subject: '%{resource_title} 的预算现在在 %{participatory_space_title} 处于活动状态。'
|
183
182
|
notification_title: <a href="%{resource_path}">%{resource_title}</a> 预算现在已经在 %{participatory_space_title} 中生效。
|
184
|
-
statistics:
|
185
|
-
projects_count: 项目
|
186
183
|
index:
|
187
184
|
confirmed_orders_count: 所得票数
|
data/config/locales/zh-TW.yml
CHANGED
@@ -3,15 +3,12 @@ zh-TW:
|
|
3
3
|
activemodel:
|
4
4
|
attributes:
|
5
5
|
budget:
|
6
|
-
decidim_scope_id: 範圍
|
7
6
|
description: 說明
|
8
7
|
title: 標題
|
9
8
|
total_budget: 總預算
|
10
9
|
weight: 排序位置
|
11
10
|
project:
|
12
11
|
budget_amount: 預算金額
|
13
|
-
decidim_category_id: 類別
|
14
|
-
decidim_scope_id: 範圍
|
15
12
|
description: 說明
|
16
13
|
proposal_ids: 相關提案
|
17
14
|
proposals: 提案
|
@@ -27,10 +24,6 @@ zh-TW:
|
|
27
24
|
admin:
|
28
25
|
filters:
|
29
26
|
projects:
|
30
|
-
category_id_eq:
|
31
|
-
label: 類別
|
32
|
-
scope_id_eq:
|
33
|
-
label: 範圍
|
34
27
|
selected_at_null:
|
35
28
|
label: 已選取
|
36
29
|
values:
|
@@ -40,7 +33,6 @@ zh-TW:
|
|
40
33
|
actions:
|
41
34
|
attachment_collections: 資料夾
|
42
35
|
attachments: 附件
|
43
|
-
destroy: 刪除
|
44
36
|
edit: 編輯
|
45
37
|
edit_projects: 管理專案
|
46
38
|
import: 將提案匯入專案
|
@@ -52,9 +44,6 @@ zh-TW:
|
|
52
44
|
create:
|
53
45
|
invalid: 建立預算時發生問題。
|
54
46
|
success: 預算已成功建立
|
55
|
-
destroy:
|
56
|
-
invalid: 刪除此預算時出現問題
|
57
|
-
success: 預算已成功刪除
|
58
47
|
edit:
|
59
48
|
title: 編輯預算
|
60
49
|
update: 更新預算
|
@@ -81,16 +70,12 @@ zh-TW:
|
|
81
70
|
create:
|
82
71
|
invalid: 這個專案創建時出了問題
|
83
72
|
success: 專案建立成功
|
84
|
-
destroy:
|
85
|
-
success: 專案刪除成功
|
86
73
|
edit:
|
87
74
|
title: 編輯專案
|
88
75
|
update: 更新
|
89
76
|
index:
|
90
77
|
actions: 操作
|
91
78
|
cancel: 撤銷
|
92
|
-
change_category: 變更類別
|
93
|
-
change_scope: 變更範圍
|
94
79
|
change_selected: 更改所選狀態
|
95
80
|
deselect_implementation: 從實施中取消選擇
|
96
81
|
finished_orders: 已完成投票
|
@@ -99,32 +84,15 @@ zh-TW:
|
|
99
84
|
selected: 已選取
|
100
85
|
title: 專案
|
101
86
|
update: 更新
|
102
|
-
update_scope_button: 更新範圍
|
103
87
|
new:
|
104
88
|
create: 建立
|
105
89
|
title: 新專案
|
106
90
|
update:
|
107
91
|
invalid: 更新此專案時出現問題
|
108
92
|
success: 專案更新成功。
|
109
|
-
update_category:
|
110
|
-
invalid: '這些專案已經擁有了 %{subject_name} 類別: %{projects}'
|
111
|
-
select_a_category: 請選擇一個類別。
|
112
|
-
select_a_project: 請選擇一個專案
|
113
|
-
success: '已成功將以下專案更新至 %{subject_name} 類別: %{projects}。'
|
114
|
-
update_scope:
|
115
|
-
invalid: '這些專案已經有了 %{subject_name} 的範圍: %{projects}。'
|
116
|
-
select_a_project: 請選擇一個專案
|
117
|
-
select_a_scope: 請選擇一個範圍。
|
118
|
-
success: '已成功將以下專案更新至 %{subject_name} 範圍: %{projects}。'
|
119
93
|
update_selected:
|
120
|
-
invalid:
|
121
|
-
selected: '這些專案已被選擇以實施:%{projects}。'
|
122
|
-
unselected: '這些專案已從實施中取消選擇: %{projects}。'
|
123
94
|
select_a_project: 請選擇一個專案
|
124
95
|
select_a_selection: 請選擇實施狀態。
|
125
|
-
success:
|
126
|
-
selected: '這些專案已成功選擇實施:%{projects}。'
|
127
|
-
unselected: '這些專案已經成功從實施中取消選擇: %{projects}。'
|
128
96
|
proposals_imports:
|
129
97
|
create:
|
130
98
|
invalid: 將提案匯入專案時出現問題。
|
@@ -178,15 +146,16 @@ zh-TW:
|
|
178
146
|
total_budget: 總預算
|
179
147
|
project:
|
180
148
|
fields:
|
181
|
-
category: 類別
|
182
149
|
id: ID
|
183
150
|
title: 標題
|
151
|
+
order:
|
152
|
+
status:
|
153
|
+
title: 您的投票已成功接受
|
184
154
|
order_summary_mailer:
|
185
155
|
order_summary:
|
186
156
|
selected_projects: '你選擇的專案如下:'
|
187
157
|
subject: 您已經在 %{space_name} 參與空間投票
|
188
158
|
voted_on_space: 您已對「%{space_name}」參與空間的「%{budget_name}」預算進行投票。
|
189
|
-
voted_on_space_with_scope: 您已在%{scope_type} 的%{scope_name} 中,對%{space_name} 參與空間的%{budget_name} 預算進行了投票。
|
190
159
|
projects:
|
191
160
|
budget_confirm:
|
192
161
|
are_you_sure: 如果您改變了主意,稍後可以更改您的選票。
|
@@ -218,8 +187,6 @@ zh-TW:
|
|
218
187
|
message: 您的投票尚未被註冊,因為您尚未完成投票程序。您確定要退出投票嗎?
|
219
188
|
title: 您尚未投票
|
220
189
|
filters:
|
221
|
-
category: 類別
|
222
|
-
scope: 範圍
|
223
190
|
search: 搜尋
|
224
191
|
status: 狀態
|
225
192
|
status_values:
|
@@ -271,13 +238,10 @@ zh-TW:
|
|
271
238
|
errors:
|
272
239
|
budget_voting_rule_only_one: 僅能啟用一個投票規則。
|
273
240
|
budget_voting_rule_required: 必須啟用一種投票規則
|
274
|
-
geocoding_enabled: 地理編碼已啟用
|
275
241
|
landing_page_content: 預算網頁首頁
|
276
242
|
more_information_modal: 更多資訊彈出式視窗
|
277
243
|
projects_per_page: 每頁顯示專案
|
278
244
|
resources_permissions_enabled: 可為每個專案設定動作權限
|
279
|
-
scope_id: 範圍
|
280
|
-
scopes_enabled: 啟用範圍
|
281
245
|
title: 標題
|
282
246
|
total_budget: 總預算
|
283
247
|
vote_minimum_budget_projects_number: 最少需要投票的專案數量
|
@@ -4,6 +4,6 @@ class AddCommentableCounterCacheToProjects < ActiveRecord::Migration[5.2]
|
|
4
4
|
def change
|
5
5
|
add_column :decidim_budgets_projects, :comments_count, :integer, null: false, default: 0, index: true
|
6
6
|
Decidim::Budgets::Project.reset_column_information
|
7
|
-
Decidim::Budgets::Project.find_each(&:update_comments_count)
|
7
|
+
Decidim::Budgets::Project.unscoped.find_each(&:update_comments_count)
|
8
8
|
end
|
9
9
|
end
|
@@ -7,7 +7,7 @@ class AddFollowableCounterCacheToBudgets < ActiveRecord::Migration[5.2]
|
|
7
7
|
reversible do |dir|
|
8
8
|
dir.up do
|
9
9
|
Decidim::Budgets::Project.reset_column_information
|
10
|
-
Decidim::Budgets::Project.find_each do |record|
|
10
|
+
Decidim::Budgets::Project.unscoped.find_each do |record|
|
11
11
|
record.class.reset_counters(record.id, :follows)
|
12
12
|
end
|
13
13
|
end
|
data/decidim-budgets.gemspec
CHANGED
@@ -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-budgets"
|
25
25
|
s.summary = "Decidim budgets module"
|
@@ -3,19 +3,16 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Budgets
|
5
5
|
class BudgetType < Decidim::Api::Types::BaseObject
|
6
|
-
implements Decidim::Core::
|
6
|
+
implements Decidim::Core::TimestampsInterface
|
7
7
|
implements Decidim::Core::TraceableInterface
|
8
8
|
|
9
9
|
description "A budget"
|
10
10
|
|
11
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this budget", null: false
|
11
12
|
field :id, GraphQL::Types::ID, "The internal ID of this budget", null: false
|
13
|
+
field :projects, [Decidim::Budgets::ProjectType, { null: true }], "The projects for this budget", null: false
|
12
14
|
field :title, Decidim::Core::TranslatedFieldType, "The title for this budget", null: false
|
13
|
-
field :description, Decidim::Core::TranslatedFieldType, "The description for this budget", null: false
|
14
15
|
field :total_budget, GraphQL::Types::Int, "The total budget", null: false, camelize: false
|
15
|
-
field :created_at, Decidim::Core::DateTimeType, "When this budget was created", null: true
|
16
|
-
field :updated_at, Decidim::Core::DateTimeType, "When this budget was updated", null: true
|
17
|
-
|
18
|
-
field :projects, [Decidim::Budgets::ProjectType, { null: true }], "The projects for this budget", null: false
|
19
16
|
|
20
17
|
def self.authorized?(object, context)
|
21
18
|
super && object.visible?
|
@@ -6,16 +6,15 @@ module Decidim
|
|
6
6
|
graphql_name "Budgets"
|
7
7
|
description "A budget component of a participatory space."
|
8
8
|
|
9
|
-
field :
|
9
|
+
field :budget, Decidim::Budgets::BudgetType, "A single Budget object", null: true do
|
10
|
+
argument :id, GraphQL::Types::ID, "The id of the Budget requested", required: true
|
11
|
+
end
|
12
|
+
field :budgets, Decidim::Budgets::BudgetType.connection_type, "A collection of Budgets", null: true, connection: true
|
10
13
|
|
11
14
|
def budgets
|
12
15
|
Budget.where(component: object).includes(:component)
|
13
16
|
end
|
14
17
|
|
15
|
-
field :budget, Decidim::Budgets::BudgetType, null: true do
|
16
|
-
argument :id, GraphQL::Types::ID, required: true
|
17
|
-
end
|
18
|
-
|
19
18
|
def budget(**args)
|
20
19
|
Budget.where(component: object).find_by(id: args[:id])
|
21
20
|
end
|
@@ -3,21 +3,19 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Budgets
|
5
5
|
class ProjectType < Decidim::Api::Types::BaseObject
|
6
|
-
implements Decidim::Core::
|
6
|
+
implements Decidim::Core::TimestampsInterface
|
7
|
+
implements Decidim::Core::TaxonomizableInterface
|
7
8
|
implements Decidim::Core::AttachableInterface
|
8
9
|
implements Decidim::Comments::CommentableInterface
|
9
|
-
implements Decidim::Core::CategorizableInterface
|
10
10
|
|
11
11
|
description "A project"
|
12
12
|
|
13
|
-
field :id, GraphQL::Types::ID, "The internal ID for this project", null: false
|
14
|
-
field :title, Decidim::Core::TranslatedFieldType, "The title for this project", null: true
|
15
|
-
field :description, Decidim::Core::TranslatedFieldType, "The description for this project", null: true
|
16
13
|
field :budget_amount, GraphQL::Types::Int, "The budget amount for this project", null: true, camelize: false
|
17
|
-
field :
|
18
|
-
field :
|
19
|
-
field :updated_at, Decidim::Core::DateTimeType, "When this project was updated", null: true
|
14
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this project", null: true
|
15
|
+
field :id, GraphQL::Types::ID, "The internal ID for this project", null: false
|
20
16
|
field :reference, GraphQL::Types::String, "The reference for this project", null: true
|
17
|
+
field :selected, GraphQL::Types::Boolean, "Whether this proposal is selected or not", method: :selected?, null: true
|
18
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this project", null: true
|
21
19
|
|
22
20
|
def self.authorized?(object, context)
|
23
21
|
context[:project] = object
|
@@ -13,13 +13,27 @@ module Decidim
|
|
13
13
|
|
14
14
|
routes do
|
15
15
|
resources :budgets do
|
16
|
+
collection do
|
17
|
+
get :manage_trash
|
18
|
+
end
|
19
|
+
|
20
|
+
member do
|
21
|
+
patch :soft_delete
|
22
|
+
patch :restore
|
23
|
+
end
|
24
|
+
|
16
25
|
resources :projects do
|
17
26
|
collection do
|
18
|
-
post :
|
19
|
-
post :update_scope
|
27
|
+
post :update_taxonomies
|
20
28
|
post :update_selected
|
21
29
|
post :update_budget
|
22
30
|
resource :proposals_import, only: [:new, :create]
|
31
|
+
get :manage_trash
|
32
|
+
end
|
33
|
+
|
34
|
+
member do
|
35
|
+
patch :soft_delete
|
36
|
+
patch :restore
|
23
37
|
end
|
24
38
|
end
|
25
39
|
end
|
@@ -46,8 +46,8 @@ Decidim.register_component(:budgets) do |component|
|
|
46
46
|
component.register_stat :orders_count do |components, start_at, end_at|
|
47
47
|
budgets = Decidim::Budgets::Budget.where(component: components)
|
48
48
|
orders = Decidim::Budgets::Order.where(budget: budgets)
|
49
|
-
orders = orders.where(
|
50
|
-
orders = orders.where(
|
49
|
+
orders = orders.where(created_at: start_at..) if start_at.present?
|
50
|
+
orders = orders.where(created_at: ..end_at) if end_at.present?
|
51
51
|
orders.count
|
52
52
|
end
|
53
53
|
|
@@ -66,7 +66,7 @@ Decidim.register_component(:budgets) do |component|
|
|
66
66
|
budgets = resource_id ? Decidim::Budgets::Budget.find(resource_id) : Decidim::Budgets::Budget.where(decidim_component_id: component_instance)
|
67
67
|
Decidim::Budgets::Project
|
68
68
|
.where(decidim_budgets_budget_id: budgets)
|
69
|
-
.includes(:
|
69
|
+
.includes(:taxonomies, :component)
|
70
70
|
end
|
71
71
|
|
72
72
|
exports.include_in_open_data = true
|
@@ -75,8 +75,7 @@ Decidim.register_component(:budgets) do |component|
|
|
75
75
|
end
|
76
76
|
|
77
77
|
component.settings(:global) do |settings|
|
78
|
-
settings.attribute :
|
79
|
-
settings.attribute :scope_id, type: :scope
|
78
|
+
settings.attribute :taxonomy_filters, type: :taxonomy_filters
|
80
79
|
settings.attribute :workflow, type: :enum, default: "one", choices: -> { Decidim::Budgets.workflows.keys.map(&:to_s) }
|
81
80
|
settings.attribute :projects_per_page, type: :integer, default: 12
|
82
81
|
settings.attribute :vote_rule_threshold_percent_enabled, type: :boolean, default: true
|
@@ -16,14 +16,7 @@ module Decidim
|
|
16
16
|
def serialize
|
17
17
|
{
|
18
18
|
id: project.id,
|
19
|
-
|
20
|
-
id: project.category.try(:id),
|
21
|
-
name: project.category.try(:name) || empty_translatable
|
22
|
-
},
|
23
|
-
scope: {
|
24
|
-
id: project.scope.try(:id),
|
25
|
-
name: project.scope.try(:name) || empty_translatable
|
26
|
-
},
|
19
|
+
taxonomies:,
|
27
20
|
participatory_space: {
|
28
21
|
id: project.participatory_space.id,
|
29
22
|
url: Decidim::ResourceLocatorPresenter.new(project.participatory_space).url
|
@@ -31,13 +24,22 @@ module Decidim
|
|
31
24
|
component: { id: component.id },
|
32
25
|
title: project.title,
|
33
26
|
description: project.description,
|
34
|
-
budget: { id: project.budget.id
|
27
|
+
budget: { id: project.budget.id,
|
28
|
+
title: project.budget.title,
|
29
|
+
url: budget_url },
|
35
30
|
budget_amount: project.budget_amount,
|
36
|
-
confirmed_votes: project.confirmed_orders_count
|
31
|
+
confirmed_votes: (project.confirmed_orders_count if
|
32
|
+
project.component.current_settings.show_votes?),
|
37
33
|
comments: project.comments_count,
|
38
34
|
created_at: project.created_at,
|
39
35
|
url: project.polymorphic_resource_url({}),
|
40
36
|
address: project.address,
|
37
|
+
updated_at: project.updated_at,
|
38
|
+
selected_at: project.selected_at,
|
39
|
+
reference: project.reference,
|
40
|
+
follows_count: project.follows_count,
|
41
|
+
latitude: project.latitude,
|
42
|
+
longitude: project.longitude,
|
41
43
|
related_proposals:,
|
42
44
|
related_proposal_titles:,
|
43
45
|
related_proposal_urls:
|
@@ -49,10 +51,6 @@ module Decidim
|
|
49
51
|
attr_reader :project
|
50
52
|
alias resource project
|
51
53
|
|
52
|
-
def component
|
53
|
-
project.component
|
54
|
-
end
|
55
|
-
|
56
54
|
def related_proposals
|
57
55
|
project.linked_resources(:proposals, "included_proposals").map(&:id)
|
58
56
|
end
|
@@ -73,6 +71,10 @@ module Decidim
|
|
73
71
|
Decidim::ResourceLocatorPresenter.new(project).url
|
74
72
|
end
|
75
73
|
|
74
|
+
def budget_url
|
75
|
+
Decidim::EngineRouter.main_proxy(component).budget_url(project.budget)
|
76
|
+
end
|
77
|
+
|
76
78
|
def empty_translatable(locales = Decidim.available_locales)
|
77
79
|
locales.each_with_object({}) do |locale, result|
|
78
80
|
result[locale.to_s] = ""
|
@@ -80,8 +80,6 @@ module Decidim
|
|
80
80
|
def create_project!(budget:)
|
81
81
|
params = {
|
82
82
|
budget:,
|
83
|
-
scope: participatory_space.organization.scopes.sample,
|
84
|
-
category: participatory_space.categories.sample,
|
85
83
|
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
86
84
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
87
85
|
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|