decidim-accountability 0.28.2 → 0.29.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/accountability/highlighted_results_for_component_cell.rb +0 -3
  3. data/app/cells/decidim/accountability/project_cell.rb +1 -6
  4. data/app/cells/decidim/accountability/result_l_cell.rb +1 -2
  5. data/app/cells/decidim/accountability/result_metadata_cell.rb +0 -6
  6. data/app/cells/decidim/accountability/results_cell.rb +0 -2
  7. data/app/cells/decidim/accountability/status_cell.rb +11 -8
  8. data/app/commands/decidim/accountability/admin/create_imported_result.rb +18 -85
  9. data/app/commands/decidim/accountability/admin/create_result.rb +12 -86
  10. data/app/commands/decidim/accountability/admin/create_status.rb +3 -31
  11. data/app/commands/decidim/accountability/admin/create_timeline_entry.rb +3 -30
  12. data/app/commands/decidim/accountability/admin/has_result_command.rb +54 -0
  13. data/app/commands/decidim/accountability/admin/update_imported_result.rb +16 -70
  14. data/app/commands/decidim/accountability/admin/update_result.rb +10 -72
  15. data/app/commands/decidim/accountability/admin/update_status.rb +3 -39
  16. data/app/commands/decidim/accountability/admin/update_timeline_entry.rb +3 -38
  17. data/app/controllers/decidim/accountability/admin/results_controller.rb +1 -1
  18. data/app/controllers/decidim/accountability/admin/statuses_controller.rb +7 -8
  19. data/app/controllers/decidim/accountability/admin/timeline_entries_controller.rb +8 -8
  20. data/app/controllers/decidim/accountability/results_controller.rb +1 -21
  21. data/app/helpers/decidim/accountability/application_helper.rb +0 -34
  22. data/app/helpers/decidim/accountability/breadcrumb_helper.rb +0 -4
  23. data/app/models/decidim/accountability/result.rb +1 -1
  24. data/app/models/decidim/accountability/status.rb +1 -1
  25. data/app/packs/src/decidim/accountability/index.js +1 -1
  26. data/app/services/decidim/accountability/results_csv_importer.rb +1 -1
  27. data/app/views/decidim/accountability/admin/results/index.html.erb +1 -1
  28. data/app/views/decidim/accountability/admin/statuses/index.html.erb +2 -2
  29. data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +1 -1
  30. data/app/views/decidim/accountability/results/_home_categories.html.erb +2 -2
  31. data/app/views/decidim/accountability/results/_nav_breadcrumb.html.erb +8 -8
  32. data/app/views/decidim/accountability/results/_project.html.erb +1 -1
  33. data/app/views/decidim/participatory_spaces/_result.html.erb +3 -3
  34. data/config/locales/ar.yml +0 -12
  35. data/config/locales/bg.yml +0 -12
  36. data/config/locales/ca.yml +0 -12
  37. data/config/locales/cs.yml +0 -12
  38. data/config/locales/da.yml +0 -11
  39. data/config/locales/de.yml +0 -12
  40. data/config/locales/el.yml +0 -12
  41. data/config/locales/en.yml +0 -12
  42. data/config/locales/es-MX.yml +0 -12
  43. data/config/locales/es-PY.yml +0 -12
  44. data/config/locales/es.yml +0 -12
  45. data/config/locales/eu.yml +0 -12
  46. data/config/locales/fi-plain.yml +0 -12
  47. data/config/locales/fi.yml +0 -12
  48. data/config/locales/fr-CA.yml +0 -12
  49. data/config/locales/fr.yml +0 -12
  50. data/config/locales/ga-IE.yml +0 -8
  51. data/config/locales/gl.yml +0 -12
  52. data/config/locales/he-IL.yml +0 -12
  53. data/config/locales/hu.yml +0 -12
  54. data/config/locales/id-ID.yml +0 -11
  55. data/config/locales/is-IS.yml +0 -12
  56. data/config/locales/it.yml +0 -12
  57. data/config/locales/ja.yml +0 -12
  58. data/config/locales/ko.yml +0 -12
  59. data/config/locales/lb.yml +0 -12
  60. data/config/locales/lt.yml +0 -12
  61. data/config/locales/lv.yml +0 -11
  62. data/config/locales/nl.yml +0 -12
  63. data/config/locales/no.yml +0 -12
  64. data/config/locales/pl.yml +0 -12
  65. data/config/locales/pt-BR.yml +0 -12
  66. data/config/locales/pt.yml +0 -12
  67. data/config/locales/ro-RO.yml +0 -12
  68. data/config/locales/ru.yml +0 -11
  69. data/config/locales/si-LK.yml +0 -5
  70. data/config/locales/sk.yml +0 -11
  71. data/config/locales/sl.yml +0 -4
  72. data/config/locales/sq-AL.yml +0 -12
  73. data/config/locales/sr-CS.yml +0 -11
  74. data/config/locales/sv.yml +0 -12
  75. data/config/locales/th-TH.yml +0 -1
  76. data/config/locales/tr-TR.yml +0 -12
  77. data/config/locales/uk.yml +0 -11
  78. data/config/locales/zh-CN.yml +0 -11
  79. data/config/locales/zh-TW.yml +0 -12
  80. data/decidim-accountability.gemspec +1 -1
  81. data/lib/decidim/accountability/component.rb +0 -4
  82. data/lib/decidim/accountability/seeds.rb +76 -67
  83. data/lib/decidim/accountability/test/factories.rb +0 -4
  84. data/lib/decidim/accountability/version.rb +1 -1
  85. data/lib/decidim/api/result_type.rb +1 -1
  86. metadata +24 -26
  87. data/app/commands/decidim/accountability/admin/destroy_result.rb +0 -43
  88. data/app/services/decidim/accountability/result_stats_calculator.rb +0 -49
  89. data/app/views/decidim/accountability/results/_stats_box.html.erb +0 -79
