decidim-participatory_processes 0.29.3 → 0.30.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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +4 -5
  3. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_settings_form/show.erb +1 -1
  4. data/app/cells/decidim/participatory_processes/process_dropdown_metadata_cell.rb +7 -0
  5. data/app/cells/decidim/participatory_processes/process_filters/show.erb +0 -1
  6. data/app/cells/decidim/participatory_processes/process_filters_cell.rb +6 -32
  7. data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +2 -23
  8. data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +3 -3
  9. data/app/commands/decidim/participatory_processes/admin/import_participatory_process.rb +0 -1
  10. data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +3 -3
  11. data/app/controllers/decidim/participatory_processes/admin/component_share_tokens_controller.rb +18 -0
  12. data/app/controllers/decidim/participatory_processes/admin/participatory_process_share_tokens_controller.rb +16 -0
  13. data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +15 -3
  14. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +2 -4
  15. data/app/controllers/decidim/participatory_processes/participatory_space_private_users_controller.rb +27 -0
  16. data/app/forms/decidim/participatory_processes/admin/participatory_process_copy_form.rb +0 -1
  17. data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +3 -33
  18. data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +0 -1
  19. data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +28 -20
  20. data/app/jobs/decidim/participatory_processes/change_active_step_job.rb +1 -1
  21. data/app/models/decidim/participatory_process.rb +19 -3
  22. data/app/permissions/decidim/participatory_processes/permissions.rb +16 -21
  23. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +1 -1
  24. data/app/queries/decidim/participatory_processes/metrics/participatory_process_followers_metric_measure.rb +2 -2
  25. data/app/queries/decidim/participatory_processes/metrics/participatory_processes_metric_manage.rb +2 -2
  26. data/app/serializers/decidim/participatory_processes/open_data_participatory_process_serializer.rb +47 -0
  27. data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +1 -43
  28. data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +17 -126
  29. data/app/views/decidim/participatory_processes/admin/participatory_process_copies/_form.html.erb +0 -4
  30. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb +0 -1
  31. data/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb +0 -3
  32. data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +25 -60
  33. data/app/views/decidim/participatory_processes/admin/participatory_processes/_process_row.html.erb +83 -0
  34. data/app/views/decidim/participatory_processes/admin/participatory_processes/_processes_thead.html.erb +19 -0
  35. data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +16 -84
  36. data/app/views/decidim/participatory_processes/admin/participatory_processes/manage_trash.html.erb +20 -0
  37. data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +3 -1
  38. data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +3 -1
  39. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +6 -6
  40. data/app/views/decidim/participatory_processes/participatory_space_private_users/index.html.erb +22 -0
  41. data/config/assets.rb +1 -2
  42. data/config/locales/ar.yml +0 -17
  43. data/config/locales/bg.yml +0 -36
  44. data/config/locales/bs-BA.yml +0 -9
  45. data/config/locales/ca.yml +61 -39
  46. data/config/locales/cs.yml +60 -36
  47. data/config/locales/de.yml +59 -37
  48. data/config/locales/el.yml +0 -36
  49. data/config/locales/en.yml +60 -38
  50. data/config/locales/es-MX.yml +61 -39
  51. data/config/locales/es-PY.yml +61 -39
  52. data/config/locales/es.yml +62 -40
  53. data/config/locales/eu.yml +141 -119
  54. data/config/locales/fi-plain.yml +60 -36
  55. data/config/locales/fi.yml +60 -36
  56. data/config/locales/fr-CA.yml +23 -37
  57. data/config/locales/fr.yml +23 -37
  58. data/config/locales/ga-IE.yml +0 -14
  59. data/config/locales/gl.yml +0 -18
  60. data/config/locales/hu.yml +0 -36
  61. data/config/locales/id-ID.yml +0 -17
  62. data/config/locales/is-IS.yml +0 -16
  63. data/config/locales/it.yml +0 -36
  64. data/config/locales/ja.yml +60 -38
  65. data/config/locales/lb.yml +0 -20
  66. data/config/locales/lt.yml +0 -36
  67. data/config/locales/lv.yml +0 -20
  68. data/config/locales/nl.yml +0 -21
  69. data/config/locales/no.yml +0 -36
  70. data/config/locales/pl.yml +0 -36
  71. data/config/locales/pt-BR.yml +0 -33
  72. data/config/locales/pt.yml +0 -21
  73. data/config/locales/ro-RO.yml +1 -38
  74. data/config/locales/ru.yml +0 -17
  75. data/config/locales/sk.yml +1 -21
  76. data/config/locales/sr-CS.yml +0 -9
  77. data/config/locales/sv.yml +52 -36
  78. data/config/locales/tr-TR.yml +0 -21
  79. data/config/locales/uk.yml +0 -17
  80. data/config/locales/zh-CN.yml +0 -20
  81. data/config/locales/zh-TW.yml +0 -36
  82. data/db/migrate/20210310120750_add_followable_counter_cache_to_participatory_processes.rb +1 -1
  83. data/db/migrate/20240822161355_add_deleted_at_to_decidim_participatory_processes.rb +8 -0
  84. data/db/migrate/20241108141423_remove_column_show_metrics_from_participatory_processes.rb +7 -0
  85. data/db/migrate/20241108141514_remove_column_banner_image_from_participatory_processes.rb +7 -0
  86. data/db/migrate/20241108141605_remove_column_show_statistics_from_participatory_processes.rb +7 -0
  87. data/decidim-participatory_processes.gemspec +1 -1
  88. data/lib/decidim/api/participatory_process_group_type.rb +3 -3
  89. data/lib/decidim/api/participatory_process_step_type.rb +7 -9
  90. data/lib/decidim/api/participatory_process_type.rb +18 -23
  91. data/lib/decidim/api/participatory_process_type_type.rb +3 -3
  92. data/lib/decidim/participatory_processes/admin_engine.rb +85 -59
  93. data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +11 -0
  94. data/lib/decidim/participatory_processes/engine.rb +7 -0
  95. data/lib/decidim/participatory_processes/menu.rb +9 -17
  96. data/lib/decidim/participatory_processes/participatory_space.rb +5 -2
  97. data/lib/decidim/participatory_processes/seeds.rb +8 -16
  98. data/lib/decidim/participatory_processes/test/factories.rb +14 -14
  99. data/lib/decidim/participatory_processes/version.rb +1 -1
  100. metadata +24 -26
  101. data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +0 -17
  102. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +0 -17
  103. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +0 -13
  104. data/app/controllers/decidim/participatory_processes/admin/categories_controller.rb +0 -13
  105. data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +0 -117
  106. data/app/forms/decidim/participatory_processes/admin/participatory_process_type_form.rb +0 -20
  107. data/app/helpers/decidim/participatory_processes/admin/participatory_process_helper.rb +0 -24
  108. data/app/packs/entrypoints/decidim_participatory_processes_admin.js +0 -1
  109. data/app/packs/src/decidim/participatory_processes/admin/participatory_processes.js +0 -18
  110. data/app/views/decidim/participatory_processes/admin/participatory_process_types/_form.html.erb +0 -9
  111. data/app/views/decidim/participatory_processes/admin/participatory_process_types/edit.html.erb +0 -18
  112. data/app/views/decidim/participatory_processes/admin/participatory_process_types/index.html.erb +0 -58
  113. data/app/views/decidim/participatory_processes/admin/participatory_process_types/new.html.erb +0 -18
  114. data/config/locales/ca-IT.yml +0 -524
