decidim-accountability 0.27.9 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/accountability/content_blocks/highlighted_results_cell.rb +3 -8
  3. data/app/cells/decidim/accountability/highlighted_results/show.erb +3 -1
  4. data/app/cells/decidim/accountability/highlighted_results_for_component/show.erb +19 -19
  5. data/app/cells/decidim/accountability/highlighted_results_for_component_cell.rb +29 -6
  6. data/app/cells/decidim/accountability/project/show.erb +11 -0
  7. data/app/cells/decidim/accountability/project/timeline.erb +22 -0
  8. data/app/cells/decidim/accountability/project_cell.rb +75 -0
  9. data/app/cells/decidim/accountability/result_activity_cell.rb +1 -4
  10. data/app/cells/decidim/accountability/result_card_cell.rb +21 -0
  11. data/app/cells/decidim/accountability/result_cell.rb +2 -2
  12. data/app/cells/decidim/accountability/result_l/extra_data.erb +3 -0
  13. data/app/cells/decidim/accountability/result_l_cell.rb +30 -0
  14. data/app/cells/decidim/accountability/result_metadata/project_aside.erb +6 -0
  15. data/app/cells/decidim/accountability/result_metadata/show_footer.erb +11 -0
  16. data/app/cells/decidim/accountability/result_metadata/versions.erb +1 -0
  17. data/app/cells/decidim/accountability/result_metadata_cell.rb +136 -0
  18. data/app/cells/decidim/accountability/results/show.erb +7 -0
  19. data/app/cells/decidim/accountability/results_cell.rb +14 -0
  20. data/app/cells/decidim/accountability/status/show.erb +9 -0
  21. data/app/cells/decidim/accountability/status/status.erb +16 -0
  22. data/app/cells/decidim/accountability/status_cell.rb +91 -0
  23. data/app/commands/decidim/accountability/admin/import_projects_to_accountability.rb +37 -0
  24. data/app/controllers/concerns/decidim/accountability/admin/filterable.rb +2 -2
  25. data/app/controllers/decidim/accountability/admin/import_results_controller.rb +18 -6
  26. data/app/controllers/decidim/accountability/admin/projects_import_controller.rb +31 -0
  27. data/app/controllers/decidim/accountability/admin/results_controller.rb +4 -5
  28. data/app/controllers/decidim/accountability/admin/statuses_controller.rb +3 -3
  29. data/app/controllers/decidim/accountability/admin/timeline_entries_controller.rb +3 -3
  30. data/app/controllers/decidim/accountability/results_controller.rb +20 -2
  31. data/app/events/decidim/accountability/proposal_linked_event.rb +18 -1
  32. data/app/events/decidim/accountability/result_progress_updated_event.rb +18 -2
  33. data/app/forms/decidim/accountability/admin/import_results_form.rb +22 -0
  34. data/app/forms/decidim/accountability/admin/result_import_projects_form.rb +51 -0
  35. data/app/helpers/decidim/accountability/admin/application_helper.rb +1 -0
  36. data/app/helpers/decidim/accountability/application_helper.rb +43 -2
  37. data/app/helpers/decidim/accountability/breadcrumb_helper.rb +10 -0
  38. data/app/jobs/decidim/accountability/admin/import_projects_job.rb +72 -0
  39. data/app/mailers/decidim/accountability/import_projects_mailer.rb +25 -0
  40. data/app/models/decidim/accountability/result.rb +1 -1
  41. data/app/packs/entrypoints/decidim_accountability.js +4 -1
  42. data/app/packs/entrypoints/decidim_accountability_admin_imports.js +3 -0
  43. data/app/packs/images/decidim/accountability/breadcrumb_arrow.svg +3 -0
  44. data/app/packs/src/decidim/accountability/admin/imports.js +15 -0
  45. data/app/packs/stylesheets/accountability.scss +169 -0
  46. data/app/permissions/decidim/accountability/admin/permissions.rb +17 -6
  47. data/app/presenters/decidim/accountability/admin_log/result_presenter.rb +2 -2
  48. data/app/presenters/decidim/accountability/admin_log/status_presenter.rb +2 -2
  49. data/app/presenters/decidim/accountability/admin_log/timeline_entry_presenter.rb +2 -2
  50. data/app/queries/decidim/accountability/metrics/results_metric_manage.rb +1 -1
  51. data/app/services/decidim/accountability/results_calculator.rb +1 -1
  52. data/app/services/decidim/accountability/results_csv_importer.rb +2 -2
  53. data/app/views/decidim/accountability/admin/import_results/new.html.erb +27 -23
  54. data/app/views/decidim/accountability/admin/projects_import/new.html.erb +45 -0
  55. data/app/views/decidim/accountability/admin/results/_form.html.erb +46 -46
  56. data/app/views/decidim/accountability/admin/results/edit.html.erb +18 -7
  57. data/app/views/decidim/accountability/admin/results/index.html.erb +102 -91
  58. data/app/views/decidim/accountability/admin/results/new.html.erb +18 -8
  59. data/app/views/decidim/accountability/admin/shared/_subnav.html.erb +1 -1
  60. data/app/views/decidim/accountability/admin/statuses/_form.html.erb +15 -17
  61. data/app/views/decidim/accountability/admin/statuses/edit.html.erb +16 -6
  62. data/app/views/decidim/accountability/admin/statuses/index.html.erb +33 -36
  63. data/app/views/decidim/accountability/admin/statuses/new.html.erb +16 -6
  64. data/app/views/decidim/accountability/admin/timeline_entries/_form.html.erb +12 -14
  65. data/app/views/decidim/accountability/admin/timeline_entries/edit.html.erb +17 -6
  66. data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +35 -34
  67. data/app/views/decidim/accountability/admin/timeline_entries/new.html.erb +17 -6
  68. data/app/views/decidim/accountability/import_projects_mailer/import.html.erb +2 -0
  69. data/app/views/decidim/accountability/results/_home_categories.html.erb +28 -73
  70. data/app/views/decidim/accountability/results/_linked_results.html.erb +3 -12
  71. data/app/views/decidim/accountability/results/_project.html.erb +29 -0
  72. data/app/views/decidim/accountability/results/_projects_aside.html.erb +40 -0
  73. data/app/views/decidim/accountability/results/_scope_filters.html.erb +27 -27
  74. data/app/views/decidim/accountability/results/_search.html.erb +15 -9
  75. data/app/views/decidim/accountability/results/_stats_box.html.erb +3 -3
  76. data/app/views/decidim/accountability/results/home.html.erb +34 -8
  77. data/app/views/decidim/accountability/results/index.html.erb +15 -15
  78. data/app/views/decidim/accountability/results/index.js.erb +3 -0
  79. data/app/views/decidim/accountability/results/show.html.erb +9 -10
  80. data/app/views/decidim/accountability/versions/show.html.erb +13 -10
  81. data/app/views/decidim/participatory_spaces/_result.html.erb +4 -4
  82. data/config/assets.rb +2 -2
  83. data/config/locales/ar.yml +23 -61
  84. data/config/locales/bg.yml +0 -96
  85. data/config/locales/ca.yml +54 -31
  86. data/config/locales/cs.yml +58 -29
  87. data/config/locales/da.yml +1 -36
  88. data/config/locales/de.yml +59 -36
  89. data/config/locales/el.yml +62 -29
  90. data/config/locales/en.yml +55 -31
  91. data/config/locales/es-MX.yml +52 -29
  92. data/config/locales/es-PY.yml +52 -29
  93. data/config/locales/es.yml +55 -32
  94. data/config/locales/eu.yml +53 -30
  95. data/config/locales/fi-plain.yml +51 -28
  96. data/config/locales/fi.yml +54 -31
  97. data/config/locales/fr-CA.yml +51 -28
  98. data/config/locales/fr.yml +52 -29
  99. data/config/locales/ga-IE.yml +0 -4
  100. data/config/locales/gl.yml +0 -41
  101. data/config/locales/hu.yml +41 -29
  102. data/config/locales/id-ID.yml +1 -30
  103. data/config/locales/is-IS.yml +0 -32
  104. data/config/locales/it.yml +0 -43
  105. data/config/locales/ja.yml +55 -39
  106. data/config/locales/kaa.yml +20 -1
  107. data/config/locales/ko.yml +0 -188
  108. data/config/locales/lb.yml +1 -42
  109. data/config/locales/lt.yml +60 -41
  110. data/config/locales/lv.yml +1 -36
  111. data/config/locales/nl.yml +0 -41
  112. data/config/locales/no.yml +8 -49
  113. data/config/locales/pl.yml +17 -61
  114. data/config/locales/pt-BR.yml +41 -29
  115. data/config/locales/pt.yml +0 -42
  116. data/config/locales/ro-RO.yml +39 -66
  117. data/config/locales/ru.yml +1 -30
  118. data/config/locales/si-LK.yml +0 -4
  119. data/config/locales/sk.yml +1 -40
  120. data/config/locales/sl.yml +0 -11
  121. data/config/locales/sq-AL.yml +82 -7
  122. data/config/locales/sr-CS.yml +1 -30
  123. data/config/locales/sv.yml +36 -51
  124. data/config/locales/th-TH.yml +0 -140
  125. data/config/locales/tr-TR.yml +9 -75
  126. data/config/locales/uk.yml +1 -28
  127. data/config/locales/zh-CN.yml +1 -36
  128. data/config/locales/zh-TW.yml +52 -43
  129. data/lib/decidim/accountability/admin_engine.rb +3 -2
  130. data/lib/decidim/accountability/component.rb +4 -99
  131. data/lib/decidim/accountability/engine.rb +9 -1
  132. data/lib/decidim/accountability/result_serializer.rb +1 -1
  133. data/lib/decidim/accountability/seeds.rb +115 -0
  134. data/lib/decidim/accountability/test/factories.rb +18 -29
  135. data/lib/decidim/accountability/version.rb +1 -1
  136. data/lib/decidim/api/result_type.rb +1 -0
  137. metadata +62 -51
  138. data/app/cells/decidim/accountability/content_blocks/highlighted_results/elements.erb +0 -5
  139. data/app/cells/decidim/accountability/content_blocks/highlighted_results/heading.erb +0 -1
  140. data/app/cells/decidim/accountability/result_m/data.erb +0 -23
  141. data/app/cells/decidim/accountability/result_m/footer.erb +0 -22
  142. data/app/cells/decidim/accountability/result_m/tags.erb +0 -1
  143. data/app/cells/decidim/accountability/result_m_cell.rb +0 -37
  144. data/app/events/decidim/accountability/base_result_event.rb +0 -29
  145. data/app/packs/stylesheets/decidim/accountability/_accountability.scss +0 -4
  146. data/app/packs/stylesheets/decidim/accountability/accountability/_cards.scss +0 -11
  147. data/app/packs/stylesheets/decidim/accountability/accountability/_categories.scss +0 -121
  148. data/app/packs/stylesheets/decidim/accountability/accountability/_lines_breadcrumb.scss +0 -37
  149. data/app/packs/stylesheets/decidim/accountability/accountability/_results.scss +0 -148
  150. data/app/views/decidim/accountability/admin/results/proposals_picker.html.erb +0 -1
  151. data/app/views/decidim/accountability/result_widgets/show.html.erb +0 -2
  152. data/app/views/decidim/accountability/results/_home_header.html.erb +0 -23
  153. data/app/views/decidim/accountability/results/_results_leaf.html.erb +0 -47
  154. data/app/views/decidim/accountability/results/_results_parent.html.erb +0 -32
  155. data/app/views/decidim/accountability/results/_show_leaf.html.erb +0 -81
  156. data/app/views/decidim/accountability/results/_show_parent.html.erb +0 -30
  157. data/app/views/decidim/accountability/results/_stats.html.erb +0 -15
  158. data/app/views/decidim/accountability/results/_timeline.html.erb +0 -30
  159. data/app/views/decidim/accountability/versions/index.html.erb +0 -12
  160. data/config/locales/he-IL.yml +0 -219
  161. data/decidim-accountability.gemspec +0 -38
