decidim-participatory_processes 0.21.0 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/_all_processes.erb +4 -1
  3. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb +5 -9
  4. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +10 -5
  5. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +1 -1
  6. data/app/cells/decidim/participatory_processes/process_filters/show.erb +2 -2
  7. data/app/cells/decidim/participatory_processes/process_group_m/footer.erb +4 -5
  8. data/app/cells/decidim/participatory_processes/process_m/data.erb +1 -1
  9. data/app/cells/decidim/participatory_processes/process_m/footer.erb +5 -6
  10. data/app/cells/decidim/participatory_processes/process_m/tags.erb +2 -2
  11. data/app/cells/decidim/participatory_processes/process_m_cell.rb +21 -0
  12. data/app/cells/decidim/participatory_processes/statistics/show.erb +2 -2
  13. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb +2 -1
  14. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +3 -3
  15. data/app/commands/decidim/participatory_processes/admin/notify_role_assigned_to_participatory_process.rb +22 -0
  16. data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +10 -5
  17. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_admin.rb +3 -1
  18. data/app/controllers/decidim/participatory_processes/admin/participatory_process_exports_controller.rb +4 -0
  19. data/app/controllers/decidim/participatory_processes/admin/participatory_process_user_roles_controller.rb +2 -1
  20. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +11 -2
  21. data/app/controllers/decidim/participatory_processes/{participatory_process_widgets_controller.rb → widgets_controller.rb} +2 -2
  22. data/app/events/decidim/participatory_process_role_assigned_event.rb +28 -0
  23. data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +5 -6
  24. data/app/forms/decidim/participatory_processes/admin/participatory_process_group_form.rb +4 -1
  25. data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +3 -0
  26. data/app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb +3 -2
  27. data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +11 -0
  28. data/app/models/decidim/participatory_process.rb +13 -1
  29. data/app/models/decidim/participatory_process_group.rb +5 -0
  30. data/app/models/decidim/participatory_process_step.rb +3 -0
  31. data/app/permissions/decidim/participatory_processes/permissions.rb +1 -0
  32. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_group_presenter.rb +2 -2
  33. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +2 -2
  34. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_user_role_presenter.rb +2 -2
  35. data/app/presenters/decidim/participatory_processes/participatory_process_metric_charts_presenter.rb +2 -2
  36. data/app/queries/decidim/participatory_processes/stats_participants_count.rb +8 -6
  37. data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +6 -4
  38. data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +1 -1
  39. data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +3 -2
  40. data/app/views/decidim/participatory_processes/participatory_process_steps/index.html.erb +8 -3
  41. data/app/views/decidim/participatory_processes/participatory_processes/_metrics.html.erb +1 -1
  42. data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb +13 -6
  43. data/app/views/decidim/participatory_processes/participatory_processes/_statistics.html.erb +0 -0
  44. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +24 -12
  45. data/app/views/layouts/decidim/_process_header.html.erb +1 -1
  46. data/app/views/layouts/decidim/_process_header_steps.html.erb +1 -1
  47. data/app/views/layouts/decidim/participatory_process.html.erb +1 -0
  48. data/config/locales/am-ET.yml +1 -0
  49. data/config/locales/bg-BG.yml +19 -0
  50. data/config/locales/bg.yml +19 -0
  51. data/config/locales/ca.yml +22 -1
  52. data/config/locales/cs.yml +33 -12
  53. data/config/locales/da-DK.yml +1 -0
  54. data/config/locales/da.yml +1 -0
  55. data/config/locales/de.yml +76 -24
  56. data/config/locales/el.yml +452 -0
  57. data/config/locales/en.yml +22 -1
  58. data/config/locales/eo.yml +1 -0
  59. data/config/locales/es-MX.yml +21 -0
  60. data/config/locales/es-PY.yml +21 -0
  61. data/config/locales/es.yml +21 -0
  62. data/config/locales/et-EE.yml +1 -0
  63. data/config/locales/et.yml +1 -0
  64. data/config/locales/fi-plain.yml +22 -1
  65. data/config/locales/fi.yml +97 -76
  66. data/config/locales/fr-CA.yml +456 -0
  67. data/config/locales/fr.yml +29 -0
  68. data/config/locales/ga-IE.yml +1 -0
  69. data/config/locales/hr-HR.yml +1 -0
  70. data/config/locales/hr.yml +1 -0
  71. data/config/locales/is.yml +215 -0
  72. data/config/locales/it.yml +31 -5
  73. data/config/locales/ja-JP.yml +445 -0
  74. data/config/locales/ja.yml +445 -0
  75. data/config/locales/ko-KR.yml +1 -0
  76. data/config/locales/ko.yml +1 -0
  77. data/config/locales/lt-LT.yml +1 -0
  78. data/config/locales/lt.yml +1 -0
  79. data/config/locales/lv.yml +445 -0
  80. data/config/locales/mt-MT.yml +1 -0
  81. data/config/locales/mt.yml +1 -0
  82. data/config/locales/nl.yml +26 -0
  83. data/config/locales/no.yml +147 -136
  84. data/config/locales/om-ET.yml +1 -0
  85. data/config/locales/pl.yml +198 -149
  86. data/config/locales/pt-BR.yml +1 -1
  87. data/config/locales/pt.yml +169 -120
  88. data/config/locales/ro-RO.yml +461 -0
  89. data/config/locales/si-LK.yml +1 -0
  90. data/config/locales/sk-SK.yml +451 -0
  91. data/config/locales/sk.yml +451 -0
  92. data/config/locales/sl.yml +9 -0
  93. data/config/locales/so-SO.yml +1 -0
  94. data/config/locales/sr-CS.yml +33 -0
  95. data/config/locales/sv.yml +154 -112
  96. data/config/locales/sw-KE.yml +1 -0
  97. data/config/locales/ti-ER.yml +1 -0
  98. data/config/locales/tr-TR.yml +53 -1
  99. data/config/locales/vi-VN.yml +1 -0
  100. data/config/locales/vi.yml +1 -0
  101. data/config/locales/zh-CN.yml +445 -0
  102. data/config/locales/zh-TW.yml +1 -0
  103. data/db/migrate/20200320105908_index_foreign_keys_in_decidim_attachments.rb +7 -0
  104. data/db/migrate/20200320105924_index_foreign_keys_in_decidim_participatory_process_user_roles.rb +7 -0
  105. data/db/migrate/20200320105925_index_foreign_keys_in_decidim_participatory_processes.rb +8 -0
  106. data/db/migrate/20201006072346_fix_attachments_titles.rb +38 -0
  107. data/db/seeds/city.jpeg +0 -0
  108. data/db/seeds/city2.jpeg +0 -0
  109. data/lib/decidim/participatory_processes/admin_engine.rb +1 -0
  110. data/lib/decidim/participatory_processes/engine.rb +1 -1
  111. data/lib/decidim/participatory_processes/participatory_space.rb +16 -12
  112. data/lib/decidim/participatory_processes/test/factories.rb +3 -3
  113. data/lib/decidim/participatory_processes/version.rb +1 -1
  114. metadata +57 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d739759631aca0408a7ae0aba4ff332eae1e0f2f0da9687baa753fdecfb1882