@@ -3,8 +3,6 @@
3
3
  module Decidim
4
4
  module ParticipatoryProcesses
5
5
  class Permissions < Decidim::DefaultPermissions
6
- include Decidim::UserRoleChecker
7
-
8
6
  def permissions
9
7
  user_can_enter_processes_space_area?
10
8
  user_can_enter_process_groups_space_area?
@@ -19,6 +17,7 @@ module Decidim
19
17
  if permission_action.scope == :public
20
18
  public_list_processes_action?
21
19
  public_list_process_groups_action?
20
+ public_list_members_action?
22
21
  public_read_process_group_action?
23
22
  public_read_process_action?
24
23
  return permission_action
@@ -37,11 +36,9 @@ module Decidim
37
36
  user_can_read_process_list?
38
37
  user_can_read_current_process?
39
38
  user_can_create_process?
40
- user_can_upload_images_in_process?
41
39
 
42
40
  # org admins and space admins can do everything in the admin section
43
41
  org_admin_action?
44
- participatory_process_type_action?
45
42
 
46
43
  return permission_action unless process
47
44
 
@@ -51,6 +48,7 @@ module Decidim
51
48
  collaborator_action?
52
49
  valuator_action?
53
50
  process_admin_action?
51
+
54
52
  permission_action
55
53
  end