@@ -35,8 +35,6 @@ zh-CN:
35
35
  confirm_destroy: 您确定要删除此 %{name} 吗?
36
36
  destroy: 删除
37
37
  edit: 编辑
38
- import_csv: 导入 CSV
39
- new: 新建 %{name}
40
38
  preview: 预览
41
39
  timeline_entries: 项目进化
42
40
  title: 行动
@@ -46,23 +44,12 @@ zh-CN:
46
44
  import_results:
47
45
  new:
48
46
  import: 导入
49
- title: 从 CSV 导入结果
50
- imports:
51
- create:
52
- success: 该文件已经开始导入。您将在几分钟内收到一封电子邮件,其导入的结果将会被导入。
53
47
  models:
54
48
  result:
55
49
  name: 结果
56
50
  status:
57
51
  name: 状态
58
- timeline_entry:
59
- name: 时间线条目
60
52
  results:
61
- create:
62
- invalid: 创建此结果时出现问题
63
- success: 结果已成功创建
64
- destroy:
65
- success: 结果删除成功
66
53
  edit:
67
54
  title: 编辑结果
68
55
  update: 更新结果
@@ -71,18 +58,10 @@ zh-CN:
71
58
  new:
72
59
  create: 创建结果
73
60
  title: 新结果
74
- update:
75
- invalid: 更新此结果时出现问题
76
- success: 结果已成功更新
77
61
  shared:
78
62
  subnav:
79
63
  statuses: Statuses
80
64
  statuses:
81
- create:
82
- invalid: 创建此状态时出现问题
83
- success: 状态创建成功
84
- destroy:
85
- success: 状态删除成功
86
65
  edit:
87
66
  title: 编辑状态
88
67
  update: 更新状态
@@ -91,15 +70,7 @@ zh-CN:
91
70
  new:
92
71
  create: 创建状态
93
72
  title: 新状态
94
- update:
95
- invalid: 更新此状态时出现问题
96
- success: 状态已更新
97
73
  timeline_entries:
98
- create:
99
- invalid: 创建此条目时出错
100
- success: 条目创建成功
101
- destroy:
102
- success: 条目删除成功
103
74
  edit:
104
75
  title: 编辑条目
105
76
  update: 更新条目
@@ -108,9 +79,6 @@ zh-CN:
108
79
  new:
109
80
  create: 创建条目
110
81
  title: 新建条目
111
- update:
112
- invalid: 更新此条目时出错
113
- success: 条目已成功更新
114
82
  admin_log:
115
83
  result:
116
84
  create: "%{user_name} 在 %{resource_name} 创建了结果 %{space_name}"
@@ -122,12 +90,9 @@ zh-CN:
122
90
  import_mailer:
123
91
  import:
124
92
  errors: 错误
125
- errors_present: 导入结果时出现问题
126
93
  row_number: 行
127
94
  subject: 成功导入结果
128
95
  success: 成功导入结果。您可以在管理界面查看结果。
129
- last_activity:
130
- new_result_at_html: "<span>在 %{link}的新结果</span>"
131
96
  models:
132
97
  result:
133
98
  fields:
@@ -151,7 +116,6 @@ zh-CN:
151
116
  other: "%{count} 个结果"
152
117
  filters:
153
118
  all: 所有的
154
- scopes: 范围
155
119
  home:
156
120
  categories_label: 类别管理
157
121
  subcategories_label: 子类别
@@ -165,6 +129,7 @@ zh-CN:
165
129
  stats:
166
130
  attendees: 参与者
167
131
  back_to_resource: 返回结果
132
+ comments: 评论
168
133
  contributions: 二. 捐款
169
134
  last_edited_by: 最后编辑者
170
135
  last_updated_at: 最后更新于
@@ -8,6 +8,7 @@ zh-TW:
8
8
  decidim_scope_id: 範圍
9
9
  description: 說明
10
10
  end_date: 結束日期
11
+ meetings_ids: 包含的會議
11
12
  progress: 進度
12
13
  project_ids: 包含的專案
13
14
  proposals: 包含的建議
@@ -38,8 +39,6 @@ zh-TW:
38
39
  confirm_destroy: 確定要刪除 %{name} ?
39
40
  destroy: 刪除
40
41
  edit: 編輯
41
- import_csv: 匯入CSV
42
- new: 新增 %{name}
43
42
  preview: 預覽
44
43
  timeline_entries: 專案評估
45
44
  title: 操作
@@ -52,43 +51,53 @@ zh-TW:
52
51
  download_export: 匯出成 CSV
53
52
  import: 匯入
54
53
  info: |
55
- <p>建議依照下面步驟:</p>
54
+ <p>建議透過下面步驟:</p>
56
55
  <ol>
57
- <li><a href='%{link_new_status}' target='_blank'>為結果建立狀態</a> 到你想要新增的</li>
58
- <li>在管理介面匯入前 <a href='%{link_new_result}' target='_blank'>至少手動建立一個結果</a> ,這樣才能確認要填寫的資料格式。</li>
56
+ <li><a href='%{link_new_status}' target='_blank'>建立結果的狀態</a></li>
57
+ <li><a href='%{link_new_result}' target='_blank'>手動建立至少一個結果</a> 在這個管理介面,這樣一來在匯入前可以先理解需要填寫的格式</li>
59
58
  <li>%{link_export_csv}</li>
60
- <li>在自己電腦編輯,只能夠異動下面欄位:
59
+ <li>下載後在電腦調整,只能夠調整 CSV 檔案的下面欄位:
61
60
  <ul>
62
- <li><b>category/id:</b> 類別代號</li>
63
- <li><b>scope/id:</b> 範圍代號</li>
64
- <li><b>parent/id:</b> 上一層代號 (相關結果),選擇性的</li>
65
- <li><b>title/en:</b> 英文標題,這要看你的平台語言設定。</li>
66
- <li><b>description/en:</b> 英文介紹,這要看你的平台語言設定。</li>
67
- <li><b>start_date:</b> 結果開始執行的日期 (格式 YYYY-MM-DD)</li>
68
- <li><b>end_date:</b> 結果結束執行的日期 (格式 YYYY-MM-DD)</li>
69
- <li><b>status/id:</b> 這個結果的狀態代號</li>
70
- <li><b>progress:</b> 這次執行的比率 ( 0 到 100) </li>
71
- <li><b>proposals_ids:</b> 相關建議的內部代號 (半形逗點分隔),會自動轉換為 <span class='attribute-name'>proposal_url</span></li>
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>
72
71
  </ul>
73
72
  </li>
74
73
  </ol>
