decidim-participatory_processes 0.14.4 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/participatory_processes/filters.js.es6 +7 -1
  3. data/app/cells/decidim/participatory_process_activity_cell.rb +10 -0
  4. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +7 -1
  5. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_settings_form/show.erb +3 -0
  6. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_settings_form_cell.rb +19 -0
  7. data/app/commands/decidim/participatory_processes/admin/publish_participatory_process.rb +1 -1
  8. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +2 -0
  9. data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +2 -2
  10. data/app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb +5 -2
  11. data/app/presenters/decidim/participatory_processes/admin_log/step_presenter.rb +2 -0
  12. data/app/queries/decidim/participatory_processes/metrics/participatory_processes_metric_manage.rb +27 -0
  13. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/_form.html.erb +14 -0
  14. data/app/views/decidim/participatory_processes/participatory_processes/index.js.erb +5 -7
  15. data/app/views/layouts/decidim/_process_header_steps.html.erb +22 -8
  16. data/app/views/layouts/decidim/admin/participatory_process.html.erb +1 -0
  17. data/config/locales/ca.yml +15 -0
  18. data/config/locales/de.yml +15 -0
  19. data/config/locales/en.yml +15 -0
  20. data/config/locales/es-PY.yml +15 -0
  21. data/config/locales/es.yml +18 -3
  22. data/config/locales/eu.yml +15 -0
  23. data/config/locales/fi.yml +21 -6
  24. data/config/locales/fr.yml +15 -0
  25. data/config/locales/gl.yml +15 -0
  26. data/config/locales/hu.yml +15 -0
  27. data/config/locales/it.yml +15 -0
  28. data/config/locales/nl.yml +15 -0
  29. data/config/locales/pl.yml +15 -0
  30. data/config/locales/pt-BR.yml +15 -0
  31. data/config/locales/pt.yml +15 -0
  32. data/config/locales/sv.yml +15 -0
  33. data/db/migrate/20180926082635_add_cta_url_and_text_to_steps.rb +8 -0
  34. data/db/seeds/city.jpeg +0 -0
  35. data/db/seeds/city2.jpeg +0 -0
  36. data/lib/decidim/participatory_processes/engine.rb +20 -0
  37. data/lib/decidim/participatory_processes/participatory_space.rb +12 -3
  38. data/lib/decidim/participatory_processes/test/factories.rb +13 -13
  39. data/lib/decidim/participatory_processes/version.rb +1 -1
  40. metadata +14 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c080d184240a12b00b2c68d9d739a530db4b7d58882f11b224f61bffdcff95ce
4
- data.tar.gz: a75d115ba8907ec7b9f8a2c0615812997bf7ad2a4892f854aa6f890b3d4d0d18
3
+ metadata.gz: 22c6a7d1d0ff6b9f04b5ae67b13933ad9f5a14906df2d6cd6a497f70944c77d0
4
+ data.tar.gz: bf8c2845f9fb7c18aa27067defcf7ec2250ab20062c306afa9e8474f132256cd
5
5
  SHA512:
6
- metadata.gz: d2f640db09723a405806276d6bce5b926f0b51c3fc2f1805740dcdb442f1a107c000c084e596761b79731af289b88ad97aa59ab21b75d570811122db8be3adb7
7
- data.tar.gz: 1f201e57e119d1d49d1e20f6a9285ed4cdf7785cdb7bf84a64757da6d3eeedd21fa850939af523a35954a98fe8452080a3279279c22c2c4158385fc83072020b
6
+ metadata.gz: 25066cacb2a64421e674c74d29058bf915823785d88ddcbb4994b81257ff88b70e26ab713484708ce6df73d5471d1c57c22ba96016f1e34de50377bd20c26896
7
+ data.tar.gz: 8e15e23241935eeea49821dc8f710cd5e8996bf55a0b6430aa627656e2ff62873cc9b9391dba2a19136d7ba7bb74159e1f5bdc910da569f04ba38d4fcfe4db93
@@ -7,8 +7,14 @@ $(() => {
7
7
  $loading.hide();
8
8
 
9
9
  $processesGrid.on("click", filterLinksSelector, (event) => {
10
- const $target = $(event.target);
11
10
  const $processesGridCards = $processesGrid.find(".card-grid .column");
11
+ let $target = $(event.target);
12
+
13
+ // IE11 matches the <strong> element inside the filtering anchor element
14
+ // as the `event.target` breaking the functionality below.
15
+ if (!$target.is("a")) {
16
+ $target = $target.parents("a");
17
+ }
12
18
 
13
19
  $(filterLinksSelector).removeClass("is-active");
14
20
  $target.addClass("is-active");
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ # A cell to display when a Participatory Process has been published.
5
+ class ParticipatoryProcessActivityCell < ActivityCell
6
+ def title
7
+ I18n.t "decidim.participatory_processes.last_activity.new_participatory_process"
8
+ end
9
+ end
10
+ end
@@ -21,10 +21,16 @@ module Decidim
21
21
  highlighted_processes.to_a.length == 1
22
22
  end
23
23
 
24
+ def max_results
25
+ model.settings.max_results
26
+ end
27
+
24
28
  def highlighted_processes
25
- OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user) |
29
+ @highlighted_processes ||= (
30
+ OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user) |
26
31
  HighlightedParticipatoryProcesses.new |
27
32
  FilteredParticipatoryProcesses.new("active")
33
+ ).query.limit(max_results)
28
34
  end
29
35
 
30
36
  def i18n_scope
@@ -0,0 +1,3 @@
1
+ <% form.fields_for :settings, form.object.settings do |settings_fields| %>
2
+ <%= settings_fields.select :max_results, [4, 8, 12], prompt: "", label: label %>
3
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ module ContentBlocks
6
+ class HighlightedProcessesSettingsFormCell < Decidim::ViewModel
7
+ alias form model
8
+
9
+ def content_block
10
+ options[:content_block]
11
+ end
12
+
13
+ def label
14
+ I18n.t("decidim.participatory_processes.admin.content_blocks.highlighted_processes.max_results")
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -24,7 +24,7 @@ module Decidim
24
24
  return broadcast(:invalid) if process.nil? || process.published?
25
25
 
26
26
  transaction do
27
- Decidim.traceability.perform_action!("publish", process, current_user) do
27
+ Decidim.traceability.perform_action!("publish", process, current_user, visibility: "all") do
28
28
  process.publish!
29
29
  end
30
30
  end
@@ -44,6 +44,8 @@ module Decidim
44
44
 
45
45
  def attributes
46
46
  {
47
+ cta_path: form.cta_path,
48
+ cta_text: form.cta_text,
47
49
  title: form.title,
48
50
  start_date: form.start_date,
49
51
  end_date: form.end_date,
@@ -23,8 +23,8 @@ module Decidim
23
23
 
24
24
  mimic :participatory_process
25
25
 
26
- attribute :start_date, Date
27
- attribute :end_date, Date
26
+ attribute :start_date, Decidim::Attributes::LocalizedDate
27
+ attribute :end_date, Decidim::Attributes::LocalizedDate
28
28
  attribute :slug, String
29
29
  attribute :hashtag, String
30
30
  attribute :promoted, Boolean
@@ -11,13 +11,16 @@ module Decidim
11
11
 
12
12
  translatable_attribute :title, String
13
13
  translatable_attribute :description, String
14
+ translatable_attribute :cta_text, String
14
15
 
15
16
  mimic :participatory_process_step
16
17
 
17
- attribute :start_date, Date
18
- attribute :end_date, Date
18
+ attribute :start_date, Decidim::Attributes::LocalizedDate
19
+ attribute :end_date, Decidim::Attributes::LocalizedDate
20
+ attribute :cta_path, String
19
21
 
20
22
  validates :title, translatable_presence: true
23
+ validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9\-\_/]+\z} }, allow_blank: true
21
24
 
22
25
  validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } }
23
26
  validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } }
@@ -17,6 +17,8 @@ module Decidim
17
17
 
18
18
  def diff_fields_mapping
19
19
  {
20
+ cta_path: :string,
21
+ cta_text: :i18n,
20
22
  description: :i18n,
21
23
  title: :i18n
22
24
  }
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ module Metrics
6
+ class ParticipatoryProcessesMetricManage < Decidim::MetricManage
7
+ def metric_name
8
+ "participatory_processes"
9
+ end
10
+
11
+ private
12
+
13
+ def query
14
+ return @query if @query
15
+
16
+ @query = Decidim::ParticipatoryProcess.where(organization: @organization)
17
+ @query = @query.where("decidim_participatory_processes.published_at <= ?", end_time)
18
+ @query
19
+ end
20
+
21
+ def quantity
22
+ @quantity ||= query.where("decidim_participatory_processes.published_at >= ?", start_time).count
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,5 @@
1
+ <%= javascript_include_tag "decidim/slug_form" %>
2
+
1
3
  <div class="card">
2
4
  <div class="card-divider">
3
5
  <h2 class="card-title"><%= title %></h2>
