decidim-assemblies 0.29.1 → 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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/assemblies/assembly_metadata_g_cell.rb +1 -14
  3. data/app/cells/decidim/assemblies/content_blocks/extra_data_cell.rb +2 -12
  4. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form/show.erb +1 -1
  5. data/app/commands/decidim/assemblies/admin/copy_assembly.rb +2 -14
  6. data/app/commands/decidim/assemblies/admin/create_assembly.rb +2 -2
  7. data/app/commands/decidim/assemblies/admin/import_assembly.rb +0 -2
  8. data/app/commands/decidim/assemblies/admin/update_assembly.rb +2 -2
  9. data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +2 -11
  10. data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +19 -4
  11. data/app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb +1 -1
  12. data/app/controllers/decidim/assemblies/admin/assembly_landing_page_content_blocks_controller.rb +6 -0
  13. data/app/controllers/decidim/assemblies/admin/assembly_share_tokens_controller.rb +18 -0
  14. data/app/controllers/decidim/assemblies/admin/component_share_tokens_controller.rb +18 -0
  15. data/app/controllers/decidim/assemblies/assemblies_controller.rb +1 -3
  16. data/app/controllers/decidim/assemblies/{assembly_members_controller.rb → participatory_space_private_users_controller.rb} +3 -11
  17. data/app/forms/decidim/assemblies/admin/assembly_copy_form.rb +0 -1
  18. data/app/forms/decidim/assemblies/admin/assembly_form.rb +13 -48
  19. data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +0 -1
  20. data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +26 -4
  21. data/app/helpers/decidim/assemblies/assemblies_helper.rb +4 -4
  22. data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +11 -15
  23. data/app/models/decidim/assembly.rb +26 -11
  24. data/app/packs/entrypoints/decidim_assemblies_admin.js +0 -1
  25. data/app/packs/entrypoints/decidim_assemblies_admin_list.js +1 -0
  26. data/app/packs/src/decidim/assemblies/admin/assemblies_list.js +72 -0
  27. data/app/permissions/decidim/assemblies/permissions.rb +9 -20
  28. data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -1
  29. data/app/presenters/decidim/assemblies/assembly_presenter.rb +2 -8
  30. data/app/queries/decidim/assemblies/metrics/assemblies_metric_manage.rb +2 -2
  31. data/app/serializers/decidim/assemblies/assembly_importer.rb +0 -35
  32. data/app/serializers/decidim/assemblies/assembly_serializer.rb +11 -135
  33. data/app/serializers/decidim/assemblies/open_data_assembly_serializer.rb +59 -0
  34. data/app/views/decidim/assemblies/admin/assemblies/_assemblies_thead.html.erb +19 -0
  35. data/app/views/decidim/assemblies/admin/assemblies/_assembly_row.html.erb +101 -0
  36. data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +29 -41
  37. data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +18 -92
  38. data/app/views/decidim/assemblies/admin/assemblies/index.js.erb +10 -0
  39. data/app/views/decidim/assemblies/admin/assemblies/manage_trash.html.erb +20 -0
  40. data/app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb +0 -4
  41. data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +0 -3
  42. data/app/views/decidim/assemblies/assemblies/index.html.erb +3 -1
  43. data/app/views/decidim/assemblies/assemblies/show.html.erb +5 -6
  44. data/app/views/decidim/assemblies/{assembly_members → participatory_space_private_users}/index.html.erb +6 -5
  45. data/config/assets.rb +2 -1
  46. data/config/locales/ar.yml +1 -72
  47. data/config/locales/bg.yml +0 -74
  48. data/config/locales/bn-BD.yml +1 -0
  49. data/config/locales/bs-BA.yml +29 -0
  50. data/config/locales/ca.yml +70 -74
  51. data/config/locales/cs.yml +70 -74
  52. data/config/locales/de.yml +72 -76
  53. data/config/locales/el.yml +0 -72
  54. data/config/locales/en.yml +71 -75
  55. data/config/locales/es-MX.yml +70 -74
  56. data/config/locales/es-PY.yml +70 -74
  57. data/config/locales/es.yml +70 -74
  58. data/config/locales/eu.yml +108 -112
  59. data/config/locales/fi-plain.yml +71 -75
  60. data/config/locales/fi.yml +75 -79
  61. data/config/locales/fr-CA.yml +22 -74
  62. data/config/locales/fr.yml +22 -74
  63. data/config/locales/ga-IE.yml +0 -23
  64. data/config/locales/gl.yml +0 -70
  65. data/config/locales/he-IL.yml +143 -23
  66. data/config/locales/hu.yml +0 -74
  67. data/config/locales/id-ID.yml +0 -58
  68. data/config/locales/is-IS.yml +0 -45
  69. data/config/locales/it.yml +0 -71
  70. data/config/locales/ja.yml +70 -74
  71. data/config/locales/kaa.yml +0 -9
  72. data/config/locales/ko.yml +0 -13
  73. data/config/locales/lb.yml +0 -66
  74. data/config/locales/lt.yml +0 -72
  75. data/config/locales/lv.yml +0 -69
  76. data/config/locales/nl.yml +0 -70
  77. data/config/locales/no.yml +0 -70
  78. data/config/locales/pl.yml +0 -75
  79. data/config/locales/pt-BR.yml +0 -74
  80. data/config/locales/pt.yml +0 -70
  81. data/config/locales/ro-RO.yml +5 -72
  82. data/config/locales/ru.yml +0 -57
  83. data/config/locales/sk.yml +0 -28
  84. data/config/locales/sl.yml +0 -39
  85. data/config/locales/sq-AL.yml +0 -74
  86. data/config/locales/sr-CS.yml +0 -15
  87. data/config/locales/sv.yml +75 -79
  88. data/config/locales/tr-TR.yml +0 -75
  89. data/config/locales/uk.yml +0 -57
  90. data/config/locales/zh-CN.yml +0 -69
  91. data/config/locales/zh-TW.yml +0 -72
  92. data/db/migrate/20190215093700_reset_negative_children_count_counters.rb +2 -2
  93. data/db/migrate/20210310120444_add_followable_counter_cache_to_assemblies.rb +1 -1
  94. data/db/migrate/20240822161222_add_deleted_at_to_decidim_assemblies.rb +8 -0
  95. data/db/migrate/20241016101151_migrate_assembly_members_to_private_users.rb +53 -0
  96. data/db/migrate/20241108141651_remove_column_show_statistics_from_assemblies.rb +7 -0
  97. data/decidim-assemblies.gemspec +2 -2
  98. data/lib/decidim/api/assemblies_type_type.rb +2 -2
  99. data/lib/decidim/api/assembly_type.rb +32 -34
  100. data/lib/decidim/assemblies/admin_engine.rb +77 -54
  101. data/lib/decidim/assemblies/api.rb +0 -1
  102. data/lib/decidim/assemblies/content_blocks/registry_manager.rb +11 -0
  103. data/lib/decidim/assemblies/engine.rb +9 -3
  104. data/lib/decidim/assemblies/menu.rb +9 -22
  105. data/lib/decidim/assemblies/participatory_space.rb +7 -3
  106. data/lib/decidim/assemblies/seeds.rb +9 -33
  107. data/lib/decidim/assemblies/test/factories.rb +15 -36
  108. data/lib/decidim/assemblies/version.rb +1 -1
  109. metadata +31 -49
  110. data/app/cells/decidim/assemblies/assembly_member/data.erb +0 -19
  111. data/app/cells/decidim/assemblies/assembly_member/name_and_position.erb +0 -11
  112. data/app/cells/decidim/assemblies/assembly_member/show.erb +0 -9
  113. data/app/cells/decidim/assemblies/assembly_member_cell.rb +0 -21
  114. data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +0 -55
  115. data/app/commands/decidim/assemblies/admin/destroy_assembly_member.rb +0 -24
  116. data/app/commands/decidim/assemblies/admin/update_assembly_member.rb +0 -29
  117. data/app/controllers/concerns/decidim/assemblies/admin/assembly_members/filterable.rb +0 -39
  118. data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +0 -107
  119. data/app/controllers/decidim/assemblies/admin/assembly_members_controller.rb +0 -83
  120. data/app/controllers/decidim/assemblies/admin/categories_controller.rb +0 -13
  121. data/app/events/decidim/assemblies/create_assembly_member_event.rb +0 -17
  122. data/app/forms/decidim/assemblies/admin/assembly_member_form.rb +0 -64
  123. data/app/helpers/decidim/assemblies/admin/assembly_members_helper.rb +0 -11
  124. data/app/models/decidim/assembly_member.rb +0 -34
  125. data/app/packs/src/decidim/assemblies/admin/assembly_members.js +0 -47
  126. data/app/packs/src/decidim/assemblies/orgchart.js +0 -0
  127. data/app/presenters/decidim/admin/assembly_member_presenter.rb +0 -24
  128. data/app/presenters/decidim/assemblies/admin_log/assembly_member_presenter.rb +0 -51
  129. data/app/presenters/decidim/assemblies/admin_log/value_types/member_position_presenter.rb +0 -22
  130. data/app/presenters/decidim/assembly_member_presenter.rb +0 -68
  131. data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +0 -9
  132. data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +0 -13
  133. data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +0 -44
  134. data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +0 -18
  135. data/app/views/decidim/assemblies/admin/assembly_members/_form.html.erb +0 -62
  136. data/app/views/decidim/assemblies/admin/assembly_members/edit.html.erb +0 -18
  137. data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +0 -55
  138. data/app/views/decidim/assemblies/admin/assembly_members/new.html.erb +0 -18
  139. data/app/views/decidim/assembly_members/_assembly_member.html.erb +0 -1
  140. data/app/views/layouts/decidim/admin/assemblies_types.html.erb +0 -17
  141. data/lib/decidim/api/assembly_member_type.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66af6cbd48625e93a42a8704afd8481256d3e87b16e137cf886dfabc7040b1bc
4
- data.tar.gz: 3eb9350969be1fdde4dc25492c5ff345c901c043bb7ca3e30885dca4c52f913c
3
+ metadata.gz: 767f537492079cef350fbb6cd63781248da90014557aa25b9e089a0934f31a96
4
+ data.tar.gz: 376a7609207d2dee4fb10182413c8283718bf273b38771ff95729374f3467edf
5
5
  SHA512:
6
- metadata.gz: 4525a24c42b770c5ab806b08510ad7d0e9b5bb1fa498c95d9817118f33847c3eae2288ac9ccedbafd9fda373a43bbf1e027d2d7307735109ebef8834c2b2b7cc
7
- data.tar.gz: f820702e5bb61fccac173948422c0b3ca98ec9a7ac430a895f4b8fe46887ef924a704d445147d363588be3ea1c9be1bfd51b0a8bd203ecc801ca1e06b8315ea0
6
+ metadata.gz: 88b2b02713d50f6e1e47d636d3f30408f17f2ba2d673a8d512829b1b6fe117829f6fb7321cebc3e2c8844af479874d1cf4739592f019488cfe0b66b61a58fbd6
7
+ data.tar.gz: da1c1a75ec045d6909f035470cdb2274bc640b913bd40589c4957e0b3b7104f74c71ea2aa67594a58fba756b3c51b65cd30bd3a26b24d69ac6125436f5259247
@@ -9,16 +9,7 @@ module Decidim
9
9
  private
10
10
 
11
11
  def items
12
- [children_item, assembly_type].compact
13
- end
14
-
15
- def assembly_type
16
- return unless has_assembly_type?
17
-
18
- {
19
- text: translated_attribute(model.assembly_type.title),
20
- icon: "group-2-line"
21
- }
12
+ [children_item].compact
22
13
  end
23
14
 
24
15
  def children_item
@@ -37,10 +28,6 @@ module Decidim
37
28
  def published_children_assemblies
38
29
  @published_children_assemblies ||= model.children.published
39
30
  end
40
-
41
- def has_assembly_type?
42
- model.assembly_type.present?
43
- end
44
31
  end
45
32
  end
46
33
  end
@@ -4,28 +4,18 @@ module Decidim
4
4
  module Assemblies
5
5
  module ContentBlocks
6
6
  class ExtraDataCell < Decidim::ContentBlocks::ParticipatorySpaceExtraDataCell
7
- delegate :assembly_type, :duration, to: :presented_resource
7
+ delegate :duration, to: :presented_resource
8
8
 
9
9
  private
10
10
 
11
11
  def extra_data_items
12
- [type_item, duration_item].compact
12
+ [duration_item].compact
13
13
  end
14
14
 
15
15
  def presented_resource
16
16
  Decidim::Assemblies::AssemblyPresenter.new(resource)
17
17
  end
18
18
 
19
- def type_item
20
- return if assembly_type.blank?
21
-
22
- {
23
- title: t("assembly_type", scope: "decidim.assemblies.show"),
24
- icon: "group-2-line",
25
- text: decidim_sanitize_translated(assembly_type)
26
- }
27
- end
28
-
29
19
  def duration_item
30
20
  {
31
21
  title: t("duration", scope: "decidim.assemblies.show"),
@@ -1,3 +1,3 @@
1
1
  <% form.fields_for :settings, form.object.settings do |settings_fields| %>
2
- <%= settings_fields.select :max_results, [6, 9, 12], prompt: "", label: %>
2
+ <%= settings_fields.number_field :max_results, label: %>
3
3
  <% end %>
@@ -29,7 +29,6 @@ module Decidim
29
29
  Assembly.transaction do
30
30
  copy_assembly
31
31
  copy_assembly_attachments
32
- copy_assembly_categories if @form.copy_categories?
33
32
  copy_assembly_components if @form.copy_components?
34
33
  end
35
34
  end
@@ -51,7 +50,6 @@ module Decidim
51
50
  description: @assembly.description,
52
51
  short_description: @assembly.short_description,
53
52
  promoted: @assembly.promoted,
54
- scope: @assembly.scope,
55
53
  parent: @assembly.parent,
56
54
  developer_group: @assembly.developer_group,
57
55
  local_area: @assembly.local_area,
@@ -60,7 +58,8 @@ module Decidim
60
58
  participatory_scope: @assembly.participatory_scope,
61
59
  participatory_structure: @assembly.participatory_structure,
62
60
  meta_scope: @assembly.meta_scope,
63
- announcement: @assembly.announcement
61
+ announcement: @assembly.announcement,
62
+ taxonomies: @assembly.taxonomies
64
63
  )
65
64
  end
66
65
 
@@ -72,17 +71,6 @@ module Decidim
72
71
  end
73
72
  end
74
73
 
75
- def copy_assembly_categories
76
- @assembly.categories.each do |category|
77
- Category.create!(
78
- name: category.name,
79
- description: category.description,
80
- parent_id: category.parent_id,
81
- participatory_space: @copied_assembly
82
- )
83
- end
84
- end
85
-
86
74
  def copy_assembly_components
87
75
  @assembly.components.each do |component|
88
76
  new_component = Component.create!(
@@ -9,10 +9,10 @@ module Decidim
9
9
  fetch_file_attributes :hero_image, :banner_image
10
10
 
11
11
  fetch_form_attributes :title, :subtitle, :weight, :slug, :hashtag, :description, :short_description,
12
- :promoted, :scopes_enabled, :scope, :area, :parent, :announcement, :organization,
12
+ :promoted, :taxonomizations, :parent, :announcement, :organization,
13
13
  :private_space, :developer_group, :local_area, :target, :participatory_scope,
14
14
  :participatory_structure, :meta_scope, :purpose_of_action,
15
- :composition, :assembly_type, :creation_date, :created_by, :created_by_other,
15
+ :composition, :creation_date, :created_by, :created_by_other,
16
16
  :duration, :included_at, :closing_date, :closing_date_reason, :internal_organisation,
17
17
  :is_transparent, :special_features, :twitter_handler, :facebook_handler,
18
18
  :instagram_handler, :youtube_handler, :github_handler
@@ -41,8 +41,6 @@ module Decidim
41
41
  assemblies.each do |original_assembly|
42
42
  Decidim.traceability.perform_action!("import", Assembly, @user) do
43
43
  @imported_assembly = importer.import(original_assembly, form.current_user, title: form.title, slug: form.slug)
44
- importer.import_assemblies_type(original_assembly["decidim_assemblies_type_id"])
45
- importer.import_categories(original_assembly["assembly_categories"]) if form.import_categories?
46
44
  importer.import_folders_and_attachments(original_assembly["attachments"]) if form.import_attachments?
47
45
  importer.import_components(original_assembly["components"]) if form.import_components?
48
46
  @imported_assembly
@@ -9,9 +9,9 @@ module Decidim
9
9
  fetch_file_attributes :hero_image, :banner_image
10
10
 
11
11
  fetch_form_attributes :title, :subtitle, :slug, :hashtag, :promoted, :description, :short_description,
12
- :scopes_enabled, :scope, :area, :parent, :private_space, :developer_group, :local_area,
12
+ :taxonomizations, :parent, :private_space, :developer_group, :local_area,
13
13
  :target, :participatory_scope, :participatory_structure, :meta_scope,
14
- :purpose_of_action, :composition, :assembly_type, :creation_date, :created_by,
14
+ :purpose_of_action, :composition, :creation_date, :created_by,
15
15
  :created_by_other, :duration, :included_at, :closing_date, :closing_date_reason,
16
16
  :internal_organisation, :is_transparent, :special_features, :twitter_handler, :announcement,
17
17
  :facebook_handler, :instagram_handler, :youtube_handler, :github_handler, :weight
@@ -25,24 +25,15 @@ module Decidim
25
25
  end
26
26
 
27
27
  def filters
28
- [:private_space_eq, :published_at_null, :decidim_assemblies_type_id_eq]
28
+ [:private_space_eq, :published_at_null]
29
29
  end
30
30
 
31
31
  def filters_with_values
32
32
  {
33
33
  private_space_eq: [true, false],
34
- published_at_null: [true, false],
35
- decidim_assemblies_type_id_eq: AssembliesType.where(organization: current_organization).pluck(:id)
34
+ published_at_null: [true, false]
36
35
  }
37
36
  end
38
-
39
- def dynamically_translated_filters
40
- [:decidim_assemblies_type_id_eq]
41
- end
42
-
43
- def translated_decidim_assemblies_type_id_eq(id)
44
- translated_attribute(Decidim::AssembliesType.find(id).title)
45
- end
46
37
  end
47
38
  end
48
39
  end
@@ -7,8 +7,11 @@ module Decidim
7
7
  #
8
8
  class AssembliesController < Decidim::Assemblies::Admin::ApplicationController
9
9
  include Decidim::Assemblies::Admin::Filterable
10
- include Decidim::Admin::ParticipatorySpaceAdminBreadcrumb
11
- helper_method :current_assembly, :parent_assembly, :current_participatory_space
10
+ include Decidim::Admin::ParticipatorySpaceAdminContext
11
+ include Decidim::Admin::HasTrashableResources
12
+
13
+ helper_method :current_assembly, :parent_assembly, :parent_assembly_id, :current_participatory_space
14
+
12
15
  layout "decidim/admin/assemblies"
13
16
 
14
17
  def index
@@ -29,7 +32,7 @@ module Decidim
29
32
  CreateAssembly.call(@form) do
30
33
  on(:ok) do |assembly|
31
34
  flash[:notice] = I18n.t("assemblies.create.success", scope: "decidim.admin")
32
- redirect_to assemblies_path(q: { parent_id_eq: assembly.parent_id })
35
+ redirect_to components_path(assembly)
33
36
  end
34
37
 
35
38
  on(:invalid) do
@@ -75,8 +78,20 @@ module Decidim
75
78
  @collection ||= OrganizationAssemblies.new(current_user.organization).query
76
79
  end
77
80
 
81
+ def trashable_deleted_resource_type
82
+ :assembly
83
+ end
84
+
85
+ def trashable_deleted_resource
86
+ @trashable_deleted_resource ||= current_assembly
87
+ end
88
+
89
+ def trashable_deleted_collection
90
+ @trashable_deleted_collection = filtered_collection.only_deleted.deleted_at_desc
91
+ end
92
+
78
93
  def current_assembly
79
- @current_assembly ||= collection.where(slug: params[:slug]).or(
94
+ @current_assembly ||= collection.with_deleted.where(slug: params[:slug]).or(
80
95
  collection.where(id: params[:slug])
81
96
  ).first
82
97
  end
@@ -20,7 +20,7 @@ module Decidim
20
20
  CopyAssembly.call(@form, current_assembly, current_user) do
21
21
  on(:ok) do
22
22
  flash[:notice] = I18n.t("assemblies_copies.create.success", scope: "decidim.admin")
23
- redirect_to assemblies_path(parent_id: current_assembly.parent_id)
23
+ redirect_to assemblies_path
24
24
  end
25
25
 
26
26
  on(:invalid) do
@@ -10,6 +10,8 @@ module Decidim
10
10
 
11
11
  layout "decidim/admin/assemblies"
12
12
 
13
+ helper_method :parent_assembly
14
+
13
15
  private
14
16
 
15
17
  def content_block_scope
@@ -29,6 +31,10 @@ module Decidim
29
31
  def resource_landing_page_content_block_path
30
32
  assembly_landing_page_content_block_path(scoped_resource, params[:id])
31
33
  end
34
+
35
+ def parent_assembly
36
+ scoped_resource.parent
37
+ end
32
38
  end
33
39
  end
34
40
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # This controller allows sharing unpublished things.
7
+ # It is targeted for customizations for sharing unpublished things that lives under
8
+ # an assembly.
9
+ class AssemblyShareTokensController < Decidim::Admin::ShareTokensController
10
+ include Concerns::AssemblyAdmin
11
+
12
+ def resource
13
+ current_assembly
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # This controller allows sharing unpublished things.
7
+ # It is targeted for customizations for sharing unpublished things that lives under
8
+ # an assembly.
9
+ class ComponentShareTokensController < Decidim::Admin::ShareTokensController
10
+ include Concerns::AssemblyAdmin
11
+
12
+ def resource
13
+ @resource ||= current_participatory_space.components.find(params[:component_id])
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -56,9 +56,7 @@ module Decidim
56
56
 
57
57
  def default_filter_params
58
58
  {
59
- with_any_scope: nil,
60
- with_any_area: nil,
61
- with_any_type: nil
59
+ with_any_taxonomies: nil
62
60
  }
63
61
  end
64
62
 
@@ -2,27 +2,19 @@
2
2
 
3
3
  module Decidim
4
4
  module Assemblies
5
- class AssemblyMembersController < Decidim::Assemblies::ApplicationController
5
+ class ParticipatorySpacePrivateUsersController < Decidim::Assemblies::ApplicationController
6
6
  include ParticipatorySpaceContext
7
- include AssemblyBreadcrumb
8
-
9
- helper_method :collection
7
+ include Decidim::HasMembersPage
10
8
 
11
9
  def index
12
10
  raise ActionController::RoutingError, "No members for this assembly" if members.none?
13
11
 
14
12
  enforce_permission_to :list, :members
15
- redirect_to decidim_assemblies.assembly_path(current_participatory_space) unless current_user_can_visit_space?
13
+ redirect_to decidim_assemblies.assembly_path(current_participatory_space) unless can_visit_index?
16
14
  end
17
15
 
18
16
  private
19
17
 
20
- def members
21
- @members ||= current_participatory_space.members.not_ceased
22
- end
23
-
24
- alias collection members
25
-
26
18
  def current_participatory_space
27
19
  return unless params[:assembly_slug]
28
20
 
@@ -14,7 +14,6 @@ module Decidim
14
14
  mimic :assembly
15
15
 
16
16
  attribute :slug, String
17
- attribute :copy_categories, Boolean
18
17
  attribute :copy_components, Boolean
19
18
 
20
19
  validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
@@ -9,28 +9,29 @@ module Decidim
9
9
  class AssemblyForm < Form
10
10
  include TranslatableAttributes
11
11
  include Decidim::HasUploadValidations
12
+ include Decidim::HasTaxonomyFormAttributes
12
13
 
13
14
  CREATED_BY = %w(city_council public others).freeze
14
15
 
15
16
  mimic :assembly
16
17
 
17
- translatable_attribute :composition, String
18
- translatable_attribute :closing_date_reason, String
18
+ translatable_attribute :composition, Decidim::Attributes::RichText
19
+ translatable_attribute :closing_date_reason, Decidim::Attributes::RichText
19
20
  translatable_attribute :created_by_other, String
20
- translatable_attribute :description, String
21
+ translatable_attribute :description, Decidim::Attributes::RichText
21
22
  translatable_attribute :developer_group, String
22
- translatable_attribute :internal_organisation, String
23
+ translatable_attribute :internal_organisation, Decidim::Attributes::RichText
23
24
  translatable_attribute :local_area, String
24
25
  translatable_attribute :meta_scope, String
25
26
  translatable_attribute :participatory_scope, String
26
27
  translatable_attribute :participatory_structure, String
27
- translatable_attribute :purpose_of_action, String
28
- translatable_attribute :short_description, String
29
- translatable_attribute :special_features, String
28
+ translatable_attribute :purpose_of_action, Decidim::Attributes::RichText
29
+ translatable_attribute :short_description, Decidim::Attributes::RichText
30
+ translatable_attribute :special_features, Decidim::Attributes::RichText
30
31
  translatable_attribute :subtitle, String
31
32
  translatable_attribute :target, String
32
33
  translatable_attribute :title, String
33
- translatable_attribute :announcement, String
34
+ translatable_attribute :announcement, Decidim::Attributes::RichText
34
35
 
35
36
  attribute :created_by, String
36
37
  attribute :facebook_handler, String
@@ -41,17 +42,13 @@ module Decidim
41
42
  attribute :twitter_handler, String
42
43
  attribute :youtube_handler, String
43
44
 
44
- attribute :decidim_assemblies_type_id, Integer
45
- attribute :area_id, Integer
46
45
  attribute :parent_id, Integer
47
46
  attribute :participatory_processes_ids, Array[Integer]
48
- attribute :scope_id, Integer
49
47
  attribute :weight, Integer, default: 0
50
48
 
51
49
  attribute :is_transparent, Boolean
52
50
  attribute :promoted, Boolean
53
51
  attribute :private_space, Boolean
54
- attribute :scopes_enabled, Boolean
55
52
 
56
53
  attribute :closing_date, Decidim::Attributes::LocalizedDate
57
54
  attribute :creation_date, Decidim::Attributes::LocalizedDate
@@ -63,16 +60,12 @@ module Decidim
63
60
  attribute :remove_banner_image, Boolean, default: false
64
61
  attribute :remove_hero_image, Boolean, default: false
65
62
 
66
- validates :area, presence: true, if: proc { |object| object.area_id.present? }
67
-
68
63
  validates :parent, presence: true, if: ->(form) { form.parent.present? }
69
64
  validate :ensure_parent_cannot_be_child, if: ->(form) { form.parent.present? }
70
65
 
71
- validates :scope, presence: true, if: proc { |object| object.scope_id.present? }
72
66
  validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
73
67
 
74
68
  validate :slug_uniqueness
75
- validate :same_type_organization, if: ->(form) { form.decidim_assemblies_type_id }
76
69
 
77
70
  validates :created_by_other, translatable_presence: true, if: ->(form) { form.created_by == "others" }
78
71
  validates :title, :subtitle, :description, :short_description, translatable_presence: true
@@ -84,6 +77,10 @@ module Decidim
84
77
 
85
78
  alias organization current_organization
86
79
 
80
+ def participatory_space_manifest
81
+ :assemblies
82
+ end
83
+
87
84
  def ensure_parent_cannot_be_child
88
85
  return if id.blank?
89
86
 
@@ -91,23 +88,6 @@ module Decidim
91
88
  errors.add(:parent, :invalid) unless available_assemblies.include? parent
92
89
  end
93
90
 
94
- def map_model(model)
95
- self.scope_id = model.decidim_scope_id
96
- end
97
-
98
- def scope
99
- @scope ||= current_organization.scopes.find_by(id: scope_id)
100
- end
101
-
102
- def area
103
- @area ||= current_organization.areas.find_by(id: area_id)
104
- end
105
-
106
- def assembly_types_for_select
107
- @assembly_types_for_select ||= organization_assembly_types
108
- &.map { |type| [translated_attribute(type.title), type.id] }
109
- end
110
-
111
91
  def created_by_for_select
112
92
  CREATED_BY.map do |creator|
113
93
  [
@@ -127,16 +107,8 @@ module Decidim
127
107
  &.sort_by { |arr| arr[0] }
128
108
  end
129
109
 
130
- def assembly_type
131
- AssembliesType.find_by(id: decidim_assemblies_type_id)
132
- end
133
-
134
110
  private
135
111
 
136
- def organization_assembly_types
137
- AssembliesType.where(organization: current_organization)
138
- end
139
-
140
112
  def organization_participatory_processes
141
113
  Decidim.find_participatory_space_manifest(:participatory_processes)
142
114
  .participatory_spaces.call(current_organization)
@@ -154,13 +126,6 @@ module Decidim
154
126
 
155
127
  errors.add(:slug, :taken)
156
128
  end
157
-
158
- def same_type_organization
159
- return unless assembly_type
160
- return if assembly_type.organization == current_organization
161
-
162
- errors.add(:assembly_type, :invalid)
163
- end
164
129
  end
165
130
  end
166
131
  end
@@ -27,7 +27,6 @@ module Decidim
27
27
 
28
28
  attribute :slug, String
29
29
  attribute :import_steps, Boolean, default: false
30
- attribute :import_categories, Boolean, default: true
31
30
  attribute :import_attachments, Boolean, default: true
32
31
  attribute :import_components, Boolean, default: true
33
32
  attribute :document, Decidim::Attributes::Blob
@@ -15,10 +15,32 @@ module Decidim
15
15
  end
16
16
  end
17
17
 
18
- # Public: A collection of Assemblies that can be selected as parent
19
- # assemblies for another assembly; to be used in forms.
20
- def parent_assemblies_for_select
21
- @parent_assemblies_for_select ||= ParentAssembliesForSelect.for(current_organization, current_assembly)
18
+ # Public: select options representing a collection of Assemblies that
19
+ # can be selected as parent assemblies for another assembly; to be used in forms.
20
+ def parent_assemblies_options
21
+ options = []
22
+ root_assemblies = ParentAssembliesForSelect.for(current_organization, current_assembly).where(parent_id: nil).sort_by(&:weight)
23
+
24
+ root_assemblies.each do |assembly|
25
+ build_assembly_options(assembly, options)
26
+ end
27
+
28
+ options
29
+ end
30
+
31
+ private
32
+
33
+ # Recursively build the options for the assembly tree
34
+ def build_assembly_options(assembly, options, level = 0)
35
+ name = sanitize("#{"&nbsp;" * 4 * level} #{assembly.translated_title}")
36
+ options << [name, assembly.id]
37
+
38
+ # Skip the current assembly to avoid selecting a child as parent
39
+ return if assembly == current_assembly
40
+
41
+ assembly.children.each do |child|
42
+ build_assembly_options(child, options, level + 1)
43
+ end
22
44
  end
23
45
  end
24
46
  end
@@ -17,11 +17,11 @@ module Decidim
17
17
  components = participatory_space.components.published.or(Decidim::Component.where(id: try(:current_component)))
18
18
 
19
19
  [
20
- *(if participatory_space.members.not_ceased.any?
20
+ *(if participatory_space.members_public_page?
21
21
  [{
22
22
  name: t("assembly_member_menu_item", scope: "layouts.decidim.assembly_navigation"),
23
- url: decidim_assemblies.assembly_assembly_members_path(participatory_space),
24
- active: is_active_link?(decidim_assemblies.assembly_assembly_members_path(participatory_space), :inclusive)
23
+ url: decidim_assemblies.assembly_participatory_space_private_users_path(participatory_space),
24
+ active: is_active_link?(decidim_assemblies.assembly_participatory_space_private_users_path(participatory_space), :inclusive)
25
25
  }]
26
26
  end
27
27
  )
@@ -31,7 +31,7 @@ module Decidim
31
31
  url: main_component_path(component),
32
32
  active: is_active_link?(main_component_path(component), :inclusive)
33
33
  }
34
- end
34
+ end.compact
35
35
  end
36
36
  end
37
37
  end
@@ -6,25 +6,21 @@ module Decidim
6
6
  module FilterAssembliesHelper
7
7
  include Decidim::CheckBoxesTreeHelper
8
8
 
9
- def assembly_types
10
- @assembly_types ||= AssembliesType.where(organization: current_organization).joins(:assemblies).distinct
11
- end
12
-
13
- def filter_types_values
14
- return if assembly_types.blank?
9
+ def filter_sections
10
+ items = []
15
11
 
16
- type_values = assembly_types.map { |type| [type.id.to_s, translated_attribute(type.title)] }
17
- type_values.prepend(["", t("decidim.assemblies.assemblies.filters.names.all")])
12
+ available_taxonomy_filters.find_each do |taxonomy_filter|
13
+ items.append(method: "with_any_taxonomies[#{taxonomy_filter.root_taxonomy_id}]",
14
+ collection: filter_taxonomy_values_for(taxonomy_filter),
15
+ label: decidim_sanitize_translated(taxonomy_filter.name),
16
+ id: "taxonomy")
17
+ end
18
18
 
19
- filter_tree_from_array(type_values)
19
+ items.reject { |item| item[:collection].blank? }
20
20
  end
21
21
 
22
- def filter_sections
23
- [
24
- { method: :with_any_scope, collection: filter_global_scopes_values, label_scope: "decidim.shared.participatory_space_filters.filters", id: "scope" },
25
- { method: :with_any_area, collection: filter_areas_values, label_scope: "decidim.shared.participatory_space_filters.filters", id: "area" },
26
- { method: :with_any_type, collection: filter_types_values, label_scope: "decidim.assemblies.assemblies.filters", id: "type" }
27
- ].reject { |item| item[:collection].blank? }
22
+ def available_taxonomy_filters
23
+ Decidim::TaxonomyFilter.for(current_organization).for_manifest(:assemblies)
28
24
  end
29
25
  end
30
26
  end