decidim-participatory_processes 0.28.5 → 0.29.0.rc1

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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/participatory_process_groups/content_blocks/extra_data_cell.rb +4 -4
  3. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +0 -2
  4. data/app/cells/decidim/participatory_processes/content_blocks/stats_cell.rb +1 -1
  5. data/app/cells/decidim/participatory_processes/process_filters/filter_tabs.erb +2 -2
  6. data/app/cells/decidim/participatory_processes/process_filters/show.erb +1 -1
  7. data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +1 -1
  8. data/app/cells/decidim/participatory_processes/process_filters_cell.rb +1 -2
  9. data/app/cells/decidim/participatory_processes/process_g_cell.rb +2 -2
  10. data/app/cells/decidim/participatory_processes/process_group_g_cell.rb +2 -2
  11. data/app/cells/decidim/participatory_processes/process_group_s_cell.rb +5 -1
  12. data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +5 -7
  13. data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +27 -99
  14. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +10 -53
  15. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_step.rb +9 -36
  16. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +4 -34
  17. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb +6 -37
  18. data/app/commands/decidim/participatory_processes/admin/import_participatory_process.rb +5 -4
  19. data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +10 -80
  20. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +6 -55
  21. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +8 -52
  22. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +2 -38
  23. data/app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb +1 -1
  24. data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +2 -2
  25. data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb +2 -2
  26. data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +2 -2
  27. data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +1 -1
  28. data/app/controllers/decidim/participatory_processes/admin/participatory_space_private_users_controller.rb +1 -1
  29. data/app/controllers/decidim/participatory_processes/application_controller.rb +3 -0
  30. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +1 -6
  31. data/app/events/decidim/participatory_process_role_assigned_event.rb +0 -5
  32. data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +3 -8
  33. data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +1 -1
  34. data/app/models/decidim/participatory_process.rb +1 -4
  35. data/app/models/decidim/participatory_process_step.rb +1 -1
  36. data/app/permissions/decidim/participatory_processes/permissions.rb +1 -1
  37. data/app/presenters/decidim/participatory_processes/participatory_process_group_presenter.rb +1 -1
  38. data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +1 -5
  39. data/app/queries/decidim/participatory_processes/stats_participants_count.rb +4 -4
  40. data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +2 -5
  41. data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +0 -3
  42. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +1 -1
  43. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/show.html.erb +1 -1
  44. data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +1 -1
  45. data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +5 -17
  46. data/app/views/decidim/participatory_processes/participatory_processes/all_metrics.html.erb +4 -1
  47. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +24 -20
  48. data/config/locales/ar.yml +3 -15
  49. data/config/locales/bg.yml +3 -4
  50. data/config/locales/ca.yml +5 -8
  51. data/config/locales/cs.yml +6 -14
  52. data/config/locales/de.yml +4 -7
  53. data/config/locales/el.yml +3 -5
  54. data/config/locales/en.yml +2 -5
  55. data/config/locales/es-MX.yml +3 -6
  56. data/config/locales/es-PY.yml +3 -6
  57. data/config/locales/es.yml +3 -6
  58. data/config/locales/eu.yml +51 -54
  59. data/config/locales/fi-plain.yml +3 -6
  60. data/config/locales/fi.yml +15 -18
  61. data/config/locales/fr-CA.yml +4 -7
  62. data/config/locales/fr.yml +4 -7
  63. data/config/locales/ga-IE.yml +0 -10
  64. data/config/locales/gl.yml +3 -16
  65. data/config/locales/hu.yml +3 -5
  66. data/config/locales/id-ID.yml +3 -13
  67. data/config/locales/is-IS.yml +1 -13
  68. data/config/locales/it.yml +3 -16
  69. data/config/locales/ja.yml +2 -5
  70. data/config/locales/lb.yml +3 -15
  71. data/config/locales/lt.yml +2 -4
  72. data/config/locales/lv.yml +3 -14
  73. data/config/locales/nl.yml +2 -15
  74. data/config/locales/no.yml +4 -6
  75. data/config/locales/pl.yml +3 -4
  76. data/config/locales/pt-BR.yml +3 -13
  77. data/config/locales/pt.yml +2 -21
  78. data/config/locales/ro-RO.yml +1 -10
  79. data/config/locales/ru.yml +1 -13
  80. data/config/locales/sk.yml +3 -14
  81. data/config/locales/sr-CS.yml +0 -1
  82. data/config/locales/sv.yml +147 -233
  83. data/config/locales/tr-TR.yml +3 -16
  84. data/config/locales/uk.yml +1 -13
  85. data/config/locales/zh-CN.yml +3 -14
  86. data/config/locales/zh-TW.yml +2 -4
  87. data/db/migrate/20240529161054_add_link_to_decidim_attachments.rb +7 -0
  88. data/decidim-participatory_processes.gemspec +2 -2
  89. data/lib/decidim/api/participatory_process_group_type.rb +1 -1
  90. data/lib/decidim/api/participatory_process_type.rb +1 -8
  91. data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +1 -1
  92. data/lib/decidim/participatory_processes/engine.rb +1 -0
  93. data/lib/decidim/participatory_processes/menu.rb +11 -0
  94. data/lib/decidim/participatory_processes/query_extensions.rb +0 -26
  95. data/lib/decidim/participatory_processes/seeds.rb +4 -12
  96. data/lib/decidim/participatory_processes/test/factories.rb +0 -3
  97. data/lib/decidim/participatory_processes/version.rb +1 -1
  98. data/lib/tasks/decidim_participatory_processes.rake +1 -1
  99. metadata +16 -22
  100. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_group.rb +0 -46
  101. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_type.rb +0 -49
  102. data/app/views/decidim/participatory_processes/participatory_processes/_statistics.html.erb +0 -0
  103. data/app/views/layouts/decidim/_process_header.html.erb +0 -17
  104. data/app/views/layouts/decidim/participatory_process.html.erb +0 -18
  105. data/config/locales/bn-BD.yml +0 -1
  106. data/config/locales/bs-BA.yml +0 -33