@@ -219,15 +219,7 @@ zh-TW:
219
219
  search: 搜尋操作
220
220
  show:
221
221
  stats:
222
- attendees: 與會者
223
222
  back_to_resource: 返回至結果
224
- comments: 評論
225
- contributions: 貢獻
226
- last_edited_by: 最後編輯者
227
- last_updated_at: 更新時間
228
- meetings: 會議
229
- proposals: 提案
230
- votes: 支援
231
223
  timeline:
232
224
  title: 專案評估
233
225
  admin:
@@ -246,16 +238,12 @@ zh-TW:
246
238
  name: 問責
247
239
  settings:
248
240
  global:
249
- categories_label: 類別名稱
250
241
  comments_enabled: 已啟用留言
251
242
  comments_max_length: 留言字數上限 (0 表示使用預設)
252
243
  display_progress_enabled: 顯示進度
253
- heading_leaf_level_results: 專案名稱
254
- heading_parent_level_results: 結果名稱
255
244
  intro: 介紹
256
245
  scope_id: 範圍
257
246
  scopes_enabled: 啟用的範圍
258
- subcategories_label: 子類別名稱
259
247
  step:
260
248
  comments_blocked: 留言已封鎖
261
249
  events:
@@ -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.1.0"
22
+ s.required_ruby_version = "~> 3.2.0"
23
23
 
24
24
  s.name = "decidim-accountability"
25
25
  s.summary = "Decidim accountability module"
@@ -30,10 +30,6 @@ Decidim.register_component(:accountability) do |component|
30
30
  settings.attribute :comments_enabled, type: :boolean, default: true
31
31
  settings.attribute :comments_max_length, type: :integer, required: true
32
32
  settings.attribute :intro, type: :text, translated: true, editor: true
