decidim-accountability 0.29.2 → 0.30.0.rc2

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.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/accountability/project/show.erb +6 -0
  3. data/app/cells/decidim/accountability/project_cell.rb +23 -42
  4. data/app/cells/decidim/accountability/result_history_cell.rb +57 -0
  5. data/app/cells/decidim/accountability/result_metadata_cell.rb +17 -17
  6. data/app/cells/decidim/accountability/status_cell.rb +9 -13
  7. data/app/commands/decidim/accountability/admin/create_imported_result.rb +1 -1
  8. data/app/commands/decidim/accountability/admin/create_result.rb +3 -2
  9. data/app/commands/decidim/accountability/admin/import_component_to_accountability.rb +47 -0
  10. data/app/commands/decidim/accountability/admin/update_imported_result.rb +1 -1
  11. data/app/commands/decidim/accountability/admin/update_result.rb +3 -2
  12. data/app/commands/decidim/accountability/admin/update_result_dates.rb +56 -0
  13. data/app/commands/decidim/accountability/admin/update_result_status.rb +61 -0
  14. data/app/commands/decidim/accountability/admin/update_result_taxonomies.rb +18 -0
  15. data/app/controllers/concerns/decidim/accountability/admin/filterable.rb +8 -6
  16. data/app/controllers/decidim/accountability/admin/import_components_controller.rb +36 -0
  17. data/app/controllers/decidim/accountability/admin/results_bulk_actions_controller.rb +102 -0
  18. data/app/controllers/decidim/accountability/admin/results_controller.rb +21 -11
  19. data/app/controllers/decidim/accountability/results_controller.rb +10 -7
  20. data/app/forms/decidim/accountability/admin/import_component_form.rb +98 -0
  21. data/app/forms/decidim/accountability/admin/result_bulk_actions_form.rb +18 -0
  22. data/app/forms/decidim/accountability/admin/result_form.rb +17 -23
  23. data/app/helpers/decidim/accountability/admin/application_helper.rb +0 -1
  24. data/app/helpers/decidim/accountability/application_helper.rb +1 -32
  25. data/app/helpers/decidim/accountability/breadcrumb_helper.rb +10 -14
  26. data/app/jobs/decidim/accountability/admin/import_projects_job.rb +5 -3
  27. data/app/jobs/decidim/accountability/admin/import_proposals_job.rb +70 -0
  28. data/app/mailers/decidim/accountability/import_proposals_mailer.rb +28 -0
  29. data/app/models/decidim/accountability/result.rb +23 -1
  30. data/app/models/decidim/accountability/status.rb +4 -0
  31. data/app/packs/entrypoints/decidim_accountability_admin_form.js +1 -0
  32. data/app/packs/src/decidim/accountability/admin/imports.js +37 -14
  33. data/app/packs/src/decidim/accountability/admin/index/action_button.js +42 -0
  34. data/app/packs/src/decidim/accountability/admin/index/action_form.js +46 -0
  35. data/app/packs/src/decidim/accountability/admin/index/action_selector.js +37 -0
  36. data/app/packs/src/decidim/accountability/admin/index/counter.js +40 -0
  37. data/app/packs/src/decidim/accountability/admin/index/select_all.js +29 -0
  38. data/app/packs/src/decidim/accountability/admin/index.js +17 -7
  39. data/app/packs/src/decidim/accountability/admin/result_form.js +21 -0
  40. data/app/packs/stylesheets/accountability.scss +5 -0
  41. data/app/permissions/decidim/accountability/admin/permissions.rb +3 -2
  42. data/app/presenters/decidim/accountability/admin_log/result_presenter.rb +1 -1
  43. data/app/presenters/decidim/accountability/result_presenter.rb +30 -0
  44. data/app/queries/decidim/accountability/metrics/results_metric_manage.rb +6 -6
  45. data/app/services/decidim/accountability/results_calculator.rb +4 -6
  46. data/app/services/decidim/accountability/results_csv_importer.rb +1 -1
  47. data/app/views/decidim/accountability/admin/import_components/_filters.html.erb +26 -0
  48. data/app/views/decidim/accountability/admin/import_components/_form.html.erb +26 -0
  49. data/app/views/decidim/accountability/admin/import_components/new.html.erb +14 -0
  50. data/app/views/decidim/accountability/admin/results/_actions.html.erb +29 -0
  51. data/app/views/decidim/accountability/admin/results/_form.html.erb +15 -8
  52. data/app/views/decidim/accountability/admin/results/_result-tr.html.erb +32 -0
  53. data/app/views/decidim/accountability/admin/results/_results-thead.html.erb +26 -0
  54. data/app/views/decidim/accountability/admin/results/bulk_actions/_dates_form.html.erb +19 -0
  55. data/app/views/decidim/accountability/admin/results/bulk_actions/_dropdown.html.erb +40 -0
  56. data/app/views/decidim/accountability/admin/results/bulk_actions/_status_form.html.erb +16 -0
  57. data/app/views/decidim/accountability/admin/results/bulk_actions/_submit_buttons.html.erb +4 -0
  58. data/app/views/decidim/accountability/admin/results/bulk_actions/_taxonomies_form.html.erb +18 -0
  59. data/app/views/decidim/accountability/admin/results/edit.html.erb +2 -2
  60. data/app/views/decidim/accountability/admin/results/index.html.erb +50 -111
  61. data/app/views/decidim/accountability/admin/results/manage_trash.html.erb +26 -0
  62. data/app/views/decidim/accountability/admin/results/new.html.erb +2 -2
  63. data/app/views/decidim/accountability/import_proposals_mailer/import.html.erb +2 -0
  64. data/app/views/decidim/accountability/results/{_home_categories.html.erb → _home_taxonomies.html.erb} +6 -8
  65. data/app/views/decidim/accountability/results/_project.html.erb +1 -3
  66. data/app/views/decidim/accountability/results/_projects_aside.html.erb +9 -7
  67. data/app/views/decidim/accountability/results/home.html.erb +18 -6
  68. data/app/views/decidim/accountability/results/index.html.erb +8 -2
  69. data/app/views/decidim/accountability/results/show.html.erb +5 -5
  70. data/config/assets.rb +3 -2
  71. data/config/locales/ar.yml +97 -55
  72. data/config/locales/bg.yml +0 -50
  73. data/config/locales/bs-BA.yml +0 -16
  74. data/config/locales/ca.yml +128 -40
  75. data/config/locales/cs.yml +147 -56
  76. data/config/locales/da.yml +0 -20
  77. data/config/locales/de.yml +126 -39
  78. data/config/locales/el.yml +0 -48
  79. data/config/locales/en.yml +128 -40
  80. data/config/locales/es-MX.yml +129 -41
  81. data/config/locales/es-PY.yml +129 -41
  82. data/config/locales/es.yml +129 -41
  83. data/config/locales/eu.yml +140 -53
  84. data/config/locales/fi-plain.yml +136 -49
  85. data/config/locales/fi.yml +136 -49
  86. data/config/locales/fr-CA.yml +111 -54
  87. data/config/locales/fr.yml +111 -54
  88. data/config/locales/ga-IE.yml +0 -13
  89. data/config/locales/gl.yml +0 -17
  90. data/config/locales/gn-PY.yml +0 -11
  91. data/config/locales/he-IL.yml +45 -54
  92. data/config/locales/hu.yml +0 -50
  93. data/config/locales/id-ID.yml +0 -16
  94. data/config/locales/is-IS.yml +0 -17
  95. data/config/locales/it.yml +0 -18
  96. data/config/locales/ja.yml +132 -47
  97. data/config/locales/kaa.yml +0 -8
  98. data/config/locales/ko.yml +0 -47
  99. data/config/locales/lb.yml +0 -17
  100. data/config/locales/lt.yml +0 -50
  101. data/config/locales/lv.yml +0 -19
  102. data/config/locales/nl.yml +0 -17
  103. data/config/locales/no.yml +0 -17
  104. data/config/locales/pl.yml +0 -47
  105. data/config/locales/pt-BR.yml +6 -50
  106. data/config/locales/pt.yml +35 -23
  107. data/config/locales/ro-RO.yml +0 -29
  108. data/config/locales/ru.yml +0 -16
  109. data/config/locales/si-LK.yml +0 -11
  110. data/config/locales/sk.yml +0 -19
  111. data/config/locales/sl.yml +0 -17
  112. data/config/locales/sq-AL.yml +0 -50
  113. data/config/locales/sr-CS.yml +0 -16
  114. data/config/locales/sv.yml +124 -36
  115. data/config/locales/th-TH.yml +0 -50
  116. data/config/locales/tr-TR.yml +0 -47
  117. data/config/locales/uk.yml +0 -16
  118. data/config/locales/zh-CN.yml +0 -20
  119. data/config/locales/zh-TW.yml +0 -47
  120. data/db/migrate/20200827154103_add_commentable_counter_cache_to_results.rb +1 -1
  121. data/db/migrate/20240828103202_add_deleted_at_to_decidim_accountability_results.rb +8 -0
  122. data/db/migrate/20240916112128_add_geolocation_fields_to_results.rb +9 -0
  123. data/decidim-accountability.gemspec +1 -1
  124. data/lib/decidim/accountability/admin_engine.rb +16 -2
  125. data/lib/decidim/accountability/component.rb +3 -3
  126. data/lib/decidim/accountability/result_serializer.rb +9 -13
  127. data/lib/decidim/accountability/seeds.rb +28 -21
  128. data/lib/decidim/accountability/test/factories.rb +6 -4
  129. data/lib/decidim/accountability/version.rb +1 -1
  130. data/lib/decidim/api/accountability_type.rb +4 -5
  131. data/lib/decidim/api/result_type.rb +10 -13
  132. data/lib/decidim/api/status_type.rb +3 -4
  133. data/lib/decidim/api/timeline_entry_type.rb +5 -6
  134. metadata +58 -30
  135. data/app/commands/decidim/accountability/admin/import_projects_to_accountability.rb +0 -37
  136. data/app/controllers/decidim/accountability/admin/projects_import_controller.rb +0 -31
  137. data/app/forms/decidim/accountability/admin/result_import_projects_form.rb +0 -51
  138. data/app/views/decidim/accountability/admin/projects_import/new.html.erb +0 -45
  139. data/app/views/decidim/accountability/results/_nav_breadcrumb.html.erb +0 -37
  140. data/app/views/decidim/accountability/results/_scope_filters.html.erb +0 -31
  141. /data/app/packs/entrypoints/{decidim_accountability_admin.js → decidim_accountability_admin_index.js} +0 -0