@@ -21,5 +23,17 @@
21
23
  <%= form.date_field :end_date %>
22
24
  </div>
23
25
  </div>
26
+
27
+ <div class="row">
28
+ <div class="columns xlarge-6 slug">
29
+ <%= form.text_field :cta_path %>
30
+ <p class="help-text"><%== t(".cta_path_help", url: decidim_form_slug_url("processes/" + current_participatory_process.slug, form.object.cta_path)) %></p>
31
+ </div>
32
+
33
+ <div class="columns xlarge-6">
34
+ <%= form.translated :text_field, :cta_text %>
35
+ <p class="help-text"><%= t(".cta_text_help") %></p>
36
+ </div>
37
+ </div>
24
38
  </div>
25
39
  </div>
@@ -1,8 +1,6 @@
1
- $(() => {
2
- const $grid = $('#processes-grid');
3
- const $loading = $grid.find('.loading');
1
+ var $grid = $('#processes-grid');
2
+ var $loading = $grid.find('.loading');
4
3
 
5
- $grid.find('.card-grid').html('<%= j(render(collection)).strip.html_safe %>');
6
- $grid.find('.processes-grid-order-by').html('<%= j(render(partial: "decidim/participatory_processes/participatory_processes/order_by_processes", locals: { include_filter: true })).strip.html_safe %>');
7
- $loading.hide();
8
- });
4
+ $grid.find('.card-grid').html('<%= j(render(collection)).strip.html_safe %>');
5
+ $grid.find('.processes-grid-order-by').html('<%= j(render(partial: "decidim/participatory_processes/participatory_processes/order_by_processes", locals: { include_filter: true })).strip.html_safe %>');
6
+ $loading.hide();
@@ -1,7 +1,7 @@
1
1
  <% if participatory_process.steps.any? %>
2
2
  <div class="columns mediumlarge-3">
3
- <div class="process-header__phase">
4
- <div class="process-header__progress show-for-medium">
3
+ <div class="process-phase">
4
+ <div class="process-header__progress">
5
5
  <ol>
6
6
  <% past_step = true %>
7
7
  <% participatory_process.steps.each_with_index do |step, index| %>
@@ -15,13 +15,27 @@
15
15
  </ol>
16
16
  <span class="phase-current"><%= t(".step", current: (participatory_process.active_step.position + 1), total: current_participatory_space.steps.count) %></span>
17
17
  </div>
18
- <div>
19
- <span class="phase-title"><%= translated_attribute participatory_process.active_step.title %></span>
20
- <span class="phase-date">
21
- <%= participatory_space_helpers.step_dates participatory_process.active_step %>
22
- </span>
18
+ <div class="process-header__body">
19
+ <div>
20
+ <span class="phase-title"><%= translated_attribute participatory_process.active_step.title %></span>
21
+ <span class="phase-date">
22
+ <%= participatory_space_helpers.step_dates participatory_process.active_step %>
23
+ </span>
24
+ </div>
25
+ <% cta_text = translated_attribute(participatory_process.active_step.cta_text) %>
26
+ <% if participatory_process.active_step.cta_path.present? && cta_text.present? %>
27
+ <div class="process-header__button">
28
+ <%= link_to(
29
+ cta_text,
30
+ participatory_process.active_step.cta_path,
31
+ class: "button button-sc"
32
+ ) %>
33
+ </div>
34
+ <% end %>
35
+ <div class="process-header__link">
36
+ <%= link_to t(".view_steps"), decidim_participatory_processes.participatory_process_participatory_process_steps_path(current_participatory_space) %>
37
+ </div>
23
38
  </div>
24
- <%= link_to t(".view_steps"), decidim_participatory_processes.participatory_process_participatory_process_steps_path(current_participatory_space), class: "button tiny hollow" %>
25
39
  </div>
26
40
  </div>
27
41
  <% end %>
@@ -1,6 +1,7 @@
1
1
  <% content_for :secondary_nav do %>
2
2
  <div class="secondary-nav secondary-nav--subnav">
3
3
  <ul>
4
+ <%= public_page_link decidim_participatory_processes.participatory_process_path(current_participatory_space) %>
4
5
  <% if allowed_to? :update, :process, process: current_participatory_space %>
5
6
  <li <% if is_active_link?(decidim_admin_participatory_processes.edit_participatory_process_path(current_participatory_space)) %> class="is-active" <% end %>>