56
54
 
@@ -103,6 +101,13 @@ module Decidim
103
101
  allow!
104
102
  end
105
103
 
104
+ def public_list_members_action?
105
+ return unless permission_action.action == :list &&
106
+ permission_action.subject == :members
107
+
108
+ allow!
109
+ end
110
+
106
111
  def public_read_process_group_action?
107
112
  return unless permission_action.action == :read &&
108
113
  permission_action.subject == :process_group &&
@@ -119,6 +124,7 @@ module Decidim
119
124
  return disallow! unless can_view_private_space?
120
125
  return allow! if user&.admin?
121
126
  return allow! if process.published?
127
+ return allow! if user_can_preview_space?
122
128
 
123
129
  toggle_allow(can_manage_process?)
124
130
  end
@@ -231,7 +237,6 @@ module Decidim
231
237
  is_allowed = [
232
238
  :attachment,
233
239
  :attachment_collection,
234
- :category,
235
240
  :component,
236
241
  :component_data,
237
242
  :moderation,
@@ -239,6 +244,7 @@ module Decidim
239
244
  :process_step,
240
245
  :process_user_role,
241
246
  :export_space,
247
+ :share_tokens,
242
248
  :import
243
249
  ].include?(permission_action.subject)
244
250
  allow! if is_allowed
@@ -250,7 +256,6 @@ module Decidim
250
256
  is_allowed = [
251
257
  :attachment,
252
258
  :attachment_collection,
253
- :category,
254
259
  :component,
255
260
  :component_data,
256
261
  :moderation,
@@ -258,22 +263,16 @@ module Decidim
258
263
  :process_step,
259
264
  :process_user_role,
260
265
  :export_space,
266
+ :share_tokens,
261
267
  :import
262
268
  ].include?(permission_action.subject)
263
269
  allow! if is_allowed
264
270
  end
265
271
 
266
- def participatory_process_type_action?
267
- return unless permission_action.subject == :participatory_process_type
268
- return disallow! unless user.admin?
269
-
270
- participatory_process_type = context.fetch(:participatory_process_type, nil)
271
- case permission_action.action
272
- when :destroy
273
- toggle_allow(participatory_process_type&.processes&.none?)
274
- else
275
- allow!
276
- end
272
+ def user_can_preview_space?
273
+ context[:share_token].present? && Decidim::ShareToken.use!(token_for: process, token: context[:share_token], user:)
274
+ rescue ActiveRecord::RecordNotFound, StandardError
275
+ nil
277
276
  end
278
277
 
279
278
  # Checks if the permission_action is to read the admin processes list or
@@ -290,10 +289,6 @@ module Decidim
290
289
  def process_group
291
290
  @process_group ||= context.fetch(:process_group, nil)
292
291
  end
293
-
294
- def user_can_upload_images_in_process?
295
- allow! if user&.admin_terms_accepted? && user_has_any_role?(user, process, broad_check: true) && (permission_action.subject == :editor_image)
296
- end
297
292
  end
298
293
  end
299
294
  end
@@ -38,7 +38,7 @@ module Decidim
38
38
 
39
39
  def action_string
40
40
  case action
41
- when "create", "publish", "unpublish", "update", "import", "export", "duplicate"
41
+ when "create", "publish", "unpublish", "update", "import", "export", "duplicate", "soft_delete", "restore"
42
42
  "decidim.admin_log.participatory_process.#{action}"
43
43
  else
44
44
  super
@@ -14,10 +14,10 @@ module Decidim
14
14
  participatory_process = @resource
15
15
 
16
16
  process_followers = Decidim::Follow.where(followable: participatory_process).joins(:user)
17
- .where("decidim_follows.created_at <= ?", end_time)
17
+ .where(decidim_follows: { created_at: ..end_time })
18
18
  cumulative_users = process_followers.pluck(:decidim_user_id)
19
19
 
20
- process_followers = process_followers.where("decidim_follows.created_at >= ?", start_time)
20
+ process_followers = process_followers.where(decidim_follows: { created_at: start_time.. })
21
21
  quantity_users = process_followers.pluck(:decidim_user_id)