4
- data.tar.gz: 5db3ca8acfbc423b83176a45dd67bc6b24083824264b367ccdc7b603b1b8bb68
3
+ metadata.gz: 38e72fa7e13259672948879ddf6a81b9bac5c3e4a5142e241f4f07985f2a32ec
4
+ data.tar.gz: 88ef2a941db1312162b8b230de78cdb31b21ad0111a44d894224dd9b28ad7306
5
5
  SHA512:
6
- metadata.gz: 71fd380d50a0bf51fac1e84ee82de34dae3c8412ddac11e7f102d91809f928af6c6d62e58c2809649067aeabcdbf8fb4992831a37876567f372901d177809b06
7
- data.tar.gz: c33eca9c58ce8cb093178232584a70916ccc314920de56443475abf129363d94e0f8cd86840ad1ae29536cbadbb8252b490ddaa93ce88002e613fd6432d00e97
6
+ metadata.gz: ddbce1cc68b92a5e20e72b871adff38b27efd965405978ae0d668c914993348d5e22386d4453f2189b05dd5b6116cc94a4fc9d9e875f7de17a52542d815ce363
7
+ data.tar.gz: ba3b11ae17cff650877d48ff66975fd04fc939ca599db7b011d088fdd512db0e9cb8e53a92b90b0a36f455bfbf15d4880003d5a370300c6620bfae1bb7f133e2
@@ -1,6 +1,9 @@
1
1
  <div class="row" id="see-all-processes">
2
2
  <div class="columns small-centered small-12
3
3
  smallmedium-8 medium-6 large-4">
4
- <%= link_to t("see_all_processes", scope: i18n_scope), decidim_participatory_processes.participatory_processes_path, class: "button expanded hollow button--sc home-section__cta" %>
4
+ <%= link_to t("see_all_processes", scope: i18n_scope),
5
+ decidim_participatory_processes.participatory_processes_path,
6
+ class: "button expanded hollow button--sc home-section__cta",
7
+ title: t("processes_button_title", scope: i18n_scope) %>
5
8
  </div>
6
9
  </div>
@@ -6,15 +6,11 @@
6
6
  large-up-4 card-grid">
7
7
  <% highlighted_processes.each do |process| %>
8
8
  <div class="column">
9
- <article class="card card--process card--mini">
10
- <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card__link" do %>
11
- <div class="card__image-top"
12
- style="background-image:url(<%= process.hero_image.url %>)"></div>
13
- <% end %>
9
+ <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card card--process card--mini" do %>
10
+ <div aria-hidden="true" class="card__image-top"
11
+ style="background-image:url(<%= process.hero_image.url %>)"></div>
14
12
  <div class="card__content">
15
- <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card__link" do %>
16
- <h4 class="card__title"><%= translated_attribute process.title %></h4>
17
- <% end %>
13
+ <span class="card__title card__link"><%= translated_attribute process.title %></span>
18
14
  <% if process.active_step %>
19
15
  <span class="card--process__small">
20
16
  <%= t("active_step", scope: i18n_scope) %>
@@ -22,7 +18,7 @@
22
18
  </span>
23
19
  <% end %>
24
20
  </div>
25
- </article>
21
+ <% end %>
26
22
  </div>
27
23
  <% end %>
28
24
  </div>
@@ -1,17 +1,21 @@
1
1
  <% process = highlighted_processes.first %>
2
+ <% title_id = "process_title" %>
2
3
  <section class="wrapper-home home-section">
3
4
  <div class="row" id="highlighted-processes">
4
5
  <h3 class="section-heading"><%= t("active_processes", scope: i18n_scope) %></h3>
5
6
  <div class="row collapse">
6
- <article class="card card--full card--process">
7
+ <div class="card card--full card--process">
7
8
  <div class="row collapse card--process__row">
8
9
  <div class="column large-6 card--process__column">
9
10
  <div class="card__content">
10
11
  <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card__link" do %>
11
- <h2 class="card__title"><%= translated_attribute process.title %></h2>
12
+ <h2 class="card__title" id="<%= title_id %>"><%= decidim_html_escape(translated_attribute(process.title)) %></h2>
12
13
  <% end %>
13
14
  <%= decidim_sanitize translated_attribute(process.short_description) %>
14
- <%= link_to t("more_information", scope: i18n_scope), decidim_participatory_processes.participatory_process_path(process), class: "button secondary small hollow" %>
15
+ <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button small hollow" do %>
16
+ <span class="show-for-sr"><%= decidim_html_escape(translated_attribute(process.title)) %></span>
17
+ <%= t("more_information", scope: i18n_scope) %>
18
+ <% end %>
15
19
  </div>
16
20
  </div>
17
21
  <div class="column large-6 card--process__column">
@@ -19,7 +23,8 @@
19
23
  <div class="card__content row collapse">
20
24
  <div class="large-6 large-offset-6 columns">
21
25
  <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button expanded button--sc" do %>
22
- <%= t("participate", scope: i18n_scope) %>
26
+ <span class="show-for-sr"><%= t("participate_in", resource_name: translated_attribute(process.title), scope: i18n_scope) %></span>
27
+ <span aria-hidden="true"><%= t("participate", scope: i18n_scope) %></span>
23
28
  <% if process.active_step %>
24
29
  <span class="button__info">
25
30
  <%= t("active_step", scope: i18n_scope) %>
@@ -32,7 +37,7 @@
32
37
  </div>
33
38
  </div>
34
39
  </div>
35
- </article>
40
+ </div>
36
41
  </div>
37
42
  </div>
38
43
  <%= render "_all_processes" %>
@@ -29,7 +29,7 @@ module Decidim
29
29
  OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user) |
30
30
  HighlightedParticipatoryProcesses.new |
31
31
  FilteredParticipatoryProcesses.new("active")
32
- ).query.limit(max_results)
32
+ ).query.includes([:organization]).limit(max_results)
33
33
  end
34
34
 
35
35
  def i18n_scope
@@ -1,8 +1,8 @@
1
1
  <div class="row collapse order-by">
2
- <h2 class="order-by__text section-heading">
2
+ <h3 class="order-by__text section-heading">
3
3
  <%= title %>
4
4
  <%= render :filter_tabs %>
5
- </h2>
5
+ </h3>
6
6
  </div>
7
7
  <% if process_count_by_filter["active"] == 0 && process_count_by_filter["upcoming"] == 0 %>
8
8
  <div class="row column">
@@ -1,9 +1,8 @@
1
1
  <div class="card__footer card__footer--spaces">
2
2
  <div class="card__support">
3
- <%= link_to(
4
- t("layouts.decidim.participatory_process_groups.participatory_process_group.browse"),
5
- resource_path,
6
- class: "card__button button button--sc secondary light small"
7
- ) %>
3
+ <%= link_to(resource_path, class: "card__button button button--sc small") do %>
4
+ <span class="show-for-sr"><%= t("browse_resource", resource_name: title, scope: "layouts.decidim.participatory_process_groups.participatory_process_group") %></span>
5
+ <%= t("layouts.decidim.participatory_process_groups.participatory_process_group.browse") %>
6
+ <% end %>
8
7
  </div>
9
8
  </div>
@@ -1,7 +1,7 @@
1
1
  <div class="card__icondata">
2
2
  <ul class="card-data">
3
3
  <li class="card-data__item">
4
- <%= icon "datetime", class: "icon--big" %>
4
+ <%= icon "datetime", class: "icon--big", role: "img", aria_label: t("decidim.participatory_processes.show.dates") %>
5
5
  </li>
6
6
  <li class="card-data__item">
7
7
  <div class="card-data__item--centerblock">
@@ -2,14 +2,13 @@
2
2
  <div class="card__support">
3
3
  <% if has_step? %>
4
4
  <div class="card__support__data--left">
5
- <div class="text-uppercase"><%= t("layouts.decidim.participatory_processes.participatory_process.active_step") %></div>
5
+ <div><%= t("layouts.decidim.participatory_processes.participatory_process.active_step") %></div>
6
6
  <div class="text-ellipsis"><strong><%= step_title %></strong></div>
7
7
  </div>
8
8
  <% end %>
9
- <%= link_to(
10
- t(model.cta_button_text_key, scope: "layouts.decidim.participatory_processes.participatory_process"),
11
- resource_path,
12
- class: "card__button button button--sc secondary light small"
13
- ) %>
9
+ <%= link_to(step_cta_path, class: "card__button button button--sc small") do %>
10
+ <span class="show-for-sr"><%= step_cta_text %></span>
11
+ <%= step_cta_text %>
12
+ <% end %>
14
13
  </div>
15
14
  </div>
@@ -1,7 +1,7 @@
1
1
  <% if model.hashtag.present? %>
2
2
  <%= link_to(
3
- "##{model.hashtag}",
4
- "https://twitter.com/hashtag/#{model.hashtag}",
3
+ "##{decidim_html_escape(model.hashtag)}",
4
+ "https://twitter.com/hashtag/#{decidim_html_escape(model.hashtag)}",
5
5
  class: "card__text--category",
6
6
  target: "_blank"
7
7
  ) %>
@@ -5,6 +5,9 @@ module Decidim
5
5
  # This cell renders the Medium (:m) process card
6
6
  # for an given instance of a Process
7
7
  class ProcessMCell < Decidim::CardMCell
8
+ include Decidim::SanitizeHelper
9
+ include Decidim::TranslationsHelper
10
+
8
11
  private
9
12
 
10
13
  def has_image?
@@ -37,6 +40,24 @@ module Decidim
37
40
  model.hero_image.url
38
41
  end
39
42
 
43
+ def step_cta_text
44
+ if translated_in_current_locale?(model.active_step&.cta_text)
45
+ translated_attribute(model.active_step.cta_text)
46
+ else
47
+ t(model.cta_button_text_key_accessible, resource_name: title, scope: "layouts.decidim.participatory_processes.participatory_process")
48
+ end
49
+ end
50
+
51
+ def step_cta_path
52
+ if model.active_step&.cta_path.present?
53
+ path, params = resource_path.split("?")
54
+
55
+ "#{path}/#{model.active_step.cta_path}" + (params.present? ? "?#{params}" : "")
56
+ else
57
+ resource_path
58
+ end
59
+ end
60
+
40
61
  def step_title
41
62
  translated_attribute model.active_step.title
42
63
  end
@@ -1,9 +1,9 @@
1
1
  <section class="row statistics" id="participatory_process-statistics">
2
2
  <div class="columns large-8">
3
3
  <div class="row column">
4
- <h4 class="section-heading">
4
+ <h3 class="section-heading">
5
5
  <%= stats_heading %>
6
- </h4>
6
+ </h3>
7
7
 
8
8
  <div class="process-stats">
9
9
  <% if model.present? %>
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when creating a new participatory
7
7
  # process admin in the system.
8
- class CreateParticipatoryProcessAdmin < Rectify::Command
8
+ class CreateParticipatoryProcessAdmin < NotifyRoleAssignedToParticipatoryProcess
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -61,6 +61,7 @@ module Decidim
61
61
  role_params,
62
62
  extra_info
63
63
  )
64
+ send_notification user
64
65
  end
65
66
 
66
67
  def existing_role
@@ -45,11 +45,11 @@ module Decidim
45
45
  form.current_user
46
46
  ) do
47
47
  ParticipatoryProcessGroup.create(
48
+ organization: form.current_organization,
48
49
  name: form.name,
49
50
  description: form.description,
50
- hero_image: form.hero_image,
51
- participatory_processes: participatory_processes,
52
- organization: form.current_organization
51
+ hero_image: form.hero_image, # Keep after organization
52
+ participatory_processes: participatory_processes
53
53
  )
54
54
  end
55
55
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ module Admin
6
+ # A command to notify users when a role is assigned for a participatory process
7
+ class NotifyRoleAssignedToParticipatoryProcess < Rectify::Command
8
+ def send_notification(user)
9
+ Decidim::EventsManager.publish(
10
+ event: "decidim.events.participatory_process.role_assigned",
11
+ event_class: Decidim::ParticipatoryProcessRoleAssignedEvent,
12
+ resource: form.current_participatory_space,
13
+ affected_users: [user],
14
+ extra: {
15
+ role: form.role
16
+ }
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -57,10 +57,6 @@ module Decidim
57
57
  subtitle: form.subtitle,
58
58
  slug: form.slug,
59
59
  hashtag: form.hashtag,
60
- hero_image: form.hero_image,
61
- remove_hero_image: form.remove_hero_image,
62
- banner_image: form.banner_image,
63
- remove_banner_image: form.remove_banner_image,
64
60
  promoted: form.promoted,
65
61
  description: form.description,
66
62
  short_description: form.short_description,
@@ -81,7 +77,16 @@ module Decidim
81
77
  show_metrics: form.show_metrics,
82
78
  show_statistics: form.show_statistics,
83
79
  announcement: form.announcement
84
- }
80
+ }.merge(uploader_attributes)
81
+ end
82
+
83
+ def uploader_attributes
84
+ {
85
+ hero_image: form.hero_image,
86
+ remove_hero_image: form.remove_hero_image,
87
+ banner_image: form.banner_image,
88
+ remove_banner_image: form.remove_banner_image
89
+ }.delete_if { |_k, val| val.is_a?(Decidim::ApplicationUploader) }
85
90
  end
86
91
 
87
92
  def related_processes
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when updated a participatory
7
7
  # process admin in the system.
8
- class UpdateParticipatoryProcessAdmin < Rectify::Command
8
+ class UpdateParticipatoryProcessAdmin < NotifyRoleAssignedToParticipatoryProcess
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -47,6 +47,8 @@ module Decidim
47
47
  { role: form.role },
48
48
  extra_info
49
49
  )
50
+
51
+ send_notification user_role.user
50
52
  end
51
53
  end
52
54
  end
@@ -11,6 +11,10 @@ module Decidim
11
11
  current_participatory_process
12
12
  end
13
13
 
14
+ def manifest_name
15
+ current_participatory_process.manifest.name.to_s
16
+ end
17
+
14
18
  def after_export_path
15
19
  participatory_processes_path
16
20
  end
@@ -25,12 +25,13 @@ module Decidim
25
25
  CreateParticipatoryProcessAdmin.call(@form, current_user, current_participatory_process) do
26
26
  on(:ok) do
27
27
  flash[:notice] = I18n.t("participatory_process_user_roles.create.success", scope: "decidim.admin")
28
+ redirect_to participatory_process_user_roles_path(current_participatory_process)
28
29
  end
29
30
 
30
31
  on(:invalid) do
31
32
  flash[:alert] = I18n.t("participatory_process_user_roles.create.error", scope: "decidim.admin")
33
+ render :new
32
34
  end
33
- redirect_to participatory_process_user_roles_path(current_participatory_process)
34
35
  end
35
36
  end
36
37
 
@@ -15,7 +15,8 @@ module Decidim
15
15
  :stats,
16
16
  :metrics,
17
17
  :default_date_filter,
18
- :related_processes
18
+ :related_processes,
19
+ :linked_assemblies
19
20
 
20
21
  def index
21
22
  raise ActionController::RoutingError, "Not Found" if published_processes.none?
@@ -29,7 +30,11 @@ module Decidim
29
30
  end
30
31
 
31
32
  def all_metrics
32
- enforce_permission_to :read, :process, process: current_participatory_space
33
+ if current_participatory_space.show_statistics
34
+ enforce_permission_to :read, :process, process: current_participatory_space
35
+ else
36
+ render status: :not_found
37
+ end
33
38
  end
34
39
 
35
40
  private
@@ -106,6 +111,10 @@ module Decidim
106
111
  .published
107
112
  .all
108
113
  end
114
+
115
+ def linked_assemblies
116
+ @linked_assemblies ||= current_participatory_space.linked_participatory_space_resources(:assembly, "included_participatory_processes").public_spaces
117
+ end
109
118
  end
110
119
  end
111
120
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
- class ParticipatoryProcessWidgetsController < Decidim::WidgetsController
5
+ class WidgetsController < Decidim::WidgetsController
6
6
  helper Decidim::SanitizeHelper
7
7
 
8
8
  private
@@ -20,7 +20,7 @@ module Decidim
20
20
  end
21
21
 
22
22
  def iframe_url
23
- @iframe_url ||= participatory_process_participatory_process_widget_url(model)
23
+ @iframe_url ||= participatory_process_widget_url(model)
24
24
  end
25
25
  end
26
26
  end
@@ -0,0 +1,28 @@
1
+ # frozen-string_literal: true
2
+
3
+ module Decidim
4
+ class ParticipatoryProcessRoleAssignedEvent < Decidim::Events::SimpleEvent
5
+ include Decidim::Events::NotificationEvent
6
+ include Decidim::Events::AuthorEvent
7
+
8
+ def notification_title
9
+ I18n.t("notification_title", i18n_options).html_safe
10
+ end
11
+
12
+ def i18n_role
13
+ I18n.t(extra["role"], "decidim.admin.models.participatory_process_user_role.roles", default: extra["role"])
14
+ end
15
+
16
+ def i18n_options
17
+ {
18
+ resource_path: resource_path,
19
+ resource_title: resource_title,
20
+ resource_url: resource_url,
21
+ scope: event_name,
22
+ participatory_space_title: participatory_space_title,
23
+ participatory_space_url: participatory_space_url,
24
+ role: i18n_role
25
+ }
26
+ end
27
+ end
28
+ end
@@ -8,6 +8,7 @@ module Decidim
8
8
  #
9
9
  class ParticipatoryProcessForm < Form
10
10
  include TranslatableAttributes
11
+ include Decidim::HasUploadValidations
11
12
 
12
13
  mimic :participatory_process
13
14
 
@@ -54,12 +55,10 @@ module Decidim
54
55
 
55
56
  validates :title, :subtitle, :description, :short_description, translatable_presence: true
56
57
 
57
- validates :banner_image,
58
- file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } },
59
- file_content_type: { allow: ["image/jpeg", "image/png"] }
60
- validates :hero_image,
61
- file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } },
62
- file_content_type: { allow: ["image/jpeg", "image/png"] }
58
+ validates :banner_image, passthru: { to: Decidim::ParticipatoryProcess }
59
+ validates :hero_image, passthru: { to: Decidim::ParticipatoryProcess }
60
+
61
+ alias organization current_organization
63
62
 
64
63
  def map_model(model)
65
64
  self.scope_id = model.decidim_scope_id