@@ -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: 更新時間
@@ -50,27 +47,6 @@ zh-TW:
50
47
  new:
51
48
  download_export: 匯出成 CSV
52
49
  import: 匯入
53
- info: |
54
- <p>建議透過下面步驟:</p>
55
- <ol>
56
- <li><a href='%{link_new_status}' target='_blank'>建立結果的狀態</a></li>
57
- <li><a href='%{link_new_result}' target='_blank'>手動建立至少一個結果</a> 在這個管理介面,這樣一來在匯入前可以先理解需要填寫的格式</li>
58
- <li>%{link_export_csv}</li>
59
- <li>下載後在電腦調整,只能夠調整 CSV 檔案的下面欄位:
60
- <ul>
61
- <li><b>category/id:</b> 類別編號</li>
62
- <li><b>scope/id:</b> 範圍編號</li>
63
- <li><b>parent/id:</b> 上層編號 (相關結果),選填</li>
64
- <li><b>title/en:</b> 英文標題,這會依據語言設定不同</li>
65
- <li><b>description/en:</b> 英文說明,這會依據語言設定不同</li>
66
- <li><b>start_date:</b> 結果開始執行時間 (格式 YYYY-MM-DD)</li>
67
- <li><b>end_date:</b> 結果結束執行時間 (格式 YYYY-MM-DD)</li>
68
- <li><b>status/id:</b> 這個結果的狀態編號</li>
69
- <li><b>progress:</b> 執行率百分比 (從 0 到 100) </li>
70
- <li><b>proposals_ids:</b> 相關提案的內部編號 (逗點分隔),會自動轉換為 <span class='attribute-name'>proposal_url</span></li>
71
- </ul>
72
- </li>
73
- </ol>
74
50
  imports:
75
51
  create:
76
52
  success: 檔案開始匯入,執行完成後會寄發 email 說明匯入結果.
@@ -79,21 +55,10 @@ zh-TW:
79
55
  name: 結果
80
56
  status:
81
57
  name: 狀態
82
- projects_import:
83
- create:
84
- invalid: 匯入專案到結果時發生錯誤,請確實依照說明小心操作,以及確認已經選擇要實做的專案
85
- new:
86
- create: 匯入
87
- import_all_selected_projects: 匯入所有選擇的專案來實現
88
- no_components: 在這個參與空間沒有預算元件來匯入專案到結果
89
- success:
90
- other: "%{count} 個專案已經排程匯入,完成後會寄送 email 通知."
91
58
  results:
92
59
  create:
93
60
  invalid: 建立結果時發生錯誤.
94
61
  success: 結果成功建立.
95
- destroy:
96
- success: 結果成功刪除.
97
62
  edit:
98
63
  title: 編輯結果
99
64
  update: 更新結果
@@ -179,12 +144,10 @@ zh-TW:
179
144
  models:
180
145
  result:
181
146
  fields:
182
- category: 類別
183
147
  created_at: 建立時間
184
148
  end_date: 結束日期
185
149
  id: 編號
186
150
  progress: 進度
187
- scope: 範圍
188
151
  start_date: 開始日期