@@ -3,95 +3,25 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  module Admin
6
- # A command with all the business logic when creating a new participatory
6
+ # A command with all the business logic when updating a participatory
7
7
  # process in the system.
8
- class UpdateParticipatoryProcess < Decidim::Command
9
- include ::Decidim::AttachmentAttributesMethods
8
+ class UpdateParticipatoryProcess < Decidim::Commands::UpdateResource
9
+ fetch_file_attributes :hero_image
10
10
 
11
- # Public: Initializes the command.
12
- #
13
- # participatory_process - the ParticipatoryProcess to update
14
- # form - A form object with the params.
15
- def initialize(participatory_process, form)
16
- @participatory_process = participatory_process
17
- @form = form
18
- end
19
-
20
- # Executes the command. Broadcasts these events:
21
- #
22
- # - :ok when everything is valid.
23
- # - :invalid if the form was not valid and we could not proceed.
24
- #
25
- # Returns nothing.
26
- def call
27
- return broadcast(:invalid) if form.invalid?
28
-
29
- update_participatory_process
30
-
31
- if @participatory_process.valid?
32
- broadcast(:ok, @participatory_process)
33
- else
34
- form.errors.add(:hero_image, @participatory_process.errors[:hero_image]) if @participatory_process.errors.include? :hero_image
35
- form.errors.add(:banner_image, @participatory_process.errors[:banner_image]) if @participatory_process.errors.include? :banner_image
36
- broadcast(:invalid)
37
- end
38
- end
11
+ fetch_form_attributes :title, :subtitle, :weight, :slug, :hashtag, :promoted, :description,
12
+ :short_description, :scopes_enabled, :scope, :scope_type_max_depth,
13
+ :private_space, :developer_group, :local_area, :area, :target, :participatory_scope,
14
+ :participatory_structure, :meta_scope, :start_date, :end_date, :participatory_process_group,
15
+ :participatory_process_type, :announcement
39
16
 
40
17
  private
41
18
 
