decidim-accountability 0.23.3 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/decidim/accountability/accountability/_categories.scss +5 -4
  3. data/app/cells/decidim/accountability/content_blocks/highlighted_results/elements.erb +5 -0
  4. data/app/cells/decidim/accountability/content_blocks/highlighted_results/heading.erb +1 -0
  5. data/app/cells/decidim/accountability/content_blocks/highlighted_results_cell.rb +18 -0
  6. data/app/cells/decidim/accountability/result_cell.rb +21 -0
  7. data/app/cells/decidim/accountability/result_m/data.erb +23 -0
  8. data/app/cells/decidim/accountability/result_m/footer.erb +22 -0
  9. data/app/cells/decidim/accountability/result_m/tags.erb +1 -0
  10. data/app/cells/decidim/accountability/result_m_cell.rb +37 -0
  11. data/app/controllers/concerns/decidim/accountability/admin/filterable.rb +59 -0
  12. data/app/controllers/decidim/accountability/admin/attachment_collections_controller.rb +32 -0
  13. data/app/controllers/decidim/accountability/admin/attachments_controller.rb +32 -0
  14. data/app/controllers/decidim/accountability/admin/results_controller.rb +7 -2
  15. data/app/helpers/decidim/accountability/admin/filterable_helper.rb +10 -0
  16. data/app/helpers/decidim/accountability/breadcrumb_helper.rb +3 -1
  17. data/app/models/decidim/accountability/result.rb +15 -2
  18. data/app/models/decidim/accountability/status.rb +5 -0
  19. data/app/views/decidim/accountability/admin/results/index.html.erb +52 -2
  20. data/app/views/decidim/accountability/results/_show_leaf.html.erb +2 -0
  21. data/app/views/decidim/accountability/results/_show_parent.html.erb +2 -0
  22. data/config/locales/ar.yml +0 -4
  23. data/config/locales/bg.yml +0 -4
  24. data/config/locales/ca.yml +14 -4
  25. data/config/locales/cs.yml +24 -4
  26. data/config/locales/da.yml +0 -4
  27. data/config/locales/de.yml +24 -4
  28. data/config/locales/el.yml +0 -4
  29. data/config/locales/en.yml +24 -4
  30. data/config/locales/es-MX.yml +12 -4
  31. data/config/locales/es-PY.yml +12 -4
  32. data/config/locales/es.yml +12 -4
  33. data/config/locales/eu.yml +0 -4
  34. data/config/locales/fi-plain.yml +24 -4
  35. data/config/locales/fi.yml +24 -4
  36. data/config/locales/fr-CA.yml +24 -4
  37. data/config/locales/fr.yml +24 -4
  38. data/config/locales/gl.yml +24 -4
  39. data/config/locales/hu.yml +0 -4
  40. data/config/locales/id-ID.yml +0 -4
  41. data/config/locales/is-IS.yml +24 -4
  42. data/config/locales/it.yml +24 -4
  43. data/config/locales/ja.yml +24 -4
  44. data/config/locales/lv.yml +0 -4
  45. data/config/locales/nl.yml +24 -4
  46. data/config/locales/no.yml +21 -4
  47. data/config/locales/pl.yml +24 -4
  48. data/config/locales/pt-BR.yml +0 -4
  49. data/config/locales/pt.yml +0 -4
  50. data/config/locales/ro-RO.yml +4 -4
  51. data/config/locales/ru.yml +0 -4
  52. data/config/locales/si-LK.yml +3 -0
  53. data/config/locales/sk.yml +7 -4
  54. data/config/locales/sl.yml +0 -4
  55. data/config/locales/sr-CS.yml +0 -4
  56. data/config/locales/sv.yml +24 -4
  57. data/config/locales/tr-TR.yml +22 -4
  58. data/config/locales/uk.yml +0 -4
  59. data/config/locales/zh-CN.yml +0 -4
  60. data/lib/decidim/accountability.rb +1 -0
  61. data/lib/decidim/accountability/admin_engine.rb +2 -0
  62. data/lib/decidim/accountability/api.rb +10 -0
  63. data/lib/decidim/accountability/component.rb +20 -8
  64. data/lib/decidim/accountability/engine.rb +0 -17
  65. data/lib/decidim/accountability/version.rb +1 -1
  66. data/lib/decidim/api/accountability_type.rb +26 -0
  67. data/lib/decidim/api/result_type.rb +32 -0
  68. data/lib/decidim/api/status_type.rb +19 -0
  69. data/lib/decidim/api/timeline_entry_type.rb +17 -0
  70. metadata +41 -30
  71. data/app/types/decidim/accountability/accountability_type.rb +0 -32
  72. data/app/types/decidim/accountability/result_type.rb +0 -35
  73. data/app/types/decidim/accountability/status_type.rb +0 -20
  74. data/app/types/decidim/accountability/timeline_entry_type.rb +0 -18
  75. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_results.html.erb +0 -12
  76. data/app/views/decidim/participatory_processes/participatory_process_groups/_result.html.erb +0 -32
@@ -15,6 +15,9 @@ si:
15
15
  models:
16
16
  status:
17
17
  name: තත්වය
18
+ content_blocks:
19
+ highlighted_results:
20
+ dates: දින
18
21
  import_mailer:
19
22
  import:
20
23
  errors: දෝෂ
@@ -122,6 +122,11 @@ sk:
122
122
  value_types:
123
123
  parent_presenter:
124
124
  not_found: 'Nadradený záznam nebol nájdený v databáze(ID: %{id})'
125
+ content_blocks:
126
+ highlighted_results:
127
+ dates: Dátumy
128
+ results: Výsledky
129
+ unspecified: Nešpecifikované
125
130
  import_mailer:
126
131
  import:
127
132
  errors: Chyby
@@ -149,6 +154,8 @@ sk:
149
154
  fields:
150
155
  description: Popis
151
156
  entry_date: Dátum
157
+ result_m:
158
+ view: Zobraziť
152
159
  results:
153
160
  count:
154
161
  results_count:
@@ -212,10 +219,6 @@ sk:
212
219
  description: Počet vytvorených výsledkov
213
220
  object: výsledky
214
221
  title: Výsledky
215
- participatory_processes:
216
- participatory_process_groups:
217
- highlighted_results:
218
- results: Výsledky
219
222
  resource_links:
220
223
  included_projects:
221
224
  result_project: Projekty, zahrnutý vo výsledku
@@ -121,10 +121,6 @@ sl:
121
121
  description: Število ustvarjenih rezultatov
122
122
  object: rezultati
123
123
  title: Rezultati
124
- participatory_processes:
125
- participatory_process_groups:
126
- highlighted_results:
127
- results: Rezultati
128
124
  resource_links:
129
125
  included_proposals:
130
126
  result_proposal: Predlogi, vključeni v rezultat
@@ -194,10 +194,6 @@ sr:
194
194
  description: Broj generisanih rezultata
195
195
  object: rezultati
196
196
  title: Rezultati
197
- participatory_processes:
198
- participatory_process_groups:
199
- highlighted_results:
200
- results: Rezultati
201
197
  resource_links:
202
198
  included_projects:
203
199
  result_project: Projekti koji su deo ovog rezultata
@@ -32,6 +32,8 @@ sv:
32
32
  decidim:
33
33
  accountability:
34
34
  actions:
35
+ attachment_collections: Mappar
36
+ attachments: Bifogade filer
35
37
  confirm_destroy: Vill du radera detta %{name}?
36
38
  destroy: Radera
37
39
  edit: Redigera
@@ -42,6 +44,7 @@ sv:
42
44
  title: Åtgärder
43
45
  admin:
44
46
  exports:
47
+ result_comments: Kommentarer
45
48
  results: Resultat
46
49
  import_results:
47
50
  new:
@@ -121,6 +124,11 @@ sv:
121
124
  value_types:
122
125
  parent_presenter:
123
126
  not_found: 'Föräldraposten hittades inte i databasen (ID: %{id})'
127
+ content_blocks:
128
+ highlighted_results:
129
+ dates: Datum
130
+ results: Resultat
131
+ unspecified: Ej angivet
124
132
  import_mailer:
125
133
  import:
126
134
  errors: Fel
@@ -133,8 +141,12 @@ sv:
133
141
  models:
134
142
  result:
135
143
  fields:
144
+ category: Kategori
145
+ created_at: Skapad
136
146
  end_date: Slutdatum
147
+ id: ID
137
148
  progress: Behandling
149
+ scope: Omfång
138
150
  start_date: Startdatum
139
151
  status: Status
140
152
  title: Titel
@@ -148,6 +160,9 @@ sv:
148
160
  fields:
149
161
  description: Beskrivning
150
162
  entry_date: Datum
163
+ result_m:
164
+ executed: Utfört
165
+ view: Visa
151
166
  results:
152
167
  count:
153
168
  results_count:
@@ -178,6 +193,15 @@ sv:
178
193
  votes: Stöd
179
194
  timeline:
180
195
  title: Projektutveckling
196
+ admin:
197
+ filters:
198
+ results:
199
+ category_id_eq:
200
+ label: Kategori
201
+ scope_id_eq:
202
+ label: Omfång
203
+ status_id_eq:
204
+ label: Status
181
205
  components:
182
206
  accountability:
183
207
  name: Ansvarsskyldighet
@@ -212,10 +236,6 @@ sv:
212
236
  description: Antal genererade resultat
213
237
  object: resultat
214
238
  title: Resultat
215
- participatory_processes:
216
- participatory_process_groups:
217
- highlighted_results:
218
- results: Resultat
219
239
  participatory_spaces:
220
240
  highlighted_results:
221
241
  see_all: Se alla resultat (%{count})
@@ -42,6 +42,7 @@ tr:
42
42
  title: Eylemler
43
43
  admin:
44
44
  exports:
45
+ result_comments: Yorumlar
45
46
  results: Sonuçlar
46
47
  import_results:
47
48
  new:
@@ -121,6 +122,11 @@ tr:
121
122
  value_types:
122
123
  parent_presenter:
123
124
  not_found: 'Üst veritabanında bulunamadı (ID: %{id})'
125
+ content_blocks:
126
+ highlighted_results:
127
+ dates: Tarih
128
+ results: Sonuç
129
+ unspecified: Belirtilmemiş
124
130
  import_mailer:
125
131
  import:
126
132
  errors: Hatalar
@@ -133,8 +139,12 @@ tr:
133
139
  models:
134
140
  result:
135
141
  fields:
142
+ category: Kategori
143
+ created_at: Oluşturuldu
136
144
  end_date: Bitiş tarihi
145
+ id: ID
137
146
  progress: İlerleme
147
+ scope: Kapsam
138
148
  start_date: Başlangıç tarihi
139
149
  status: durum
140
150
  title: Başlık
@@ -148,6 +158,9 @@ tr:
148
158
  fields:
149
159
  description: Açıklama
150
160
  entry_date: tarih
161
+ result_m:
162
+ executed: Yürütüldü
163
+ view: Görünüm
151
164
  results:
152
165
  count:
153
166
  results_count:
@@ -178,6 +191,15 @@ tr:
178
191
  votes: Destekler
179
192
  timeline:
180
193
  title: Proje gelişimi
194
+ admin:
195
+ filters:
196
+ results:
197
+ category_id_eq:
198
+ label: Kategori
199
+ scope_id_eq:
200
+ label: Kapsam
201
+ status_id_eq:
202
+ label: Durum
181
203
  components:
182
204
  accountability:
183
205
  name: Sorumluluk
@@ -212,10 +234,6 @@ tr:
212
234
  description: Üretilen sonuç sayısı
213
235
  object: sonuçlar
214
236
  title: Sonuçlar
215
- participatory_processes:
216
- participatory_process_groups:
217
- highlighted_results:
218
- results: Sonuçlar
219
237
  participatory_spaces:
220
238
  highlighted_results:
221
239
  see_all: Tüm sonuçları gör (%{count})
@@ -183,10 +183,6 @@ uk:
183
183
  email_outro: Ви отримали це сповіщення, тому що ви стежите за "%{proposal_title}". Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
184
184
  email_subject: Оновлення до %{proposal_title}
185
185
  notification_title: Пропозиція <a href="%{proposal_path}">%{proposal_title}</a> була включена до підсумку <a href="%{resource_path}">%{resource_title}</a>.
186
- participatory_processes:
187
- participatory_process_groups:
188
- highlighted_results:
189
- results: Підсумки
190
186
  resource_links:
191
187
  included_projects:
192
188
  result_project: Проекти, включені до цих підсумків
@@ -209,10 +209,6 @@ zh-CN:
209
209
  description: 生成的结果数
210
210
  object: 结果
211
211
  title: 成果
212
- participatory_processes:
213
- participatory_process_groups:
214
- highlighted_results:
215
- results: 成果
216
212
  participatory_spaces:
217
213
  highlighted_results:
218
214
  see_all: 查看所有结果 (%{count})
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "decidim/accountability/admin"
4
+ require "decidim/accountability/api"
4
5
  require "decidim/accountability/engine"
5
6
  require "decidim/accountability/admin_engine"
6
7
  require "decidim/accountability/component"
@@ -16,6 +16,8 @@ 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
21
  resources :timeline_entries, except: [:show]
20
22
  end
21
23
  get :import_results, to: "import_results#new"
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ autoload :AccountabilityType, "decidim/api/accountability_type"
6
+ autoload :ResultType, "decidim/api/result_type"
7
+ autoload :StatusType, "decidim/api/status_type"
8
+ autoload :TimelineEntryType, "decidim/api/timeline_entry_type"
9
+ end
10
+ end
@@ -54,6 +54,18 @@ Decidim.register_component(:accountability) do |component|
54
54
  exports.serializer Decidim::Accountability::ResultSerializer
55
55
  end
56
56
 
57
+ component.exports :result_comments do |exports|
58
+ exports.collection do |component_instance|
59
+ Decidim::Comments::Export.comments_for_resource(
60
+ Decidim::Accountability::Result, component_instance
61
+ )
62
+ end
63
+
64
+ exports.include_in_open_data = true
65
+
66
+ exports.serializer Decidim::Comments::CommentSerializer
67
+ end
68
+
57
69
  component.seeds do |participatory_space|
58
70
  admin_user = Decidim::User.find_by(
59
71
  organization: participatory_space.organization,
@@ -66,7 +78,7 @@ Decidim.register_component(:accountability) do |component|
66
78
  published_at: Time.current,
67
79
  participatory_space: participatory_space,
68
80
  settings: {
69
- intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) },
81
+ intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(word_count: 4) },
70
82
  categories_label: Decidim::Faker::Localized.word,
71
83
  subcategories_label: Decidim::Faker::Localized.word,
72
84
  heading_parent_level_results: Decidim::Faker::Localized.word,
@@ -94,9 +106,9 @@ Decidim.register_component(:accountability) do |component|
94
106
 
95
107
  2.times do
96
108
  categories << Decidim::Category.create!(
97
- name: Decidim::Faker::Localized.sentence(5),
109
+ name: Decidim::Faker::Localized.sentence(word_count: 5),
98
110
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
99
- Decidim::Faker::Localized.paragraph(3)
111
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
100
112
  end,
101
113
  parent: parent_category,
102
114
  participatory_space: participatory_space
@@ -111,9 +123,9 @@ Decidim.register_component(:accountability) do |component|
111
123
  component: component,
112
124
  scope: participatory_space.organization.scopes.sample,
113
125
  category: category,
114
- title: Decidim::Faker::Localized.sentence(2),
126
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
115
127
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
116
- Decidim::Faker::Localized.paragraph(3)
128
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
117
129
  end
118
130
  },
119
131
  visibility: "all"
@@ -132,9 +144,9 @@ Decidim.register_component(:accountability) do |component|
132
144
  end_date: Time.zone.today + 10,
133
145
  status: Decidim::Accountability::Status.all.sample,
134
146
  progress: rand(1..100),
135
- title: Decidim::Faker::Localized.sentence(2),
147
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
136
148
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
137
- Decidim::Faker::Localized.paragraph(3)
149
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
138
150
  end
139
151
  },
140
152
  visibility: "all"
@@ -143,7 +155,7 @@ Decidim.register_component(:accountability) do |component|
143
155
  rand(0..5).times do |i|
144
156
  child_result.timeline_entries.create!(
145
157
  entry_date: child_result.start_date + i.days,
146
- description: Decidim::Faker::Localized.sentence(2)
158
+ description: Decidim::Faker::Localized.sentence(word_count: 2)
147
159
  )
148
160
  end
149
161
 
@@ -26,23 +26,6 @@ module Decidim
26
26
  Decidim.view_hooks.register(:participatory_space_highlighted_elements, priority: Decidim::ViewHooks::LOW_PRIORITY) do |view_context|
27
27
  view_context.cell("decidim/accountability/highlighted_results", view_context.current_participatory_space)
28
28
  end
29
-
30
- if defined? Decidim::ParticipatoryProcesses
31
- Decidim::ParticipatoryProcesses.view_hooks.register(:process_group_highlighted_elements, priority: Decidim::ViewHooks::LOW_PRIORITY) do |view_context|
32
- published_components = Decidim::Component.where(participatory_space: view_context.participatory_processes).published
33
- results = Decidim::Accountability::Result.where(component: published_components).order_randomly(rand * 2 - 1).limit(4)
34
-
35
- next unless results.any?
36
-
37
- view_context.extend Decidim::Accountability::ApplicationHelper
38
- view_context.render(
39
- partial: "decidim/participatory_processes/participatory_process_groups/highlighted_results",
40
- locals: {
41
- results: results
42
- }
43
- )
44
- end
45
- end
46
29
  end
47
30
 
48
31
  initializer "decidim_accountability.add_cells_view_paths" 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.23.3"
7
+ "0.24.0.rc1"
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ class AccountabilityType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::ComponentInterface
7
+
8
+ graphql_name "Accountability"
9
+ description "An accountability component of a participatory space."
10
+
11
+ field :results, Decidim::Accountability::ResultType.connection_type, null: true, connection: true
12
+
13
+ def results
14
+ Result.where(component: object).includes(:component)
15
+ end
16
+
17
+ field :result, Decidim::Accountability::ResultType, null: true do
18
+ argument :id, ID, required: true
19
+ end
20
+
21
+ def result(**args)
22
+ Result.where(component: object).find_by(id: args[:id])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ class ResultType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::ComponentInterface
7
+ implements Decidim::Core::CategorizableInterface
8
+ implements Decidim::Comments::CommentableInterface
9
+ implements Decidim::Core::ScopableInterface
10
+
11
+ description "A result"
12
+
13
+ field :id, GraphQL::Types::ID, "The internal ID for this result", null: false
14
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this result", null: true
15
+ field :description, Decidim::Core::TranslatedFieldType, "The description for this result", null: true
16
+ field :reference, GraphQL::Types::String, "The reference for this result", null: true
17
+ field :start_date, Decidim::Core::DateType, "The start date for this result", null: true
18
+ field :end_date, Decidim::Core::DateType, "The end date for this result", null: true
19
+ field :progress, GraphQL::Types::Float, "The progress for this result", null: true
20
+ field :created_at, Decidim::Core::DateTimeType, "When this result was created", null: true
21
+ field :updated_at, Decidim::Core::DateTimeType, "When this result was updated", null: true
22
+ field :children_count, GraphQL::Types::Int, "The number of children results", null: true
23
+ field :weight, GraphQL::Types::Int, "The order of this result", null: false
24
+ field :external_id, GraphQL::Types::String, "The external ID for this result", null: true
25
+
26
+ field :children, [Decidim::Accountability::ResultType, { null: true }], "The childrens results", null: true
27
+ field :parent, Decidim::Accountability::ResultType, "The parent result", null: true
28
+ field :status, Decidim::Accountability::StatusType, "The status for this result", null: true
29
+ field :timeline_entries, [Decidim::Accountability::TimelineEntryType, { null: true }], "The timeline entries for this result", null: true
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ class StatusType < Decidim::Api::Types::BaseObject
6
+ description "A status"
7
+
8
+ field :id, GraphQL::Types::ID, "The internal ID for this status", null: false
9
+ field :key, GraphQL::Types::String, "The key for this status", null: true
10
+ 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
+ field :progress, GraphQL::Types::Int, "The progress for this status", null: true
15
+
16
+ field :results, [Decidim::Accountability::ResultType, { null: true }], "The results for this status", null: true
17
+ end
18
+ end
19
+ end