189
152
  status: 狀態
190
153
  title: 標題
@@ -202,12 +165,8 @@ zh-TW:
202
165
  count:
203
166
  results_count:
204
167
  other: "%{count} 個結果"
205
- filters:
206
- all: 全部
207
168
  home_header:
208
169
  global_status: 全域執行狀態
209
- nav_breadcrumb:
210
- global: 全域執行
211
170
  search:
212
171
  search: 搜尋操作
213
172
  show:
@@ -218,10 +177,6 @@ zh-TW:
218
177
  admin:
219
178
  filters:
220
179
  results:
221
- category_id_eq:
222
- label: 類別
223
- scope_id_eq:
224
- label: 範圍
225
180
  status_id_eq:
226
181
  label: 狀態
227
182
  components:
@@ -235,8 +190,6 @@ zh-TW:
235
190
  comments_max_length: 留言字數上限 (0 表示使用預設)
236
191
  display_progress_enabled: 顯示進度
237
192
  intro: 介紹
238
- scope_id: 範圍
239
- scopes_enabled: 啟用的範圍
240
193
  step:
241
194
  comments_blocked: 留言已封鎖
242
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,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDeletedAtToDecidimAccountabilityResults < ActiveRecord::Migration[7.0]
4
+ def change
5
+ add_column :decidim_accountability_results, :deleted_at, :datetime
6
+ add_index :decidim_accountability_results, :deleted_at
7
+ end
8
+ 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.2.0"
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 :projects_import, only: [:new, :create]
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 :scopes_enabled, type: :boolean, default: true
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(:category, :scope, :status, component: { participatory_space: :organization })
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
- category: {
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
- categories = create_categories!
20
+ taxonomies = create_taxonomies!
21
21
 
22
- categories.each do |category|
23
- create_result!(component:, category:)
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
- scopes_enabled: true,
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 create_categories!
57
- parent_category = participatory_space.categories.sample
58
- categories = [parent_category]
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
- categories << Decidim::Category.create!(
62
- name: Decidim::Faker::Localized.sentence(word_count: 5),
63
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
64
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
65
- end,
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
- categories
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:, category:)
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
- scope: participatory_space.organization.scopes.sample,
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 :status, component:, skip_injection: }
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
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-accountability version.
5
5
  module Accountability
6
6
  def self.version
7
- "0.29.2"
7
+ "0.30.0.rc2"
8
8
  end
9
9
  end
10
10
  end
@@ -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 :results, Decidim::Accountability::ResultType.connection_type, null: true, connection: true
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::CategorizableInterface
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 :id, GraphQL::Types::ID, "The internal ID for this result", null: false
13
- field :title, Decidim::Core::TranslatedFieldType, "The title for this result", null: true
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 :created_at, Decidim::Core::DateTimeType, "When this timeline entry was created", null: true
13
- field :updated_at, Decidim::Core::DateTimeType, "When this timeline entry was updated", null: true
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