42
- attr_reader :form, :participatory_process
43
-
44
- def update_participatory_process
45
- @participatory_process.assign_attributes(attributes)
46
- return unless @participatory_process.valid?
47
-
48
- @participatory_process.save!
49
-
50
- Decidim.traceability.perform_action!(:update, @participatory_process, form.current_user) do
51
- @participatory_process
52
- end
53
- link_related_processes
54
- end
55
-
56
- def attributes
57
- {
58
- title: form.title,
59
- subtitle: form.subtitle,
60
- weight: form.weight,
61
- slug: form.slug,
62
- hashtag: form.hashtag,
63
- promoted: form.promoted,
64
- description: form.description,
65
- short_description: form.short_description,
66
- scopes_enabled: form.scopes_enabled,
67
- scope: form.scope,
68
- scope_type_max_depth: form.scope_type_max_depth,
69
- private_space: form.private_space,
70
- developer_group: form.developer_group,
71
- local_area: form.local_area,
72
- area: form.area,
73
- target: form.target,
74
- participatory_scope: form.participatory_scope,
75
- participatory_structure: form.participatory_structure,
76
- meta_scope: form.meta_scope,
77
- start_date: form.start_date,
78
- end_date: form.end_date,
79
- participatory_process_group: form.participatory_process_group,
80
- participatory_process_type: form.participatory_process_type,
81
- show_metrics: form.show_metrics,
82
- show_statistics: form.show_statistics,
83
- announcement: form.announcement
84
- }.merge(
85
- attachment_attributes(:hero_image, :banner_image)
86
- )
87
- end
88
-
89
19
  def related_processes
90
20
  @related_processes ||= Decidim::ParticipatoryProcess.where(id: form.related_process_ids)
91
21
  end
92
22
 
93
- def link_related_processes
94
- @participatory_process.link_participatory_space_resources(related_processes, "related_processes")
23
+ def run_after_hooks
24
+ resource.link_participatory_space_resources(related_processes, "related_processes")
95
25
  end
96
26
  end
97
27
  end
@@ -3,69 +3,20 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  module Admin
6
- # A command with all the business logic when creating a new participatory
6
+ # A command with all the business logic when updating a participatory
7
7
  # process group in the system.
8
- class UpdateParticipatoryProcessGroup < Decidim::Command
9
- include ::Decidim::AttachmentAttributesMethods
8
+ class UpdateParticipatoryProcessGroup < Decidim::Commands::UpdateResource
9
+ fetch_file_attributes :hero_image
10
10
 
11
- # Public: Initializes the command.
12
- #
13
- # participatory_process_group - the ParticipatoryProcessGroup to update
14
- # form - A form object with the params.
15
- def initialize(participatory_process_group, form)
16
- @participatory_process_group = participatory_process_group
17
- @form = form
18
- end
19
-
20
- # Executes the command. Broadcasts these events:
21
- #
22
- # - :ok when everything is valid.
23
- # - :invalid if the form was not valid and we could not proceed.
24
- #
25
- # Returns nothing.
26
- def call
27
- return broadcast(:invalid) if form.invalid?
28
-
29
- update_participatory_process_group
30
-
31
- if @participatory_process_group.valid?
32
- broadcast(:ok, @participatory_process_group)
33
- else
34
- form.errors.add(:hero_image, @participatory_process_group.errors[:hero_image]) if @participatory_process_group.errors.include? :hero_image
35
- broadcast(:invalid)
36
- end
37
- end
11
+ fetch_form_attributes :title, :description, :hashtag, :group_url, :developer_group, :local_area,
12
+ :meta_scope, :participatory_scope, :participatory_structure, :target, :promoted
38
13
 
39
14
  private
40
15
 
41
16
  attr_reader :form
42
17
 
43
- def update_participatory_process_group
44
- Decidim.traceability.perform_action!(
45
- "update",
46
- @participatory_process_group,
47
- form.current_user
48
- ) do
49
- @participatory_process_group.assign_attributes(attributes)
50
- @participatory_process_group.save! if @participatory_process_group.valid?
51
- end
52
- end
53
-
54
18
  def attributes
55
- {
56
- title: form.title,
57
- description: form.description,
58
- hashtag: form.hashtag,
59
- group_url: form.group_url,
60
- participatory_processes:,
61
- developer_group: form.developer_group,
62
- local_area: form.local_area,
63
- meta_scope: form.meta_scope,
64
- participatory_scope: form.participatory_scope,
65
- participatory_structure: form.participatory_structure,
66
- target: form.target,
67
- promoted: form.promoted
68
- }.merge(attachment_attributes(:hero_image))
19
+ super.merge({ participatory_processes: })
69
20
  end