75
- title: 從 CSV 匯入結果
76
74
  imports:
77
75
  create:
78
- success: 檔案開始匯入,執行完成後會寄發 email 說明匯入結果
76
+ success: 檔案開始匯入,執行完成後會寄發 email 說明匯入結果.
79
77
  models:
80
78
  result:
81
79
  name: 結果
82
80
  status:
83
81
  name: 狀態
84
- timeline_entry:
85
- name: 輸入時間線
82
+ projects_import:
83
+ create:
84
+ invalid: 匯入專案到結果時發生錯誤,請確實依照說明小心操作,以及確認已經選擇要實做的專案
85
+ new:
86
+ create: 匯入
87
+ import_all_selected_projects: 匯入所有選擇的專案來實現
88
+ new_items:
89
+ other: "%{count} 個專案將匯入"
90
+ no_components: 在這個參與空間沒有預算元件來匯入專案到結果
91
+ origin_component_id: 原始元件
92
+ select_component: 選擇一個元件
93
+ success:
94
+ other: "%{count} 個專案已經排程匯入,完成後會寄送 email 通知."
86
95
  results:
87
96
  create:
88
- invalid: 建立結果時發生錯誤
89
- success: 結果成功建立
97
+ invalid: 建立結果時發生錯誤.
98
+ success: 結果成功建立.
90
99
  destroy:
91
- success: 結果成功刪除
100
+ success: 結果成功刪除.
92
101
  edit:
93
102
  title: 編輯結果
94
103
  update: 更新結果
@@ -98,17 +107,17 @@ zh-TW:
98
107
  create: 建立結果
99
108
  title: 新增結果
100
109
  update:
101
- invalid: 更新結果時發生錯誤
102
- success: 結果成功更新
110
+ invalid: 更新結果時發生錯誤.
111
+ success: 結果成功更新.
103
112
  shared:
104
113
  subnav:
105
114
  statuses: 狀態
106
115
  statuses:
107
116
  create:
108
- invalid: 建立狀態時發生錯誤
109
- success: 狀態成功建立
117
+ invalid: 建立狀態時發生錯誤.
118
+ success: 狀態成功建立.
110
119
  destroy:
111
- success: 狀態成功刪除
120
+ success: 狀態成功刪除.
112
121
  edit:
113
122
  title: 編輯狀態
114
123
  update: 更新狀態
@@ -118,14 +127,14 @@ zh-TW:
118
127
  create: 新增狀態
119
128
  title: 新狀態
120
129
  update:
121
- invalid: 更新狀態時發生錯誤
122
- success: 狀態成功更新
130
+ invalid: 更新狀態時發生錯誤.
131
+ success: 狀態成功更新.
123
132
  timeline_entries:
124
133
  create:
125
- invalid: 建立資料時發生錯誤
126
- success: 資料成功建立
134
+ invalid: 建立資料時發生錯誤.
135
+ success: 資料成功建立.
127
136
  destroy:
128
- success: 資料成功刪除
137
+ success: 資料成功刪除.
129
138
  edit:
130
139
  title: 編輯資料
131
140
  update: 更新資料
@@ -135,8 +144,8 @@ zh-TW:
135
144
  create: 建立資料
136
145
  title: 新資料
137
146
  update:
138
- invalid: 更新資料時發生錯誤
139
- success: 資料成功更新
147
+ invalid: 更新資料時發生錯誤.
148
+ success: 資料成功更新.
140
149
  admin_log:
141
150
  result:
142
151
  create: "%{user_name} 建立結果 %{resource_name} 在 %{space_name}"
@@ -155,18 +164,22 @@ zh-TW:
155
164
  not_found: '資料庫中找不到上一層 (ID: %{id})'
156
165
  content_blocks:
157
166
  highlighted_results:
158
- dates: 日期
159
167
  results: 結果
160
- unspecified: 未指定
161
168
  import_mailer:
162
169
  import:
163
170
  errors: 錯誤
164
- errors_present: 匯入結果時發生錯誤
171
+ errors_present: 匯入結果時發生錯誤.
165
172
  row_number: 列
166
173
  subject: 結果匯入成功
167
174
  success: 結果匯入成功,在管理介面可以檢視。
175
+ import_projects_mailer:
176
+ import:
177
+ added_projects:
178
+ other: "從專案匯入 %{count} 個結果"
179
+ subject: 專案匯入成功
180
+ success: 在元件 %{component_name} 成功匯入專案到結果,可以在管理介面檢視。
168
181
  last_activity:
169
- new_result_at_html: "<span>在 %{link} 有新的結果</span>"
182
+ new_result: '新結果:'
170
183
  models:
171
184
  result:
172
185
  fields:
@@ -189,16 +202,12 @@ zh-TW:
189
202
  fields:
190
203
  entry_date: 日期
191
204
  title: 標題
192
- result_m:
193
- executed: 已執行
194
- view: 檢視
195
205
  results:
196
206
  count:
197
207
  results_count:
198
208
  other: "%{count} 個結果"
199
209
  filters:
200
210
  all: 全部
201
- scopes: 範圍
202
211
  home:
203
212
  categories_label: 類別
204
213
  subcategories_label: 子類別
@@ -16,10 +16,11 @@ module Decidim
16
16
  resources :results, except: [:show] do
17
17
  get :proposals_picker, on: :collection
18
18
 
19
- resources :attachment_collections
20
- resources :attachments
19
+ resources :attachment_collections, except: [:show]
20
+ resources :attachments, except: [:show]
21
21
  resources :timeline_entries, except: [:show]
22
22
  end
23
+ resources :projects_import, only: [:new, :create]
23
24
  get :import_results, to: "import_results#new"
24
25
  post :import_results, to: "import_results#create"
25
26
  root to: "results#index"
@@ -1,17 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "decidim/components/namer"
4
-
5
3
  Decidim.register_component(:accountability) do |component|
6
4
  component.engine = Decidim::Accountability::Engine
7
5
  component.admin_engine = Decidim::Accountability::AdminEngine
8
6
  component.icon = "media/images/decidim_accountability.svg"
7
+ component.icon_key = "bar-chart-line"
9
8
  component.stylesheet = "decidim/accountability/accountability"
10
9
  component.permissions_class_name = "Decidim::Accountability::Permissions"
11
10
  component.query_type = "Decidim::Accountability::AccountabilityType"
12
11
 
13
12
  component.on(:before_destroy) do |instance|
14
- raise StandardError, "Can't remove this component" if Decidim::Accountability::Result.where(component: instance).any?
13
+ raise StandardError, "Cannot remove this component" if Decidim::Accountability::Result.where(component: instance).any?
15
14
  end
16
15
 
17
16
  # These actions permissions can be configured in the admin panel
@@ -71,102 +70,8 @@ Decidim.register_component(:accountability) do |component|
71
70
  end
72
71
 
73
72
  component.seeds do |participatory_space|
74
- admin_user = Decidim::User.find_by(
75
- organization: participatory_space.organization,
76
- email: "admin@example.org"
77
- )
78
-
79
- params = {
80
- name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name,
81
- manifest_name: :accountability,
82
- published_at: Time.current,
83
- participatory_space: participatory_space,
84
- settings: {
85
- intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(word_count: 4) },
86
- categories_label: Decidim::Faker::Localized.word,
87
- subcategories_label: Decidim::Faker::Localized.word,
88
- heading_parent_level_results: Decidim::Faker::Localized.word,
89
- heading_leaf_level_results: Decidim::Faker::Localized.word,
90
- scopes_enabled: true,
91
- scope_id: participatory_space.scope&.id
92
- }
93
- }
94
-
95
- component = Decidim.traceability.perform_action!("publish", Decidim::Component, admin_user, visibility: "all") do
96
- Decidim::Component.create!(params)
97
- end
98
-
99
- 5.times do |i|
100
- Decidim::Accountability::Status.create!(
101
- component: component,
102
- name: Decidim::Faker::Localized.word,
103
- key: "status_#{i}"
104
- )
105
- end
106
-
107
- 3.times do
108
- parent_category = participatory_space.categories.sample
109
- categories = [parent_category]
73
+ require "decidim/accountability/seeds"
110
74
 
111
- 2.times do
112
- categories << Decidim::Category.create!(
113
- name: Decidim::Faker::Localized.sentence(word_count: 5),
114
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
115
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
116
- end,
117
- parent: parent_category,
118
- participatory_space: participatory_space
119
- )
120
- end
121
-
122
- categories.each do |category|
123
- result = Decidim.traceability.create!(
124
- Decidim::Accountability::Result,
125
- admin_user,
126
- {
127
- component: component,
128
- scope: participatory_space.organization.scopes.sample,
129
- category: category,
130
- title: Decidim::Faker::Localized.sentence(word_count: 2),
131
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
132
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
133
- end
134
- },
135
- visibility: "all"
136
- )
137
-
138
- Decidim::Comments::Seed.comments_for(result)
139
-
140
- 3.times do
141
- child_result = Decidim.traceability.create!(
142
- Decidim::Accountability::Result,
143
- admin_user,
144
- {
145
- component: component,
146
- parent: result,
147
- start_date: Time.zone.today,
148
- end_date: Time.zone.today + 10,
149
- status: Decidim::Accountability::Status.all.sample,
150
- progress: rand(1..100),
151
- title: Decidim::Faker::Localized.sentence(word_count: 2),
152
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
153
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
154
- end
155
- },
156
- visibility: "all"
157
- )
158
-
159
- rand(0..5).times do |i|
160
- child_result.timeline_entries.create!(
161
- entry_date: child_result.start_date + i.days,
162
- title: Decidim::Faker::Localized.sentence(word_count: 2),
163
- description: Decidim::Faker::Localized.paragraph(sentence_count: 1)
164
- )
165
- end
166
-
167
- Decidim::Comments::Seed.comments_for(child_result)
168
- end
169
- end
170
- end
75
+ Decidim::Accountability::Seeds.new(participatory_space:).call
171
76
  end