33
- settings.attribute :categories_label, type: :string, translated: true, editor: true
34
- settings.attribute :subcategories_label, type: :string, translated: true, editor: true
35
- settings.attribute :heading_parent_level_results, type: :string, translated: true, editor: true
36
- settings.attribute :heading_leaf_level_results, type: :string, translated: true, editor: true
37
33
  settings.attribute :display_progress_enabled, type: :boolean, default: true
38
34
  end
39
35
 
@@ -4,7 +4,7 @@ require "decidim/components/namer"
4
4
 
5
5
  module Decidim
6
6
  module Accountability
7
- class Seeds
7
+ class Seeds < Decidim::Seeds
8
8
  attr_reader :participatory_space
9
9
 
10
10
  def initialize(participatory_space:)
@@ -12,11 +12,20 @@ module Decidim
12
12
  end
13
13
 
14
14
  def call
15
- admin_user = Decidim::User.find_by(
16
- organization: participatory_space.organization,
17
- email: "admin@example.org"
18
- )
15
+ component = create_component!
16
+
17
+ create_statuses!(component:)
18
+
19
+ 3.times do
20
+ categories = create_categories!
21
+
22
+ categories.each do |category|
23
+ create_result!(component:, category:)
24
+ end
25
+ end
26
+ end
19
27
 
28
+ def create_component!
20
29
  params = {
21
30
  name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name,
22
31
  manifest_name: :accountability,
@@ -24,19 +33,17 @@ module Decidim
24
33
  participatory_space:,
25
34
  settings: {
26
35
  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
36
  scopes_enabled: true,
32
37
  scope_id: participatory_space.scope&.id
33
38
  }
34
39
  }
35
40
 
36
- component = Decidim.traceability.perform_action!("publish", Decidim::Component, admin_user, visibility: "all") do
41
+ Decidim.traceability.perform_action!("publish", Decidim::Component, admin_user, visibility: "all") do
37
42
  Decidim::Component.create!(params)
38
43
  end
44
+ end
39
45
 
46
+ def create_statuses!(component:)
40
47
  5.times do |i|
41
48
  Decidim::Accountability::Status.create!(
42
49
  component:,
@@ -44,70 +51,72 @@ module Decidim
44
51
  key: "status_#{i}"
45
52
  )
46
53
  end
54
+ end
47
55
 
48
- 3.times do
49
- parent_category = participatory_space.categories.sample
50
- categories = [parent_category]
56
+ def create_categories!
57
+ parent_category = participatory_space.categories.sample
58
+ categories = [parent_category]
51
59
 
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
60
+ 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
+ )
69
+ end
62
70
 
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
- )
71
+ categories
72
+ end
73
+
74
+ def create_result!(component:, category:)
75
+ result = Decidim.traceability.create!(
76
+ Decidim::Accountability::Result,
77
+ admin_user,
78
+ {
79
+ component:,
80
+ scope: participatory_space.organization.scopes.sample,
81
+ category:,
82
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
83
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
84
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
85
+ end
86
+ },
87
+ visibility: "all"
88
+ )
78
89
 
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
- )
90
+ Decidim::Comments::Seed.comments_for(result)
91
+
92
+ 3.times do
93
+ child_result = Decidim.traceability.create!(
94
+ Decidim::Accountability::Result,
95
+ admin_user,
96
+ {
97
+ component:,
98
+ parent: result,
99
+ start_date: Time.zone.today,
100
+ end_date: Time.zone.today + 10,
101
+ status: Decidim::Accountability::Status.all.sample,
102
+ progress: rand(1..100),
103
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
104
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
105
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
106
106
  end
107
+ },
108
+ visibility: "all"
109
+ )
107
110
 
108
- Decidim::Comments::Seed.comments_for(child_result)
109
- end
111
+ rand(0..5).times do |i|
112
+ child_result.timeline_entries.create!(
113
+ entry_date: child_result.start_date + i.days,
114
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
115
+ description: Decidim::Faker::Localized.paragraph(sentence_count: 1)
116
+ )
110
117
  end
118
+
119
+ Decidim::Comments::Seed.comments_for(child_result)
111
120
  end