70
21
 
71
22
  def participatory_processes
@@ -3,65 +3,21 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  module Admin
6
- # A command with all the business logic when creating a new participatory
7
- # process in the system.
8
- class UpdateParticipatoryProcessStep < Decidim::Command
9
- attr_reader :step
10
-
11
- # Public: Initializes the command.
12
- #
13
- # step - the ParticipatoryProcessStep to update
14
- # form - A form object with the params.
15
- def initialize(step, form)
16
- @step = step
17
- @form = form
18
- end
19
-
20
- # Executes the command. Broadcasts these events:
21
- #
22
- # - :ok when everything is valid.
23
- # - :invalid if the form was not valid and we could not proceed.
24
- #
25
- # Returns nothing.
26
- def call
27
- return broadcast(:invalid) if form.invalid?
28
-
29
- update_step
30
- notify_followers
31
- broadcast(:ok)
32
- end
6
+ # A command with all the business logic when updating a participatory
7
+ # process step in the system.
8
+ class UpdateParticipatoryProcessStep < Decidim::Commands::UpdateResource
9
+ fetch_form_attributes :cta_path, :cta_text, :title, :start_date, :end_date, :description
33
10
 
34
11
  private
35
12
 
36
- attr_reader :form
37
-
38
- def update_step
39
- Decidim.traceability.update!(
40
- step,
41
- form.current_user,
42
- attributes
43
- )
44
- end
45
-
46
- def attributes
47
- {
48
- cta_path: form.cta_path,
49
- cta_text: form.cta_text,
50
- title: form.title,
51
- start_date: form.start_date,
52
- end_date: form.end_date,
53
- description: form.description
54
- }
55
- end
56
-
57
- def notify_followers
58
- return unless step.saved_change_to_start_date || step.saved_change_to_end_date
13
+ def run_after_hooks
14
+ return unless resource.saved_change_to_start_date || resource.saved_change_to_end_date
59
15
 
60
16
  Decidim::EventsManager.publish(
61
17
  event: "decidim.events.participatory_process.step_changed",
62
18
  event_class: Decidim::ParticipatoryProcessStepChangedEvent,
63
- resource: step,
64
- followers: step.participatory_process.followers
19
+ resource:,
20
+ followers: resource.participatory_process.followers
65
21
  )
66
22
  end
67
23
  end
@@ -5,44 +5,8 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when updating a participatory
7
7
  # process type in the system.
8
- class UpdateParticipatoryProcessType < Decidim::Command
9
- # Public: Initializes the command.
10
- #
11
- # participatory_process_type - A participatory_process_type object to
12
- # update
13
- # form - A form object with the params.
14
- def initialize(participatory_process_type, form)
15
- @participatory_process_type = participatory_process_type
16
- @form = form
17
- end
18
-
19
- # Executes the command. Broadcasts these events:
20
- #
21
- # - :ok when everything is valid.
22
- # - :invalid if the form was not valid and we could not proceed.
23
- #
24
- # Returns nothing.
25
- def call
26
- return broadcast(:invalid) if form.invalid?
27
-
28
- update_participatory_process_type!
29
-
30
- broadcast(:ok)
31
- end
32
-
33
- private
34
-
35
- attr_reader :form, :participatory_process_type
36
-
37
- def update_participatory_process_type!
38
- transaction do
39
- Decidim.traceability.update!(
40
- participatory_process_type,
41
- form.current_user,
42
- title: form.title
43
- )
44
- end
45
- end
8
+ class UpdateParticipatoryProcessType < Decidim::Commands::UpdateResource
9
+ fetch_form_attributes :title
46
10
  end
47
11
  end
48
12
  end
@@ -17,7 +17,7 @@ module Decidim
17
17
  enforce_permission_to :create, :process
18
18
  @form = form(ParticipatoryProcessCopyForm).from_params(params)
19
19
 
20
- CopyParticipatoryProcess.call(@form, current_participatory_process, current_user) do
20
+ CopyParticipatoryProcess.call(@form, current_participatory_process) do
21
21
  on(:ok) do
