decidim-accountability 0.14.4 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8999867c1290482081f6959190e5d94e4c7af0e6b03f296fa186edcf177cb48c
4
- data.tar.gz: 243d5b5743a7f29537b02686a9f87b26f3a394e2f70191d2c24b0033567c3464
3
+ metadata.gz: 68394a0c97e99bbd300e9a31cb7311cdf416849af05862fab2a33f292dcb1d61
4
+ data.tar.gz: a0bb8c05ca1cad771d1277f0d1e3b53b4891117a1a2314f429d130c3df5d3afa
5
5
  SHA512:
6
- metadata.gz: 63119061b3947adaf67842c7d754e43560d62814f18679fbd486c61956abe13bc563265cce1911a0e5075ddcaad37a12d587422cd07d5401a316423c4561888e
7
- data.tar.gz: 5cdef7cccfc74962817177a1920bd35bff57bc0494389b077e6684ba6412e5bf02b5cebb4041fd95691d646b88ecd92d323a2751cb8f88049d47566893a48233
6
+ metadata.gz: 54c2a7a799b366de6150f0ce1b8ee285d9254d56e63647c8be4383bbe480b2dc6a00ef7e7434b1b8668c1deee7ade02982bbbd6e5d2cff27311cc0892f5e3633
7
+ data.tar.gz: 43182a6fdf16984739c0af6210173a365c38fbf6a69e5645ba7405883dd5c2b0f920a936a9ce6b61967e7b7e06851d7c070c9aa212dd964e183a05ff76e1303b
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ # A cell to display when a Result has been created.
6
+ class ResultActivityCell < ActivityCell
7
+ def title
8
+ I18n.t(
9
+ "decidim.accountability.last_activity.new_result_at_html",
10
+ link: participatory_space_link
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -32,9 +32,7 @@ module Decidim
32
32
  attr_reader :result
33
33
 
34
34
  def create_result
35
- @result = Decidim.traceability.create!(
36
- Result,
37
- @form.current_user,
35
+ params = {
38
36
  component: @form.current_component,
39
37
  scope: @form.scope,
40
38
  category: @form.category,
@@ -47,6 +45,13 @@ module Decidim
47
45
  decidim_accountability_status_id: @form.decidim_accountability_status_id,
48
46
  external_id: @form.external_id.presence,
49
47
  weight: @form.weight
48
+ }
49
+
50
+ @result = Decidim.traceability.create!(
51
+ Result,
52
+ @form.current_user,
53
+ params,
54
+ visibility: "all"
50
55
  )
51
56
  end
52
57
 
@@ -82,12 +87,11 @@ module Decidim
82
87
 
83
88
  def notify_proposal_followers
84
89
  proposals.each do |proposal|
85
- authors_ids = proposal.authors.pluck(:id)
86
90
  Decidim::EventsManager.publish(
87
91
  event: "decidim.events.accountability.proposal_linked",
88
92
  event_class: Decidim::Accountability::ProposalLinkedEvent,
89
93
  resource: result,
90
- recipient_ids: authors_ids + proposal.followers.pluck(:id),
94
+ recipient_ids: proposal.followers.pluck(:id),
91
95
  extra: {
92
96
  proposal_id: proposal.id
93
97
  }
@@ -15,8 +15,8 @@ module Decidim
15
15
  attribute :decidim_category_id, Integer
16
16
  attribute :proposal_ids, Array[Integer]
17
17
  attribute :project_ids, Array[Integer]
18
- attribute :start_date, Date
19
- attribute :end_date, Date
18
+ attribute :start_date, Decidim::Attributes::LocalizedDate
19
+ attribute :end_date, Decidim::Attributes::LocalizedDate
20
20
  attribute :progress, Float
21
21
  attribute :decidim_accountability_status_id, Integer
22
22
  attribute :parent_id, Integer
@@ -9,7 +9,7 @@ module Decidim
9
9
  include TranslationsHelper
10
10
 
11
11
  attribute :decidim_accountability_result_id, Integer
12
- attribute :entry_date, Date
12
+ attribute :entry_date, Decidim::Attributes::LocalizedDate
13
13
  translatable_attribute :description, String
14
14
 
15
15
  validates :entry_date, presence: true
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ module Metrics
6
+ class ResultsMetricManage < Decidim::MetricManage
7
+ def metric_name
8
+ "results"
9
+ end
10
+
11
+ def save
12
+ return @registry if @registry
13
+
14
+ @registry = []
15
+ cumulative.each do |key, cumulative_value|
16
+ next if cumulative_value.zero?
17
+ quantity_value = quantity[key] || 0
18
+ category_id, space_type, space_id, related_object_id = key
19
+ record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
20
+ organization: @organization, decidim_category_id: category_id,
21
+ participatory_space_type: space_type, participatory_space_id: space_id,
22
+ related_object_type: "Decidim::Component", related_object_id: related_object_id)
23
+ record.assign_attributes(cumulative: cumulative_value, quantity: quantity_value)
24
+ @registry << record
25
+ end
26
+ @registry.each(&:save!)
27
+ @registry
28
+ end
29
+
30
+ private
31
+
32
+ def query
33
+ return @query if @query
34
+
35
+ spaces = Decidim.participatory_space_manifests.flat_map do |manifest|
36
+ manifest.participatory_spaces.call(@organization).public_spaces
37
+ end
38
+ components = Decidim::Component.where(participatory_space: spaces).published
39
+ @query = Decidim::Accountability::Result.where(component: components).joins(:component)
40
+ .left_outer_joins(:category)
41
+ @query = @query.where("decidim_accountability_results.created_at <= ?", end_time)
42
+ @query = @query.group("decidim_categorizations.decidim_category_id",
43
+ :participatory_space_type,
44
+ :participatory_space_id,
45
+ "decidim_components.id")
46
+
47
+ @query
48
+ end
49
+
50
+ def quantity
51
+ @quantity ||= query.where("decidim_accountability_results.created_at >= ?", start_time).count
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -116,6 +116,8 @@ ca:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'No s''ha trobat el pare a la base de dades (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nou resultat a %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ ca:
199
201
  email_outro: Has rebut aquesta notificació perquè estàs seguint "%{proposal_title}". Pots deixar de rebre notificacions seguint l'enllaç anterior.
200
202
  email_subject: Una actualització a %{proposal_title}
201
203
  notification_title: La proposta <a href="%{proposal_path}">%{proposal_title}</a> s'ha inclòs al resultat <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: resultats
207
+ title: Resultats
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ de:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Der Elternteil wurde nicht in der Datenbank gefunden (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Neues Ergebnis bei %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -198,6 +200,10 @@ de:
198
200
  email_intro: 'Der Vorschlag "%{proposal_title}" wurde in ein Ergebnis aufgenommen. Sie können es von dieser Seite sehen:'
199
201
  email_subject: Ein Update auf %{proposal_title}
200
202
  notification_title: Der Vorschlag <a href="%{proposal_path}">%{proposal_title}</a> wurde in das Ergebnis <a href="%{resource_path}">%{resource_title}</a>.
203
+ metrics:
204
+ results:
205
+ object: Ergebnisse
206
+ title: Ergebnisse
201
207
  participatory_processes:
202
208
  participatory_process_groups:
203
209
  highlighted_results:
@@ -117,6 +117,8 @@ en:
117
117
  value_types:
118
118
  parent_presenter:
119
119
  not_found: 'The parent was not found on the database (ID: %{id})'
120
+ last_activity:
121
+ new_result_at_html: "<span>New result at %{link}</span>"
120
122
  models:
121
123
  result:
122
124
  fields:
@@ -200,6 +202,10 @@ en:
200
202
  email_outro: You have received this notification because you are following "%{proposal_title}". You can stop receiving notifications following the previous link.
201
203
  email_subject: An update to %{proposal_title}
202
204
  notification_title: The proposal <a href="%{proposal_path}">%{proposal_title}</a> has been included in the <a href="%{resource_path}">%{resource_title}</a> result.
205
+ metrics:
206
+ results:
207
+ object: results
208
+ title: Results
203
209
  participatory_processes:
204
210
  participatory_process_groups:
205
211
  highlighted_results:
@@ -116,6 +116,8 @@ es-PY:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'El padre no se encontró en la base de datos (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nuevo resultado en %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ es-PY:
199
201
  email_outro: Has recibido esta notificación porque estás siguiendo "%{proposal_title}". Puedes dejar de recibir notificaciones siguiendo el enlace anterior.
200
202
  email_subject: Una actualización en %{proposal_title}
201
203
  notification_title: Se ha incluido la propuesta <a href="%{proposal_path}">%{proposal_title}</a> en el resultado <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: resultados
207
+ title: Resultados
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ es:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'El padre no se encontró en la base de datos (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nuevo resultado en %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ es:
199
201
  email_outro: Has recibido esta notificación porque estás siguiendo "%{proposal_title}". Puedes dejar de recibir notificaciones siguiendo el enlace anterior.
200
202
  email_subject: Una actualización en %{proposal_title}
201
203
  notification_title: Se ha incluido la propuesta <a href="%{proposal_path}">%{proposal_title}</a> en el resultado <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: resultados
207
+ title: Resultados
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ eu:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Gurasoa ez zen datu-basean aurkitu (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span> %{link}</span>emaitza berrian"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ eu:
199
201
  email_outro: Jakinarazpena jaso duzu "%{proposal_title}" jarraitzen ari zarenagatik. Aurreko esteka jarraituz jakinarazpenak jasotzeari uztea erabaki dezakezu.
200
202
  email_subject: '%{proposal_title} eguneratzea'
201
203
  notification_title: <a href="%{proposal_path}">%{proposal_title}</a> <a href="%{resource_path}">%{resource_title}</a> emaitza izan da.
204
+ metrics:
205
+ results:
206
+ object: emaitzak
207
+ title: Emaitzak
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ fi:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Pääelementtiä ei löytynyt tietokannasta (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Uusi tulos osoitteessa %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ fi:
199
201
  email_outro: Tämä ilmoitus on lähetetty sinulle, koska seuraat "%{proposal_title}". Voit lopettaa ilmoitusten vastaanottamisen edellä esitetyn linkin kautta.
200
202
  email_subject: Päivitys kohtaan %{proposal_title}
201
203
  notification_title: Ehdotus <a href="%{proposal_path}">%{proposal_title}</a> on sisällytetty tulokseen <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: tulokset
207
+ title: Tulokset
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ fr:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Le parent n''a pas été trouvé dans la base de données (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nouveau résultat à %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ fr:
199
201
  email_outro: Vous avez reçu cette notification parce que vous suivez "%{proposal_title}". Vous pouvez arrêter de recevoir des notifications à partir du lien précédent.
200
202
  email_subject: Une mise à jour de %{proposal_title}
201
203
  notification_title: La proposition <a href="%{proposal_path}">%{proposal_title}</a> a été incluse dans la réalisation <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: résultats
207
+ title: Résultats
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ gl:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Non se atopou o pai na base de datos (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Novo resultado en %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ gl:
199
201
  email_outro: Recibiches esta notificación porque estás seguindo "%{proposal_title}". Podes deixar de recibir notificacións seguindo a ligazón anterior.
200
202
  email_subject: Unha actualización a %{proposal_title}
201
203
  notification_title: A proposta <a href="%{proposal_path}">%{proposal_title}</a> foi incluída no <a href="%{resource_path}">%{resource_title}</a> resultado.
204
+ metrics:
205
+ results:
206
+ object: resultados
207
+ title: Resultados
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ hu:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Nem található az adatbázisban (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Új eredmény %{link}</span>kor"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ hu:
199
201
  email_outro: Ezt az értesítést azért kaptad, mert követed a(z) "%{proposal_title}" nevű ajánlást. Az értesítéseket a következő linkre kattintva kapcsolhatod ki.
200
202
  email_subject: A %{proposal_title} frissítve lett
201
203
  notification_title: 'A(z) <a href="%{proposal_path}">%{proposal_title}</a> javaslat szerepel ebben a(z) eredményben: <a href="%{resource_path}">%{resource_title}</a>.'
204
+ metrics:
205
+ results:
206
+ object: eredmények
207
+ title: Eredmények
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ it:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Il genitore non è stato trovato sul database (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nuovo risultato a %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ it:
199
201
  email_outro: Hai ricevuto questa notifica perché stai seguendo "%{proposal_title}". È possibile interrompere la ricezione di notifiche seguendo il collegamento precedente.
200
202
  email_subject: Un aggiornamento a %{proposal_title}
201
203
  notification_title: La proposta <a href="%{proposal_path}">%{proposal_title}</a> è stata inclusa nel risultato <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: risultati
207
+ title: risultati
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ nl:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Het bovenliggende element is niet gevonden in de database (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nieuw resultaat op %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ nl:
199
201
  email_outro: Je hebt deze melding ontvangen omdat je "%{proposal_title}" volgt. Je kan de meldingen deactiveren door te klikken op de vorige link.
200
202
  email_subject: Een update voor %{proposal_title}
201
203
  notification_title: Het voorstel <a href="%{proposal_path}">%{proposal_title}</a> is opgenomen in het <a href="%{resource_path}">%{resource_title}</a> resultaat.
204
+ metrics:
205
+ results:
206
+ object: uitslagen
207
+ title: resultaten
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -118,6 +118,8 @@ pl:
118
118
  value_types:
119
119
  parent_presenter:
120
120
  not_found: 'Nie znaleziono elementu nadrzędnego w bazie danych (ID: %{id})'
121
+ last_activity:
122
+ new_result_at_html: "<span>Nowy wynik na %{link}</span>"
121
123
  models:
122
124
  result:
123
125
  fields:
@@ -203,6 +205,10 @@ pl:
203
205
  email_outro: Otrzymałeś to powiadomienie, ponieważ obserwujesz "%{proposal_title}". Możesz przestać otrzymywać powiadomienia po poprzednim linku.
204
206
  email_subject: Aktualizacja do %{proposal_title}
205
207
  notification_title: Wniosek <a href="%{proposal_path}">%{proposal_title}</a> został uwzględniony w wyniku <a href="%{resource_path}">%{resource_title}</a>.
208
+ metrics:
209
+ results:
210
+ object: wyniki
211
+ title: Wyniki
206
212
  participatory_processes:
207
213
  participatory_process_groups:
208
214
  highlighted_results:
@@ -116,6 +116,8 @@ pt-BR:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'O pai não foi encontrado no banco de dados (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Novo resultado em %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ pt-BR:
199
201
  email_outro: Você recebeu esta notificação porque está seguindo "%{proposal_title}". Você pode parar de receber notificações após o link anterior.
200
202
  email_subject: Uma atualização para %{proposal_title}
201
203
  notification_title: A proposta <a href="%{proposal_path}">%{proposal_title}</a> foi incluída no resultado <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: resultados
207
+ title: Resultados
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -116,6 +116,8 @@ pt:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'O pai não foi encontrado no banco de dados (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Novo resultado em %{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -199,6 +201,10 @@ pt:
199
201
  email_outro: Você recebeu esta notificação porque está seguindo "%{proposal_title}". Você pode parar de receber notificações após o link anterior.
200
202
  email_subject: Uma atualização para %{proposal_title}
201
203
  notification_title: A proposta <a href="%{proposal_path}">%{proposal_title}</a> foi incluída no resultado <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: resultados
207
+ title: Resultados
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -50,7 +50,7 @@ sv:
50
50
  name: Tidslinje inmatning
51
51
  results:
52
52
  create:
53
- invalid: Det här har uppstått ett problem
53
+ invalid: Det har uppstått ett problem med att skapa det här resultatet
54
54
  success: Resultat har skapats framgångsrikt
55
55
  destroy:
56
56
  success: Resultatet har tagits bort
@@ -69,14 +69,14 @@ sv:
69
69
  current_selection: Aktuellt urval
70
70
  select: Välj
71
71
  update:
72
- invalid: Det har blivit ett problem med att uppdatera resultatet
72
+ invalid: Det har uppstått ett problem med att uppdatera det här resultatet
73
73
  success: Resultatet uppdaterades framgångsrikt
74
74
  shared:
75
75
  subnav:
76
76
  statuses: Statusar
77
77
  statuses:
78
78
  create:
79
- invalid: Det har blivit ett problem med att skapa denna status
79
+ invalid: Det har uppstått ett problem med att skapa denna status
80
80
  success: Status skapad
81
81
  destroy:
82
82
  success: Statusen har tagits bort
@@ -89,12 +89,12 @@ sv:
89
89
  create: Skapa status
90
90
  title: Ny status
91
91
  update:
92
- invalid: Det blivit ett problem med att uppdatera denna status
92
+ invalid: Det uppstått ett problem med att uppdatera denna status
93
93
  success: Status uppdaterad
94
94
  timeline_entries:
95
95
  create:
96
96
  invalid: Det har uppstått ett problem med att skapa den här inmatningen
97
- success: Inmatningen skapades med framgång
97
+ success: Inmatningen skapades
98
98
  destroy:
99
99
  success: Inmatningen har tagits bort
100
100
  edit:
@@ -116,6 +116,8 @@ sv:
116
116
  value_types:
117
117
  parent_presenter:
118
118
  not_found: 'Den överordnade hittades inte i databasen (ID: %{id})'
119
+ last_activity:
120
+ new_result_at_html: "<span>Nytt resultat på%{link}</span>"
119
121
  models:
120
122
  result:
121
123
  fields:
@@ -146,7 +148,7 @@ sv:
146
148
  categories_label: Kategorier
147
149
  subcategories_label: Underkategorier
148
150
  home_header:
149
- global_status: Global exekveringsstatus
151
+ global_status: Global utförandestatus
150
152
  nav_breadcrumb:
151
153
  global: Globalt utförande
152
154
  search:
@@ -199,6 +201,10 @@ sv:
199
201
  email_outro: Du har fått den här meddelandet eftersom du följer "%{proposal_title}". Du kan sluta ta emot meddelanden vid föregående länk.
200
202
  email_subject: En uppdatering till %{proposal_title}
201
203
  notification_title: Förslaget <a href="%{proposal_path}">%{proposal_title}</a> har inkluderats i resultat <a href="%{resource_path}">%{resource_title}</a>.
204
+ metrics:
205
+ results:
206
+ object: resultat
207
+ title: Resultat
202
208
  participatory_processes:
203
209
  participatory_process_groups:
204
210
  highlighted_results:
@@ -16,6 +16,7 @@ Decidim.register_component(:accountability) do |component|
16
16
  component.register_resource(:result) do |resource|
17
17
  resource.model_class_name = "Decidim::Accountability::Result"
18
18
  resource.template = "decidim/accountability/results/linked_results"
19
+ resource.card = "decidim/accountability/result"
19
20
  end
20
21
 
21
22
  component.settings(:global) do |settings|
@@ -52,7 +53,7 @@ Decidim.register_component(:accountability) do |component|
52
53
  email: "admin@example.org"
53
54
  )
54
55
 
55
- component = Decidim::Component.create!(
56
+ params = {
56
57
  name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name,
57
58
  manifest_name: :accountability,
58
59
  published_at: Time.current,
@@ -64,7 +65,11 @@ Decidim.register_component(:accountability) do |component|
64
65
  heading_parent_level_results: Decidim::Faker::Localized.word,
65
66
  heading_leaf_level_results: Decidim::Faker::Localized.word
66
67
  }
67
- )
68
+ }
69
+
70
+ component = Decidim.traceability.perform_action!("publish", Decidim::Component, admin_user, visibility: "all") do
71
+ Decidim::Component.create!(params)
72
+ end
68
73
 
69
74
  5.times do |i|
70
75
  Decidim::Accountability::Status.create!(
@@ -93,13 +98,16 @@ Decidim.register_component(:accountability) do |component|
93
98
  result = Decidim.traceability.create!(
94
99
  Decidim::Accountability::Result,
95
100
  admin_user,
96
- component: component,
97
- scope: participatory_space.organization.scopes.sample,
98
- category: category,
99
- title: Decidim::Faker::Localized.sentence(2),
100
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
101
- Decidim::Faker::Localized.paragraph(3)
102
- end
101
+ {
102
+ component: component,
103
+ scope: participatory_space.organization.scopes.sample,
104
+ category: category,
105
+ title: Decidim::Faker::Localized.sentence(2),
106
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
107
+ Decidim::Faker::Localized.paragraph(3)
108
+ end
109
+ },
110
+ visibility: "all"
103
111
  )
104
112
 
105
113
  Decidim::Comments::Seed.comments_for(result)
@@ -108,16 +116,19 @@ Decidim.register_component(:accountability) do |component|
108
116
  child_result = Decidim.traceability.create!(
109
117
  Decidim::Accountability::Result,
110
118
  admin_user,
111
- component: component,
112
- parent: result,
113
- start_date: Time.zone.today,
114
- end_date: Time.zone.today + 10,
115
- status: Decidim::Accountability::Status.all.sample,
116
- progress: rand(1..100),
117
- title: Decidim::Faker::Localized.sentence(2),
118
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
119
- Decidim::Faker::Localized.paragraph(3)
120
- end
119
+ {
120
+ component: component,
121
+ parent: result,
122
+ start_date: Time.zone.today,
123
+ end_date: Time.zone.today + 10,
124
+ status: Decidim::Accountability::Status.all.sample,
125
+ progress: rand(1..100),
126
+ title: Decidim::Faker::Localized.sentence(2),
127
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
128
+ Decidim::Faker::Localized.paragraph(3)
129
+ end
130
+ },
131
+ visibility: "all"
121
132
  )
122
133
 
123
134
  rand(0..5).times do |i|
@@ -56,6 +56,15 @@ module Decidim
56
56
  end
57
57
  end
58
58
  end
59
+
60
+ initializer "decidim_accountability.register_metrics" do
61
+ Decidim.metrics_registry.register(
62
+ :results,
63
+ "Decidim::Accountability::Metrics::ResultsMetricManage",
64
+ Decidim::MetricRegistry::NOT_HIGHLIGHTED,
65
+ 4
66
+ )
67
+ end
59
68
  end
60
69
  end
61
70
  end
@@ -13,7 +13,7 @@ FactoryBot.define do
13
13
  participatory_space { create(:participatory_process, :with_steps, organization: organization) }
14
14
  settings do
15
15
  {
16
- intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) },
16
+ intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title },
17
17
  categories_label: Decidim::Faker::Localized.word,
18
18
  subcategories_label: Decidim::Faker::Localized.word,
19
19
  heading_parent_level_results: Decidim::Faker::Localized.word,
@@ -26,14 +26,14 @@ FactoryBot.define do
26
26
  component { create(:accountability_component) }
27
27
  sequence(:key) { |n| "status_#{n}" }
28
28
  name { Decidim::Faker::Localized.word }
29
- description { Decidim::Faker::Localized.sentence(3) }
29
+ description { generate_localized_title }
30
30
  progress { rand(1..100) }
31
31
  end
32
32
 
33
33
  factory :result, class: "Decidim::Accountability::Result" do
34
34
  component { create(:accountability_component) }
35
- title { Decidim::Faker::Localized.sentence(3) }
36
- description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
35
+ title { generate_localized_title }
36
+ description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
37
37
  start_date { "12/7/2017" }
38
38
  end_date { "30/9/2017" }
39
39
  status { create :status, component: component }
@@ -43,6 +43,6 @@ FactoryBot.define do
43
43
  factory :timeline_entry, class: "Decidim::Accountability::TimelineEntry" do
44
44
  result { create(:result) }
45
45
  entry_date { "12/7/2017" }
46
- description { Decidim::Faker::Localized.sentence(2) }
46
+ description { generate_localized_title }
47
47
  end
48
48
  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.14.4"
7
+ "0.15.0"
8
8
  end
9
9
  end
10
10
  end
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.14.4
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-10-24 00:00:00.000000000 Z
13
+ date: 2018-11-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-comments
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.14.4
21
+ version: 0.15.0
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.14.4
28
+ version: 0.15.0
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.14.4
35
+ version: 0.15.0
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.14.4
42
+ version: 0.15.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: kaminari
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -74,98 +74,98 @@ dependencies:
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.14.4
77
+ version: 0.15.0
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.14.4
84
+ version: 0.15.0
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: decidim-assemblies
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.14.4
91
+ version: 0.15.0
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.14.4
98
+ version: 0.15.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-comments
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.14.4
105
+ version: 0.15.0
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.14.4
112
+ version: 0.15.0
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-dev
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.14.4
119
+ version: 0.15.0
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.14.4
126
+ version: 0.15.0
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: decidim-meetings
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.14.4
133
+ version: 0.15.0
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.14.4
140
+ version: 0.15.0
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: decidim-participatory_processes
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - '='
146
146
  - !ruby/object:Gem::Version
147
- version: 0.14.4
147
+ version: 0.15.0
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - '='
153
153
  - !ruby/object:Gem::Version
154
- version: 0.14.4
154
+ version: 0.15.0
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: decidim-proposals
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: 0.14.4
161
+ version: 0.15.0
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: 0.14.4
168
+ version: 0.15.0
169
169
  description: An accountability component for decidim's participatory spaces.
170
170
  email:
171
171
  - josepjaume@gmail.com
@@ -189,6 +189,7 @@ files:
189
189
  - app/assets/stylesheets/decidim/accountability/accountability/_lines_breadcrumb.scss
190
190
  - app/assets/stylesheets/decidim/accountability/accountability/_results.scss
191
191
  - app/assets/stylesheets/decidim/accountability/accountability/_versions.scss
192
+ - app/cells/decidim/accountability/result_activity_cell.rb
192
193
  - app/commands/decidim/accountability/admin/create_result.rb
193
194
  - app/commands/decidim/accountability/admin/create_status.rb
194
195
  - app/commands/decidim/accountability/admin/create_timeline_entry.rb
@@ -218,6 +219,7 @@ files:
218
219
  - app/permissions/decidim/accountability/permissions.rb
219
220
  - app/presenters/decidim/accountability/admin_log/result_presenter.rb
220
221
  - app/presenters/decidim/accountability/admin_log/value_types/parent_presenter.rb
222
+ - app/queries/decidim/accountability/metrics/results_metric_manage.rb
221
223
  - app/services/decidim/accountability/diff_renderer.rb
222
224
  - app/services/decidim/accountability/result_search.rb
223
225
  - app/services/decidim/accountability/result_stats_calculator.rb
@@ -318,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
320
  version: '0'
319
321
  requirements: []
320
322
  rubyforge_project:
321
- rubygems_version: 2.7.7
323
+ rubygems_version: 2.7.6
322
324
  signing_key:
323
325
  specification_version: 4
324
326
  summary: Decidim accountability module