172
77
  end
@@ -12,11 +12,19 @@ module Decidim
12
12
 
13
13
  routes do
14
14
  resources :results, only: [:index, :show] do
15
- resources :versions, only: [:show, :index]
15
+ resources :versions, only: [:show]
16
16
  end
17
17
  root to: "results#home"
18
18
  end
19
19
 
20
+ initializer "decidim_accountability.register_icons" do
21
+ Decidim.icons.register(name: "Decidim::Accountability::Result", icon: "briefcase-2-line", description: "Result / project (Accountability)", category: "activity",
22
+ engine: :accountability)
23
+
24
+ Decidim.icons.register(name: "focus-2-line", icon: "focus-2-line", category: "system", description: "", engine: :accountability)
25
+ Decidim.icons.register(name: "briefcase-2-line", icon: "briefcase-2-line", category: "system", description: "", engine: :accountability)
26
+ end
27
+
20
28
  initializer "decidim_accountability.view_hooks" do
21
29
  Decidim.view_hooks.register(:participatory_space_highlighted_elements, priority: Decidim::ViewHooks::LOW_PRIORITY) do |view_context|
22
30
  view_context.cell("decidim/accountability/highlighted_results", view_context.current_participatory_space)
@@ -39,7 +39,7 @@ module Decidim
39
39
  },
40
40
  progress: result.progress,
41
41
  created_at: result.created_at,
42
- url: url,
42
+ url:,
43
43
  component: { id: component.id },
44
44
  proposal_urls: proposals
45
45
  }
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "decidim/components/namer"
4
+
5
+ module Decidim
6
+ module Accountability
7
+ class Seeds
8
+ attr_reader :participatory_space
9
+
10
+ def initialize(participatory_space:)
11
+ @participatory_space = participatory_space
12
+ end
13
+
14
+ def call
15
+ admin_user = Decidim::User.find_by(
16
+ organization: participatory_space.organization,
17
+ email: "admin@example.org"
18
+ )
19
+
20
+ params = {
21
+ name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name,
22
+ manifest_name: :accountability,
23
+ published_at: Time.current,
24
+ participatory_space:,
25
+ settings: {
26
+ intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(word_count: 4) },
27
+ categories_label: Decidim::Faker::Localized.word,
28
+ subcategories_label: Decidim::Faker::Localized.word,
29
+ heading_parent_level_results: Decidim::Faker::Localized.word,
30
+ heading_leaf_level_results: Decidim::Faker::Localized.word,
31
+ scopes_enabled: true,
32
+ scope_id: participatory_space.scope&.id
33
+ }
34
+ }
35
+
36
+ component = Decidim.traceability.perform_action!("publish", Decidim::Component, admin_user, visibility: "all") do
37
+ Decidim::Component.create!(params)
38
+ end
39
+
40
+ 5.times do |i|
41
+ Decidim::Accountability::Status.create!(
42
+ component:,
43
+ name: Decidim::Faker::Localized.word,
44
+ key: "status_#{i}"
45
+ )
46
+ end
47
+
48
+ 3.times do
49
+ parent_category = participatory_space.categories.sample
50
+ categories = [parent_category]
51
+
52
+ 2.times do
53
+ categories << Decidim::Category.create!(
54
+ name: Decidim::Faker::Localized.sentence(word_count: 5),
55
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
56
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
57
+ end,
58
+ parent: parent_category,
59
+ participatory_space:
60
+ )
61
+ end
62
+
63
+ categories.each do |category|
64
+ result = Decidim.traceability.create!(
65
+ Decidim::Accountability::Result,
66
+ admin_user,
67
+ {
68
+ component:,
69
+ scope: participatory_space.organization.scopes.sample,
70
+ category:,
71
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
72
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
73
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
74
+ end
75
+ },
76
+ visibility: "all"
77
+ )
78
+
79
+ Decidim::Comments::Seed.comments_for(result)
80
+
81
+ 3.times do
82
+ child_result = Decidim.traceability.create!(
83
+ Decidim::Accountability::Result,
84
+ admin_user,
85
+ {
86
+ component:,
87
+ parent: result,
88
+ start_date: Time.zone.today,
89
+ end_date: Time.zone.today + 10,
90
+ status: Decidim::Accountability::Status.all.sample,
91
+ progress: rand(1..100),
92
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
93
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
94
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
95
+ end
96
+ },
97
+ visibility: "all"
98
+ )
99
+
100
+ rand(0..5).times do |i|
101
+ child_result.timeline_entries.create!(
102
+ entry_date: child_result.start_date + i.days,
103
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
104
+ description: Decidim::Faker::Localized.paragraph(sentence_count: 1)
105
+ )
106
+ end
107
+
108
+ Decidim::Comments::Seed.comments_for(child_result)
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/components/namer"
3
4
  require "decidim/faker/localized"