22
22
  flash[:notice] = I18n.t("participatory_processes_copies.create.success", scope: "decidim.admin")
23
23
  redirect_to participatory_processes_path
@@ -53,7 +53,7 @@ module Decidim
53
53
  enforce_permission_to :update, :process_group, process_group: @participatory_process_group
54
54
  @form = form(ParticipatoryProcessGroupForm).from_params(params)
55
55
 
56
- UpdateParticipatoryProcessGroup.call(@participatory_process_group, @form) do
56
+ UpdateParticipatoryProcessGroup.call(@form, @participatory_process_group) do
57
57
  on(:ok) do |participatory_process_group|
58
58
  flash[:notice] = I18n.t("participatory_process_groups.update.success", scope: "decidim.admin")
59
59
  redirect_to edit_participatory_process_group_path(participatory_process_group)
@@ -70,7 +70,7 @@ module Decidim
70
70
  @participatory_process_group = collection.find(params[:id])
71
71
  enforce_permission_to :destroy, :process_group, process_group: @participatory_process_group
72
72
 
73
- DestroyParticipatoryProcessGroup.call(@participatory_process_group, current_user) do
73
+ Decidim::Commands::DestroyResource.call(@participatory_process_group, current_user) do
74
74
  on(:ok) do
75
75
  flash[:notice] = I18n.t("participatory_process_groups.destroy.success", scope: "decidim.admin")
76
76
  redirect_to action: :index
@@ -24,7 +24,7 @@ module Decidim
24
24
  enforce_permission_to :create, :process_step
25
25
  @form = form(ParticipatoryProcessStepForm).from_params(params)
26
26
 
27
- CreateParticipatoryProcessStep.call(@form, current_participatory_process) do
27
+ CreateParticipatoryProcessStep.call(@form) do
28
28
  on(:ok) do
29
29
  flash[:notice] = I18n.t("participatory_process_steps.create.success", scope: "decidim.admin")
30
30
  redirect_to participatory_process_steps_path(current_participatory_process)
@@ -46,7 +46,7 @@ module Decidim
46
46
  enforce_permission_to :update, :process_step, process_step: @participatory_process_step
47
47
  @form = form(ParticipatoryProcessStepForm).from_params(params)
48
48
 
49
- UpdateParticipatoryProcessStep.call(@participatory_process_step, @form) do
49
+ UpdateParticipatoryProcessStep.call(@form, @participatory_process_step) do
50
50
  on(:ok) do
51
51
  flash[:notice] = I18n.t("participatory_process_steps.update.success", scope: "decidim.admin")
52
52
  redirect_to participatory_process_steps_path(current_participatory_process)
@@ -57,7 +57,7 @@ module Decidim
57
57
  @form = participatory_process_type_form
58
58
  .from_params(params, participatory_process_type: current_participatory_process_type)
59
59
 
60
- UpdateParticipatoryProcessType.call(current_participatory_process_type, @form) do
60
+ UpdateParticipatoryProcessType.call(@form, current_participatory_process_type) do
61
61
  on(:ok) do
62
62
  flash[:notice] = I18n.t("participatory_process_types.update.success", scope: "decidim.admin")
63
63
  redirect_to participatory_process_types_path
@@ -74,7 +74,7 @@ module Decidim
74
74
  def destroy
75
75
  enforce_permission_to :destroy, :participatory_process_type, participatory_process_type: current_participatory_process_type
76
76
 
77
- DestroyParticipatoryProcessType.call(current_participatory_process_type, current_user) do
77
+ Decidim::Commands::DestroyResource.call(current_participatory_process_type, current_user) do
78
78
  on(:ok) do
79
79
  flash[:notice] = I18n.t("participatory_process_types.destroy.success", scope: "decidim.admin")
80
80
  redirect_to participatory_process_types_path
@@ -60,7 +60,7 @@ module Decidim
60
60
  process_id: current_participatory_process.id
61
61
  )
62
62
 
63
- UpdateParticipatoryProcess.call(current_participatory_process, @form) do
63
+ UpdateParticipatoryProcess.call(@form, current_participatory_process) do
64
64
  on(:ok) do |participatory_process|
65
65
  flash[:notice] = I18n.t("participatory_processes.update.success", scope: "decidim.admin")
