decidim-assemblies 0.30.7 → 0.31.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/content_blocks/highlighted_assemblies_settings_form/show.erb +3 -1
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/{copy_assembly.rb → duplicate_assembly.rb} +20 -21
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +2 -4
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -1
- data/app/controllers/concerns/decidim/assemblies/assembly_breadcrumb.rb +7 -2
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +3 -3
- data/app/controllers/decidim/assemblies/admin/assembly_duplicates_controller.rb +35 -0
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +2 -3
- data/app/controllers/decidim/assemblies/admin/assembly_landing_page_controller.rb +4 -0
- data/app/forms/decidim/assemblies/admin/{assembly_copy_form.rb → assembly_duplicate_form.rb} +4 -4
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +0 -1
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +0 -11
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +1 -4
- data/app/models/decidim/assembly.rb +1 -5
- data/app/packs/entrypoints/decidim_assemblies_admin.js +0 -1
- data/app/packs/src/decidim/assemblies/admin/assemblies.js +3 -62
- data/app/packs/src/decidim/assemblies/controllers/.gitkeep +0 -0
- data/app/packs/src/decidim/assemblies/controllers/assembly_admin/assembly_admin.test.js +1077 -0
- data/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.js +66 -0
- data/app/permissions/decidim/assemblies/permissions.rb +7 -7
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -13
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +1 -3
- data/app/queries/decidim/assemblies/assemblies_stats_followers_count.rb +14 -0
- data/app/queries/decidim/assemblies/assemblies_stats_participants_count.rb +14 -0
- data/app/serializers/decidim/assemblies/assembly_importer.rb +12 -76
- data/app/views/decidim/assemblies/admin/assemblies/_assembly_row.html.erb +118 -49
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +8 -12
- data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +1 -9
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assemblies/index.js.erb +4 -0
- data/app/views/decidim/assemblies/admin/assemblies/manage_trash.html.erb +2 -1
- data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/{assembly_copies → assembly_duplicates}/_form.html.erb +4 -4
- data/app/views/decidim/assemblies/admin/assembly_duplicates/new.html.erb +19 -0
- data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +16 -20
- data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +0 -1
- data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +42 -18
- data/app/views/decidim/assemblies/assemblies/index.html.erb +0 -1
- data/app/views/decidim/assemblies/assemblies/show.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_manage_assemblies.html.erb +1 -1
- data/config/assets.rb +2 -3
- data/config/locales/ar.yml +1 -17
- data/config/locales/bg.yml +3 -20
- data/config/locales/bs-BA.yml +0 -4
- data/config/locales/ca-IT.yml +12 -27
- data/config/locales/ca.yml +12 -27
- data/config/locales/cs.yml +11 -26
- data/config/locales/de.yml +19 -21
- data/config/locales/el.yml +1 -17
- data/config/locales/en.yml +11 -26
- data/config/locales/es-MX.yml +14 -29
- data/config/locales/es-PY.yml +14 -29
- data/config/locales/es.yml +13 -28
- data/config/locales/eu.yml +12 -27
- data/config/locales/fi-plain.yml +17 -26
- data/config/locales/fi.yml +17 -26
- data/config/locales/fr-CA.yml +13 -44
- data/config/locales/fr.yml +13 -44
- data/config/locales/ga-IE.yml +0 -7
- data/config/locales/gl.yml +1 -17
- data/config/locales/he-IL.yml +7 -12
- data/config/locales/hu.yml +2 -18
- data/config/locales/id-ID.yml +0 -13
- data/config/locales/is-IS.yml +8 -11
- data/config/locales/it.yml +13 -22
- data/config/locales/ja.yml +17 -32
- data/config/locales/kaa.yml +0 -3
- data/config/locales/ko.yml +0 -8
- data/config/locales/lb.yml +1 -18
- data/config/locales/lt.yml +1 -18
- data/config/locales/lv.yml +0 -14
- data/config/locales/nl.yml +2 -18
- data/config/locales/no.yml +1 -17
- data/config/locales/pl.yml +2 -19
- data/config/locales/pt-BR.yml +2 -97
- data/config/locales/pt.yml +7 -21
- data/config/locales/ro-RO.yml +11 -32
- data/config/locales/ru.yml +7 -11
- data/config/locales/sk.yml +1 -8
- data/config/locales/sl.yml +4 -18
- data/config/locales/sq-AL.yml +10 -17
- data/config/locales/sr-CS.yml +0 -8
- data/config/locales/sv.yml +21 -31
- data/config/locales/tr-TR.yml +2 -33
- data/config/locales/uk.yml +7 -11
- data/config/locales/zh-CN.yml +1 -17
- data/config/locales/zh-TW.yml +2 -18
- data/db/migrate/20250604081741_remove_hastags_column_assemblies.rb +7 -0
- data/lib/decidim/api/assembly_type.rb +10 -6
- data/lib/decidim/assemblies/admin_engine.rb +1 -1
- data/lib/decidim/assemblies/api.rb +0 -1
- data/lib/decidim/assemblies/engine.rb +5 -21
- data/lib/decidim/assemblies/participatory_space.rb +18 -2
- data/lib/decidim/assemblies/query_extensions.rb +0 -18
- data/lib/decidim/assemblies/seeds.rb +2 -3
- data/lib/decidim/assemblies/test/factories.rb +2 -2
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +23 -21
- data/app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb +0 -35
- data/app/packs/entrypoints/decidim_assemblies.js +0 -4
- data/app/packs/src/decidim/assemblies/assemblies.js +0 -14
- data/app/queries/decidim/assemblies/metrics/assemblies_metric_manage.rb +0 -27
- data/app/views/decidim/assemblies/admin/assembly_copies/new.html.erb +0 -19
- data/lib/decidim/api/assemblies_type_type.rb +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d018d946999f92c36cb1382901e224dc928869b75f0598598a9009915273b443
|
|
4
|
+
data.tar.gz: c3f32fc6f46777b1a5c0837bb3d5ca4a8dbaf45d87725e52d9c8369168421121
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61e63411dd6100f1d766d6f6feaf714efd607e0d1d0e76b70613a091afbe9a3ccb34ee3e20f45d478c3a1ea365020a0d524ece702676c4edd9916328d849e1a8
|
|
7
|
+
data.tar.gz: 64d22117555d2275ee23236c7ba8cc4991ee40f3cdd11540b2bebe76aa315c53210c728051cd760766b003869ad51d97135407fa96763ab3b3ae4cac028cbcf3
|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
|
8
8
|
class CreateAssembly < Decidim::Commands::CreateResource
|
|
9
9
|
fetch_file_attributes :hero_image, :banner_image
|
|
10
10
|
|
|
11
|
-
fetch_form_attributes :title, :subtitle, :weight, :slug, :
|
|
11
|
+
fetch_form_attributes :title, :subtitle, :weight, :slug, :description, :short_description,
|
|
12
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,
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Assemblies
|
|
5
5
|
module Admin
|
|
6
|
-
# A command with all the business logic when
|
|
6
|
+
# A command with all the business logic when duplicating a new participatory
|
|
7
7
|
# assembly in the system.
|
|
8
|
-
class
|
|
8
|
+
class DuplicateAssembly < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# form - A form object with the params.
|
|
@@ -27,27 +27,26 @@ module Decidim
|
|
|
27
27
|
|
|
28
28
|
Decidim.traceability.perform_action!("duplicate", @assembly, @user) do
|
|
29
29
|
Assembly.transaction do
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
duplicate_assembly
|
|
31
|
+
duplicate_assembly_attachments
|
|
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
|
|
|
37
|
-
broadcast(:ok, @
|
|
37
|
+
broadcast(:ok, @duplicated_assembly)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
private
|
|
41
41
|
|
|
42
42
|
attr_reader :form
|
|
43
43
|
|
|
44
|
-
def
|
|
45
|
-
@
|
|
44
|
+
def duplicate_assembly
|
|
45
|
+
@duplicated_assembly = Assembly.create!(
|
|
46
46
|
organization: @assembly.organization,
|
|
47
47
|
title: form.title,
|
|
48
48
|
subtitle: @assembly.subtitle,
|
|
49
49
|
slug: form.slug,
|
|
50
|
-
hashtag: @assembly.hashtag,
|
|
51
50
|
description: @assembly.description,
|
|
52
51
|
short_description: @assembly.short_description,
|
|
53
52
|
promoted: @assembly.promoted,
|
|
@@ -64,47 +63,47 @@ module Decidim
|
|
|
64
63
|
)
|
|
65
64
|
end
|
|
66
65
|
|
|
67
|
-
def
|
|
66
|
+
def duplicate_assembly_attachments
|
|
68
67
|
[:hero_image, :banner_image].each do |attribute|
|
|
69
68
|
next unless @assembly.attached_uploader(attribute).attached?
|
|
70
69
|
|
|
71
|
-
@
|
|
70
|
+
@duplicated_assembly.send(attribute).attach(@assembly.send(attribute).blob)
|
|
72
71
|
end
|
|
73
72
|
end
|
|
74
73
|
|
|
75
|
-
def
|
|
74
|
+
def duplicate_assembly_components
|
|
76
75
|
@assembly.components.each do |component|
|
|
77
76
|
new_component = Component.create!(
|
|
78
77
|
manifest_name: component.manifest_name,
|
|
79
78
|
name: component.name,
|
|
80
|
-
participatory_space: @
|
|
79
|
+
participatory_space: @duplicated_assembly,
|
|
81
80
|
settings: component.settings,
|
|
82
81
|
step_settings: component.step_settings,
|
|
83
82
|
weight: component.weight
|
|
84
83
|
)
|
|
85
|
-
component.manifest.run_hooks(:
|
|
84
|
+
component.manifest.run_hooks(:duplicate, new_component:, old_component: component)
|
|
86
85
|
end
|
|
87
86
|
end
|
|
88
87
|
|
|
89
|
-
def
|
|
88
|
+
def duplicate_landing_page_blocks
|
|
90
89
|
blocks = Decidim::ContentBlock.where(scoped_resource_id: @assembly.id, scope_name: "assembly_homepage", organization: @assembly.organization)
|
|
91
90
|
return if blocks.blank?
|
|
92
91
|
|
|
93
92
|
blocks.each do |block|
|
|
94
93
|
new_block = Decidim::ContentBlock.create!(
|
|
95
|
-
organization: @
|
|
94
|
+
organization: @duplicated_assembly.organization,
|
|
96
95
|
scope_name: "assembly_homepage",
|
|
97
|
-
scoped_resource_id: @
|
|
96
|
+
scoped_resource_id: @duplicated_assembly.id,
|
|
98
97
|
manifest_name: block.manifest_name,
|
|
99
98
|
settings: block.settings,
|
|
100
99
|
weight: block.weight,
|
|
101
|
-
published_at: block.published_at.present? ? @
|
|
100
|
+
published_at: block.published_at.present? ? @duplicated_assembly.created_at : nil # determine if block is active/inactive
|
|
102
101
|
)
|
|
103
|
-
|
|
102
|
+
duplicate_block_attachments(block, new_block) if block.attachments.present?
|
|
104
103
|
end
|
|
105
104
|
end
|
|
106
105
|
|
|
107
|
-
def
|
|
106
|
+
def duplicate_block_attachments(block, new_block)
|
|
108
107
|
block.attachments.map(&:name).each do |name|
|
|
109
108
|
original_image = block.images_container.send(name).blob
|
|
110
109
|
next if original_image.blank?
|
|
@@ -29,7 +29,7 @@ module Decidim
|
|
|
29
29
|
add_admins_as_followers(@imported_assembly)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
broadcast(:ok, @imported_assembly
|
|
32
|
+
broadcast(:ok, @imported_assembly)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
private
|
|
@@ -37,14 +37,12 @@ module Decidim
|
|
|
37
37
|
attr_reader :form
|
|
38
38
|
|
|
39
39
|
def import_assembly
|
|
40
|
-
|
|
40
|
+
importer = Decidim::Assemblies::AssemblyImporter.new(form.current_organization, form.current_user)
|
|
41
41
|
assemblies.each do |original_assembly|
|
|
42
|
-
importer = Decidim::Assemblies::AssemblyImporter.new(form.current_organization, form.current_user)
|
|
43
42
|
Decidim.traceability.perform_action!("import", Assembly, @user) do
|
|
44
43
|
@imported_assembly = importer.import(original_assembly, form.current_user, title: form.title, slug: form.slug)
|
|
45
44
|
importer.import_folders_and_attachments(original_assembly["attachments"]) if form.import_attachments?
|
|
46
45
|
importer.import_components(original_assembly["components"]) if form.import_components?
|
|
47
|
-
@warnings.concat(importer.warnings)
|
|
48
46
|
@imported_assembly
|
|
49
47
|
end
|
|
50
48
|
end
|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
|
8
8
|
class UpdateAssembly < Decidim::Commands::UpdateResource
|
|
9
9
|
fetch_file_attributes :hero_image, :banner_image
|
|
10
10
|
|
|
11
|
-
fetch_form_attributes :title, :subtitle, :slug, :
|
|
11
|
+
fetch_form_attributes :title, :subtitle, :slug, :promoted, :description, :short_description,
|
|
12
12
|
:taxonomizations, :parent, :private_space, :developer_group, :local_area,
|
|
13
13
|
:target, :participatory_scope, :participatory_structure, :meta_scope,
|
|
14
14
|
:purpose_of_action, :composition, :creation_date, :created_by,
|
|
@@ -10,7 +10,6 @@ module Decidim
|
|
|
10
10
|
|
|
11
11
|
def current_participatory_space_breadcrumb_item
|
|
12
12
|
return {} if current_participatory_space.blank?
|
|
13
|
-
return super unless current_participatory_space.is_a?(Decidim::Assembly)
|
|
14
13
|
|
|
15
14
|
dropdown_cell = current_participatory_space_manifest.breadcrumb_cell
|
|
16
15
|
|
|
@@ -24,7 +23,13 @@ module Decidim
|
|
|
24
23
|
}
|
|
25
24
|
end
|
|
26
25
|
|
|
27
|
-
items <<
|
|
26
|
+
items << {
|
|
27
|
+
label: current_participatory_space.title,
|
|
28
|
+
url: Decidim::ResourceLocatorPresenter.new(current_participatory_space).path,
|
|
29
|
+
active: true,
|
|
30
|
+
dropdown_cell:,
|
|
31
|
+
resource: current_participatory_space
|
|
32
|
+
}
|
|
28
33
|
end
|
|
29
34
|
end
|
|
30
35
|
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
|
|
40
|
+
render :new, status: :unprocessable_entity
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -63,12 +63,12 @@ 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"
|
|
66
|
+
render :edit, layout: "decidim/admin/assembly", status: :unprocessable_entity
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
def
|
|
71
|
+
def duplicate
|
|
72
72
|
enforce_permission_to :create, :assembly, assembly: collection.find_by(id: params[:parent_id])
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Assemblies
|
|
5
|
+
module Admin
|
|
6
|
+
# Controller that allows managing assemblies.
|
|
7
|
+
#
|
|
8
|
+
class AssemblyDuplicatesController < Decidim::Assemblies::Admin::ApplicationController
|
|
9
|
+
include Concerns::AssemblyAdmin
|
|
10
|
+
|
|
11
|
+
def new
|
|
12
|
+
enforce_permission_to :create, :assembly
|
|
13
|
+
@form = form(AssemblyDuplicateForm).from_model(current_assembly)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
enforce_permission_to :create, :assembly
|
|
18
|
+
@form = form(AssemblyDuplicateForm).from_params(params)
|
|
19
|
+
|
|
20
|
+
DuplicateAssembly.call(@form, current_assembly, current_user) do
|
|
21
|
+
on(:ok) do
|
|
22
|
+
flash[:notice] = I18n.t("assemblies_duplicates.create.success", scope: "decidim.admin")
|
|
23
|
+
redirect_to assemblies_path
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
on(:invalid) do
|
|
27
|
+
flash.now[:alert] = I18n.t("assemblies_duplicates.create.error", scope: "decidim.admin")
|
|
28
|
+
render :new, status: :unprocessable_entity
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -16,15 +16,14 @@ module Decidim
|
|
|
16
16
|
@form = form(AssemblyImportForm).from_params(params)
|
|
17
17
|
|
|
18
18
|
ImportAssembly.call(@form, current_user) do
|
|
19
|
-
on(:ok) do
|
|
19
|
+
on(:ok) do
|
|
20
20
|
flash[:notice] = I18n.t("assembly_imports.create.success", scope: "decidim.admin")
|
|
21
|
-
flash[:warning] = warnings.join("<br>") if warnings.any?
|
|
22
21
|
redirect_to assemblies_path
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
on(:invalid) do
|
|
26
25
|
flash.now[:alert] = I18n.t("assembly_imports.create.error", scope: "decidim.admin")
|
|
27
|
-
render :new
|
|
26
|
+
render :new, status: :unprocessable_entity
|
|
28
27
|
end
|
|
29
28
|
end
|
|
30
29
|
end
|
data/app/forms/decidim/assemblies/admin/{assembly_copy_form.rb → assembly_duplicate_form.rb}
RENAMED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Assemblies
|
|
5
5
|
module Admin
|
|
6
|
-
# A form object used to
|
|
6
|
+
# A form object used to duplicate a assemblies from the admin
|
|
7
7
|
# dashboard.
|
|
8
8
|
#
|
|
9
|
-
class
|
|
9
|
+
class AssemblyDuplicateForm < Form
|
|
10
10
|
include TranslatableAttributes
|
|
11
11
|
|
|
12
12
|
translatable_attribute :title, String
|
|
@@ -14,8 +14,8 @@ module Decidim
|
|
|
14
14
|
mimic :assembly
|
|
15
15
|
|
|
16
16
|
attribute :slug, String
|
|
17
|
-
attribute :
|
|
18
|
-
attribute :
|
|
17
|
+
attribute :duplicate_components, Boolean
|
|
18
|
+
attribute :duplicate_landing_page_blocks, Boolean
|
|
19
19
|
|
|
20
20
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
|
21
21
|
validates :title, translatable_presence: true
|
|
@@ -31,14 +31,12 @@ module Decidim
|
|
|
31
31
|
attribute :import_components, Boolean, default: true
|
|
32
32
|
attribute :document, Decidim::Attributes::Blob
|
|
33
33
|
|
|
34
|
-
validates :document, presence: true
|
|
35
34
|
validates :document, file_content_type: { allow: ACCEPTED_TYPES.values }
|
|
36
35
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
|
37
36
|
validates :title, translatable_presence: true
|
|
38
37
|
validate :slug_uniqueness
|
|
39
38
|
|
|
40
39
|
validate :document_type_must_be_valid, if: :document
|
|
41
|
-
validate :document_must_have_content, if: -> { document.present? && errors[:document].none? }
|
|
42
40
|
|
|
43
41
|
def document_text
|
|
44
42
|
@document_text ||= document&.download
|
|
@@ -78,15 +76,6 @@ module Decidim
|
|
|
78
76
|
|
|
79
77
|
errors.add(:slug, :taken)
|
|
80
78
|
end
|
|
81
|
-
|
|
82
|
-
def document_must_have_content
|
|
83
|
-
return if document_text.blank?
|
|
84
|
-
|
|
85
|
-
parsed = JSON.parse(document_text)
|
|
86
|
-
errors.add(:document, :empty) if parsed.is_a?(Array) && parsed.empty?
|
|
87
|
-
rescue JSON::ParserError
|
|
88
|
-
errors.add(:document, :invalid_json)
|
|
89
|
-
end
|
|
90
79
|
end
|
|
91
80
|
end
|
|
92
81
|
end
|
|
@@ -14,10 +14,7 @@ module Decidim
|
|
|
14
14
|
|
|
15
15
|
# Items to display in the navigation of an assembly
|
|
16
16
|
def assembly_nav_items(participatory_space)
|
|
17
|
-
components = participatory_space
|
|
18
|
-
.components
|
|
19
|
-
.published.or(Decidim::Component.where(id: try(:current_component)))
|
|
20
|
-
.where(visible: true)
|
|
17
|
+
components = participatory_space.components.published.or(Decidim::Component.where(id: try(:current_component)))
|
|
21
18
|
|
|
22
19
|
[
|
|
23
20
|
*(if participatory_space.members_public_page?
|
|
@@ -123,10 +123,6 @@ module Decidim
|
|
|
123
123
|
published? && (!private_space? || (private_space? && is_transparent?))
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
def hashtag
|
|
127
|
-
attributes["hashtag"].to_s.delete("#")
|
|
128
|
-
end
|
|
129
|
-
|
|
130
126
|
def to_param
|
|
131
127
|
slug
|
|
132
128
|
end
|
|
@@ -173,7 +169,7 @@ module Decidim
|
|
|
173
169
|
|
|
174
170
|
return base unless auth_object&.admin?
|
|
175
171
|
|
|
176
|
-
base + %w(published_at
|
|
172
|
+
base + %w(published_at private_space parent_id)
|
|
177
173
|
end
|
|
178
174
|
|
|
179
175
|
def self.ransackable_associations(_auth_object = nil)
|
|
@@ -1,63 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const $assemblyScopeEnabled = $("#assembly_scopes_enabled");
|
|
3
|
-
const $assemblyScopeId = $("#assembly_scope_id");
|
|
1
|
+
import { definitionsFromContext } from "src/decidim/refactor/support/stimulus"
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const checked = event.target.checked;
|
|
8
|
-
$assemblyScopeId.attr("disabled", !checked);
|
|
9
|
-
})
|
|
10
|
-
$assemblyScopeId.attr("disabled", !$assemblyScopeEnabled.prop("checked"));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const $form = $(".assembly_form_admin");
|
|
14
|
-
|
|
15
|
-
if ($form.length > 0) {
|
|
16
|
-
|
|
17
|
-
const $privateSpace = $form.find("#private_space");
|
|
18
|
-
const $isTransparent = $form.find("#is_transparent");
|
|
19
|
-
const $specialFeatures = $form.find("#special_features");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const toggleDisabledHiddenFields = () => {
|
|
23
|
-
const enabledPrivateSpace = $privateSpace.find("input[type='checkbox']").prop("checked");
|
|
24
|
-
$isTransparent.find("input[type='checkbox']").attr("disabled", "disabled");
|
|
25
|
-
$specialFeatures.hide();
|
|
26
|
-
|
|
27
|
-
if (enabledPrivateSpace) {
|
|
28
|
-
$isTransparent.find("input[type='checkbox']").attr("disabled", !enabledPrivateSpace);
|
|
29
|
-
$specialFeatures.show();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
$privateSpace.on("change", toggleDisabledHiddenFields);
|
|
34
|
-
toggleDisabledHiddenFields();
|
|
35
|
-
|
|
36
|
-
const $assemblyType = $form.find("#assembly_assembly_type");
|
|
37
|
-
const $assemblyTypeOther = $form.find("#assembly_type_other");
|
|
38
|
-
|
|
39
|
-
const $assemblyCreatedBy = $form.find("#assembly_created_by");
|
|
40
|
-
const $assemblyCreatedByOther = $form.find("#created_by_other");
|
|
41
|
-
|
|
42
|
-
const toggleDependsOnSelect = ($target, $showDiv) => {
|
|
43
|
-
const value = $target.val();
|
|
44
|
-
$showDiv.hide();
|
|
45
|
-
if (value === "others") {
|
|
46
|
-
$showDiv.show();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
$assemblyType.on("change", (ev) => {
|
|
51
|
-
const $target = $(ev.target);
|
|
52
|
-
toggleDependsOnSelect($target, $assemblyTypeOther);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
$assemblyCreatedBy.on("change", (ev) => {
|
|
56
|
-
const $target = $(ev.target);
|
|
57
|
-
toggleDependsOnSelect($target, $assemblyCreatedByOther);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
toggleDependsOnSelect($assemblyType, $assemblyTypeOther);
|
|
61
|
-
toggleDependsOnSelect($assemblyCreatedBy, $assemblyCreatedByOther);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
3
|
+
const context = require.context("../controllers", true, /controller\.js$/)
|
|
4
|
+
window.Stimulus.load(definitionsFromContext(context))
|
|
File without changes
|