4
5
  require "decidim/dev"
5
6
 
@@ -8,19 +9,16 @@ require "decidim/participatory_processes/test/factories"
8
9
 
9
10
  FactoryBot.define do
10
11
  factory :accountability_component, parent: :component do
11
- transient do
12
- skip_injection { false }
13
- end
14
- name { generate_component_name(participatory_space.organization.available_locales, :accountability, skip_injection: skip_injection) }
12
+ name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name }
15
13
  manifest_name { :accountability }
16
- participatory_space { create(:participatory_process, :with_steps, organization: organization, skip_injection: skip_injection) }
14
+ participatory_space { create(:participatory_process, :with_steps, organization:) }
17
15
  settings do
18
16
  {
19
- intro: generate_localized_description(:accountability_component_intro, skip_injection: skip_injection),
20
- categories_label: generate_localized_word(:accountability_component_categories_label, skip_injection: skip_injection),
21
- subcategories_label: generate_localized_word(:accountability_component_subcategories_label, skip_injection: skip_injection),
22
- heading_parent_level_results: generate_localized_word(:accountability_component_heading_parent_level_results, skip_injection: skip_injection),
23
- heading_leaf_level_results: generate_localized_word(:accountability_component_heading_leaf_level_results, skip_injection: skip_injection),
17
+ intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title },
18
+ categories_label: Decidim::Faker::Localized.word,
19
+ subcategories_label: Decidim::Faker::Localized.word,
20
+ heading_parent_level_results: Decidim::Faker::Localized.word,
21
+ heading_leaf_level_results: Decidim::Faker::Localized.word,
24
22
  scopes_enabled: true,
25
23
  scope_id: participatory_space.scope&.id
26
24
  }
@@ -28,36 +26,27 @@ FactoryBot.define do
28
26
  end
29
27
 
30
28
  factory :status, class: "Decidim::Accountability::Status" do
31
- transient do
32
- skip_injection { false }
33
- end
34
- component { create(:accountability_component, skip_injection: skip_injection) }
29
+ component { create(:accountability_component) }
35
30
  sequence(:key) { |n| "status_#{n}" }
36
- name { generate_localized_word(:status_name, skip_injection: skip_injection) }
37
- description { generate_localized_word(:status_description, skip_injection: skip_injection) }
31
+ name { Decidim::Faker::Localized.word }
32
+ description { generate_localized_title }
38
33
  progress { rand(1..100) }
39
34
  end
40
35
 
41
36
  factory :result, class: "Decidim::Accountability::Result" do
42
- transient do
43
- skip_injection { false }
44
- end
45
- component { create(:accountability_component, skip_injection: skip_injection) }
46
- title { generate_localized_title(:result_title, skip_injection: skip_injection) }
47
- description { generate_localized_description(:result_description, skip_injection: skip_injection) }
37
+ component { create(:accountability_component) }
38
+ title { generate_localized_title }
39
+ description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
48
40
  start_date { "12/7/2017" }
49
41
  end_date { "30/9/2017" }
50
- status { create :status, component: component, skip_injection: skip_injection }
42
+ status { create :status, component: }
51
43
  progress { rand(1..100) }
52
44
  end
53
45
 
54
46
  factory :timeline_entry, class: "Decidim::Accountability::TimelineEntry" do
55
- transient do
56
- skip_injection { false }
57
- end
58
- result { create(:result, skip_injection: skip_injection) }
47
+ result { create(:result) }
59
48
  entry_date { "12/7/2017" }
60
- title { generate_localized_title(:timeline_entry_title, skip_injection: skip_injection) }
61
- description { generate_localized_title(:timeline_entry_description, skip_injection: skip_injection) }
49
+ title { generate_localized_title }
50
+ description { generate_localized_title }
62
51
  end
63
52
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-accountability version.
5
5
  module Accountability
6
6
  def self.version
7
- "0.27.9"
7
+ "0.28.0.rc4"
8
8
  end
9
9
  end
10
10
  end