66
66
  redirect_to edit_participatory_process_path(participatory_process)
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  module Admin
6
- # Controller that allows managing participatory process privte users
6
+ # Controller that allows managing participatory process private users
7
7
  class ParticipatorySpacePrivateUsersController < Decidim::Admin::ApplicationController
8
8
  include Concerns::ParticipatoryProcessAdmin
9
9
  include Decidim::Admin::Concerns::HasPrivateUsers
@@ -2,11 +2,14 @@
2
2
 
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
+ # The main application controller for participatory processes
6
+ #
5
7
  # This controller is the abstract class from which all other controllers of
6
8
  # this engine inherit.
7
9
  class ApplicationController < Decidim::ApplicationController
8
10
  helper Decidim::ParticipatoryProcesses::ApplicationHelper
9
11
  helper ParticipatoryProcessHelper
12
+
10
13
  include NeedsPermission
11
14
 
12
15
  register_permissions(Decidim::ParticipatoryProcesses::ApplicationController,
@@ -6,7 +6,6 @@ module Decidim
6
6
  # public layout.
7
7
  class ParticipatoryProcessesController < Decidim::ParticipatoryProcesses::ApplicationController
8
8
  include ParticipatorySpaceContext
9
- participatory_space_layout only: [:show, :all_metrics]
10
9
  include FilterResource
11
10
  include Paginable
12
11
  include HasParticipatorySpaceContentBlocks
@@ -33,11 +32,7 @@ module Decidim
33
32
  end
34
33
 
35
34
  def all_metrics
36
- if current_participatory_space.show_statistics
37
- enforce_permission_to :read, :process, process: current_participatory_space
38
- else
39
- render status: :not_found
40
- end
35
+ enforce_permission_to :read, :process, process: current_participatory_space
41
36
  end
42
37
 
43
38
  private
@@ -2,13 +2,8 @@
2
2
 
3
3
  module Decidim
4
4
  class ParticipatoryProcessRoleAssignedEvent < Decidim::Events::SimpleEvent
5
- include Decidim::Events::NotificationEvent
6
5
  include Decidim::Events::AuthorEvent
7
6
 
8
- def notification_title
9
- I18n.t("notification_title", **i18n_options).html_safe
10
- end
11
-
12
7
  def i18n_role
13
8
  I18n.t(extra["role"], scope: "decidim.admin.models.participatory_process_user_role.roles", default: extra["role"])
14
9
  end
@@ -12,15 +12,15 @@ module Decidim
12
12
 
13
13
  mimic :participatory_process
14
14
 
15
- translatable_attribute :announcement, Decidim::Attributes::RichText
16
- translatable_attribute :description, Decidim::Attributes::RichText
15
+ translatable_attribute :announcement, String
16
+ translatable_attribute :description, String
17
17
  translatable_attribute :developer_group, String
18
18
  translatable_attribute :local_area, String
19
19
  translatable_attribute :meta_scope, String
20
20
  translatable_attribute :participatory_scope, String
21
21
  translatable_attribute :participatory_structure, String
22
22
  translatable_attribute :subtitle, String
23
- translatable_attribute :short_description, Decidim::Attributes::RichText
23
+ translatable_attribute :short_description, String
24
24
  translatable_attribute :title, String
25
25
  translatable_attribute :target, String
26
26
 
@@ -37,16 +37,12 @@ module Decidim
37
37
  attribute :private_space, Boolean
38
38
  attribute :promoted, Boolean
39
39
  attribute :scopes_enabled, Boolean
40
- attribute :show_metrics, Boolean
41
- attribute :show_statistics, Boolean
42
40
  attribute :participatory_process_type_id, Integer
43
41
 
44
42
  attribute :end_date, Decidim::Attributes::LocalizedDate
45
43
  attribute :start_date, Decidim::Attributes::LocalizedDate
46
44
 
47
- attribute :banner_image
48
45
  attribute :hero_image
49
- attribute :remove_banner_image, Boolean, default: false
50
46
  attribute :remove_hero_image, Boolean, default: false
51
47
 
52
48
  validates :area, presence: true, if: proc { |object| object.area_id.present? }
@@ -57,7 +53,6 @@ module Decidim
57
53
 
58
54
  validates :title, :subtitle, :description, :short_description, translatable_presence: true
59
55
 
60
- validates :banner_image, passthru: { to: Decidim::ParticipatoryProcess }
61
56
  validates :hero_image, passthru: { to: Decidim::ParticipatoryProcess }
62
57
 
63
58
  validates :weight, presence: true
@@ -53,7 +53,7 @@ module Decidim
53
53
  OpenStruct.new(
54
54
  text: translated_attribute(cta_settings.button_text),
55
55
  path: cta_settings.button_url,
56
- image_url: block.images_container.attached_uploader(:background_image).variant_url(:big)
56
+ image_url: block.images_container.attached_uploader(:background_image).path(variant: :big)
57
57
  )
58
58
  end
59
59
 
@@ -71,9 +71,6 @@ module Decidim
71
71
  has_one_attached :hero_image
72
72
  validates_upload :hero_image, uploader: Decidim::HeroImageUploader
73
73
 
74
- has_one_attached :banner_image
75
- validates_upload :banner_image, uploader: Decidim::BannerImageUploader
76
-
77
74
  scope :past, -> { where(arel_table[:end_date].lt(Date.current)) }
78
75
  scope :upcoming, -> { where(arel_table[:start_date].gt(Date.current)) }
79
76
  scope :active, -> { where(arel_table[:start_date].lteq(Date.current).and(arel_table[:end_date].gteq(Date.current).or(arel_table[:end_date].eq(nil)))) }
@@ -193,7 +190,7 @@ module Decidim
193
190
  end
194
191
 
195
192
  def user_roles(role_name = nil)
196
- roles = Decidim::ParticipatoryProcessUserRole.order_by_name.where(participatory_process: self)
193
+ roles = Decidim::ParticipatoryProcessUserRole.where(participatory_process: self)
197
194
  return roles if role_name.blank?
198
195
 
199
196
  roles.where(role: role_name)
@@ -38,7 +38,7 @@ module Decidim
38
38
  # set to the last step's position + 1.
39
39
  #
40
40
  # Note: This allows manual positioning, but there is a validation that
41
- # forbids two steps from the same proccess to have the same position. Take
41
+ # forbids two steps from the same process to have the same position. Take
42
42
  # that into account. It would be best if you did not use manual
43
43
  # positioning.
44
44
  def set_position
@@ -217,7 +217,7 @@ module Decidim
217
217
  allow! if permission_action.action == :export && permission_action.subject == :component_data
218
218
  end
219
219
 
220
- # Process admins can eprform everything *inside* that process. They cannot
220
+ # Process admins can perform everything *inside* that process. They cannot
221
221
  # create a process or perform actions on process groups or other
222
222
  # processes.
223
223
  def process_admin_action?
@@ -6,7 +6,7 @@ module Decidim
6
6
  def hero_image_url
7
7
  return if process_group.blank?
8
8
 
9
- process_group.attached_uploader(:hero_image).url
9
+ process_group.attached_uploader(:hero_image).url(host: process_group.organization.host)
10
10
  end
11
11
 
12
12
  def process_group
@@ -4,11 +4,7 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  class ParticipatoryProcessPresenter < SimpleDelegator
6
6
  def hero_image_url
7
- process.attached_uploader(:hero_image).url
8
- end
9
-
10
- def banner_image_url
11
- process.attached_uploader(:banner_image).url(host: process.organization.host)
7
+ process.attached_uploader(:hero_image).url(host: process.organization.host)
12
8
  end
13
9
 
14
10
  def area_name
@@ -22,9 +22,9 @@ module Decidim
22
22
  debates_query,
23
23
  meetings_query,
24
24
  endorsements_query,
25
- project_supports_query,
25
+ project_votes_query,
26
26
  proposals_query,
27
- proposal_supports_query,
27
+ proposal_votes_query,
28
28
  survey_answer_query
29
29
  ].flatten.uniq.count
