decidim-assemblies 0.29.2 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- 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 -14
- 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 +1 -3
- 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 -1
- 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 -20
- 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 -4
- 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 +71 -75
- 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 +0 -72
- data/config/locales/he-IL.yml +8 -57
- data/config/locales/hu.yml +0 -74
- data/config/locales/id-ID.yml +0 -63
- data/config/locales/is-IS.yml +0 -45
- data/config/locales/it.yml +0 -73
- 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 -72
- data/config/locales/ro-RO.yml +1 -72
- data/config/locales/ru.yml +0 -57
- data/config/locales/sk.yml +0 -46
- data/config/locales/sl.yml +0 -54
- data/config/locales/sq-AL.yml +0 -74
- 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 -57
- 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 -48
- 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/lib/decidim/api/assembly_member_type.rb +0 -27
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MigrateAssemblyMembersToPrivateUsers < ActiveRecord::Migration[7.0]
|
4
|
+
class AssemblyMember < ApplicationRecord
|
5
|
+
self.table_name = :decidim_assembly_members
|
6
|
+
end
|
7
|
+
|
8
|
+
class ParticipatorySpacePrivateUser < ApplicationRecord
|
9
|
+
self.table_name = :decidim_participatory_space_private_users
|
10
|
+
end
|
11
|
+
|
12
|
+
def up
|
13
|
+
AssemblyMember.find_each do |assembly_member|
|
14
|
+
next if assembly_member.ceased_date
|
15
|
+
next unless assembly_member.decidim_user_id
|
16
|
+
|
17
|
+
attrs = {
|
18
|
+
privatable_to_id: assembly_member.decidim_assembly_id,
|
19
|
+
privatable_to_type: "Decidim::Assembly",
|
20
|
+
decidim_user_id: assembly_member.decidim_user_id
|
21
|
+
}
|
22
|
+
|
23
|
+
next if ParticipatorySpacePrivateUser.find_by(attrs)
|
24
|
+
|
25
|
+
role = case assembly_member.position
|
26
|
+
when "president"
|
27
|
+
translated_role("decidim.admin.models.assembly_member.positions.president")
|
28
|
+
when "vice_president"
|
29
|
+
translated_role("decidim.admin.models.assembly_member.positions.vice_president")
|
30
|
+
when "secretary"
|
31
|
+
translated_role("decidim.admin.models.assembly_member.positions.secretary")
|
32
|
+
when "other"
|
33
|
+
{ I18n.locale.to_s => assembly_member.position_other }
|
34
|
+
end
|
35
|
+
|
36
|
+
Rails.logger.debug { "Migrating assembly member #{assembly_member.id} to private user" }
|
37
|
+
|
38
|
+
ParticipatorySpacePrivateUser.create!(attrs.merge(role:))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def down; end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def translated_role(key)
|
47
|
+
I18n.available_locales.each_with_object({}) do |locale, hash|
|
48
|
+
I18n.with_locale(locale) do
|
49
|
+
hash[locale.to_s] = I18n.t(key)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/decidim-assemblies.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
"homepage_uri" => "https://decidim.org",
|
18
18
|
"source_code_uri" => "https://github.com/decidim/decidim"
|
19
19
|
}
|
20
|
-
s.required_ruby_version = "~> 3.
|
20
|
+
s.required_ruby_version = "~> 3.3.0"
|
21
21
|
|
22
22
|
s.name = "decidim-assemblies"
|
23
23
|
s.summary = "Decidim assemblies module"
|
@@ -6,11 +6,11 @@ module Decidim
|
|
6
6
|
class AssembliesTypeType < Decidim::Api::Types::BaseObject
|
7
7
|
description "An assemblies type"
|
8
8
|
|
9
|
+
field :assemblies, [Decidim::Assemblies::AssemblyType, { null: true }], "Assemblies with this assemblies type", null: false
|
10
|
+
field :created_at, Decidim::Core::DateTimeType, "The time this assemblies type was created", null: false
|
9
11
|
field :id, GraphQL::Types::ID, "The assemblies type's unique ID", null: false
|
10
12
|
field :title, Decidim::Core::TranslatedFieldType, "The title of this assemblies type.", null: false
|
11
|
-
field :created_at, Decidim::Core::DateTimeType, "The time this assemblies type was created", null: false
|
12
13
|
field :updated_at, Decidim::Core::DateTimeType, "The time this assemblies type was updated", null: false
|
13
|
-
field :assemblies, [Decidim::Assemblies::AssemblyType, { null: true }], "Assemblies with this assemblies type", null: false
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -7,57 +7,55 @@ module Decidim
|
|
7
7
|
implements Decidim::Core::ParticipatorySpaceInterface
|
8
8
|
implements Decidim::Core::AttachableInterface
|
9
9
|
implements Decidim::Core::ParticipatorySpaceResourceableInterface
|
10
|
+
implements Decidim::Core::TaxonomizableInterface
|
10
11
|
implements Decidim::Core::CategoriesContainerInterface
|
12
|
+
implements Decidim::Core::TimestampsInterface
|
11
13
|
|
12
14
|
description "An assembly"
|
13
15
|
|
14
|
-
field :
|
15
|
-
field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this assembly", null: true
|
16
|
-
field :short_description, Decidim::Core::TranslatedFieldType, "The sort description of this assembly", null: true
|
17
|
-
field :description, Decidim::Core::TranslatedFieldType, "The description of this assembly", null: true
|
18
|
-
field :slug, String, "The slug of this assembly", null: false
|
19
|
-
field :hashtag, String, "The hashtag for this assembly", null: true
|
20
|
-
field :created_at, Decidim::Core::DateTimeType, "The time this assembly was created", null: false
|
21
|
-
field :updated_at, Decidim::Core::DateTimeType, "The time this assembly was updated", null: false
|
22
|
-
field :published_at, Decidim::Core::DateTimeType, "The time this assembly was published", null: false
|
23
|
-
field :reference, String, "Reference for this assembly", null: false
|
24
|
-
|
25
|
-
field :hero_image, String, "The hero image for this assembly", null: true
|
26
|
-
field :banner_image, String, "The banner image for this assembly", null: true
|
27
|
-
field :promoted, Boolean, "If this assembly is promoted (therefore in the homepage)", null: true
|
28
|
-
field :developer_group, Decidim::Core::TranslatedFieldType, "The promoter group of this assembly", null: true
|
29
|
-
field :meta_scope, Decidim::Core::TranslatedFieldType, "The scope metadata of this assembly", null: true
|
30
|
-
field :local_area, Decidim::Core::TranslatedFieldType, "The organization area of this assembly", null: true
|
31
|
-
field :target, Decidim::Core::TranslatedFieldType, "Who participates in this assembly", null: true
|
32
|
-
field :participatory_scope, Decidim::Core::TranslatedFieldType, "What is decided on this assembly", null: true
|
33
|
-
field :participatory_structure, Decidim::Core::TranslatedFieldType, "How it is decided on this assembly", null: true
|
34
|
-
field :scopes_enabled, Boolean, "If this assembly has scopes enabled", null: true
|
35
|
-
field :private_space, Boolean, "If this assembly is a private space", null: true
|
16
|
+
field :announcement, Decidim::Core::TranslatedFieldType, "Highlighted announcement for this assembly", null: true
|
36
17
|
field :area, Decidim::Core::AreaApiType, "Area of this assembly", null: true
|
37
|
-
field :
|
38
|
-
field :
|
18
|
+
field :assembly_type, Decidim::Assemblies::AssembliesTypeType, "Type of the assembly", null: true
|
19
|
+
field :banner_image, String, "The banner image for this assembly", null: true
|
39
20
|
field :children_count, Integer, "Number of children assemblies", null: true
|
40
|
-
field :
|
21
|
+
field :closing_date, Decidim::Core::DateType, "Closing date of the assembly", null: true
|
22
|
+
field :closing_date_reason, Decidim::Core::TranslatedFieldType, "Closing date reason of this assembly", null: true
|
41
23
|
field :composition, Decidim::Core::TranslatedFieldType, "Composition of this assembly", null: true
|
42
|
-
field :assembly_type, Decidim::Assemblies::AssembliesTypeType, "Type of the assembly", null: true
|
43
|
-
field :creation_date, Decidim::Core::DateType, "Creation date of this assembly", null: true
|
44
24
|
field :created_by, String, "The creator of this assembly", null: true
|
45
25
|
field :created_by_other, Decidim::Core::TranslatedFieldType, "Custom creator", null: true
|
26
|
+
field :creation_date, Decidim::Core::DateType, "Creation date of this assembly", null: true
|
27
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description of this assembly", null: true
|
28
|
+
field :developer_group, Decidim::Core::TranslatedFieldType, "The promoter group of this assembly", null: true
|
46
29
|
field :duration, Decidim::Core::DateType, "Duration of this assembly", null: true
|
30
|
+
field :facebook_handler, String, "Facebook handler", null: true
|
31
|
+
field :github_handler, String, "GitHub handler", null: true
|
32
|
+
field :hashtag, String, "The hashtag for this assembly", null: true
|
33
|
+
field :hero_image, String, "The hero image for this assembly", null: true
|
34
|
+
field :id, ID, "The internal ID for this assembly", null: false
|
47
35
|
field :included_at, Decidim::Core::DateType, "Included at", null: true
|
48
|
-
field :
|
49
|
-
field :closing_date_reason, Decidim::Core::TranslatedFieldType, "Closing date reason of this assembly", null: true
|
36
|
+
field :instagram_handler, String, "Instagram handler", null: true
|
50
37
|
field :internal_organisation, Decidim::Core::TranslatedFieldType, "Internal organisation of this assembly", null: true
|
51
38
|
field :is_transparent, Boolean, "If this assembly is transparent", null: true
|
39
|
+
field :local_area, Decidim::Core::TranslatedFieldType, "The organization area of this assembly", null: true
|
40
|
+
field :meta_scope, Decidim::Core::TranslatedFieldType, "The scope metadata of this assembly", null: true
|
41
|
+
field :parent, Decidim::Assemblies::AssemblyType, "The parent assembly of this assembly", null: true
|
42
|
+
field :parents_path, String, "Assembly hierarchy representation", null: true
|
43
|
+
field :participatory_scope, Decidim::Core::TranslatedFieldType, "What is decided on this assembly", null: true
|
44
|
+
field :participatory_structure, Decidim::Core::TranslatedFieldType, "How it is decided on this assembly", null: true
|
45
|
+
field :private_space, Boolean, "If this assembly is a private space", null: true
|
46
|
+
field :promoted, Boolean, "If this assembly is promoted (therefore in the homepage)", null: true
|
47
|
+
field :published_at, Decidim::Core::DateTimeType, "The time this assembly was published", null: false
|
48
|
+
field :purpose_of_action, Decidim::Core::TranslatedFieldType, "Purpose of action", null: true
|
49
|
+
field :reference, String, "Reference for this assembly", null: false
|
50
|
+
field :scopes_enabled, Boolean, "If this assembly has scopes enabled", null: true
|
51
|
+
field :short_description, Decidim::Core::TranslatedFieldType, "The sort description of this assembly", null: true
|
52
|
+
field :slug, String, "The slug of this assembly", null: false
|
52
53
|
field :special_features, Decidim::Core::TranslatedFieldType, "Special features of this assembly", null: true
|
54
|
+
field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this assembly", null: true
|
55
|
+
field :target, Decidim::Core::TranslatedFieldType, "Who participates in this assembly", null: true
|
53
56
|
field :twitter_handler, String, "Twitter handler", null: true
|
54
|
-
field :instagram_handler, String, "Instagram handler", null: true
|
55
|
-
field :facebook_handler, String, "Facebook handler", null: true
|
56
57
|
field :youtube_handler, String, "YouTube handler", null: true
|
57
|
-
field :github_handler, String, "GitHub handler", null: true
|
58
|
-
field :announcement, Decidim::Core::TranslatedFieldType, "Highlighted announcement for this assembly", null: true
|
59
58
|
|
60
|
-
field :members, [Decidim::Assemblies::AssemblyMemberType, { null: true }], "Members of this assembly", null: false
|
61
59
|
field :children, [Decidim::Assemblies::AssemblyType, { null: true }], "Children of this assembly", null: false
|
62
60
|
|
63
61
|
def hero_image
|
@@ -16,82 +16,105 @@ module Decidim
|
|
16
16
|
paths["lib/tasks"] = nil
|
17
17
|
|
18
18
|
routes do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
member do
|
28
|
-
post :resend_invitation, to: "assembly_user_roles#resend_invitation"
|
19
|
+
constraints(->(request) { Decidim::Admin::OrganizationDashboardConstraint.new(request).matches? }) do
|
20
|
+
resources :assemblies, param: :slug, except: [:show, :destroy] do
|
21
|
+
resource :publish, controller: "assembly_publications", only: [:create, :destroy]
|
22
|
+
resources :copies, controller: "assembly_copies", only: [:new, :create]
|
23
|
+
resources :user_roles, controller: "assembly_user_roles" do
|
24
|
+
member do
|
25
|
+
post :resend_invitation, to: "assembly_user_roles#resend_invitation"
|
26
|
+
end
|
29
27
|
end
|
30
|
-
end
|
31
|
-
|
32
|
-
resources :attachment_collections, controller: "assembly_attachment_collections", except: [:show]
|
33
|
-
resources :attachments, controller: "assembly_attachments", except: [:show]
|
34
|
-
|
35
|
-
resource :export, controller: "assembly_exports", only: :create
|
36
|
-
|
37
|
-
collection do
|
38
|
-
resources :imports, controller: "assembly_imports", only: [:new, :create]
|
39
|
-
end
|
40
28
|
|
41
|
-
|
42
|
-
resources :
|
43
|
-
end
|
44
|
-
end
|
29
|
+
resources :attachment_collections, controller: "assembly_attachment_collections", except: [:show]
|
30
|
+
resources :attachments, controller: "assembly_attachments", except: [:show]
|
45
31
|
|
46
|
-
|
47
|
-
resources :categories, except: [:show]
|
32
|
+
resource :export, controller: "assembly_exports", only: :create
|
48
33
|
|
49
|
-
resources :components do
|
50
|
-
resource :permissions, controller: "component_permissions"
|
51
34
|
member do
|
52
|
-
|
53
|
-
|
54
|
-
get :share
|
35
|
+
patch :soft_delete
|
36
|
+
patch :restore
|
55
37
|
end
|
56
|
-
|
57
|
-
|
58
|
-
get :
|
38
|
+
|
39
|
+
collection do
|
40
|
+
get :manage_trash, to: "assemblies#manage_trash"
|
41
|
+
resources :imports, controller: "assembly_imports", only: [:new, :create]
|
59
42
|
end
|
60
|
-
resources :reminders, only: [:new, :create]
|
61
|
-
end
|
62
43
|
|
63
|
-
|
64
|
-
|
65
|
-
put :unreport
|
66
|
-
put :hide
|
67
|
-
put :unhide
|
44
|
+
resource :landing_page, only: [:edit, :update], controller: "assembly_landing_page" do
|
45
|
+
resources :content_blocks, only: [:edit, :update, :destroy, :create], controller: "assembly_landing_page_content_blocks"
|
68
46
|
end
|
69
|
-
resources :reports, controller: "moderations/reports", only: [:index, :show]
|
70
47
|
end
|
71
48
|
|
72
|
-
|
73
|
-
|
74
|
-
|
49
|
+
scope "/assemblies/:assembly_slug" do
|
50
|
+
resources :components do
|
51
|
+
collection do
|
52
|
+
put :reorder
|
53
|
+
end
|
54
|
+
resource :permissions, controller: "component_permissions"
|
55
|
+
member do
|
56
|
+
put :publish
|
57
|
+
put :unpublish
|
58
|
+
get :share
|
59
|
+
patch :soft_delete
|
60
|
+
patch :restore
|
61
|
+
end
|
62
|
+
collection do
|
63
|
+
get :manage_trash, to: "components#manage_trash"
|
64
|
+
put :hide
|
65
|
+
end
|
66
|
+
resources :component_share_tokens, except: [:show], path: "share_tokens", as: "share_tokens"
|
67
|
+
resources :exports, only: :create
|
68
|
+
resources :imports, only: [:new, :create] do
|
69
|
+
get :example, on: :collection
|
70
|
+
end
|
71
|
+
resources :reminders, only: [:new, :create]
|
75
72
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
73
|
+
|
74
|
+
resources :moderations do
|
75
|
+
member do
|
76
|
+
put :unreport
|
77
|
+
put :hide
|
78
|
+
put :unhide
|
79
|
+
end
|
80
|
+
patch :bulk_action, on: :collection
|
81
|
+
resources :reports, controller: "moderations/reports", only: [:index, :show]
|
82
|
+
end
|
83
|
+
|
84
|
+
resources :participatory_space_private_users, controller: "participatory_space_private_users" do
|
85
|
+
member do
|
86
|
+
post :resend_invitation, to: "participatory_space_private_users#resend_invitation"
|
87
|
+
end
|
88
|
+
collection do
|
89
|
+
resource :participatory_space_private_users_csv_imports, only: [:new, :create], path: "csv_import" do
|
90
|
+
delete :destroy_all
|
91
|
+
end
|
92
|
+
post :publish_all
|
93
|
+
post :unpublish_all
|
79
94
|
end
|
80
95
|
end
|
96
|
+
|
97
|
+
resources :assembly_share_tokens, except: [:show], path: "share_tokens"
|
81
98
|
end
|
82
|
-
end
|
83
99
|
|
84
|
-
|
85
|
-
|
86
|
-
|
100
|
+
scope "/assemblies/:assembly_slug/components/:component_id/manage" do
|
101
|
+
Decidim.component_manifests.each do |manifest|
|
102
|
+
next unless manifest.admin_engine
|
87
103
|
|
88
|
-
|
89
|
-
|
104
|
+
constraints CurrentComponent.new(manifest) do
|
105
|
+
mount manifest.admin_engine, at: "/", as: "decidim_admin_assembly_#{manifest.name}"
|
106
|
+
end
|
90
107
|
end
|
91
108
|
end
|
92
109
|
end
|
93
110
|
end
|
94
111
|
|
112
|
+
initializer "decidim_assemblies_admin.mount_routes" do
|
113
|
+
Decidim::Core::Engine.routes do
|
114
|
+
mount Decidim::Assemblies::AdminEngine, at: "/admin", as: "decidim_admin_assemblies"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
95
118
|
initializer "decidim_assemblies_admin.action_controller" do |app|
|
96
119
|
app.config.to_prepare do
|
97
120
|
ActiveSupport.on_load :action_controller do
|
@@ -111,6 +111,7 @@ module Decidim
|
|
111
111
|
content_block.public_name_key = "decidim.application.photos.related_photos"
|
112
112
|
end
|
113
113
|
|
114
|
+
register_highlighted_debates
|
114
115
|
register_highlighted_meetings
|
115
116
|
register_highlighted_posts
|
116
117
|
register_highlighted_proposals
|
@@ -118,6 +119,16 @@ module Decidim
|
|
118
119
|
register_related_processes
|
119
120
|
end
|
120
121
|
|
122
|
+
def self.register_highlighted_debates
|
123
|
+
return unless Decidim.module_installed?(:debates)
|
124
|
+
|
125
|
+
Decidim.content_blocks.register(:assembly_homepage, :highlighted_debates) do |content_block|
|
126
|
+
content_block.cell = "decidim/debates/content_blocks/highlighted_debates"
|
127
|
+
content_block.public_name_key = "decidim.debates.content_blocks.highlighted_debates.name"
|
128
|
+
content_block.component_manifest_name = "debates"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
121
132
|
def self.register_highlighted_meetings
|
122
133
|
return unless Decidim.module_installed?(:meetings)
|
123
134
|
|
@@ -26,7 +26,7 @@ module Decidim
|
|
26
26
|
}, constraints: { assembly_id: /[0-9]+/ }
|
27
27
|
|
28
28
|
resources :assemblies, only: [:index, :show], param: :slug, path: "assemblies" do
|
29
|
-
resources :
|
29
|
+
resources :participatory_space_private_users, only: :index, path: "members"
|
30
30
|
end
|
31
31
|
|
32
32
|
scope "/assemblies/:assembly_slug/f/:component_id" do
|
@@ -40,6 +40,12 @@ module Decidim
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
initializer "decidim_assemblies.mount_routes" do
|
44
|
+
Decidim::Core::Engine.routes do
|
45
|
+
mount Decidim::Assemblies::Engine, at: "/", as: "decidim_assemblies"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
43
49
|
initializer "decidim_assemblies.register_icons" do
|
44
50
|
Decidim.icons.register(name: "Decidim::Assembly", icon: "government-line", description: "Assembly", category: "activity", engine: :assemblies)
|
45
51
|
Decidim.icons.register(name: "assembly_type", icon: "group-2-line", description: "Type", category: "assemblies", engine: :assemblies)
|
@@ -68,8 +74,8 @@ module Decidim
|
|
68
74
|
Decidim.view_hooks.register(:user_profile_bottom, priority: Decidim::ViewHooks::MEDIUM_PRIORITY) do |view_context|
|
69
75
|
assemblies = OrganizationPublishedAssemblies.new(view_context.current_organization, view_context.current_user)
|
70
76
|
.query.distinct
|
71
|
-
.joins(:
|
72
|
-
.merge(Decidim::
|
77
|
+
.joins(:participatory_space_private_users)
|
78
|
+
.merge(Decidim::ParticipatorySpacePrivateUser.where(user: view_context.profile_holder))
|
73
79
|
.reorder(title: :asc)
|
74
80
|
|
75
81
|
next unless assemblies.any?
|
@@ -43,8 +43,7 @@ module Decidim
|
|
43
43
|
decidim_admin_assemblies.assemblies_path,
|
44
44
|
icon_name: "government-line",
|
45
45
|
position: 2.2,
|
46
|
-
active: is_active_link?(decidim_admin_assemblies.assemblies_path)
|
47
|
-
is_active_link?(decidim_admin_assemblies.assemblies_types_path),
|
46
|
+
active: is_active_link?(decidim_admin_assemblies.assemblies_path),
|
48
47
|
if: allowed_to?(:enter, :space_area, space_name: :assemblies)
|
49
48
|
end
|
50
49
|
end
|
@@ -78,6 +77,7 @@ module Decidim
|
|
78
77
|
active: is_active_link?(manage_component_path(component)) ||
|
79
78
|
is_active_link?(decidim_admin_assemblies.edit_component_path(current_participatory_space, component)) ||
|
80
79
|
is_active_link?(decidim_admin_assemblies.edit_component_permissions_path(current_participatory_space, component)) ||
|
80
|
+
is_active_link?(decidim_admin_assemblies.component_share_tokens_path(current_participatory_space, component)) ||
|
81
81
|
participatory_space_active_link?(component),
|
82
82
|
if: component.manifest.admin_engine && user_role_config.component_is_accessible?(component.manifest_name)
|
83
83
|
end
|
@@ -107,12 +107,6 @@ module Decidim
|
|
107
107
|
if: allowed_to?(:read, :component, assembly: current_participatory_space),
|
108
108
|
submenu: { target_menu: :admin_assemblies_components_menu }
|
109
109
|
|
110
|
-
menu.add_item :categories,
|
111
|
-
I18n.t("categories", scope: "decidim.admin.menu.assemblies_submenu"),
|
112
|
-
decidim_admin_assemblies.categories_path(current_participatory_space),
|
113
|
-
icon_name: "price-tag-3-line",
|
114
|
-
if: allowed_to?(:read, :category, assembly: current_participatory_space)
|
115
|
-
|
116
110
|
menu.add_item :attachments,
|
117
111
|
I18n.t("attachments", scope: "decidim.admin.menu.assemblies_submenu"),
|
118
112
|
decidim_admin_assemblies.assembly_attachments_path(current_participatory_space),
|
@@ -122,12 +116,6 @@ module Decidim
|
|
122
116
|
if: allowed_to?(:read, :attachment_collection, assembly: current_participatory_space) ||
|
123
117
|
allowed_to?(:read, :attachment, assembly: current_participatory_space)
|
124
118
|
|
125
|
-
menu.add_item :assembly_members,
|
126
|
-
I18n.t("assembly_members", scope: "decidim.admin.menu.assemblies_submenu"),
|
127
|
-
decidim_admin_assemblies.assembly_members_path(current_participatory_space),
|
128
|
-
icon_name: "user-settings-line",
|
129
|
-
if: allowed_to?(:read, :assembly_member, assembly: current_participatory_space)
|
130
|
-
|
131
119
|
menu.add_item :assembly_user_roles,
|
132
120
|
I18n.t("assembly_admins", scope: "decidim.admin.menu.assemblies_submenu"),
|
133
121
|
decidim_admin_assemblies.assembly_user_roles_path(current_participatory_space),
|
@@ -145,6 +133,13 @@ module Decidim
|
|
145
133
|
decidim_admin_assemblies.moderations_path(current_participatory_space),
|
146
134
|
icon_name: "flag-line",
|
147
135
|
if: allowed_to?(:read, :moderation, assembly: current_participatory_space)
|
136
|
+
|
137
|
+
menu.add_item :assembly_share_tokens,
|
138
|
+
I18n.t("menu.share_tokens", scope: "decidim.admin"),
|
139
|
+
decidim_admin_assemblies.assembly_share_tokens_path(current_participatory_space),
|
140
|
+
active: is_active_link?(decidim_admin_assemblies.assembly_share_tokens_path(current_participatory_space)),
|
141
|
+
icon_name: "share-line",
|
142
|
+
if: allowed_to?(:read, :share_tokens, current_participatory_space:)
|
148
143
|
end
|
149
144
|
end
|
150
145
|
|
@@ -165,14 +160,6 @@ module Decidim
|
|
165
160
|
active: is_active_link?(decidim_admin_assemblies.new_import_path),
|
166
161
|
icon_name: "price-tag-3-line",
|
167
162
|
if: allowed_to?(:import, :assembly)
|
168
|
-
|
169
|
-
menu.add_item :assemblies_types,
|
170
|
-
I18n.t("menu.assemblies_types", scope: "decidim.admin"),
|
171
|
-
decidim_admin_assemblies.assemblies_types_path,
|
172
|
-
position: 3,
|
173
|
-
active: is_active_link?(decidim_admin_assemblies.assemblies_types_path),
|
174
|
-
icon_name: "government-line",
|
175
|
-
if: allowed_to?(:manage, :assemblies_type)
|
176
163
|
end
|
177
164
|
end
|
178
165
|
end
|
@@ -32,16 +32,20 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
participatory_space.exports :assemblies do |export|
|
35
|
-
export.collection do
|
36
|
-
Decidim::Assembly
|
35
|
+
export.collection do
|
36
|
+
Decidim::Assembly
|
37
|
+
.public_spaces
|
38
|
+
.includes(:attachment_collections)
|
37
39
|
end
|
38
40
|
|
41
|
+
export.include_in_open_data = true
|
42
|
+
|
39
43
|
export.serializer Decidim::Assemblies::AssemblySerializer
|
44
|
+
export.open_data_serializer Decidim::Assemblies::OpenDataAssemblySerializer
|
40
45
|
end
|
41
46
|
|
42
47
|
participatory_space.register_on_destroy_account do |user|
|
43
48
|
Decidim::AssemblyUserRole.where(user:).destroy_all
|
44
|
-
Decidim::AssemblyMember.where(user:).destroy_all
|
45
49
|
end
|
46
50
|
|
47
51
|
participatory_space.seeds do
|
@@ -8,6 +8,15 @@ module Decidim
|
|
8
8
|
def call
|
9
9
|
create_content_block!
|
10
10
|
|
11
|
+
taxonomy = create_taxonomy!(name: "Assembly Types", parent: nil)
|
12
|
+
2.times do
|
13
|
+
create_taxonomy!(name: ::Faker::Lorem.word, parent: taxonomy)
|
14
|
+
end
|
15
|
+
# filters for assemblies only
|
16
|
+
create_taxonomy_filter!(root_taxonomy: taxonomy,
|
17
|
+
taxonomies: taxonomy.all_children,
|
18
|
+
participatory_space_manifests: [:assemblies])
|
19
|
+
|
11
20
|
2.times do |_n|
|
12
21
|
assembly = create_assembly!
|
13
22
|
|
@@ -20,12 +29,6 @@ module Decidim
|
|
20
29
|
|
21
30
|
create_attachments!(attached_to: current_assembly)
|
22
31
|
|
23
|
-
2.times do
|
24
|
-
create_category!(participatory_space: current_assembly)
|
25
|
-
end
|
26
|
-
|
27
|
-
create_assembly_members!(assembly: current_assembly)
|
28
|
-
|
29
32
|
seed_components_manifests!(participatory_space: current_assembly)
|
30
33
|
|
31
34
|
Decidim::ContentBlocksCreator.new(current_assembly).create_default!
|
@@ -74,7 +77,6 @@ module Decidim
|
|
74
77
|
composition: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
75
78
|
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
76
79
|
end,
|
77
|
-
assembly_type: Decidim::AssembliesType.create!(organization:, title: Decidim::Faker::Localized.word),
|
78
80
|
creation_date: 1.day.from_now,
|
79
81
|
created_by: "others",
|
80
82
|
created_by_other: Decidim::Faker::Localized.word,
|
@@ -120,32 +122,6 @@ module Decidim
|
|
120
122
|
)
|
121
123
|
end
|
122
124
|
end
|
123
|
-
|
124
|
-
def create_assembly_members!(assembly:)
|
125
|
-
Decidim::AssemblyMember::POSITIONS.each do |position|
|
126
|
-
Decidim::AssemblyMember.create!(
|
127
|
-
full_name: ::Faker::Name.name,
|
128
|
-
gender: ::Faker::Lorem.word,
|
129
|
-
birthday: ::Faker::Date.birthday(min_age: 18, max_age: 65),
|
130
|
-
birthplace: ::Faker::Demographic.demonym,
|
131
|
-
designation_date: ::Faker::Date.between(from: 1.year.ago, to: 1.month.ago),
|
132
|
-
position:,
|
133
|
-
position_other: position == "other" ? ::Faker::Job.position : nil,
|
134
|
-
assembly:
|
135
|
-
)
|
136
|
-
end
|
137
|
-
|
138
|
-
Decidim::AssemblyMember.create!(
|
139
|
-
user: assembly.organization.users.first,
|
140
|
-
gender: ::Faker::Lorem.word,
|
141
|
-
birthday: ::Faker::Date.birthday(min_age: 18, max_age: 65),
|
142
|
-
birthplace: ::Faker::Demographic.demonym,
|
143
|
-
designation_date: ::Faker::Date.between(from: 1.year.ago, to: 1.month.ago),
|
144
|
-
position: "other",
|
145
|
-
position_other: ::Faker::Job.position,
|
146
|
-
assembly:
|
147
|
-
)
|
148
|
-
end
|
149
125
|
end
|
150
126
|
end
|
151
127
|
end
|