112
121
  end
113
122
  end
@@ -18,10 +18,6 @@ FactoryBot.define do
18
18
  settings do
19
19
  {
20
20
  intro: generate_localized_description(:accountability_component_intro, skip_injection:),
21
- categories_label: generate_localized_word(:accountability_component_categories_label, skip_injection:),
22
- subcategories_label: generate_localized_word(:accountability_component_subcategories_label, skip_injection:),
23
- heading_parent_level_results: generate_localized_word(:accountability_component_heading_parent_level_results, skip_injection:),
24
- heading_leaf_level_results: generate_localized_word(:accountability_component_heading_leaf_level_results, skip_injection:),
25
21
  scopes_enabled: true,
26
22
  scope_id: participatory_space.scope&.id
27
23
  }
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-accountability version.
5
5
  module Accountability
6
6
  def self.version
7
- "0.28.2"
7
+ "0.29.0.rc2"
8
8
  end
9
9
  end
10
10
  end
@@ -22,7 +22,7 @@ module Decidim
22
22
  field :weight, GraphQL::Types::Int, "The order of this result", null: false
23
23
  field :external_id, GraphQL::Types::String, "The external ID for this result", null: true
24
24
 
25
- field :children, [Decidim::Accountability::ResultType, { null: true }], "The childrens results", null: true
25
+ field :children, [Decidim::Accountability::ResultType, { null: true }], "The children's results", null: true
26
26
  field :parent, Decidim::Accountability::ResultType, "The parent result", null: true
27
27
  field :status, Decidim::Accountability::StatusType, "The status for this result", null: true
28
28
  field :timeline_entries, [Decidim::Accountability::TimelineEntryType, { null: true }], "The timeline entries for this result", null: true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-accountability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2
4
+ version: 0.29.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -18,126 +18,126 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.28.2
21
+ version: 0.29.0.rc2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.28.2
28
+ version: 0.29.0.rc2
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-core
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.28.2
35
+ version: 0.29.0.rc2
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.28.2
42
+ version: 0.29.0.rc2
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: decidim-admin
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.28.2
49
+ version: 0.29.0.rc2
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.28.2
56
+ version: 0.29.0.rc2
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: decidim-assemblies
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.28.2
63
+ version: 0.29.0.rc2
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.28.2
70
+ version: 0.29.0.rc2
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: decidim-comments
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.28.2
77
+ version: 0.29.0.rc2
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.28.2
84
+ version: 0.29.0.rc2
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: decidim-dev
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.28.2
91
+ version: 0.29.0.rc2
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.28.2
98
+ version: 0.29.0.rc2
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-meetings
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.28.2
105
+ version: 0.29.0.rc2
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - '='
111
111
  - !ruby/object:Gem::Version
112
- version: 0.28.2
112
+ version: 0.29.0.rc2
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-participatory_processes
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.28.2
119
+ version: 0.29.0.rc2
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 0.28.2
126
+ version: 0.29.0.rc2
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: decidim-proposals
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.28.2
133
+ version: 0.29.0.rc2
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - '='
139
139
  - !ruby/object:Gem::Version
140
- version: 0.28.2
140
+ version: 0.29.0.rc2
141
141
  description: An accountability component for decidim's participatory spaces.
142
142
  email:
143
143
  - josepjaume@gmail.com
@@ -175,7 +175,7 @@ files:
175
175
  - app/commands/decidim/accountability/admin/create_result.rb
176
176
  - app/commands/decidim/accountability/admin/create_status.rb
177
177
  - app/commands/decidim/accountability/admin/create_timeline_entry.rb
178
- - app/commands/decidim/accountability/admin/destroy_result.rb
178
+ - app/commands/decidim/accountability/admin/has_result_command.rb
179
179
  - app/commands/decidim/accountability/admin/import_projects_to_accountability.rb
180
180
  - app/commands/decidim/accountability/admin/update_imported_result.rb
181
181
  - app/commands/decidim/accountability/admin/update_result.rb
@@ -232,7 +232,6 @@ files:
232
232
  - app/presenters/decidim/accountability/admin_log/value_types/parent_presenter.rb
233
233
  - app/queries/decidim/accountability/metrics/results_metric_manage.rb
234
234
  - app/services/decidim/accountability/diff_renderer.rb
235
- - app/services/decidim/accountability/result_stats_calculator.rb
236
235
  - app/services/decidim/accountability/results_calculator.rb
237
236
  - app/services/decidim/accountability/results_csv_importer.rb
238
237
  - app/views/decidim/accountability/admin/import_results/new.html.erb
@@ -259,7 +258,6 @@ files:
259
258
  - app/views/decidim/accountability/results/_projects_aside.html.erb
260
259
  - app/views/decidim/accountability/results/_scope_filters.html.erb
261
260
  - app/views/decidim/accountability/results/_search.html.erb
262
- - app/views/decidim/accountability/results/_stats_box.html.erb
263
261
  - app/views/decidim/accountability/results/home.html.erb
264
262
  - app/views/decidim/accountability/results/index.html.erb
265
263
  - app/views/decidim/accountability/results/index.js.erb
@@ -393,14 +391,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
393
391
  requirements:
394
392
  - - "~>"
395
393
  - !ruby/object:Gem::Version
396
- version: 3.1.0
394
+ version: 3.2.0
397
395
  required_rubygems_version: !ruby/object:Gem::Requirement
398
396
  requirements:
399
- - - ">="
397
+ - - ">"
400
398
  - !ruby/object:Gem::Version
401
- version: '0'
399
+ version: 1.3.1
402
400
  requirements: []
403
- rubygems_version: 3.3.7
401
+ rubygems_version: 3.4.10
404
402
  signing_key:
405
403
  specification_version: 4