30
30
  end
@@ -93,7 +93,7 @@ module Decidim
93
93
  .uniq
94
94
  end
95
95
 
96
- def proposal_supports_query
96
+ def proposal_votes_query
97
97
  return [] unless Decidim.module_installed?(:proposals)
98
98
 
99
99
  Decidim::Proposals::ProposalVote
@@ -105,7 +105,7 @@ module Decidim
105
105
  .uniq
106
106
  end
107
107
 
108
- def project_supports_query
108
+ def project_votes_query
109
109
  return [] unless Decidim.module_installed?(:budgets)
110
110
 
111
111
  Decidim::Budgets::Order.joins(budget: [:component])
@@ -14,8 +14,8 @@ module Decidim
14
14
  # attributes - The Hash of attributes to create the ParticipatoryProcess with.
15
15
  # user - The user that performs the action.
16
16
  # opts - The options MUST contain:
17
- # - title: The +title+ for the new PartidicpatoryProcess
18
- # - slug: The +slug+ for the new PartidicpatoryProcess
17
+ # - title: The +title+ for the new ParticipatoryProcess
18
+ # - slug: The +slug+ for the new ParticipatoryProcess
19
19
  #
20
20
  # Returns a ParticipatoryProcess.
21
21
  def import(attributes, _user, opts)
