decidim-participatory_processes 0.29.1 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) 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 +6 -36
  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 +15 -14
  23. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +1 -1
  24. data/app/presenters/decidim/participatory_processes/participatory_process_group_presenter.rb +1 -1
  25. data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +1 -1
  26. data/app/queries/decidim/participatory_processes/metrics/participatory_process_followers_metric_measure.rb +2 -2
  27. data/app/queries/decidim/participatory_processes/metrics/participatory_processes_metric_manage.rb +2 -2
  28. data/app/serializers/decidim/participatory_processes/open_data_participatory_process_serializer.rb +47 -0
  29. data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +1 -43
  30. data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +17 -126
  31. data/app/views/decidim/participatory_processes/admin/participatory_process_copies/_form.html.erb +0 -4
  32. data/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb +0 -3
  33. data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +25 -60
  34. data/app/views/decidim/participatory_processes/admin/participatory_processes/_process_row.html.erb +83 -0
  35. data/app/views/decidim/participatory_processes/admin/participatory_processes/_processes_thead.html.erb +19 -0
  36. data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +16 -84
  37. data/app/views/decidim/participatory_processes/admin/participatory_processes/manage_trash.html.erb +20 -0
  38. data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +3 -1
  39. data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +3 -1
  40. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +6 -6
  41. data/app/views/decidim/participatory_processes/participatory_space_private_users/index.html.erb +22 -0
  42. data/config/assets.rb +1 -2
  43. data/config/locales/ar.yml +3 -7
  44. data/config/locales/bg.yml +0 -36
  45. data/config/locales/bn-BD.yml +1 -0
  46. data/config/locales/bs-BA.yml +23 -0
  47. data/config/locales/ca.yml +61 -36
  48. data/config/locales/cs.yml +61 -36
  49. data/config/locales/de.yml +60 -35
  50. data/config/locales/el.yml +0 -36
  51. data/config/locales/en.yml +61 -36
  52. data/config/locales/es-MX.yml +60 -35
  53. data/config/locales/es-PY.yml +60 -35
  54. data/config/locales/es.yml +60 -35
  55. data/config/locales/eu.yml +103 -78
  56. data/config/locales/fi-plain.yml +61 -36
  57. data/config/locales/fi.yml +67 -42
  58. data/config/locales/fr-CA.yml +24 -35
  59. data/config/locales/fr.yml +24 -35
  60. data/config/locales/ga-IE.yml +0 -4
  61. data/config/locales/gl.yml +0 -7
  62. data/config/locales/hu.yml +0 -36
  63. data/config/locales/id-ID.yml +0 -7
  64. data/config/locales/is-IS.yml +0 -3
  65. data/config/locales/it.yml +0 -10
  66. data/config/locales/ja.yml +61 -36
  67. data/config/locales/lb.yml +0 -9
  68. data/config/locales/lt.yml +0 -36
  69. data/config/locales/lv.yml +0 -10
  70. data/config/locales/nl.yml +0 -10
  71. data/config/locales/no.yml +0 -36
  72. data/config/locales/pl.yml +0 -36
  73. data/config/locales/pt-BR.yml +0 -25
  74. data/config/locales/pt.yml +6 -10
  75. data/config/locales/ro-RO.yml +6 -36
  76. data/config/locales/ru.yml +0 -4
  77. data/config/locales/sk.yml +0 -10
  78. data/config/locales/sr-CS.yml +0 -9
  79. data/config/locales/sv.yml +62 -43
  80. data/config/locales/tr-TR.yml +0 -10
  81. data/config/locales/uk.yml +0 -4
  82. data/config/locales/zh-CN.yml +0 -10
  83. data/config/locales/zh-TW.yml +0 -36
  84. data/db/migrate/20210310120750_add_followable_counter_cache_to_participatory_processes.rb +1 -1
  85. data/db/migrate/20240822161355_add_deleted_at_to_decidim_participatory_processes.rb +8 -0
  86. data/db/migrate/20241108141423_remove_column_show_metrics_from_participatory_processes.rb +7 -0
  87. data/db/migrate/20241108141514_remove_column_banner_image_from_participatory_processes.rb +7 -0
  88. data/db/migrate/20241108141605_remove_column_show_statistics_from_participatory_processes.rb +7 -0
  89. data/decidim-participatory_processes.gemspec +2 -2
  90. data/lib/decidim/api/participatory_process_group_type.rb +3 -3
  91. data/lib/decidim/api/participatory_process_step_type.rb +7 -9
  92. data/lib/decidim/api/participatory_process_type.rb +18 -23
  93. data/lib/decidim/api/participatory_process_type_type.rb +3 -3
  94. data/lib/decidim/participatory_processes/admin_engine.rb +85 -59
  95. data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +11 -0
  96. data/lib/decidim/participatory_processes/engine.rb +7 -0
  97. data/lib/decidim/participatory_processes/menu.rb +9 -17
  98. data/lib/decidim/participatory_processes/participatory_space.rb +5 -2
  99. data/lib/decidim/participatory_processes/query_extensions.rb +26 -0
  100. data/lib/decidim/participatory_processes/seeds.rb +8 -16
  101. data/lib/decidim/participatory_processes/test/factories.rb +14 -14
  102. data/lib/decidim/participatory_processes/version.rb +1 -1
  103. metadata +27 -26
  104. data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +0 -17
  105. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +0 -17
  106. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +0 -13
  107. data/app/controllers/decidim/participatory_processes/admin/categories_controller.rb +0 -13
  108. data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +0 -117
  109. data/app/forms/decidim/participatory_processes/admin/participatory_process_type_form.rb +0 -20
  110. data/app/helpers/decidim/participatory_processes/admin/participatory_process_helper.rb +0 -24
  111. data/app/packs/entrypoints/decidim_participatory_processes_admin.js +0 -1
  112. data/app/packs/src/decidim/participatory_processes/admin/participatory_processes.js +0 -18
  113. data/app/views/decidim/participatory_processes/admin/participatory_process_types/_form.html.erb +0 -9
  114. data/app/views/decidim/participatory_processes/admin/participatory_process_types/edit.html.erb +0 -18
  115. data/app/views/decidim/participatory_processes/admin/participatory_process_types/index.html.erb +0 -58
  116. data/app/views/decidim/participatory_processes/admin/participatory_process_types/new.html.erb +0 -18
@@ -17,6 +17,7 @@ module Decidim
17
17
  if permission_action.scope == :public
18
18
  public_list_processes_action?
19
19
  public_list_process_groups_action?
20
+ public_list_members_action?
20
21
  public_read_process_group_action?
21
22
  public_read_process_action?
22
23
  return permission_action
@@ -38,7 +39,6 @@ module Decidim
38
39
 
39
40
  # org admins and space admins can do everything in the admin section
40
41
  org_admin_action?
41
- participatory_process_type_action?
42
42
 
43
43
  return permission_action unless process
44
44
 
@@ -101,6 +101,13 @@ module Decidim
101
101
  allow!
102
102
  end
103
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
+
104
111
  def public_read_process_group_action?
105
112
  return unless permission_action.action == :read &&
106
113
  permission_action.subject == :process_group &&
@@ -117,6 +124,7 @@ module Decidim
117
124
  return disallow! unless can_view_private_space?
118
125
  return allow! if user&.admin?
119
126
  return allow! if process.published?
127
+ return allow! if user_can_preview_space?
120
128
 
121
129
  toggle_allow(can_manage_process?)
122
130
  end
@@ -229,7 +237,6 @@ module Decidim
229
237
  is_allowed = [
230
238
  :attachment,
231
239
  :attachment_collection,
232
- :category,
233
240
  :component,
234
241
  :component_data,
235
242
  :moderation,
@@ -237,6 +244,7 @@ module Decidim
237
244
  :process_step,
238
245
  :process_user_role,
239
246
  :export_space,
247
+ :share_tokens,
240
248
  :import
241
249
  ].include?(permission_action.subject)
242
250
  allow! if is_allowed
@@ -248,7 +256,6 @@ module Decidim
248
256
  is_allowed = [
249
257
  :attachment,
250
258
  :attachment_collection,
251
- :category,
252
259
  :component,
253
260
  :component_data,
254
261
  :moderation,
@@ -256,22 +263,16 @@ module Decidim
256
263
  :process_step,
257
264
  :process_user_role,
258
265
  :export_space,
266
+ :share_tokens,
259
267
  :import
260
268
  ].include?(permission_action.subject)
261
269
  allow! if is_allowed
262
270
  end
263
271
 
264
- def participatory_process_type_action?
265
- return unless permission_action.subject == :participatory_process_type
266
- return disallow! unless user.admin?
267
-
268
- participatory_process_type = context.fetch(:participatory_process_type, nil)
269
- case permission_action.action
270
- when :destroy
271
- toggle_allow(participatory_process_type&.processes&.none?)
272
- else
273
- allow!
274
- 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
275
276
  end
276
277
 
277
278
  # Checks if the permission_action is to read the admin processes list or
@@ -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
@@ -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(host: process_group.organization.host)
9
+ process_group.attached_uploader(:hero_image).url
10
10
  end
11
11
 
12
12
  def process_group
@@ -4,7 +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(host: process.organization.host)
7
+ process.attached_uploader(:hero_image).url
8
8
  end
9
9
 
10
10
  def area_name
@@ -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>
@@ -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>