22
22
 
23
23
  {
@@ -14,12 +14,12 @@ module Decidim
14
14
  return @query if @query
15
15
 
16
16
  @query = Decidim::ParticipatoryProcess.where(organization: @organization)
17
- @query = @query.where("decidim_participatory_processes.published_at <= ?", end_time)
17
+ @query = @query.where(decidim_participatory_processes: { published_at: ..end_time })
18
18
  @query
19
19
  end
20
20
 
21
21
  def quantity
22
- @quantity ||= query.where("decidim_participatory_processes.published_at >= ?", start_time).count
22
+ @quantity ||= query.where(decidim_participatory_processes: { published_at: start_time.. }).count
23
23
  end
24
24
  end
25
25
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ # This class serializes a ParticipatoryProcess so it can be exported to CSV for the Open Data feature.
6
+ class OpenDataParticipatoryProcessSerializer < Decidim::Exporters::ParticipatorySpaceSerializer
7
+ # Public: Exports a hash with the serialized data for this resource.
8
+ def serialize
9
+ super.merge(
10
+ {
11
+ url: EngineRouter.main_proxy(resource).participatory_process_url(resource),
12
+ subtitle: resource.subtitle,
13
+ remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessPresenter.new(resource).hero_image_url,
14
+ announcement: resource.announcement,
15
+ start_date: resource.start_date,
16
+ end_date: resource.end_date,
17
+ developer_group: resource.developer_group,
18
+ local_area: resource.local_area,
19
+ meta_scope: resource.meta_scope,
20
+ participatory_scope: resource.participatory_scope,
21
+ participatory_structure: resource.participatory_structure,
22
+ target: resource.target,
23
+ area: {
24
+ id: resource.area.try(:id),
25
+ name: resource.area.try(:name) || empty_translatable
26
+ },
27
+ participatory_process_group: {
28
+ id: resource.participatory_process_group.try(:id),
29
+ title: resource.participatory_process_group.try(:title) || empty_translatable,
30
+ description: resource.participatory_process_group.try(:description) || empty_translatable,
31
+ remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessGroupPresenter.new(resource.participatory_process_group).hero_image_url
32
+ },
33
+ scope: {
34
+ id: resource.scope.try(:id),
35
+ name: resource.scope.try(:name) || empty_translatable
36
+ },
37
+ scopes_enabled: resource.scopes_enabled,
38
+ participatory_process_type: {
39
+ id: resource.participatory_process_type.try(:id),
40
+ title: resource.participatory_process_type.try(:title) || empty_translatable
41
+ }
42
+ }
43
+ )
44
+ end
45
+ end
46
+ end
47
+ end
@@ -41,9 +41,7 @@ module Decidim
41
41
  end_date: attributes["end_date"],
42
42
  announcement: attributes["announcement"],
43
43
  private_space: attributes["private_space"],
44
- scopes_enabled: attributes["scopes_enabled"],
45
- participatory_process_group: import_process_group(attributes["participatory_process_group"]),
46
- participatory_process_type: import_participatory_process_type(attributes["participatory_process_type"])
44
+ participatory_process_group: import_process_group(attributes["participatory_process_group"])
47
45
  )
48
46
  @imported_process.attached_uploader(:hero_image).remote_url = attributes["remote_hero_image_url"] if attributes["remote_hero_image_url"].present?
49
47
 
@@ -71,19 +69,6 @@ module Decidim
71
69
  end
72
70
  end
73
71
 
74
- def import_participatory_process_type(participatory_process_type)
75
- return if participatory_process_type.blank?
76
-
77
- return if compact_translation(participatory_process_type["title"]).blank?
78
-
79
- Decidim.traceability.perform_action!("create", ParticipatoryProcessType, @user) do
80
- Decidim::ParticipatoryProcessType.find_or_create_by(
81
- title: participatory_process_type["title"],
82
- organization: @organization
83
- )
84
- end
85
- end
86
-
87
72
  def import_participatory_process_steps(steps)
88
73
  return if steps.nil?
89
74
 
@@ -102,33 +87,6 @@ module Decidim
102
87
  end
103
88
  end
104
89
 
105
- def import_categories(categories)
106
- return if categories.nil?
107
-
108
- categories.map do |category_attributes|
109
- category = Decidim.traceability.create!(
110
- Category,
111
- @user,
112
- name: category_attributes["name"],
113
- description: category_attributes["description"],
114
- parent_id: category_attributes["parent_id"],
115
- participatory_space: @imported_process
116
- )
117
- next if category_attributes["subcategories"].nil?
118
-
119
- category_attributes["subcategories"].map do |subcategory_attributes|
120
- Decidim.traceability.create!(
121
- Category,
122
- @user,
123
- name: subcategory_attributes["name"],
124
- description: subcategory_attributes["description"],
125
- parent_id: category.id,
126
- participatory_space: @imported_process
127
- )
128
- end
129
- end
130
- end
131
-
132
90
  def import_folders_and_attachments(attachments)
133
91
  return if attachments["files"].nil?
134
92
 
@@ -4,76 +4,31 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  # This class serializes a ParticipatoryProcesses so can be exported to CSV, JSON or other
6
6
  # formats.
7
- class ParticipatoryProcessSerializer < Decidim::Exporters::Serializer
8
- include Decidim::ApplicationHelper
9
- include Decidim::ResourceHelper
10
- include Decidim::TranslationsHelper
11
-
12
- # Public: Initializes the serializer with a participatory_process.
13
- def initialize(participatory_process)
14
- @participatory_process = participatory_process
15
- end
16
-
7
+ class ParticipatoryProcessSerializer < Decidim::ParticipatoryProcesses::OpenDataParticipatoryProcessSerializer
17
8
  # Public: Exports a hash with the serialized data for this participatory_process.
18
9
  def serialize
19
- {
20
- id: participatory_process.id,
21
- title: participatory_process.title,
22
- subtitle: participatory_process.subtitle,
23
- slug: participatory_process.slug,
24
- hashtag: participatory_process.hashtag,
25
- short_description: participatory_process.short_description,
26
- description: participatory_process.description,
27
- announcement: participatory_process.announcement,
28
- start_date: participatory_process.start_date,
29
- end_date: participatory_process.end_date,
30
- remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessPresenter.new(participatory_process).hero_image_url,
31
- developer_group: participatory_process.developer_group,
32
- local_area: participatory_process.local_area,
33
- meta_scope: participatory_process.meta_scope,
34
- participatory_scope: participatory_process.participatory_scope,
35
- participatory_structure: participatory_process.participatory_structure,
36
- target: participatory_process.target,
37
- area: {
38
- id: participatory_process.area.try(:id),
39
- name: participatory_process.area.try(:name) || empty_translatable
40
- },
41
- participatory_process_group: {
42
- id: participatory_process.participatory_process_group.try(:id),
43
- title: participatory_process.participatory_process_group.try(:title) || empty_translatable,
44
- description: participatory_process.participatory_process_group.try(:description) || empty_translatable,
45
- remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessGroupPresenter.new(participatory_process.participatory_process_group).hero_image_url
46
- },
47
- scope: {
48
- id: participatory_process.scope.try(:id),
49
- name: participatory_process.scope.try(:name) || empty_translatable
50
- },
51
- private_space: participatory_process.private_space,
52
- promoted: participatory_process.promoted,
53
- scopes_enabled: participatory_process.scopes_enabled,
54
- participatory_process_type: {
55
- id: participatory_process.participatory_process_type.try(:id),
56
- title: participatory_process.participatory_process_type.try(:title) || empty_translatable
57
- },
58
- participatory_process_steps: serialize_participatory_process_steps,
59
- participatory_process_categories: serialize_categories,
60
- attachments: {
61
- attachment_collections: serialize_attachment_collections,
62
- files: serialize_attachments
63
- },
64
- components: serialize_components
65
- }
10
+ super.merge(
11
+ {
12
+ categories: serialize_categories,
13
+ taxonomies:,
14
+ attachments: {
15
+ attachment_collections: serialize_attachment_collections,
16
+ files: serialize_attachments
17
+ },
18
+ private_space: resource.private_space,
19
+ weight: resource.weight,
20
+ components: serialize_components,
21
+ participatory_process_steps: serialize_participatory_process_steps
22
+ }
23
+ )
66
24
  end
67
25
 
68
26
  private
69
27
 
70
- attr_reader :participatory_process
71
- alias resource participatory_process
72
-
73
28
  def serialize_participatory_process_steps
74
- return unless participatory_process.steps.any?
29
+ return unless resource.steps.any?
75
30
 
76
- participatory_process.steps.map do |step|
31
+ resource.steps.map do |step|
77
32
  {
78
33
  id: step.try(:id),
79
34
  title: step.try(:title),
@@ -87,70 +42,6 @@ module Decidim
87
42
  }
88
43
  end
89
44
  end
90
-
91
- def serialize_categories
92
- return unless participatory_process.categories.first_class.any?
93
-
94
- participatory_process.categories.first_class.map do |category|
95
- {
96
- id: category.try(:id),
97
- name: category.try(:name),
98
- description: category.try(:description),
99
- parent_id: category.try(:parent_id),
100
- subcategories: serialize_subcategories(category.subcategories)
101
- }
102
- end
103
- end
104
-
105
- def serialize_subcategories(subcategories)
106
- return unless subcategories.any?
107
-
108
- subcategories.map do |subcategory|
109
- {
110
- id: subcategory.try(:id),
111
- name: subcategory.try(:name),
112
- description: subcategory.try(:description),
113
- parent_id: subcategory.try(:parent_id)
114
- }
115
- end
116
- end
117
-
118
- def serialize_attachment_collections
119
- return unless participatory_process.attachment_collections.any?
120
-
121
- participatory_process.attachment_collections.map do |collection|
122
- {
123
- id: collection.try(:id),
124
- name: collection.try(:name),
125
- weight: collection.try(:weight),
126
- description: collection.try(:description)
127
- }
128
- end
129
- end
130
-
131
- def serialize_attachments
132
- return unless participatory_process.attachments.any?
133
-
134
- participatory_process.attachments.map do |attachment|
135
- {
136
- id: attachment.try(:id),
137
- title: attachment.try(:title),
138
- weight: attachment.try(:weight),
139
- description: attachment.try(:description),
140
- attachment_collection: {
141
- name: attachment.attachment_collection.try(:name),
142
- weight: attachment.attachment_collection.try(:weight),
143
- description: attachment.attachment_collection.try(:description)
144
- },
145
- remote_file_url: Decidim::AttachmentPresenter.new(attachment).attachment_file_url
146
- }
147
- end
148
- end
149
-
150
- def serialize_components
151
- serializer = Decidim::Exporters::ParticipatorySpaceComponentsSerializer.new(@participatory_process)
152
- serializer.run
153
- end
154
45
  end
155
46
  end
156
47
  end
@@ -18,10 +18,6 @@
18
18
  <%= form.check_box :copy_steps %>
19
19
  </div>
20
20
 
21
- <div class="columns">
22
- <%= form.check_box :copy_categories %>
23
- </div>
24
-
25
21
  <div class="columns">
26
22
  <%= form.check_box :copy_components %>
27
23
  </div>
@@ -21,7 +21,6 @@
21
21
  <% if processes_for_select %>
22
22
  <%= form.select :participatory_process_ids, processes_for_select, {}, { multiple: true, class: "chosen-select" } %>
23
23
  <% end %>
24
- <%= form.label :participatory_process_ids, t("decidim.participatory_process_groups.related_processes.help") %>
25
24
  </div>
26
25
 
27
26
  <div class="row column">
@@ -23,9 +23,6 @@
23
23
  <div class="columns">
24
24
  <%= form.check_box :import_steps %>
25
25
  </div>
26
- <div class="columns">
27
- <%= form.check_box :import_categories %>
28
- </div>
29
26
  <div class="columns">
30
27
  <%= form.check_box :import_attachments %>
31
28
  </div>
@@ -100,14 +100,12 @@
100
100
  </button>
101
101
  </div>
102
102
  <div id="panel-metadata" class="card-section">
103
- <div class="row">
104
- <div class="columns">
105
- <%= form.translated :text_field, :developer_group, aria: { label: :developer_group } %>
106
- </div>
103
+ <div class="row column">
104
+ <%= form.translated :text_field, :developer_group, aria: { label: :developer_group } %>
105
+ </div>
107
106
 
108
- <div class="columns">
109
- <%= form.translated :text_field, :local_area, aria: { label: :local_area } %>
110
- </div>
107
+ <div class="row column">
108
+ <%= form.translated :text_field, :local_area, aria: { label: :local_area } %>
111
109
  </div>
112
110
 
113
111
  <div class="row column">
@@ -128,39 +126,30 @@
128
126
  </div>
129
127
  </div>
130
128
 
131
- <div class="card" data-component="accordion" id="accordion-filters">
129
+ <div class="card" data-component="accordion" id="accordion-taxonomies">
132
130
  <div class="card-divider">
133
- <button class="card-divider-button" data-open="true" data-controls="panel-filters" type="button">
131
+ <button class="card-divider-button" data-open="true" data-controls="panel-taxonomies" type="button">
134
132
  <%= icon "arrow-right-s-line" %>
135
- <h2 class="card-title" id="filters">
136
- <%= t("filters", scope: "decidim.participatory_processes.admin.participatory_processes.form") %>
133
+ <h2 class="card-title" id="taxonomies">
134
+ <%= t("taxonomies", scope: "decidim.participatory_processes.admin.participatory_processes.form") %>
137
135
  </h2>
138
136
  </button>
139
137
  </div>
140
- <div id="panel-filters" class="card-section">
141
- <div class="row column">
142
- <%= form.check_box :scopes_enabled %>
143
- </div>
144
-
145
- <div class="row column">
146
- <%= scopes_select_field form, :scope_id, root: nil %>
147
- </div>
148
-
149
- <div class="row column" id="scope-depth ">
150
- <%= form.collection_select :scope_type_max_depth_id,
151
- organization_scope_depths,
152
- :id,
153
- :name,
154
- scope_type_depth_select_options,
155
- scope_type_depth_select_html_options %>
156
- </div>
157
-
158
- <div class="row column">
159
- <%= form.areas_select :area_id,
160
- areas_for_select(current_organization),
161
- selected: current_participatory_process.try(:decidim_area_id),
162
- include_blank: t(".select_an_area") %>
163
- </div>
138
+ <div id="panel-taxonomies" class="card-section">
139
+ <% if @form.taxonomy_filters.blank? %>
140
+ <div class="row column">
141
+ <p class="text-gray mr-2 mt-4">
142
+ <%= t("no_taxonomy_filters_found", scope: "decidim.participatory_processes.admin.participatory_processes.form") %>
143
+ <%= link_to(t("define_taxonomy_filters", scope: "decidim.participatory_processes.admin.participatory_processes.form"), decidim_admin.taxonomies_path, class: "button button__text-secondary") %>
144
+ </p>
145
+ </div>
146
+ <% else %>
147
+ <% @form.taxonomy_filters.each do |filter| %>
148
+ <div class="row column">
149
+ <%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
150
+ </div>
151
+ <% end %>
152
+ <% end %>
164
153
  </div>
165
154
  </div>
166
155
 
@@ -184,6 +173,7 @@
184
173
 
185
174
  <div class="row column">
186
175
  <%= form.check_box :private_space %>
176
+ <p class="help-text"><%= t(".private_notice") %></p>
187
177
  </div>
188
178
  <div class="row column">
189
179
  <%= form.check_box :promoted %>
@@ -211,29 +201,4 @@
211
201
  </div>
212
202
  </div>
213
203
  </div>
214
-
215
- <div class="card" data-component="accordion" id="accordion-other">
216
- <div class="card-divider">
217
- <button class="card-divider-button" data-open="true" data-controls="panel-other" type="button">
218
- <%= icon "arrow-right-s-line" %>
219
- <h2 class="card-title" id="other">
220
- <%= t("other", scope: "decidim.participatory_processes.admin.participatory_processes.form") %>
221
- </h2>
222
- </button>
223
- </div>
224
-
225
- <div id="panel-other" class="card-section">
226
- <% if @form.participatory_process_types_for_select.present? %>
227
- <div class="row column">
228
- <%= form.select(
229
- :participatory_process_type_id,
230
- @form.participatory_process_types_for_select,
231
- include_blank: t(".select_participatory_process_type")
232
- ) %>
233
- </div>
234
- <% end %>
235
- </div>
236
- </div>
237
-
238
204
  </div>
239
- <%= append_javascript_pack_tag "decidim_participatory_processes_admin" %>
@@ -0,0 +1,83 @@
1
+ <tr>
2
+ <td>
3
+ <% if process.promoted? %>
4
+ <%= icon_with_tooltip "star-s-fill", t("models.assembly.fields.promoted", scope: "decidim.admin") %>
5
+ <% end %>
6
+ <% if allowed_to? :update, :process, process: process %>
7
+ <%= link_to translated_attribute(process.title), edit_participatory_process_path(process) %><br>
8
+ <% elsif allowed_to? :read, :component, process: process %>
9
+ <%= link_to translated_attribute(process.title), components_path(process) %><br>
10
+ <% else %>
11
+ <%= translated_attribute(process.title) %>
12
+ <% end %>
13
+ </td>
14
+ <td class="table-list__date">
15
+ <%= l process.created_at, format: :short %>
16
+ </td>
17
+ <td class="table-list__state">
18
+ <% if process.private_space? %>
19
+ <span><%= t("participatory_processes.index.private", scope: "decidim.admin") %></span>
20
+ <% else %>
21
+ <span><%= t("participatory_processes.index.public", scope: "decidim.admin") %></span>
22
+ <% end %>
23
+ </td>
24
+ <td class="table-list__state">
25
+ <% if process.published? %>
26
+ <span class="label success !text-sm"><%= t("participatory_processes.index.published", scope: "decidim.admin") %></span>
27
+ <% else %>
28
+ <span class="label alert !text-sm"><%= t("participatory_processes.index.unpublished", scope: "decidim.admin") %></span>
29
+ <% end %>
30
+ </td>
31
+ <td class="table-list__actions">
32
+ <% if view == :deleted %>
33
+ <% if allowed_to? :restore, :process, trashable_deleted_resource: process %>
34
+ <%= icon_link_to "refresh-line", restore_participatory_process_path(process), t("actions.restore", scope: "decidim.admin"), method: :patch, class: "action-icon--restore" %>
35
+ <% else %>
36
+ <span class="action-space icon"></span>
37
+ <% end %>
38
+ <% else %>
39
+ <% if allowed_to? :read, :share_tokens, current_participatory_space: process %>
40
+ <%= icon_link_to "share-line", decidim_admin_participatory_processes.participatory_process_share_tokens_path(process), t("actions.share_tokens", scope: "decidim.admin"), class: "action-icon--new" %>
41
+ <% else %>
42
+ <span class="action-space icon"></span>
43
+ <% end %>
44
+ <% if allowed_to? :update, :process, process: process %>
45
+ <%= icon_link_to "pencil-line", edit_participatory_process_path(process), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
46
+ <% else %>
47
+ <span class="action-space icon"></span>
48
+ <% end %>
49
+
50
+ <% if allowed_to? :create, :process, process: process %>
51
+ <%= icon_link_to "download-line", participatory_process_export_path(process), t("actions.export", scope: "decidim.admin"), method: :post, class: "action-icon--export" %>
52
+ <% else %>
53
+ <span class="action-space icon"></span>
54
+ <% end %>
55
+
56
+ <% if allowed_to? :create, :process, process: process %>
57
+ <%= icon_link_to "file-copy-line", new_participatory_process_copy_path(process), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
58
+ <% else %>
59
+ <span class="action-space icon"></span>
60
+ <% end %>
61
+
62
+ <% if allowed_to? :preview, :process, process: process %>
63
+ <%= icon_link_to "eye-line", decidim_participatory_processes.participatory_process_path(process), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview", target: "_blank", data: { "external-link": false } %>
64
+ <% else %>
65
+ <span class="action-space icon"></span>
66
+ <% end %>
67
+
68
+ <% if allowed_to? :read, :moderation, process: process %>
69
+ <%= icon_link_to "flag-line", moderations_path(process), t("actions.moderate", scope: "decidim.admin"), class: "action-icon--moderate" %>
70
+ <% else %>
71
+ <span class="action-space icon"></span>
72
+ <% end %>
73
+
74
+ <% if allowed_to? :soft_delete, :process, trashable_deleted_resource: process %>
75
+ <% if process.published? %>
76
+ <%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.soft_delete", scope: "decidim.admin") %>
77
+ <% else %>
78
+ <%= icon_link_to "delete-bin-line", soft_delete_participatory_process_path(process), t("actions.soft_delete", scope: "decidim.admin"), method: :patch, class: "action-icon--delete", data: { confirm: t("actions.confirm_delete_process", scope: "decidim.admin") } %>
79
+ <% end %>
80
+ <% end %>
81
+ <% end %>
82
+ </td>
83
+ </tr>