@@ -42,13 +42,10 @@ module Decidim
42
42
  announcement: attributes["announcement"],
43
43
  private_space: attributes["private_space"],
44
44
  scopes_enabled: attributes["scopes_enabled"],
45
- show_metrics: attributes["show_metrics"],
46
- show_statistics: attributes["show_statistics"],
47
45
  participatory_process_group: import_process_group(attributes["participatory_process_group"]),
48
46
  participatory_process_type: import_participatory_process_type(attributes["participatory_process_type"])
49
47
  )
50
48
  @imported_process.attached_uploader(:hero_image).remote_url = attributes["remote_hero_image_url"] if attributes["remote_hero_image_url"].present?
51
- @imported_process.attached_uploader(:banner_image).remote_url = attributes["remote_banner_image_url"] if attributes["remote_banner_image_url"].present?
52
49
 
53
50
  @imported_process.save!
54
51
  @imported_process
@@ -28,7 +28,6 @@ module Decidim
28
28
  start_date: participatory_process.start_date,
29
29
  end_date: participatory_process.end_date,
30
30
  remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessPresenter.new(participatory_process).hero_image_url,
31
- remote_banner_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessPresenter.new(participatory_process).banner_image_url,
32
31
  developer_group: participatory_process.developer_group,
33
32
  local_area: participatory_process.local_area,
34
33
  meta_scope: participatory_process.meta_scope,
@@ -52,8 +51,6 @@ module Decidim
52
51
  private_space: participatory_process.private_space,
53
52
  promoted: participatory_process.promoted,
54
53
  scopes_enabled: participatory_process.scopes_enabled,
55
- show_metrics: participatory_process.show_metrics,
56
- show_statistics: participatory_process.show_statistics,
57
54
  participatory_process_type: {
58
55
  id: participatory_process.participatory_process_type.try(:id),
59
56
  title: participatory_process.participatory_process_type.try(:title) || empty_translatable
@@ -16,7 +16,7 @@
16
16
  <th><%= t("models.participatory_process_step.fields.title", scope: "decidim.admin") %></th>
17
17
  <th><%= t("models.participatory_process_step.fields.start_date", scope: "decidim.admin") %></th>
18
18
  <th><%= t("models.participatory_process_step.fields.end_date", scope: "decidim.admin") %></th>
19
- <th class="actions"></th>
19
+ <th></th>
20
20
  </tr>
21
21
  </thead>
22
22
  <tbody class="sortable" data-sort-url="<%= ordering_participatory_process_steps_path(current_participatory_process) %>">
@@ -1,6 +1,6 @@
1
1
  <h3><%= translated_attribute(@participatory_process_step.title) %></h3>
2
2
 
3
- <div class="actions">
3
+ <div>
4
4
  <hr>
5
5
  <%= link_to t("decidim.admin.actions.edit"), edit_participatory_process_step_path(participatory_process, @participatory_process_step) if allowed_to? :update, :process_step, process_step: @participatory_process_step %>
6
6
  <%= link_to t("decidim.admin.actions.destroy"), participatory_process_step_path(participatory_process, @participatory_process_step), method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } if allowed_to? :destroy, :process_step, process_step: @participatory_process_step %>