decidim-assemblies 0.29.4 → 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.
- checksums.yaml +4 -4
- data/app/cells/decidim/assemblies/assembly_metadata_g_cell.rb +1 -14
- data/app/cells/decidim/assemblies/content_blocks/extra_data_cell.rb +2 -12
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form/show.erb +1 -1
- data/app/commands/decidim/assemblies/admin/copy_assembly.rb +2 -47
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +2 -2
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +0 -2
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +2 -2
- data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +2 -11
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +19 -4
- data/app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/assembly_share_tokens_controller.rb +18 -0
- data/app/controllers/decidim/assemblies/admin/component_share_tokens_controller.rb +18 -0
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +2 -4
- data/app/controllers/decidim/assemblies/{assembly_members_controller.rb → participatory_space_private_users_controller.rb} +3 -11
- data/app/forms/decidim/assemblies/admin/assembly_copy_form.rb +0 -2
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +5 -40
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +0 -1
- data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +26 -4
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +4 -4
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +11 -15
- data/app/models/decidim/assembly.rb +21 -11
- data/app/packs/entrypoints/decidim_assemblies_admin.js +0 -1
- data/app/packs/entrypoints/decidim_assemblies_admin_list.js +1 -0
- data/app/packs/src/decidim/assemblies/admin/assemblies_list.js +72 -0
- data/app/permissions/decidim/assemblies/permissions.rb +9 -26
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -1
- data/app/presenters/decidim/assemblies/assembly_presenter.rb +0 -6
- data/app/queries/decidim/assemblies/metrics/assemblies_metric_manage.rb +2 -2
- data/app/serializers/decidim/assemblies/assembly_importer.rb +0 -35
- data/app/serializers/decidim/assemblies/assembly_serializer.rb +11 -135
- data/app/serializers/decidim/assemblies/open_data_assembly_serializer.rb +59 -0
- data/app/views/decidim/assemblies/admin/assemblies/_assemblies_thead.html.erb +19 -0
- data/app/views/decidim/assemblies/admin/assemblies/_assembly_row.html.erb +101 -0
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +29 -41
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +18 -92
- data/app/views/decidim/assemblies/admin/assemblies/index.js.erb +10 -0
- data/app/views/decidim/assemblies/admin/assemblies/manage_trash.html.erb +20 -0
- data/app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb +0 -7
- data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +0 -3
- data/app/views/decidim/assemblies/assemblies/index.html.erb +3 -1
- data/app/views/decidim/assemblies/assemblies/show.html.erb +5 -6
- data/app/views/decidim/assemblies/{assembly_members → participatory_space_private_users}/index.html.erb +6 -5
- data/config/assets.rb +2 -1
- data/config/locales/ar.yml +0 -72
- data/config/locales/bg.yml +0 -74
- data/config/locales/bs-BA.yml +0 -15
- data/config/locales/ca.yml +70 -74
- data/config/locales/cs.yml +70 -74
- data/config/locales/de.yml +70 -74
- data/config/locales/el.yml +0 -72
- data/config/locales/en.yml +71 -75
- data/config/locales/es-MX.yml +70 -74
- data/config/locales/es-PY.yml +70 -74
- data/config/locales/es.yml +70 -74
- data/config/locales/eu.yml +74 -78
- data/config/locales/fi-plain.yml +71 -75
- data/config/locales/fi.yml +71 -75
- data/config/locales/fr-CA.yml +22 -74
- data/config/locales/fr.yml +22 -74
- data/config/locales/ga-IE.yml +0 -25
- data/config/locales/gl.yml +1 -73
- data/config/locales/he-IL.yml +8 -60
- data/config/locales/hu.yml +0 -74
- data/config/locales/id-ID.yml +0 -63
- data/config/locales/is-IS.yml +0 -48
- data/config/locales/it.yml +1 -144
- data/config/locales/ja.yml +70 -74
- data/config/locales/kaa.yml +0 -9
- data/config/locales/ko.yml +0 -6
- data/config/locales/lb.yml +0 -70
- data/config/locales/lt.yml +0 -72
- data/config/locales/lv.yml +0 -74
- data/config/locales/nl.yml +0 -72
- data/config/locales/no.yml +0 -72
- data/config/locales/pl.yml +0 -75
- data/config/locales/pt-BR.yml +0 -74
- data/config/locales/pt.yml +0 -152
- data/config/locales/ro-RO.yml +14 -85
- data/config/locales/ru.yml +0 -60
- data/config/locales/sk.yml +0 -46
- data/config/locales/sl.yml +0 -54
- data/config/locales/sq-AL.yml +0 -77
- data/config/locales/sr-CS.yml +0 -15
- data/config/locales/sv.yml +71 -75
- data/config/locales/tr-TR.yml +0 -75
- data/config/locales/uk.yml +0 -60
- data/config/locales/zh-CN.yml +0 -74
- data/config/locales/zh-TW.yml +0 -72
- data/db/migrate/20190215093700_reset_negative_children_count_counters.rb +2 -2
- data/db/migrate/20210310120444_add_followable_counter_cache_to_assemblies.rb +1 -1
- data/db/migrate/20240822161222_add_deleted_at_to_decidim_assemblies.rb +8 -0
- data/db/migrate/20241016101151_migrate_assembly_members_to_private_users.rb +53 -0
- data/db/migrate/20241108141651_remove_column_show_statistics_from_assemblies.rb +7 -0
- data/decidim-assemblies.gemspec +1 -1
- data/lib/decidim/api/assemblies_type_type.rb +2 -2
- data/lib/decidim/api/assembly_type.rb +32 -34
- data/lib/decidim/assemblies/admin_engine.rb +77 -54
- data/lib/decidim/assemblies/api.rb +0 -1
- data/lib/decidim/assemblies/content_blocks/registry_manager.rb +11 -0
- data/lib/decidim/assemblies/engine.rb +9 -3
- data/lib/decidim/assemblies/menu.rb +9 -22
- data/lib/decidim/assemblies/participatory_space.rb +7 -3
- data/lib/decidim/assemblies/seeds.rb +9 -33
- data/lib/decidim/assemblies/test/factories.rb +15 -36
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +28 -49
- data/app/cells/decidim/assemblies/assembly_member/data.erb +0 -19
- data/app/cells/decidim/assemblies/assembly_member/name_and_position.erb +0 -11
- data/app/cells/decidim/assemblies/assembly_member/show.erb +0 -9
- data/app/cells/decidim/assemblies/assembly_member_cell.rb +0 -21
- data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +0 -55
- data/app/commands/decidim/assemblies/admin/destroy_assembly_member.rb +0 -24
- data/app/commands/decidim/assemblies/admin/update_assembly_member.rb +0 -29
- data/app/controllers/concerns/decidim/assemblies/admin/assembly_members/filterable.rb +0 -39
- data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +0 -107
- data/app/controllers/decidim/assemblies/admin/assembly_members_controller.rb +0 -83
- data/app/controllers/decidim/assemblies/admin/categories_controller.rb +0 -13
- data/app/events/decidim/assemblies/create_assembly_member_event.rb +0 -17
- data/app/forms/decidim/assemblies/admin/assembly_member_form.rb +0 -64
- data/app/helpers/decidim/assemblies/admin/assembly_members_helper.rb +0 -11
- data/app/models/decidim/assembly_member.rb +0 -34
- data/app/packs/src/decidim/assemblies/admin/assembly_members.js +0 -47
- data/app/packs/src/decidim/assemblies/orgchart.js +0 -0
- data/app/presenters/decidim/admin/assembly_member_presenter.rb +0 -24
- data/app/presenters/decidim/assemblies/admin_log/assembly_member_presenter.rb +0 -51
- data/app/presenters/decidim/assemblies/admin_log/value_types/member_position_presenter.rb +0 -22
- data/app/presenters/decidim/assembly_member_presenter.rb +0 -68
- data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +0 -9
- data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +0 -13
- data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +0 -44
- data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +0 -18
- data/app/views/decidim/assemblies/admin/assembly_members/_form.html.erb +0 -62
- data/app/views/decidim/assemblies/admin/assembly_members/edit.html.erb +0 -18
- data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +0 -55
- data/app/views/decidim/assemblies/admin/assembly_members/new.html.erb +0 -18
- data/app/views/decidim/assembly_members/_assembly_member.html.erb +0 -1
- data/app/views/layouts/decidim/admin/assemblies_types.html.erb +0 -17
- data/config/locales/ca-IT.yml +0 -460
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 767f537492079cef350fbb6cd63781248da90014557aa25b9e089a0934f31a96
|
4
|
+
data.tar.gz: 376a7609207d2dee4fb10182413c8283718bf273b38771ff95729374f3467edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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 :
|
7
|
+
delegate :duration, to: :presented_resource
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def extra_data_items
|
12
|
-
[
|
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"),
|
@@ -29,9 +29,7 @@ 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
|
-
copy_landing_page_blocks if @form.copy_landing_page_blocks?
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
@@ -52,7 +50,6 @@ module Decidim
|
|
52
50
|
description: @assembly.description,
|
53
51
|
short_description: @assembly.short_description,
|
54
52
|
promoted: @assembly.promoted,
|
55
|
-
scope: @assembly.scope,
|
56
53
|
parent: @assembly.parent,
|
57
54
|
developer_group: @assembly.developer_group,
|
58
55
|
local_area: @assembly.local_area,
|
@@ -61,7 +58,8 @@ module Decidim
|
|
61
58
|
participatory_scope: @assembly.participatory_scope,
|
62
59
|
participatory_structure: @assembly.participatory_structure,
|
63
60
|
meta_scope: @assembly.meta_scope,
|
64
|
-
announcement: @assembly.announcement
|
61
|
+
announcement: @assembly.announcement,
|
62
|
+
taxonomies: @assembly.taxonomies
|
65
63
|
)
|
66
64
|
end
|
67
65
|
|
@@ -73,17 +71,6 @@ module Decidim
|
|
73
71
|
end
|
74
72
|
end
|
75
73
|
|
76
|
-
def copy_assembly_categories
|
77
|
-
@assembly.categories.each do |category|
|
78
|
-
Category.create!(
|
79
|
-
name: category.name,
|
80
|
-
description: category.description,
|
81
|
-
parent_id: category.parent_id,
|
82
|
-
participatory_space: @copied_assembly
|
83
|
-
)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
74
|
def copy_assembly_components
|
88
75
|
@assembly.components.each do |component|
|
89
76
|
new_component = Component.create!(
|
@@ -97,38 +84,6 @@ module Decidim
|
|
97
84
|
component.manifest.run_hooks(:copy, new_component:, old_component: component)
|
98
85
|
end
|
99
86
|
end
|
100
|
-
|
101
|
-
def copy_landing_page_blocks
|
102
|
-
blocks = Decidim::ContentBlock.where(scoped_resource_id: @assembly.id, scope_name: "assembly_homepage", organization: @assembly.organization)
|
103
|
-
return if blocks.blank?
|
104
|
-
|
105
|
-
blocks.each do |block|
|
106
|
-
new_block = Decidim::ContentBlock.create!(
|
107
|
-
organization: @copied_assembly.organization,
|
108
|
-
scope_name: "assembly_homepage",
|
109
|
-
scoped_resource_id: @copied_assembly.id,
|
110
|
-
manifest_name: block.manifest_name,
|
111
|
-
settings: block.settings,
|
112
|
-
weight: block.weight,
|
113
|
-
published_at: block.published_at.present? ? @copied_assembly.created_at : nil # determine if block is active/inactive
|
114
|
-
)
|
115
|
-
copy_block_attachments(block, new_block) if block.attachments.present?
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def copy_block_attachments(block, new_block)
|
120
|
-
block.attachments.map(&:name).each do |name|
|
121
|
-
original_image = block.images_container.send(name).blob
|
122
|
-
next if original_image.blank?
|
123
|
-
|
124
|
-
new_block.images_container.send("#{name}=", ActiveStorage::Blob.create_and_upload!(
|
125
|
-
io: StringIO.new(original_image.download),
|
126
|
-
filename: "image.png",
|
127
|
-
content_type: block.images_container.background_image.blob.content_type
|
128
|
-
))
|
129
|
-
new_block.save!
|
130
|
-
end
|
131
|
-
end
|
132
87
|
end
|
133
88
|
end
|
134
89
|
end
|
@@ -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, :
|
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, :
|
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
|
-
:
|
12
|
+
:taxonomizations, :parent, :private_space, :developer_group, :local_area,
|
13
13
|
:target, :participatory_scope, :participatory_structure, :meta_scope,
|
14
|
-
:purpose_of_action, :composition, :
|
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
|
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::
|
11
|
-
|
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
|
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
|
23
|
+
redirect_to assemblies_path
|
24
24
|
end
|
25
25
|
|
26
26
|
on(:invalid) do
|
@@ -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
|
@@ -51,14 +51,12 @@ module Decidim
|
|
51
51
|
private
|
52
52
|
|
53
53
|
def search_collection
|
54
|
-
|
54
|
+
Assembly.where(organization: current_organization).published.visible_for(current_user)
|
55
55
|
end
|
56
56
|
|
57
57
|
def default_filter_params
|
58
58
|
{
|
59
|
-
|
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
|
5
|
+
class ParticipatorySpacePrivateUsersController < Decidim::Assemblies::ApplicationController
|
6
6
|
include ParticipatorySpaceContext
|
7
|
-
include
|
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
|
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,9 +14,7 @@ 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
|
-
attribute :copy_landing_page_blocks, Boolean
|
20
18
|
|
21
19
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
22
20
|
validates :title, translatable_presence: true
|
@@ -9,6 +9,7 @@ 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
|
|
@@ -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:
|
19
|
-
# assemblies for another assembly; to be used in forms.
|
20
|
-
def
|
21
|
-
|
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("#{" " * 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.
|
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.
|
24
|
-
active: is_active_link?(decidim_assemblies.
|
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
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def filter_types_values
|
14
|
-
return if assembly_types.blank?
|
9
|
+
def filter_sections
|
10
|
+
items = []
|
15
11
|
|
16
|
-
|
17
|
-
|
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
|
-
|
19
|
+
items.reject { |item| item[:collection].blank? }
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
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
|