decidim-assemblies 0.31.8 → 0.32.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/README.md +4 -12
- data/app/cells/decidim/assemblies/content_blocks/main_data_cell.rb +1 -0
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +4 -4
- data/app/commands/decidim/assemblies/admin/duplicate_assembly.rb +2 -3
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +3 -3
- data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +6 -2
- data/app/controllers/concerns/decidim/assemblies/assembly_breadcrumb.rb +0 -3
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +2 -2
- data/app/controllers/decidim/assemblies/admin/assembly_attachment_collections_controller.rb +0 -2
- data/app/controllers/decidim/assemblies/admin/assembly_attachments_controller.rb +0 -2
- data/app/controllers/decidim/assemblies/admin/assembly_duplicates_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/assembly_exports_controller.rb +0 -2
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/assembly_landing_page_controller.rb +2 -8
- data/app/controllers/decidim/assemblies/admin/assembly_share_tokens_controller.rb +0 -2
- data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +0 -2
- data/app/controllers/decidim/assemblies/admin/component_share_tokens_controller.rb +0 -2
- data/app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb +3 -5
- data/app/controllers/decidim/assemblies/admin/members_controller.rb +14 -0
- data/app/controllers/decidim/assemblies/admin/members_csv_imports_controller.rb +22 -0
- data/app/controllers/decidim/assemblies/{participatory_space_private_users_controller.rb → members_controller.rb} +2 -11
- data/app/forms/decidim/assemblies/admin/assembly_duplicate_form.rb +2 -1
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +9 -7
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +1 -1
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +3 -3
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +2 -1
- data/app/models/decidim/assembly.rb +12 -15
- data/app/packs/src/decidim/assemblies/controllers/assembly_admin/assembly_admin.test.js +1 -130
- data/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.js +0 -28
- data/app/permissions/decidim/assemblies/permissions.rb +9 -9
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -2
- data/app/presenters/decidim/assemblies/assembly_presenter.rb +0 -4
- data/app/queries/decidim/assemblies/admin/admin_users.rb +1 -1
- data/app/serializers/decidim/assemblies/assembly_importer.rb +12 -15
- data/app/serializers/decidim/assemblies/assembly_serializer.rb +1 -1
- data/app/serializers/decidim/assemblies/open_data_assembly_serializer.rb +2 -8
- data/app/views/decidim/assemblies/admin/assemblies/_assemblies_thead.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assemblies/_assembly_row.html.erb +6 -7
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +33 -17
- data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +3 -2
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +2 -1
- data/app/views/decidim/assemblies/admin/assemblies/manage_trash.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assembly_duplicates/_form.html.erb +3 -0
- data/app/views/decidim/assemblies/admin/assembly_duplicates/new.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assembly_user_roles/edit.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assembly_user_roles/new.html.erb +2 -2
- data/app/views/decidim/assemblies/assemblies/show.html.erb +11 -5
- data/app/views/decidim/assemblies/members/index.html.erb +24 -0
- data/config/locales/ar.yml +0 -26
- data/config/locales/bg.yml +0 -26
- data/config/locales/bs-BA.yml +0 -8
- data/config/locales/ca-IT.yml +37 -36
- data/config/locales/ca.yml +38 -37
- data/config/locales/cs.yml +36 -35
- data/config/locales/de.yml +146 -160
- data/config/locales/el.yml +0 -26
- data/config/locales/en.yml +36 -34
- data/config/locales/es-MX.yml +36 -35
- data/config/locales/es-PY.yml +36 -35
- data/config/locales/es.yml +36 -35
- data/config/locales/eu.yml +53 -52
- data/config/locales/fi-plain.yml +36 -35
- data/config/locales/fi.yml +36 -35
- data/config/locales/fr-CA.yml +34 -41
- data/config/locales/fr.yml +35 -45
- data/config/locales/ga-IE.yml +0 -12
- data/config/locales/gl.yml +33 -232
- data/config/locales/he-IL.yml +3 -11
- data/config/locales/hu.yml +0 -26
- data/config/locales/id-ID.yml +0 -22
- data/config/locales/is-IS.yml +1 -10
- data/config/locales/it.yml +0 -28
- data/config/locales/ja.yml +23 -35
- data/config/locales/kaa.yml +0 -1
- data/config/locales/ko.yml +0 -9
- data/config/locales/lb.yml +0 -24
- data/config/locales/lt.yml +0 -25
- data/config/locales/lv.yml +0 -25
- data/config/locales/nl.yml +0 -26
- data/config/locales/no.yml +0 -26
- data/config/locales/pl.yml +0 -26
- data/config/locales/pt-BR.yml +9 -33
- data/config/locales/pt.yml +0 -28
- data/config/locales/ro-RO.yml +2 -25
- data/config/locales/ru.yml +0 -15
- data/config/locales/sk.yml +0 -374
- data/config/locales/sl.yml +0 -11
- data/config/locales/sq-AL.yml +0 -17
- data/config/locales/sr-CS.yml +0 -8
- data/config/locales/sv.yml +16 -35
- data/config/locales/tr-TR.yml +4 -30
- data/config/locales/uk.yml +0 -15
- data/config/locales/zh-CN.yml +0 -25
- data/config/locales/zh-TW.yml +0 -26
- data/db/data/20260104094930_remove_assemblies_types_references.rb +25 -0
- data/db/data/20260111185230_replace_legacy_fields_to_access_mode_for_assemblies.rb +25 -0
- data/db/data/20260210195653_move_announcement_to_content_block_on_assemblies.rb +40 -0
- data/db/migrate/20180226103942_add_parent_child_relation_to_assemblies.rb +4 -4
- data/db/migrate/20190215093700_reset_negative_children_count_counters.rb +6 -2
- data/db/migrate/20210310120444_add_followable_counter_cache_to_assemblies.rb +6 -2
- data/db/migrate/20251112114736_remove_legacy_images_from_assemblies_module.rb +8 -0
- data/db/migrate/20251205120000_add_has_members_to_decidim_assemblies.rb +7 -0
- data/db/migrate/20260104093601_remove_assemblies_types.rb +12 -0
- data/db/migrate/20260111120000_add_access_mode_to_assemblies.rb +11 -0
- data/decidim-assemblies.gemspec +8 -9
- data/lib/decidim/api/assembly_type.rb +1 -8
- data/lib/decidim/assemblies/admin_engine.rb +10 -4
- data/lib/decidim/assemblies/content_blocks/registry_manager.rb +5 -0
- data/lib/decidim/assemblies/engine.rb +26 -42
- data/lib/decidim/assemblies/menu.rb +5 -5
- data/lib/decidim/assemblies/participatory_space.rb +0 -2
- data/lib/decidim/assemblies/seeds.rb +1 -2
- data/lib/decidim/assemblies/test/factories.rb +8 -20
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +25 -30
- data/app/cells/decidim/assemblies/assembly_dropdown_metadata_cell.rb +0 -19
- data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +0 -17
- data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +0 -13
- data/app/controllers/decidim/assemblies/admin/participatory_space_private_users_controller.rb +0 -24
- data/app/controllers/decidim/assemblies/admin/participatory_space_private_users_csv_imports_controller.rb +0 -24
- data/app/forms/decidim/assemblies/admin/assemblies_type_form.rb +0 -17
- data/app/models/decidim/assemblies_type.rb +0 -27
- data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +0 -43
- data/app/presenters/decidim/log/value_types/assembly_type_presenter.rb +0 -29
- data/app/queries/decidim/assemblies/filtered_assemblies.rb +0 -22
- data/app/views/decidim/assemblies/pages/user_profile/_member_of.html.erb +0 -9
- data/app/views/decidim/assemblies/participatory_space_private_users/index.html.erb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e281f489f7f47da21acec28d2771d799f6a46de0d0ca7fb34d1a6e4f9baa8a32
|
|
4
|
+
data.tar.gz: 3b173a11dc651d6dececd6c9c05022365e85f91e406abd0ba1b06d4e0c5e079e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a2e340210186d6225909ff074fae66f02b153cc63808ff8d14ae2d723be1d1a3acf02e95962869e2f2f1250d83cb608b3953801170e6fc60e3d60255f919328
|
|
7
|
+
data.tar.gz: 4f334da82cd6ce0ddb35b3a7a51c6bf2efb00a3b301f8e413db1a5d6d308861f04cef4f2da55870fb39536960c765e157b3bf04484d4d1bead3188790e26dc5b
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# decidim-assemblies
|
|
2
2
|
|
|
3
3
|
Assemblies are the permanent Decidim's participatory space. They are always
|
|
4
4
|
"active" so unlike participatory processes, they have no steps or phases.
|
|
@@ -15,19 +15,11 @@ This module provides:
|
|
|
15
15
|
|
|
16
16
|
* Public views for assembly via a high level section in the main menu.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Add this line to your application's Gemfile:
|
|
18
|
+
You can see the documentation of this feature at the [Decidim Documentation](https://docs.decidim.org/en/develop/admin/spaces/assemblies).
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
gem 'decidim-assemblies'
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
And then execute:
|
|
20
|
+
## Installation
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
bundle
|
|
30
|
-
```
|
|
22
|
+
This is on the default Decidim installation so you should not change anything to use this participatory space.
|
|
31
23
|
|
|
32
24
|
## Contributing
|
|
33
25
|
|
|
@@ -6,15 +6,15 @@ module Decidim
|
|
|
6
6
|
# A command with all the business logic when creating a new assembly
|
|
7
7
|
# in the system.
|
|
8
8
|
class CreateAssembly < Decidim::Commands::CreateResource
|
|
9
|
-
fetch_file_attributes :hero_image
|
|
9
|
+
fetch_file_attributes :hero_image
|
|
10
10
|
|
|
11
11
|
fetch_form_attributes :title, :subtitle, :weight, :slug, :description, :short_description,
|
|
12
|
-
:promoted, :taxonomizations, :parent, :
|
|
13
|
-
:
|
|
12
|
+
:promoted, :taxonomizations, :parent, :organization,
|
|
13
|
+
:access_mode, :developer_group, :local_area, :target, :participatory_scope,
|
|
14
14
|
:participatory_structure, :meta_scope, :purpose_of_action,
|
|
15
15
|
:composition, :creation_date, :created_by, :created_by_other,
|
|
16
16
|
:duration, :included_at, :closing_date, :closing_date_reason, :internal_organisation,
|
|
17
|
-
:
|
|
17
|
+
:has_members, :special_features, :twitter_handler, :facebook_handler,
|
|
18
18
|
:instagram_handler, :youtube_handler, :github_handler
|
|
19
19
|
|
|
20
20
|
protected
|
|
@@ -29,8 +29,8 @@ module Decidim
|
|
|
29
29
|
Assembly.transaction do
|
|
30
30
|
duplicate_assembly
|
|
31
31
|
duplicate_assembly_attachments
|
|
32
|
-
duplicate_landing_page_blocks
|
|
33
32
|
duplicate_assembly_components if @form.duplicate_components?
|
|
33
|
+
duplicate_landing_page_blocks if @form.duplicate_landing_page_blocks?
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -58,13 +58,12 @@ module Decidim
|
|
|
58
58
|
participatory_scope: @assembly.participatory_scope,
|
|
59
59
|
participatory_structure: @assembly.participatory_structure,
|
|
60
60
|
meta_scope: @assembly.meta_scope,
|
|
61
|
-
announcement: @assembly.announcement,
|
|
62
61
|
taxonomies: @assembly.taxonomies
|
|
63
62
|
)
|
|
64
63
|
end
|
|
65
64
|
|
|
66
65
|
def duplicate_assembly_attachments
|
|
67
|
-
[:hero_image
|
|
66
|
+
[:hero_image].each do |attribute|
|
|
68
67
|
next unless @assembly.attached_uploader(attribute).attached?
|
|
69
68
|
|
|
70
69
|
@duplicated_assembly.send(attribute).attach(@assembly.send(attribute).blob)
|
|
@@ -6,14 +6,14 @@ module Decidim
|
|
|
6
6
|
# A command with all the business logic when updating a new assembly
|
|
7
7
|
# in the system.
|
|
8
8
|
class UpdateAssembly < Decidim::Commands::UpdateResource
|
|
9
|
-
fetch_file_attributes :hero_image
|
|
9
|
+
fetch_file_attributes :hero_image
|
|
10
10
|
|
|
11
11
|
fetch_form_attributes :title, :subtitle, :slug, :promoted, :description, :short_description,
|
|
12
|
-
:taxonomizations, :parent, :
|
|
12
|
+
:taxonomizations, :parent, :access_mode, :developer_group, :local_area,
|
|
13
13
|
:target, :participatory_scope, :participatory_structure, :meta_scope,
|
|
14
14
|
:purpose_of_action, :composition, :creation_date, :created_by,
|
|
15
15
|
:created_by_other, :duration, :included_at, :closing_date, :closing_date_reason,
|
|
16
|
-
:internal_organisation, :
|
|
16
|
+
:internal_organisation, :has_members, :special_features, :twitter_handler,
|
|
17
17
|
:facebook_handler, :instagram_handler, :youtube_handler, :github_handler, :weight
|
|
18
18
|
|
|
19
19
|
private
|
|
@@ -25,15 +25,19 @@ module Decidim
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def filters
|
|
28
|
-
[:
|
|
28
|
+
[:with_any_access_mode, :published_at_null]
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def filters_with_values
|
|
32
32
|
{
|
|
33
|
-
|
|
33
|
+
with_any_access_mode: access_modes,
|
|
34
34
|
published_at_null: [true, false]
|
|
35
35
|
}
|
|
36
36
|
end
|
|
37
|
+
|
|
38
|
+
def access_modes
|
|
39
|
+
Assembly::ACCESS_MODES.keys
|
|
40
|
+
end
|
|
37
41
|
end
|
|
38
42
|
end
|
|
39
43
|
end
|
|
@@ -12,14 +12,11 @@ module Decidim
|
|
|
12
12
|
return {} if current_participatory_space.blank?
|
|
13
13
|
return super unless current_participatory_space.is_a?(Decidim::Assembly)
|
|
14
14
|
|
|
15
|
-
dropdown_cell = current_participatory_space_manifest.breadcrumb_cell
|
|
16
|
-
|
|
17
15
|
items = current_participatory_space.ancestors.map do |participatory_space|
|
|
18
16
|
{
|
|
19
17
|
label: participatory_space.title,
|
|
20
18
|
url: Decidim::ResourceLocatorPresenter.new(participatory_space).path,
|
|
21
19
|
active: false,
|
|
22
|
-
dropdown_cell:,
|
|
23
20
|
resource: participatory_space
|
|
24
21
|
}
|
|
25
22
|
end
|
|
@@ -37,7 +37,7 @@ module Decidim
|
|
|
37
37
|
|
|
38
38
|
on(:invalid) do
|
|
39
39
|
flash.now[:alert] = I18n.t("assemblies.create.error", scope: "decidim.admin")
|
|
40
|
-
render :new, status: :
|
|
40
|
+
render :new, status: :unprocessable_content
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -63,7 +63,7 @@ module Decidim
|
|
|
63
63
|
|
|
64
64
|
on(:invalid) do
|
|
65
65
|
flash.now[:alert] = I18n.t("assemblies.update.error", scope: "decidim.admin")
|
|
66
|
-
render :edit, layout: "decidim/admin/assembly", status: :
|
|
66
|
+
render :edit, layout: "decidim/admin/assembly", status: :unprocessable_content
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
end
|
|
@@ -10,18 +10,12 @@ module Decidim
|
|
|
10
10
|
|
|
11
11
|
layout "decidim/admin/assembly"
|
|
12
12
|
|
|
13
|
-
helper_method :scoped_resource
|
|
14
|
-
|
|
15
|
-
def scoped_resource
|
|
16
|
-
current_participatory_space
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
protected
|
|
20
|
-
|
|
21
13
|
def content_block_scope
|
|
22
14
|
current_participatory_space_manifest.content_blocks_scope_name
|
|
23
15
|
end
|
|
24
16
|
|
|
17
|
+
alias scoped_resource current_participatory_space
|
|
18
|
+
|
|
25
19
|
def enforce_permission_to_update_resource
|
|
26
20
|
enforce_permission_to :update, :assembly, assembly: scoped_resource
|
|
27
21
|
end
|
|
@@ -20,21 +20,19 @@ module Decidim
|
|
|
20
20
|
included do
|
|
21
21
|
include Decidim::Admin::ParticipatorySpaceAdminContext
|
|
22
22
|
|
|
23
|
-
helper_method :current_assembly
|
|
23
|
+
helper_method :current_assembly
|
|
24
24
|
add_breadcrumb_item_from_menu :admin_assembly_menu
|
|
25
25
|
|
|
26
26
|
participatory_space_admin_layout
|
|
27
27
|
|
|
28
|
-
def current_participatory_space = current_assembly
|
|
29
|
-
|
|
30
|
-
protected
|
|
31
|
-
|
|
32
28
|
def current_assembly
|
|
33
29
|
@current_assembly ||= organization_assemblies.find_by!(
|
|
34
30
|
slug: params[:assembly_slug] || params[:slug]
|
|
35
31
|
)
|
|
36
32
|
end
|
|
37
33
|
|
|
34
|
+
alias_method :current_participatory_space, :current_assembly
|
|
35
|
+
|
|
38
36
|
def organization_assemblies
|
|
39
37
|
@organization_assemblies ||= OrganizationAssemblies.new(current_organization).query
|
|
40
38
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Assemblies
|
|
5
|
+
module Admin
|
|
6
|
+
# Controller that allows managing assembly members
|
|
7
|
+
# on assemblies
|
|
8
|
+
class MembersController < Decidim::Assemblies::Admin::ApplicationController
|
|
9
|
+
include Concerns::AssemblyAdmin
|
|
10
|
+
include Decidim::Admin::ParticipatorySpace::Concerns::HasMembers
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Assemblies
|
|
5
|
+
module Admin
|
|
6
|
+
# Controller that allows importing assembly members
|
|
7
|
+
# on assemblies
|
|
8
|
+
class MembersCsvImportsController < Decidim::Admin::ApplicationController
|
|
9
|
+
include Concerns::AssemblyAdmin
|
|
10
|
+
include Decidim::Admin::ParticipatorySpace::Concerns::HasMembersCsvImport
|
|
11
|
+
|
|
12
|
+
def after_import_path
|
|
13
|
+
members_path(current_assembly)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def participatory_space
|
|
17
|
+
current_assembly
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Assemblies
|
|
5
|
-
class
|
|
5
|
+
class MembersController < Decidim::Assemblies::ApplicationController
|
|
6
6
|
include ParticipatorySpaceContext
|
|
7
|
-
include Decidim::HasMembersPage
|
|
8
|
-
include Paginable
|
|
7
|
+
include Decidim::ParticipatorySpace::HasMembersPage
|
|
9
8
|
|
|
10
9
|
def index
|
|
11
10
|
raise ActionController::RoutingError, "No members for this assembly" if members.none?
|
|
12
11
|
|
|
13
|
-
@members = paginate(members)
|
|
14
12
|
enforce_permission_to :list, :members
|
|
15
13
|
redirect_to decidim_assemblies.assembly_path(current_participatory_space) unless can_visit_index?
|
|
16
14
|
end
|
|
@@ -24,13 +22,6 @@ module Decidim
|
|
|
24
22
|
OrganizationAssemblies.new(current_organization).query.where(id: params[:assembly_slug])
|
|
25
23
|
).first!
|
|
26
24
|
end
|
|
27
|
-
|
|
28
|
-
def page_params
|
|
29
|
-
{
|
|
30
|
-
per_page:,
|
|
31
|
-
page: params[:page]
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
25
|
end
|
|
35
26
|
end
|
|
36
27
|
end
|
|
@@ -15,6 +15,7 @@ module Decidim
|
|
|
15
15
|
|
|
16
16
|
attribute :slug, String
|
|
17
17
|
attribute :duplicate_components, Boolean
|
|
18
|
+
attribute :duplicate_landing_page_blocks, Boolean
|
|
18
19
|
|
|
19
20
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
|
20
21
|
validates :title, translatable_presence: true
|
|
@@ -23,7 +24,7 @@ module Decidim
|
|
|
23
24
|
private
|
|
24
25
|
|
|
25
26
|
def slug_uniqueness
|
|
26
|
-
return unless OrganizationAssemblies.new(current_organization).query.
|
|
27
|
+
return unless OrganizationAssemblies.new(current_organization).query.where(slug:).where.not(id:).any?
|
|
27
28
|
|
|
28
29
|
errors.add(:slug, :taken)
|
|
29
30
|
end
|
|
@@ -31,7 +31,6 @@ module Decidim
|
|
|
31
31
|
translatable_attribute :subtitle, String
|
|
32
32
|
translatable_attribute :target, String
|
|
33
33
|
translatable_attribute :title, String
|
|
34
|
-
translatable_attribute :announcement, Decidim::Attributes::RichText
|
|
35
34
|
|
|
36
35
|
attribute :created_by, String
|
|
37
36
|
attribute :facebook_handler, String
|
|
@@ -45,18 +44,16 @@ module Decidim
|
|
|
45
44
|
attribute :participatory_processes_ids, Array[Integer]
|
|
46
45
|
attribute :weight, Integer, default: 0
|
|
47
46
|
|
|
48
|
-
attribute :
|
|
47
|
+
attribute :access_mode, String, default: :open
|
|
48
|
+
attribute :has_members, Boolean
|
|
49
49
|
attribute :promoted, Boolean
|
|
50
|
-
attribute :private_space, Boolean
|
|
51
50
|
|
|
52
51
|
attribute :closing_date, Decidim::Attributes::LocalizedDate
|
|
53
52
|
attribute :creation_date, Decidim::Attributes::LocalizedDate
|
|
54
53
|
attribute :duration, Decidim::Attributes::LocalizedDate
|
|
55
54
|
attribute :included_at, Decidim::Attributes::LocalizedDate
|
|
56
55
|
|
|
57
|
-
attribute :banner_image
|
|
58
56
|
attribute :hero_image
|
|
59
|
-
attribute :remove_banner_image, Boolean, default: false
|
|
60
57
|
attribute :remove_hero_image, Boolean, default: false
|
|
61
58
|
|
|
62
59
|
validates :parent, presence: true, if: ->(form) { form.parent.present? }
|
|
@@ -69,11 +66,13 @@ module Decidim
|
|
|
69
66
|
validates :created_by_other, translatable_presence: true, if: ->(form) { form.created_by == "others" }
|
|
70
67
|
validates :title, :subtitle, :description, :short_description, translatable_presence: true
|
|
71
68
|
|
|
72
|
-
validates :banner_image, passthru: { to: Decidim::Assembly }
|
|
73
69
|
validates :hero_image, passthru: { to: Decidim::Assembly }
|
|
74
70
|
|
|
75
71
|
validates :weight, presence: true
|
|
76
72
|
|
|
73
|
+
validates :access_mode, presence: true, inclusion: { in: Decidim::Assembly.access_modes.keys }
|
|
74
|
+
validate :ensure_access_mode_for_has_members
|
|
75
|
+
|
|
77
76
|
alias organization current_organization
|
|
78
77
|
|
|
79
78
|
def participatory_space_manifest
|
|
@@ -119,13 +118,16 @@ module Decidim
|
|
|
119
118
|
|
|
120
119
|
def slug_uniqueness
|
|
121
120
|
return unless organization_assemblies
|
|
122
|
-
.with_deleted
|
|
123
121
|
.where(slug:)
|
|
124
122
|
.where.not(id: context[:assembly_id])
|
|
125
123
|
.any?
|
|
126
124
|
|
|
127
125
|
errors.add(:slug, :taken)
|
|
128
126
|
end
|
|
127
|
+
|
|
128
|
+
def ensure_access_mode_for_has_members
|
|
129
|
+
self.access_mode = :open if has_members == false
|
|
130
|
+
end
|
|
129
131
|
end
|
|
130
132
|
end
|
|
131
133
|
end
|
|
@@ -74,7 +74,7 @@ module Decidim
|
|
|
74
74
|
private
|
|
75
75
|
|
|
76
76
|
def slug_uniqueness
|
|
77
|
-
return unless OrganizationAssemblies.new(current_organization).query.
|
|
77
|
+
return unless OrganizationAssemblies.new(current_organization).query.where(slug:).where.not(id:).any?
|
|
78
78
|
|
|
79
79
|
errors.add(:slug, :taken)
|
|
80
80
|
end
|
|
@@ -23,14 +23,14 @@ module Decidim
|
|
|
23
23
|
*(if participatory_space.members_public_page?
|
|
24
24
|
[{
|
|
25
25
|
name: t("assembly_member_menu_item", scope: "layouts.decidim.assembly_navigation"),
|
|
26
|
-
url: decidim_assemblies.
|
|
27
|
-
active: is_active_link?(decidim_assemblies.
|
|
26
|
+
url: decidim_assemblies.assembly_members_path(participatory_space),
|
|
27
|
+
active: is_active_link?(decidim_assemblies.assembly_members_path(participatory_space), :inclusive)
|
|
28
28
|
}]
|
|
29
29
|
end
|
|
30
30
|
)
|
|
31
31
|
] + components.map do |component|
|
|
32
32
|
{
|
|
33
|
-
name:
|
|
33
|
+
name: decidim_escape_translated(component.name),
|
|
34
34
|
url: main_component_path(component),
|
|
35
35
|
active: is_active_link?(main_component_path(component), :inclusive)
|
|
36
36
|
}
|
|
@@ -10,7 +10,8 @@ module Decidim
|
|
|
10
10
|
items = []
|
|
11
11
|
|
|
12
12
|
available_taxonomy_filters.find_each do |taxonomy_filter|
|
|
13
|
-
items.append(method:
|
|
13
|
+
items.append(method: :with_any_taxonomies,
|
|
14
|
+
name: "[with_any_taxonomies][#{taxonomy_filter.root_taxonomy_id}]",
|
|
14
15
|
collection: filter_taxonomy_values_for(taxonomy_filter),
|
|
15
16
|
label: decidim_sanitize_translated(taxonomy_filter.name),
|
|
16
17
|
id: "taxonomy-#{taxonomy_filter.root_taxonomy_id}")
|
|
@@ -31,7 +31,7 @@ module Decidim
|
|
|
31
31
|
include Decidim::Traceable
|
|
32
32
|
include Decidim::Loggable
|
|
33
33
|
include Decidim::ParticipatorySpaceResourceable
|
|
34
|
-
include Decidim::
|
|
34
|
+
include Decidim::ParticipatorySpace::HasMembers
|
|
35
35
|
include Decidim::Searchable
|
|
36
36
|
include Decidim::HasUploadValidations
|
|
37
37
|
include Decidim::TranslatableResource
|
|
@@ -53,10 +53,6 @@ module Decidim
|
|
|
53
53
|
foreign_key: "decidim_area_id",
|
|
54
54
|
class_name: "Decidim::Area",
|
|
55
55
|
optional: true
|
|
56
|
-
belongs_to :assembly_type,
|
|
57
|
-
foreign_key: "decidim_assemblies_type_id",
|
|
58
|
-
class_name: "Decidim::AssembliesType",
|
|
59
|
-
optional: true
|
|
60
56
|
has_many :categories,
|
|
61
57
|
foreign_key: "decidim_participatory_space_id",
|
|
62
58
|
foreign_type: "decidim_participatory_space_type",
|
|
@@ -71,9 +67,6 @@ module Decidim
|
|
|
71
67
|
has_one_attached :hero_image
|
|
72
68
|
validates_upload :hero_image, uploader: Decidim::HeroImageUploader
|
|
73
69
|
|
|
74
|
-
has_one_attached :banner_image
|
|
75
|
-
validates_upload :banner_image, uploader: Decidim::BannerImageUploader
|
|
76
|
-
|
|
77
70
|
validates :slug, uniqueness: { scope: :organization }
|
|
78
71
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
|
79
72
|
|
|
@@ -92,10 +85,14 @@ module Decidim
|
|
|
92
85
|
index_on_create: ->(_assembly) { false },
|
|
93
86
|
index_on_update: ->(assembly) { assembly.visible? })
|
|
94
87
|
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
# Access modes are consistent across participatory spaces (assemblies and processes)
|
|
89
|
+
# open: visible and accessible for all
|
|
90
|
+
# transparent: visible for all but the actions require to be a member of the space
|
|
91
|
+
# restricted: visible and accessible only for members fo the space
|
|
92
|
+
ACCESS_MODES = { open: 0, transparent: 1, restricted: 2 }.freeze
|
|
93
|
+
enum :access_mode, ACCESS_MODES
|
|
94
|
+
|
|
95
|
+
scope_search_multi :with_any_access_mode, ACCESS_MODES.keys
|
|
99
96
|
|
|
100
97
|
# Scope to return only the promoted assemblies.
|
|
101
98
|
#
|
|
@@ -120,7 +117,7 @@ module Decidim
|
|
|
120
117
|
|
|
121
118
|
# This is a overwrite for Decidim::ParticipatorySpaceResourceable.visible?
|
|
122
119
|
def visible?
|
|
123
|
-
published? && (
|
|
120
|
+
published? && (open? || transparent?)
|
|
124
121
|
end
|
|
125
122
|
|
|
126
123
|
def to_param
|
|
@@ -157,7 +154,7 @@ module Decidim
|
|
|
157
154
|
end
|
|
158
155
|
|
|
159
156
|
def self.ransackable_scopes(_auth_object = nil)
|
|
160
|
-
[:with_any_taxonomies]
|
|
157
|
+
[:with_any_taxonomies, :with_any_access_mode]
|
|
161
158
|
end
|
|
162
159
|
|
|
163
160
|
def shareable_url(share_token)
|
|
@@ -169,7 +166,7 @@ module Decidim
|
|
|
169
166
|
|
|
170
167
|
return base unless auth_object&.admin?
|
|
171
168
|
|
|
172
|
-
base + %w(published_at created_at
|
|
169
|
+
base + %w(published_at created_at parent_id access_mode)
|
|
173
170
|
end
|
|
174
171
|
|
|
175
172
|
def self.ransackable_associations(_auth_object = nil)
|