6
7
  <%= aria_selected_link_to t("info", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.edit_participatory_process_path(current_participatory_space) %>
@@ -35,6 +35,8 @@ ca:
35
35
  name: Nom
36
36
  participatory_process_ids: Processos relacionats
37
37
  participatory_process_step:
38
+ cta_path: Ruta del botó d'acció
39
+ cta_text: Text del botó d'acció
38
40
  description: Descripció
39
41
  end_date: Data de finalització
40
42
  short_description: Descripció breu
@@ -255,6 +257,10 @@ ca:
255
257
  notification_title: Les dates de la fase <a href="%{resource_path}">%{resource_title}</a> a <a href="%{participatory_space_url}">%{participatory_space_title}</a> s'han actualitzat.
256
258
  menu:
257
259
  processes: Processos
260
+ metrics:
261
+ participatory_processes:
262
+ object: processos participatius
263
+ title: Processos participatius
258
264
  participatory_process_groups:
259
265
  show:
260
266
  group_participatory_processes:
@@ -267,9 +273,16 @@ ca:
267
273
  title: Fases del procés participatiu
268
274
  participatory_processes:
269
275
  admin:
276
+ content_blocks:
277
+ highlighted_processes:
278
+ max_results: Quantitat màxima d'elements que es mostraran
270
279
  participatory_process_copies:
271
280
  form:
272
281
  slug_help: 'Els noms curts d''URL s''utilitzen per generar els URL que apunten a aquest procés. Només accepta lletres, números i guions, i ha de començar amb una lletra. Exemple: %{url}'
282
+ participatory_process_steps:
283
+ form:
284
+ cta_path_help: 'Utilitza rutes parcials, no URL complerts aquí. Accepta lletres, números, guions i barres, i ha de començar amb una lletra. Si no s''estableix cap ruta, el botó no es mostrarà. Exemple: %{url}'
285
+ cta_text_help: Si no s'estableix cap ruta el botó no es mostrarà.
273
286
  participatory_processes:
274
287
  form:
275
288
  announcement_help: El text que introdueixis aquí es mostrarà a l'usuari just a sota de la informació del procés.
@@ -279,6 +292,8 @@ ca:
279
292
  name: Processos destacats
280
293
  index:
281
294
  title: Processos participatius
295
+ last_activity:
296
+ new_participatory_process: Nou procés participatiu
282
297
  pages:
283
298
  home:
284
299
  highlighted_processes:
@@ -35,6 +35,8 @@ de:
35
35
  name: Name
36
36
  participatory_process_ids: Ähnliche Prozesse
37
37
  participatory_process_step:
38
+ cta_path: Aufruf zum Aktionspfad
39
+ cta_text: Call to Action-Text
38
40
  description: Beschreibung
39
41
  end_date: Endtermin
40
42
  short_description: Kurze Beschreibung
@@ -255,6 +257,10 @@ de:
255
257
  notification_title: Die Daten für den <a href="%{resource_path}">%{resource_title}</a> Schritt bei <a href="%{participatory_space_url}">%{participatory_space_title}</a> wurden aktualisiert.
256
258
  menu:
257
259
  processes: Prozesse
260
+ metrics:
261
+ participatory_processes:
262
+ object: partizipative Prozesse
263
+ title: Partizipative Prozesse
258
264
  participatory_process_groups:
259
265
  show:
260
266
  group_participatory_processes:
@@ -267,9 +273,16 @@ de:
267
273
  title: Partizipative Prozessschritte
268
274
  participatory_processes:
269
275
  admin:
276
+ content_blocks:
277
+ highlighted_processes:
278
+ max_results: Maximale Anzahl der Elemente, die angezeigt werden sollen
270
279
  participatory_process_copies:
271
280
  form:
272
281
  slug_help: 'URL-Slugs werden zum Generieren der URLs verwendet, die auf diesen Prozess verweisen. Akzeptiert nur Buchstaben, Zahlen und Bindestriche und muss mit einem Buchstaben beginnen. Beispiel: %{url}'
282
+ participatory_process_steps:
283
+ form:
284
+ cta_path_help: 'Verwenden Sie hier Teilpfade, nicht vollständige URLs. Akzeptiert Buchstaben, Zahlen, Bindestriche und Schrägstriche und muss mit einem Buchstaben beginnen. Wenn nicht eingestellt, wird die Schaltfläche nicht angezeigt. Beispiel: %{url}'
285
+ cta_text_help: Wenn nicht eingestellt, wird die Schaltfläche nicht angezeigt.
273
286
  participatory_processes:
274
287
  form:
275
288
  announcement_help: Der Text, den Sie hier eingeben, wird dem Benutzer direkt unter den Prozessinformationen angezeigt.
@@ -279,6 +292,8 @@ de:
279
292
  name: Markierte Prozesse
280
293
  index:
281
294
  title: Partizipative Prozesse
295
+ last_activity:
296
+ new_participatory_process: Neuer partizipativer Prozess
282
297
  pages:
283
298
  home:
284
299
  highlighted_processes:
@@ -36,6 +36,8 @@ en:
36
36
  name: Name
37
37
  participatory_process_ids: Related processes
38
38
  participatory_process_step:
39
+ cta_path: Call to Action path
40
+ cta_text: Call to Action text
39
41
  description: Description
40
42
  end_date: End date
41
43
  short_description: Short description
@@ -256,6 +258,10 @@ en:
256
258
  notification_title: The dates for the <a href="%{resource_path}">%{resource_title}</a> step at <a href="%{participatory_space_url}">%{participatory_space_title}</a> have been updated.
257
259
  menu:
258
260
  processes: Processes
261
+ metrics:
262
+ participatory_processes:
263
+ object: participatory processes
264
+ title: Participatory processes
259
265
  participatory_process_groups:
260
266
  show:
261
267
  group_participatory_processes:
@@ -268,9 +274,16 @@ en:
268
274
  title: Participatory process steps
269
275
  participatory_processes:
270
276
  admin:
277
+ content_blocks:
278
+ highlighted_processes:
279
+ max_results: Maximum amount of elements to show
271
280
  participatory_process_copies:
272
281
  form:
273
282
  slug_help: 'URL slugs are used to generate the URLs that point to this process. Only accepts letters, numbers and dashes, and must start with a letter. Example: %{url}'
283
+ participatory_process_steps:
284
+ form:
285
+ cta_path_help: 'Use partial paths, not full URLs here. Accepts letters, numbers, dashes and slashes, and must start with a letter. If not set, the button will not be shown. Example: %{url}'
286
+ cta_text_help: If not set, the button will not be shown.
274
287
  participatory_processes:
275
288
  form:
276
289
  announcement_help: The text you enter here will be shown to the user right below the process information.
@@ -280,6 +293,8 @@ en:
280
293
  name: Highlighted processes
281
294
  index:
282
295
  title: Participatory processes
296
+ last_activity:
297
+ new_participatory_process: New participatory process
283
298
  pages:
284
299
  home:
285
300
  highlighted_processes:
@@ -35,6 +35,8 @@ es-PY:
35
35
  name: Nombre
36
36
  participatory_process_ids: Procesos relacionados
37
37
  participatory_process_step:
38
+ cta_path: Ruta de llamada a la acción
39
+ cta_text: Texto de llamada a la acción
38
40
  description: Descripción
39
41
  end_date: Fecha de finalización
40
42
  short_description: Descripción breve
@@ -255,6 +257,10 @@ es-PY:
255
257
  notification_title: Se han actualizado las fechas de la fase <a href="%{resource_path}">%{resource_title}</a> en <a href="%{participatory_space_url}">%{participatory_space_title}</a>.
256
258
  menu:
257
259
  processes: Procesos
260
+ metrics:
261
+ participatory_processes:
262
+ object: procesos participativos
263
+ title: Procesos participativos
258
264
  participatory_process_groups:
259
265
  show:
260
266
  group_participatory_processes:
@@ -267,9 +273,16 @@ es-PY:
267
273
  title: Fases del proceso participativo
268
274
  participatory_processes:
269
275
  admin:
276
+ content_blocks:
277
+ highlighted_processes:
278
+ max_results: Cantidad máxima de elementos para mostrar
270
279
  participatory_process_copies:
271
280
  form:
272
281
  slug_help: 'Los textos cortos de URL se utilizan para generar las URL que apuntan a este proceso. Sólo acepta letras, números y guiones, y debe comenzar con una letra. Ejemplo: %{url}'
282
+ participatory_process_steps:
283
+ form:
284
+ cta_path_help: 'Use rutas parciales, no URL completas aquí. Acepta letras, números, guiones y barras, y debe comenzar con una letra. Si no está configurado, el botón no se mostrará. Ejemplo: %{url}'
285
+ cta_text_help: Si no está configurado, el botón no se mostrará.
273
286
  participatory_processes:
274
287
  form:
275
288
  announcement_help: El texto que ingreses aquí se mostrará al usuario justo debajo de la información del proceso.
@@ -279,6 +292,8 @@ es-PY:
279
292
  name: Procesos destacados
280
293
  index:
281
294
  title: Procesos participativos
295
+ last_activity:
296
+ new_participatory_process: Nuevo proceso participativo
282
297
  pages:
283
298
  home:
284
299
  highlighted_processes: