decidim-participatory_processes 0.26.10 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters.erb +3 -3
  4. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/show.erb +1 -0
  5. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes_cell.rb +6 -11
  6. data/app/cells/decidim/participatory_process_groups/content_blocks/title/show.erb +1 -1
  7. data/app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb +1 -8
  8. data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +15 -18
  9. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb +1 -1
  10. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +1 -1
  11. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +1 -1
  12. data/app/cells/decidim/participatory_processes/filtered_participatory_processes_cell.rb +11 -7
  13. data/app/cells/decidim/participatory_processes/process_filters/show.erb +13 -9
  14. data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +17 -0
  15. data/app/cells/decidim/participatory_processes/process_filters_cell.rb +49 -21
  16. data/app/cells/decidim/participatory_processes/process_group_s/image.erb +1 -1
  17. data/app/cells/decidim/participatory_processes/process_s/image.erb +1 -1
  18. data/app/commands/decidim/participatory_processes/admin/activate_participatory_process_step.rb +1 -1
  19. data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +11 -8
  20. data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +2 -1
  21. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +1 -1
  22. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_step.rb +1 -1
  23. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +47 -0
  24. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb +1 -6
  25. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_group.rb +1 -1
  26. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb +1 -1
  27. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_type.rb +49 -0
  28. data/app/commands/decidim/participatory_processes/admin/import_participatory_process.rb +9 -6
  29. data/app/commands/decidim/participatory_processes/admin/notify_role_assigned_to_participatory_process.rb +1 -1
  30. data/app/commands/decidim/participatory_processes/admin/publish_participatory_process.rb +1 -1
  31. data/app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb +1 -1
  32. data/app/commands/decidim/participatory_processes/admin/unpublish_participatory_process.rb +1 -1
  33. data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +2 -1
  34. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +1 -1
  35. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +1 -1
  36. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +49 -0
  37. data/app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb +1 -1
  38. data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +3 -2
  39. data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +98 -0
  40. data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +1 -1
  41. data/app/controllers/decidim/participatory_processes/admin/reminders_controller.rb +14 -0
  42. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +8 -7
  43. data/app/events/decidim/participatory_process_role_assigned_event.rb +1 -1
  44. data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +16 -0
  45. data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +5 -7
  46. data/app/forms/decidim/participatory_processes/admin/participatory_process_type_form.rb +20 -0
  47. data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +2 -2
  48. data/app/models/decidim/participatory_process.rb +35 -6
  49. data/app/models/decidim/participatory_process_type.rb +27 -0
  50. data/app/permissions/decidim/participatory_processes/permissions.rb +14 -0
  51. data/app/presenters/decidim/log/value_types/participatory_process_type_presenter.rb +27 -0
  52. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +3 -2
  53. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_type_presenter.rb +38 -0
  54. data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb +4 -1
  55. data/app/presenters/decidim/participatory_processes/participatory_process_metric_charts_presenter.rb +5 -1
  56. data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb +4 -1
  57. data/app/queries/decidim/participatory_processes/admin/admin_users.rb +1 -1
  58. data/app/queries/decidim/participatory_processes/admin/moderators.rb +1 -1
  59. data/app/queries/decidim/participatory_processes/filtered_participatory_process_groups.rb +3 -5
  60. data/app/queries/decidim/participatory_processes/filtered_participatory_processes.rb +1 -1
  61. data/app/queries/decidim/participatory_processes/group_participatory_processes.rb +1 -1
  62. data/app/queries/decidim/participatory_processes/group_published_participatory_processes.rb +2 -2
  63. data/app/queries/decidim/participatory_processes/highlighted_participatory_processes.rb +1 -1
  64. data/app/queries/decidim/participatory_processes/organization_participatory_process_groups.rb +1 -1
  65. data/app/queries/decidim/participatory_processes/organization_participatory_processes.rb +1 -1
  66. data/app/queries/decidim/participatory_processes/organization_prioritized_participatory_process_groups.rb +2 -2
  67. data/app/queries/decidim/participatory_processes/organization_prioritized_participatory_processes.rb +2 -2
  68. data/app/queries/decidim/participatory_processes/organization_promoted_participatory_process_groups.rb +1 -1
  69. data/app/queries/decidim/participatory_processes/organization_published_participatory_processes.rb +2 -2
  70. data/app/queries/decidim/participatory_processes/participatory_processes_by_group.rb +1 -1
  71. data/app/queries/decidim/participatory_processes/prioritized_participatory_processes.rb +1 -1
  72. data/app/queries/decidim/participatory_processes/promoted_participatory_process_groups.rb +1 -1
  73. data/app/queries/decidim/participatory_processes/promoted_participatory_processes.rb +1 -1
  74. data/app/queries/decidim/participatory_processes/published_participatory_processes.rb +1 -1
  75. data/app/queries/decidim/participatory_processes/stats_followers_count.rb +2 -2
  76. data/app/queries/decidim/participatory_processes/stats_participants_count.rb +2 -14
  77. data/app/queries/decidim/participatory_processes/visible_participatory_process_groups.rb +1 -1
  78. data/app/queries/decidim/participatory_processes/visible_participatory_processes.rb +1 -1
  79. data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +4 -15
  80. data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +1 -1
  81. data/app/views/decidim/participatory_processes/admin/participatory_process_copies/new.html.erb +2 -1
  82. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb +1 -1
  83. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +0 -1
  84. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +0 -1
  85. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb +0 -1
  86. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/_form.html.erb +1 -1
  87. data/app/views/decidim/participatory_processes/admin/participatory_process_types/_form.html.erb +11 -0
  88. data/app/views/decidim/participatory_processes/admin/participatory_process_types/edit.html.erb +9 -0
  89. data/app/views/decidim/participatory_processes/admin/participatory_process_types/index.html.erb +60 -0
  90. data/app/views/decidim/participatory_processes/admin/participatory_process_types/new.html.erb +9 -0
  91. data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +11 -1
  92. data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +1 -0
  93. data/app/views/decidim/participatory_processes/admin/participatory_processes/new.html.erb +1 -0
  94. data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +3 -1
  95. data/app/views/decidim/participatory_processes/participatory_process_groups/show.js.erb +9 -6
  96. data/app/views/decidim/participatory_processes/participatory_process_steps/index.html.erb +1 -0
  97. data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb +1 -1
  98. data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process_group.html.erb +1 -1
  99. data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +3 -1
  100. data/app/views/decidim/participatory_processes/participatory_processes/index.js.erb +3 -1
  101. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +2 -2
  102. data/app/views/layouts/decidim/_process_header.html.erb +1 -1
  103. data/app/views/layouts/decidim/admin/participatory_process_type.html.erb +15 -0
  104. data/config/locales/am-ET.yml +1 -0
  105. data/config/locales/ar.yml +10 -13
  106. data/config/locales/bg.yml +1 -6
  107. data/config/locales/ca.yml +51 -16
  108. data/config/locales/cs.yml +62 -27
  109. data/config/locales/da.yml +1 -0
  110. data/config/locales/de.yml +20 -32
  111. data/config/locales/el.yml +9 -69
  112. data/config/locales/en.yml +42 -8
  113. data/config/locales/eo.yml +1 -0
  114. data/config/locales/es-MX.yml +46 -11
  115. data/config/locales/es-PY.yml +46 -11
  116. data/config/locales/es.yml +47 -12
  117. data/config/locales/et.yml +1 -0
  118. data/config/locales/eu.yml +121 -136
  119. data/config/locales/fi-plain.yml +48 -13
  120. data/config/locales/fi.yml +49 -14
  121. data/config/locales/fr-CA.yml +49 -14
  122. data/config/locales/fr.yml +51 -16
  123. data/config/locales/ga-IE.yml +1 -2
  124. data/config/locales/gl.yml +14 -10
  125. data/config/locales/hr.yml +1 -0
  126. data/config/locales/hu.yml +60 -136
  127. data/config/locales/id-ID.yml +10 -13
  128. data/config/locales/is-IS.yml +16 -6
  129. data/config/locales/it.yml +20 -15
  130. data/config/locales/ja.yml +53 -18
  131. data/config/locales/ko.yml +1 -0
  132. data/config/locales/lb.yml +8 -10
  133. data/config/locales/lt.yml +1 -505
  134. data/config/locales/lv.yml +10 -19
  135. data/config/locales/mt.yml +1 -0
  136. data/config/locales/nl.yml +16 -11
  137. data/config/locales/no.yml +36 -15
  138. data/config/locales/om-ET.yml +1 -0
  139. data/config/locales/pl.yml +19 -8
  140. data/config/locales/pt-BR.yml +14 -11
  141. data/config/locales/pt.yml +15 -10
  142. data/config/locales/ro-RO.yml +11 -15
  143. data/config/locales/ru.yml +10 -10
  144. data/config/locales/si-LK.yml +1 -0
  145. data/config/locales/sk.yml +11 -19
  146. data/config/locales/sl.yml +1 -3
  147. data/config/locales/so-SO.yml +1 -0
  148. data/config/locales/sr-CS.yml +1 -0
  149. data/config/locales/sv.yml +29 -13
  150. data/config/locales/sw-KE.yml +1 -0
  151. data/config/locales/ti-ER.yml +1 -0
  152. data/config/locales/tr-TR.yml +15 -10
  153. data/config/locales/uk.yml +10 -10
  154. data/config/locales/val-ES.yml +1 -0
  155. data/config/locales/vi.yml +1 -0
  156. data/config/locales/zh-CN.yml +10 -18
  157. data/config/locales/zh-TW.yml +1 -477
  158. data/db/migrate/20211125202008_create_decidim_participatory_process_types.rb +22 -0
  159. data/lib/decidim/api/participatory_process_type_type.rb +17 -0
  160. data/lib/decidim/participatory_processes/admin_engine.rb +12 -1
  161. data/lib/decidim/participatory_processes/api.rb +1 -0
  162. data/lib/decidim/participatory_processes/participatory_space.rb +17 -8
  163. data/lib/decidim/participatory_processes/query_extensions.rb +22 -0
  164. data/lib/decidim/participatory_processes/test/factories.rb +17 -4
  165. data/lib/decidim/participatory_processes/version.rb +1 -1
  166. metadata +31 -24
  167. data/app/services/decidim/participatory_processes/participatory_process_search.rb +0 -27
  168. data/config/environment.rb +0 -3
  169. data/config/locales/fa-IR.yml +0 -1
  170. data/config/locales/gn-PY.yml +0 -1
  171. data/config/locales/ka-GE.yml +0 -1
  172. data/config/locales/kaa.yml +0 -6
  173. data/config/locales/lo-LA.yml +0 -1
  174. data/config/locales/oc-FR.yml +0 -1
  175. data/config/locales/sq-AL.yml +0 -1
  176. data/config/locales/th-TH.yml +0 -1
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ module AdminLog
6
+ # This class holds the logic to present a
7
+ # `Decidim::ParticipatoryProcessType`
8
+ # for the `AdminLog` log.
9
+ #
10
+ # Usage should be automatic and you shouldn't need to call this class
11
+ # directly, but here's an example:
12
+ #
13
+ # action_log = Decidim::ActionLog.last
14
+ # view_helpers # => this comes from the views
15
+ # ParticipatoryProcessTypePresenter.new(action_log, view_helpers).present
16
+ class ParticipatoryProcessTypePresenter < Decidim::Log::BasePresenter
17
+ private
18
+
19
+ def diff_fields_mapping
20
+ { title: :i18n }
21
+ end
22
+
23
+ def action_string
24
+ case action
25
+ when "create", "update"
26
+ "decidim.admin_log.participatory_process_type.#{action}"
27
+ else
28
+ super
29
+ end
30
+ end
31
+
32
+ def i18n_labels_scope
33
+ "activemodel.attributes.participatory_process_type"
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -4,9 +4,12 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # A presenter to render statistics in the homepage.
6
6
  class ParticipatoryProcessGroupStatsPresenter < Decidim::StatsPresenter
7
- attribute :participatory_process_group, Decidim::ParticipatoryProcessGroup
8
7
  include Decidim::IconHelper
9
8
 
9
+ def participatory_process_group
10
+ __getobj__.fetch(:participatory_process_group)
11
+ end
12
+
10
13
  # Public: returns a collection of stats (Hash) for the participatory
11
14
  # process group landing page.
12
15
  def collection
@@ -4,7 +4,11 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # A presenter to render metrics in ParticipatoryProcesses statistics page
6
6
  class ParticipatoryProcessMetricChartsPresenter < Decidim::MetricChartsPresenter
7
- attribute :participatory_process, Decidim::ParticipatoryProcess
7
+ delegate :hidden_field_tag, :link_to, :capture, to: :view_context
8
+
9
+ def participatory_process
10
+ __getobj__.fetch(:participatory_process)
11
+ end
8
12
 
9
13
  def params
10
14
  capture do
@@ -4,9 +4,12 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # A presenter to render statistics in the homepage.
6
6
  class ParticipatoryProcessStatsPresenter < Decidim::StatsPresenter
7
- attribute :participatory_process, Decidim::ParticipatoryProcess
8
7
  include Decidim::IconHelper
9
8
 
9
+ def participatory_process
10
+ __getobj__.fetch(:participatory_process)
11
+ end
12
+
10
13
  # Public: returns a collection of stats (Hash) for the Process Home.
11
14
  def collection
12
15
  highlighted_stats = process_participants_stats
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A class used to find the admins for a participatory process including
7
7
  # organization admins.
8
- class AdminUsers < Rectify::Query
8
+ class AdminUsers < Decidim::Query
9
9
  # Syntactic sugar to initialize the class and return the queried objects.
10
10
  #
11
11
  # process - a process that needs to find its process admins
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A class used to find the users that can moderate the participatory
7
7
  # process.
8
- class Moderators < Rectify::Query
8
+ class Moderators < Decidim::Query
9
9
  # Syntactic sugar to initialize the class and return the queried objects.
10
10
  #
11
11
  # process - a process that needs to find its moderators
@@ -5,7 +5,7 @@ module Decidim
5
5
  # This query class filters participatory processes groups given a filter name.
6
6
  # The filter is applied checking the start and end dates of the processes in
7
7
  # the group.
8
- class FilteredParticipatoryProcessGroups < Rectify::Query
8
+ class FilteredParticipatoryProcessGroups < Decidim::Query
9
9
  def initialize(filter = "active")
10
10
  @filter = filter
11
11
  end
@@ -15,11 +15,9 @@ module Decidim
15
15
 
16
16
  processes = case @filter
17
17
  when "past"
18
- processes.past
18
+ processes.where("decidim_participatory_processes.end_date <= ?", Date.current)
19
19
  when "upcoming"
20
- processes.upcoming
21
- when "active"
22
- processes.active
20
+ processes.where("decidim_participatory_processes.start_date > ?", Date.current)
23
21
  else
24
22
  processes
25
23
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters participatory processes given a filter name.
6
6
  # It uses the start and end dates to select the correct processes.
7
- class FilteredParticipatoryProcesses < Rectify::Query
7
+ class FilteredParticipatoryProcesses < Decidim::Query
8
8
  def initialize(filter = "active")
9
9
  @filter = filter
10
10
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters all processes of a participatory process group
6
- class GroupParticipatoryProcesses < Rectify::Query
6
+ class GroupParticipatoryProcesses < Decidim::Query
7
7
  def initialize(group)
8
8
  @group = group
9
9
  end
@@ -3,14 +3,14 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters published processes of a participatory process group
6
- class GroupPublishedParticipatoryProcesses < Rectify::Query
6
+ class GroupPublishedParticipatoryProcesses < Decidim::Query
7
7
  def initialize(group, user = nil)
8
8
  @group = group
9
9
  @user = user
10
10
  end
11
11
 
12
12
  def query
13
- Rectify::Query.merge(
13
+ Decidim::Query.merge(
14
14
  GroupParticipatoryProcesses.new(@group),
15
15
  VisibleParticipatoryProcesses.new(@user),
16
16
  PublishedParticipatoryProcesses.new
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query selects some prioritized processes.
6
- class HighlightedParticipatoryProcesses < Rectify::Query
6
+ class HighlightedParticipatoryProcesses < Decidim::Query
7
7
  def query
8
8
  PrioritizedParticipatoryProcesses.new.query.limit(8)
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters participatory process groups given an organization.
6
- class OrganizationParticipatoryProcessGroups < Rectify::Query
6
+ class OrganizationParticipatoryProcessGroups < Decidim::Query
7
7
  def initialize(organization)
8
8
  @organization = organization
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters all processes given an organization.
6
- class OrganizationParticipatoryProcesses < Rectify::Query
6
+ class OrganizationParticipatoryProcesses < Decidim::Query
7
7
  def initialize(organization)
8
8
  @organization = organization
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters participatory process groups given an organization and a filter.
6
- class OrganizationPrioritizedParticipatoryProcessGroups < Rectify::Query
6
+ class OrganizationPrioritizedParticipatoryProcessGroups < Decidim::Query
7
7
  def initialize(organization, filter = "active", user = nil)
8
8
  @organization = organization
9
9
  @filter = filter
@@ -11,7 +11,7 @@ module Decidim
11
11
  end
12
12
 
13
13
  def query
14
- Rectify::Query.merge(
14
+ Decidim::Query.merge(
15
15
  OrganizationParticipatoryProcessGroups.new(@organization),
16
16
  FilteredParticipatoryProcessGroups.new(@filter),
17
17
  VisibleParticipatoryProcessGroups.new(@user)
@@ -4,7 +4,7 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters public processes given an organization and a
6
6
  # filter in a meaningful prioritized order.
7
- class OrganizationPrioritizedParticipatoryProcesses < Rectify::Query
7
+ class OrganizationPrioritizedParticipatoryProcesses < Decidim::Query
8
8
  def initialize(organization, filter = "active", user = nil)
9
9
  @organization = organization
10
10
  @filter = filter
@@ -12,7 +12,7 @@ module Decidim
12
12
  end
13
13
 
14
14
  def query
15
- Rectify::Query.merge(
15
+ Decidim::Query.merge(
16
16
  OrganizationPublishedParticipatoryProcesses.new(@organization, @user),
17
17
  PrioritizedParticipatoryProcesses.new,
18
18
  FilteredParticipatoryProcesses.new(@filter)
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters participatory process groups given an organization.
6
- class OrganizationPromotedParticipatoryProcessGroups < Rectify::Query
6
+ class OrganizationPromotedParticipatoryProcessGroups < Decidim::Query
7
7
  def initialize(organization)
8
8
  @organization = organization
9
9
  end
@@ -3,14 +3,14 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters published processes given an organization.
6
- class OrganizationPublishedParticipatoryProcesses < Rectify::Query
6
+ class OrganizationPublishedParticipatoryProcesses < Decidim::Query
7
7
  def initialize(organization, user = nil)
8
8
  @organization = organization
9
9
  @user = user
10
10
  end
11
11
 
12
12
  def query
13
- Rectify::Query.merge(
13
+ Decidim::Query.merge(
14
14
  OrganizationParticipatoryProcesses.new(@organization),
15
15
  VisibleParticipatoryProcesses.new(@user),
16
16
  PublishedParticipatoryProcesses.new
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # A class used to find the ParticipatoryProcesses from a ProcessGroup.
6
- class ParticipatoryProcessesByGroup < Rectify::Query
6
+ class ParticipatoryProcessesByGroup < Decidim::Query
7
7
  # Syntactic sugar to initialize the class and return the queried objects.
8
8
  def self.for(process_group)
9
9
  new(process_group).query
@@ -4,7 +4,7 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query orders processes by importance, prioritizing promoted processes
6
6
  # first, and closest to finalization date second.
7
- class PrioritizedParticipatoryProcesses < Rectify::Query
7
+ class PrioritizedParticipatoryProcesses < Decidim::Query
8
8
  def query
9
9
  Decidim::ParticipatoryProcess.order(promoted: :desc).includes(:active_step).order("decidim_participatory_process_steps.end_date ASC")
10
10
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query filters participatory process groups so only promoted ones are returned.
6
- class PromotedParticipatoryProcessGroups < Rectify::Query
6
+ class PromotedParticipatoryProcessGroups < Decidim::Query
7
7
  def query
8
8
  Decidim::ParticipatoryProcessGroup.promoted
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query filters processes so only promoted ones are returned.
6
- class PromotedParticipatoryProcesses < Rectify::Query
6
+ class PromotedParticipatoryProcesses < Decidim::Query
7
7
  def query
8
8
  Decidim::ParticipatoryProcess.promoted
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query filters published processes only.
6
- class PublishedParticipatoryProcesses < Rectify::Query
6
+ class PublishedParticipatoryProcesses < Decidim::Query
7
7
  def query
8
8
  Decidim::ParticipatoryProcess.published
9
9
  end
@@ -4,10 +4,10 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This class counts all Followers of a participatory process or
6
6
  # participatory processes belonging to a participatory process group
7
- class StatsFollowersCount < Rectify::Query
7
+ class StatsFollowersCount < Decidim::Query
8
8
  def self.for(participatory_space)
9
9
  return 0 unless participatory_space.is_a?(Decidim::ParticipatoryProcess) ||
10
- participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?
10
+ (participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?)
11
11
 
12
12
  new(participatory_space).query
13
13
  end
@@ -4,10 +4,10 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This class counts unique Participants on a participatory process or
6
6
  # participatory processes belonging to a participatory process group
7
- class StatsParticipantsCount < Rectify::Query
7
+ class StatsParticipantsCount < Decidim::Query
8
8
  def self.for(participatory_space)
9
9
  return 0 unless participatory_space.is_a?(Decidim::ParticipatoryProcess) ||
10
- participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?
10
+ (participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?)
11
11
 
12
12
  new(participatory_space).query
13
13
  end
@@ -42,8 +42,6 @@ module Decidim
42
42
  end
43
43
 
44
44
  def comments_query
45
- return [] unless Decidim.module_installed?(:comments)
46
-
47
45
  Decidim::Comments::Comment
48
46
  .where(decidim_participatory_space_type: Decidim::ParticipatoryProcess.class.name)
49
47
  .where(decidim_participatory_space_id: participatory_space_ids)
@@ -52,8 +50,6 @@ module Decidim
52
50
  end
53
51
 
54
52
  def debates_query
55
- return [] unless Decidim.module_installed?(:debates)
56
-
57
53
  Decidim::Debates::Debate
58
54
  .where(
59
55
  component: space_components,
@@ -65,8 +61,6 @@ module Decidim
65
61
  end
66
62
 
67
63
  def meetings_query
68
- return [] unless Decidim.module_installed?(:meetings)
69
-
70
64
  meetings = Decidim::Meetings::Meeting.where(component: space_components).not_hidden
71
65
  registrations = Decidim::Meetings::Registration.where(decidim_meeting_id: meetings).distinct.pluck(:decidim_user_id)
72
66
  organizers = meetings.where(decidim_author_type: Decidim::UserBaseEntity.name).distinct.pluck(:decidim_author_id)
@@ -82,8 +76,6 @@ module Decidim
82
76
  end
83
77
 
84
78
  def proposals_query
85
- return [] unless Decidim.module_installed?(:proposals)
86
-
87
79
  Decidim::Coauthorship
88
80
  .where(
89
81
  coauthorable: proposals_components,
@@ -94,8 +86,6 @@ module Decidim
94
86
  end
95
87
 
96
88
  def proposal_supports_query
97
- return [] unless Decidim.module_installed?(:proposals)
98
-
99
89
  Decidim::Proposals::ProposalVote
100
90
  .where(
101
91
  proposal: proposals_components
@@ -106,8 +96,6 @@ module Decidim
106
96
  end
107
97
 
108
98
  def project_supports_query
109
- return [] unless Decidim.module_installed?(:budgets)
110
-
111
99
  Decidim::Budgets::Order.joins(budget: [:component])
112
100
  .where(budget: {
113
101
  decidim_components: { id: space_components.pluck(:id) }
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters participatory processes given a current_user.
6
- class VisibleParticipatoryProcessGroups < Rectify::Query
6
+ class VisibleParticipatoryProcessGroups < Decidim::Query
7
7
  def initialize(current_user)
8
8
  @current_user = current_user
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This query class filters participatory processes given a current_user.
6
- class VisibleParticipatoryProcesses < Rectify::Query
6
+ class VisibleParticipatoryProcesses < Decidim::Query
7
7
  def initialize(current_user)
8
8
  @current_user = current_user
9
9
  end
@@ -44,23 +44,17 @@ module Decidim
44
44
  scopes_enabled: attributes["scopes_enabled"],
45
45
  participatory_process_group: import_process_group(attributes["participatory_process_group"])
46
46
  )
47
- @imported_process.attached_uploader(:hero_image).remote_url = attributes["remote_hero_image_url"] if attributes["remote_hero_image_url"].present?
48
- @imported_process.attached_uploader(:banner_image).remote_url = attributes["remote_banner_image_url"] if attributes["remote_banner_image_url"].present?
49
-
47
+ @imported_process.remote_hero_image_url = attributes["remote_hero_image_url"] if remote_file_exists?(attributes["remote_hero_image_url"])
48
+ @imported_process.remote_banner_image_url = attributes["remote_banner_image_url"] if remote_file_exists?(attributes["remote_banner_image_url"])
50
49
  @imported_process.save!
51
50
  @imported_process
52
51
  end
53
52
  end
54
53
 
55
54
  def import_process_group(attributes)
56
- title = compact_translation(attributes["title"] || attributes["name"])
57
- description = compact_translation(attributes["description"])
58
-
59
- return if title.blank? && description.blank?
60
-
61
55
  Decidim.traceability.perform_action!("create", ParticipatoryProcessGroup, @user) do
62
56
  group = ParticipatoryProcessGroup.find_or_initialize_by(
63
- title: attributes["title"] || attributes["name"],
57
+ title: attributes["title"],
64
58
  description: attributes["description"],
65
59
  organization: @organization
66
60
  )
@@ -122,7 +116,7 @@ module Decidim
122
116
  attachments["files"].map do |file|
123
117
  next unless remote_file_exists?(file["remote_file_url"])
124
118
 
125
- file_tmp = URI.open(file["remote_file_url"])
119
+ file_tmp = URI.parse(file["remote_file_url"]).open
126
120
 
127
121
  Decidim.traceability.perform_action!("create", Attachment, @user) do
128
122
  attachment = Attachment.new(
@@ -157,11 +151,6 @@ module Decidim
157
151
 
158
152
  private
159
153
 
160
- def compact_translation(translation)
161
- translation["machine_translations"] = translation["machine_translations"].reject { |_k, v| v.blank? } if translation["machine_translations"].present?
162
- translation.reject { |_k, v| v.blank? }
163
- end
164
-
165
154
  def create_attachment_collection(attributes)
166
155
  return unless attributes.compact.any?
167
156
 
@@ -10,7 +10,7 @@
10
10
  <h3 class="timeline__title heading4"><%= translated_attribute(participatory_process_step.title) %></h3>
11
11
  </div>
12
12
  <div class="timeline__content">
13
- <%= decidim_sanitize_editor_admin translated_attribute(participatory_process_step.description) %>
13
+ <%= translated_attribute(participatory_process_step.description).html_safe %>
14
14
  </div>
15
15
  </div>
16
16
  </li>
@@ -1,4 +1,5 @@
1
- <% add_decidim_page_title(t("participatory_process_copies.new.title", scope: "decidim.admin")) %>
1
+ <% add_decidim_page_title(t("participatory_process_copies.new.select", scope: "decidim.admin")) %>
2
+
2
3
  <%= decidim_form_for(@form, url: participatory_process_copies_path(current_participatory_process), method: :post, html: { class: "form copy_participatory_process" }) do |f| %>
3
4
  <%= render partial: "form", object: f, locals: { title: t("participatory_process_copies.new.title", scope: "decidim.admin"), select: t("participatory_process_copies.new.select", scope: "decidim.admin") } %>
4
5
 
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <div class="row column">
11
- <%= form.translated :editor, :description %>
11
+ <%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
12
12
  </div>
13
13
 
14
14
  <div class="row column">
@@ -1,4 +1,3 @@
1
- <% add_decidim_page_title t("participatory_process_groups.edit.title", scope: "decidim.admin") %>
2
1
  <%= decidim_form_for(@form, html: { class: "form edit_participatory_process_group" }) do |f| %>
3
2
  <h2 class="process-title-summary">
4
3
  <%= t "participatory_process_groups.edit.title", scope: "decidim.admin" %>
@@ -1,4 +1,3 @@
1
- <% add_decidim_page_title(t("decidim.admin.titles.participatory_process_groups")) %>
2
1
  <% content_for :sidebar_menu_nav do %>
3
2
  <%= sidebar_menu(:admin_participatory_processes_menu).render %>
4
3
  <% end %>
@@ -1,4 +1,3 @@
1
- <% add_decidim_page_title(t("participatory_process_groups.new.title", scope: "decidim.admin")) %>
2
1
  <%= decidim_form_for(@form, html: { class: "form new_participatory_process_group" }) do |f| %>
3
2
  <h2 class="process-title-summary"><%= t "participatory_process_groups.new.title", scope: "decidim.admin" %></h2>
4
3
  <%= render partial: "form", object: f %>
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
 
11
11
  <div class="row column">
12
- <%= form.translated :editor, :description %>
12
+ <%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
13
13
  </div>
14
14
 
15
15
  <div class="row">
@@ -0,0 +1,11 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= t("participatory_process_types.form.title", scope: "decidim.admin") %></h2>
4
+ </div>
5
+
6
+ <div class="card-section">
7
+ <div class="row column">
8
+ <%= form.translated :text_field, :title, autofocus: true %>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1,9 @@
1
+ <%= decidim_form_for(@form, html: { class: "form edit_participatory_process_type" }) do |f| %>
2
+ <h2 class="process-title-summary">
3
+ <%= t("participatory_process_types.edit.title", scope: "decidim.admin") %>
4
+ </h2>
5
+ <%= render partial: "form", object: f %>
6
+ <div class="button--double form-general-submit">
7
+ <%= f.submit t("participatory_process_types.edit.update", scope: "decidim.admin"), class: "button" %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,60 @@
1
+ <div class="card" id="participatory-process-types">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t("titles.participatory_process_types", scope: "decidim.admin") %>
5
+ <%= link_to(
6
+ t("actions.new_process_type", scope: "decidim.admin"),
7
+ [:new, :participatory_process_type],
8
+ class: "button tiny button--title"
9
+ ) if allowed_to? :create, :participatory_process_type %>
10
+ </h2>
11
+ </div>
12
+ <div class="card-section">
13
+ <div class="table-scroll">
14
+ <table class="table-list">
15
+ <thead>
16
+ <tr>
17
+ <th><%= t("models.participatory_process_type.fields.title", scope: "decidim.admin") %></th>
18
+ <th><%= t("models.participatory_process_type.fields.created_at", scope: "decidim.admin") %></th>
19
+ <th></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% collection.each do |participatory_process_type| %>
24
+ <tr>
25
+ <td>
26
+ <% if allowed_to?(:update, :participatory_process_type, participatory_process_type: participatory_process_type) %>
27
+ <%= link_to(
28
+ translated_attribute(participatory_process_type.title),
29
+ edit_participatory_process_type_path(participatory_process_type)
30
+ ) %>
31
+ <% else %>
32
+ <%= translated_attribute(participatory_process_type.title) %></td>
33
+ <% end %>
34
+ <td><%= l(participatory_process_type.created_at, format: :short) %></td>
35
+ <td class="table-list__actions">
36
+ <% if allowed_to?(:update, :participatory_process_type, participatory_process_type: participatory_process_type) %>
37
+ <%= icon_link_to(
38
+ "pencil",
39
+ edit_participatory_process_type_path(participatory_process_type),
40
+ t("actions.edit", scope: "decidim.admin"),
41
+ class: "action-icon--new"
42
+ ) %>
43
+ <% end %>
44
+ <% if allowed_to?(:destroy, :participatory_process_type, participatory_process_type: participatory_process_type) %>
45
+ <%= icon_link_to(
46
+ "circle-x",
47
+ participatory_process_type_path(participatory_process_type),
48
+ t("actions.destroy", scope: "decidim.admin"),
49
+ class: "action-icon--remove",
50
+ method: :delete,
51
+ data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") }
52
+ ) %>
53
+ <% end %>
54
+ </td>
55
+ <% end %>
56
+ </tbody>
57
+ </table>
58
+ </div>
59
+ </div>
60
+ </div>
@@ -0,0 +1,9 @@
1
+ <%= decidim_form_for(@form, html: { class: "form new_participatory_process_type" }) do |f| %>
2
+ <h2 class="process-title-summary">
3
+ <%= t("participatory_process_types.new.title", scope: "decidim.admin") %>
4
+ </h2>
5
+ <%= render partial: "form", object: f %>
6
+ <div class="button--double form-general-submit">
7
+ <%= f.submit t("participatory_process_types.new.create", scope: "decidim.admin"), class: "button" %>
8
+ </div>
9
+ <% end %>
@@ -34,7 +34,7 @@
34
34
  </div>
35
35
 
36
36
  <div class="row column">
37
- <%= form.translated :editor, :description %>
37
+ <%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
38
38
  </div>
39
39
 
40
40
  <div class="row column">
@@ -188,6 +188,16 @@
188
188
  <div class="row column">
189
189
  <%= form.check_box :show_metrics %>
190
190
  </div>
191
+
192
+ <% if @form.participatory_process_types_for_select.present? %>
193
+ <div class="row column">
194
+ <%= form.select(
195
+ :participatory_process_type_id,
196
+ @form.participatory_process_types_for_select,
197
+ include_blank: t(".select_participatory_process_type")
198
+ ) %>
199
+ </div>
200
+ <% end %>
191
201
  </div>
192
202
  </div>
193
203