406
404
  summary: Decidim accountability module
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Accountability
5
- module Admin
6
- # This command is executed when the user destroys a Result from the admin
7
- # panel.
8
- class DestroyResult < Decidim::Command
9
- # Initializes an UpdateResult Command.
10
- #
11
- # result - The current instance of the result to be destroyed.
12
- # current_user - the user performing the action
13
- def initialize(result, current_user)
14
- @result = result
15
- @current_user = current_user
16
- end
17
-
18
- # Destroys the result.
19
- #
20
- # Broadcasts :ok if successful, :invalid otherwise.
21
- def call
22
- destroy_result
23
-
24
- broadcast(:ok)
25
- end
26
-
27
- private
28
-
29
- attr_reader :result, :current_user
30
-
31
- def destroy_result
32
- Decidim.traceability.perform_action!(
33
- :delete,
34
- result,
35
- current_user
36
- ) do
37
- result.destroy!
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Accountability
5
- # This class handles statistics of results. Needs a `result` in
6
- # order to find the stats.
7
- class ResultStatsCalculator
8
- # Public: Initializes the service.
9
- # result - The result from which to calculate the stats.
10
- def initialize(result)
11
- @result = result
12
- end
13
-
14
- delegate :count, to: :proposals, prefix: true
15
-
16
- def votes_count
17
- return 0 unless proposals
18
-
19
- proposals.sum { |proposal| proposal.votes.size }
20
- end
21
-
22
- def comments_count
23
- proposals.sum(:comments_count)
24
- end
25
-
26
- def attendees_count
27
- meetings.where("attendees_count > 0").sum(:attendees_count)
28
- end
29
-
30
- def contributions_count
31
- meetings.where("contributions_count > 0").sum(:contributions_count)
32
- end
33
-
34
- delegate :count, to: :meetings, prefix: true
35
-
36
- private
37
-
38
- attr_reader :result
39
-
40
- def proposals
41
- @proposals ||= result.linked_resources(:proposals, "included_proposals")
42
- end
43
-
44
- def meetings
45
- @meetings ||= result.linked_resources(:meetings, "meetings_through_proposals")
46
- end
47
- end
48
- end
49
- end
@@ -1,79 +0,0 @@
1
- <div class="columns section mediumlarge-4 large-3">
2
-
3
- <% if result.children.any? && component_settings.display_progress_enabled? && result.progress.present? %>
4
- <div class="progress-level section">
5
- <div class="progress-label">
6
- <span class="progress-text"><%= t("models.result.fields.progress", scope: "decidim.accountability") %>:</span>
7
- <span class="progress-figure">
8
- <%= display_percentage result.progress %>
9
- </span>
10
- </div>
11
-
12
- <div class="progress">
13
- <div class="progress-meter" style="width:<%= result.progress %>%"></div>
14
- </div>
15
- </div>
16
- <% end %>
17
-
18
- <% if result.versions.any? || result.linked_resources(:proposals, "included_proposals").any? %>
19
- <div class="card extra line-stats">
20
- <div class="definition-data">
21
- <% if result.versions.any? %>
22
- <div class="definition-data__item versions_count">
23
- <div>
24
- <%= resource_version_number(result.versions_count) %>
25
- <small>
26
- <%= resource_version_of(result.versions_count) %>
27
- </small>
28
- </div>
29
-
30
- <div>
31
- <span>
32
- <%= link_to_other_resource_versions(result_versions_path(result)) %>
33
- </span>
34
- </div>
35
- </div>
36
- <% if result.last_editor.present? %>
37
- <div class="definition-data__item last_revision_by">
38
- <span class="definition-data__title"><%= t("results.show.stats.last_edited_by", scope: "decidim.accountability") %></span>
39
- <%= render_resource_last_editor(result) %>
40
- </div>
41
- <% end %>
42
- <div class="definition-data__item last_updated_at">
43
- <span class="definition-data__title"><%= t("results.show.stats.last_updated_at", scope: "decidim.accountability") %></span>
44
- <%= l result.versions.last.created_at, format: :decidim_short %>
45
- </div>
46
- <% end %>
47
- <% if result.linked_resources(:proposals, "included_proposals").any? %>
48
- <div class="definition-data__item definition-data__item--double">
49
- <span class="definition-data__title"><%= t("results.show.stats.proposals", scope: "decidim.accountability") %></span>
50
- <span class="definition-data__number"><%= stats_calculator.proposals_count %></span>
51
- </div>
52
- <div class="definition-data__item definition-data__item--double">
53
- <span class="definition-data__title"><%= t("results.show.stats.meetings", scope: "decidim.accountability") %></span>
54
- <span class="definition-data__number"><%= stats_calculator.meetings_count %></span>
55
- </div>
56
- <div class="definition-data__item definition-data__item--double">
57
- <span class="definition-data__title"><%= t("results.show.stats.comments", scope: "decidim.accountability") %></span>
58
- <span class="definition-data__number"><%= stats_calculator.comments_count %></span>
59
- </div>
60
- <div class="definition-data__item definition-data__item--double">
61
- <span class="definition-data__title"><%= t("results.show.stats.attendees", scope: "decidim.accountability") %></span>
62
- <span class="definition-data__number"><%= stats_calculator.attendees_count %></span>
63
- </div>
64
- <div class="definition-data__item definition-data__item--double">
65
- <span class="definition-data__title"><%= t("results.show.stats.votes", scope: "decidim.accountability") %></span>
66
- <span class="definition-data__number"><%= stats_calculator.votes_count %></span>
67
- </div>
68
- <div class="definition-data__item definition-data__item--double">
69
- <span class="definition-data__title"><%= t("results.show.stats.contributions", scope: "decidim.accountability") %></span>
70
- <span class="definition-data__number"><%= stats_calculator.contributions_count %></span>
71
- </div>
72
- <% end %>
73
- </div>
74
- </div>
75
- <% end %>
76
-
77
- <%= resource_reference(result) %>
78
- <%= render partial: "decidim/shared/share_modal" %>
79
- </div>