decidim-assemblies 0.10.1 → 0.11.0.pre1
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 +1 -1
- data/app/assets/config/decidim_assemblies_manifest.js +1 -0
- data/app/assets/javascripts/decidim/assemblies/admin/assemblies.js.es6 +57 -4
- data/app/assets/javascripts/decidim/assemblies/assemblies.js.es6 +18 -0
- data/app/commands/decidim/assemblies/admin/copy_assembly.rb +9 -9
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +33 -1
- data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +2 -2
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +31 -1
- data/app/constraints/decidim/assemblies/{current_feature.rb → current_component.rb} +7 -7
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +17 -6
- data/app/controllers/decidim/assemblies/admin/{feature_permissions_controller.rb → component_permissions_controller.rb} +2 -2
- data/app/controllers/decidim/assemblies/admin/{features_controller.rb → components_controller.rb} +2 -2
- data/app/controllers/decidim/assemblies/admin/participatory_space_private_users_controller.rb +26 -0
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +10 -4
- data/app/controllers/decidim/assemblies/assembly_widgets_controller.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_copy_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +63 -2
- data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +20 -0
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +51 -0
- data/app/models/decidim/assemblies/abilities/admin/admin_ability.rb +1 -0
- data/app/models/decidim/assemblies/abilities/admin/assembly_admin_ability.rb +3 -3
- data/app/models/decidim/assemblies/abilities/admin/assembly_moderator_ability.rb +1 -1
- data/app/models/decidim/assembly.rb +102 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +20 -1
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +9 -9
- data/app/presenters/decidim/log/value_types/assembly_presenter.rb +28 -0
- data/app/queries/decidim/assemblies/organization_prioritized_assemblies.rb +3 -2
- data/app/queries/decidim/assemblies/organization_published_assemblies.rb +3 -1
- data/app/queries/decidim/assemblies/visible_assemblies.rb +20 -0
- data/app/views/decidim/assemblies/_assembly.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +76 -1
- data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +3 -4
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +20 -4
- data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +2 -2
- data/app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assembly_copies/new.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assembly_user_roles/edit.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assembly_user_roles/new.html.erb +1 -1
- data/app/views/decidim/assemblies/assemblies/_nav_breadcumb.html.erb +11 -0
- data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +1 -1
- data/app/views/decidim/assemblies/assemblies/_statistics.html.erb +1 -1
- data/app/views/decidim/assemblies/assemblies/index.html.erb +1 -1
- data/app/views/decidim/assemblies/assemblies/show.html.erb +129 -7
- data/app/views/decidim/assemblies/assembly_widgets/show.html.erb +1 -1
- data/app/views/layouts/decidim/_assembly_header.html.erb +13 -13
- data/app/views/layouts/decidim/admin/assemblies.html.erb +1 -1
- data/app/views/layouts/decidim/admin/assembly.html.erb +15 -10
- data/app/views/layouts/decidim/assembly.html.erb +2 -2
- data/config/locales/ca.yml +71 -1
- data/config/locales/en.yml +71 -1
- data/config/locales/es.yml +71 -1
- data/config/locales/eu.yml +71 -1
- data/config/locales/fi.yml +71 -1
- data/config/locales/fr.yml +88 -18
- data/config/locales/gl.yml +71 -1
- data/config/locales/it.yml +71 -1
- data/config/locales/nl.yml +105 -35
- data/config/locales/pl.yml +71 -1
- data/config/locales/pt-BR.yml +71 -1
- data/config/locales/pt.yml +71 -1
- data/config/locales/ru.yml +0 -1
- data/config/locales/sv.yml +71 -1
- data/config/locales/uk.yml +0 -1
- data/db/migrate/20180124083729_add_private_to_assemblies.rb +7 -0
- data/db/migrate/20180226103942_add_parent_child_relation_to_assemblies.rb +22 -0
- data/db/migrate/20180302121116_add_fields_to_assemblies.rb +25 -0
- data/lib/decidim/assemblies/admin_engine.rb +11 -5
- data/lib/decidim/assemblies/engine.rb +7 -7
- data/lib/decidim/assemblies/participatory_space.rb +89 -34
- data/lib/decidim/assemblies/test/factories.rb +24 -0
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +23 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f603662b1e867eeeae60d0a92dfef0f6e7d9acf6211cf525e3e93c4f55c326ce
|
4
|
+
data.tar.gz: 1369941b9f64beecb271a3585cb2e4b68f99c6d0ad04feaed4c00393675f8547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f557e56dcc33cb61bd9ff15a400b8b8b2161ffcf19e2e1a06dc340d527187e6b88e97850d71422491eab482c0d6057503fb34d556f589a32719ed9d1bb45aff
|
7
|
+
data.tar.gz: ea07f1a489fb86c07cfb386cae72629a4a6d871f1a3d20330d2c99f92cb899b79c5d10b2add9a2b3f0917cabf6a04cbe401cc4a632be4557d5ae351c7ac17047
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
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.
|
5
5
|
|
6
|
-
A assembly can get different
|
6
|
+
A assembly can get different components (such as meetings or proposals) attached.
|
7
7
|
It can also have attachments, be associated to custom categories or scopes, and
|
8
8
|
can be fully managed via an administration UI.
|
9
9
|
|
@@ -1,14 +1,67 @@
|
|
1
1
|
$(() => {
|
2
2
|
((exports) => {
|
3
|
-
const $assemblyScopeEnabled = $(
|
3
|
+
const $assemblyScopeEnabled = $("#assembly_scopes_enabled");
|
4
4
|
const $assemblyScopeId = $("#assembly_scope_id");
|
5
5
|
|
6
|
-
if ($(
|
7
|
-
$assemblyScopeEnabled.on(
|
6
|
+
if ($(".edit_assembly, .new_assembly").length > 0) {
|
7
|
+
$assemblyScopeEnabled.on("change", (event) => {
|
8
8
|
const checked = event.target.checked;
|
9
9
|
exports.theDataPicker.enabled($assemblyScopeId, checked);
|
10
10
|
})
|
11
|
-
exports.theDataPicker.enabled($assemblyScopeId, $assemblyScopeEnabled.prop(
|
11
|
+
exports.theDataPicker.enabled($assemblyScopeId, $assemblyScopeEnabled.prop("checked"));
|
12
12
|
}
|
13
|
+
|
14
|
+
|
15
|
+
const $form = $(".assembly_form_admin");
|
16
|
+
|
17
|
+
if ($form.length > 0) {
|
18
|
+
|
19
|
+
const $privateSpace = $form.find("#private_space");
|
20
|
+
const $isTransparent = $form.find("#is_transparent");
|
21
|
+
const $specialFeatures = $form.find("#special_features");
|
22
|
+
|
23
|
+
|
24
|
+
const toggleDisabledHiddenFields = () => {
|
25
|
+
const enabledPrivateSpace = $privateSpace.find("input[type='checkbox']").prop("checked");
|
26
|
+
$isTransparent.find("input[type='checkbox']").attr("disabled", "disabled");
|
27
|
+
$specialFeatures.hide();
|
28
|
+
|
29
|
+
if (enabledPrivateSpace) {
|
30
|
+
$isTransparent.find("input[type='checkbox']").attr("disabled", !enabledPrivateSpace);
|
31
|
+
$specialFeatures.show();
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
$privateSpace.on("change", toggleDisabledHiddenFields);
|
36
|
+
toggleDisabledHiddenFields();
|
37
|
+
|
38
|
+
const $assemblyType = $form.find("#assembly_assembly_type");
|
39
|
+
const $assemblyTypeOther = $form.find("#assembly_type_other");
|
40
|
+
|
41
|
+
const $assemblyCreatedBy = $form.find("#assembly_created_by");
|
42
|
+
const $assemblyCreatedByOther = $form.find("#created_by_other");
|
43
|
+
|
44
|
+
const toggleDependsOnSelect = ($target, $showDiv) => {
|
45
|
+
const value = $target.val();
|
46
|
+
$showDiv.hide();
|
47
|
+
if (value === "others") {
|
48
|
+
$showDiv.show();
|
49
|
+
}
|
50
|
+
};
|
51
|
+
|
52
|
+
$assemblyType.on("change", (ev) => {
|
53
|
+
const $target = $(ev.target);
|
54
|
+
toggleDependsOnSelect($target, $assemblyTypeOther);
|
55
|
+
});
|
56
|
+
|
57
|
+
$assemblyCreatedBy.on("change", (ev) => {
|
58
|
+
const $target = $(ev.target);
|
59
|
+
toggleDependsOnSelect($target, $assemblyCreatedByOther);
|
60
|
+
});
|
61
|
+
|
62
|
+
toggleDependsOnSelect($assemblyType, $assemblyTypeOther);
|
63
|
+
toggleDependsOnSelect($assemblyCreatedBy, $assemblyCreatedByOther);
|
64
|
+
}
|
65
|
+
|
13
66
|
})(window);
|
14
67
|
});
|
@@ -0,0 +1,18 @@
|
|
1
|
+
(function() {
|
2
|
+
$(() => {
|
3
|
+
|
4
|
+
$(".show-more").on("click", function() {
|
5
|
+
/* eslint-disable no-invalid-this */
|
6
|
+
$(this).hide();
|
7
|
+
$(".show-more-panel").removeClass("hide");
|
8
|
+
$(".hide-more").show();
|
9
|
+
});
|
10
|
+
|
11
|
+
$(".hide-more").on("click", function() {
|
12
|
+
$(this).hide();
|
13
|
+
$(".show-more-panel").addClass("hide");
|
14
|
+
$(".show-more").show();
|
15
|
+
});
|
16
|
+
|
17
|
+
})
|
18
|
+
}(window));
|
@@ -27,7 +27,7 @@ module Decidim
|
|
27
27
|
Assembly.transaction do
|
28
28
|
copy_assembly
|
29
29
|
copy_assembly_categories if @form.copy_categories?
|
30
|
-
|
30
|
+
copy_assembly_components if @form.copy_components?
|
31
31
|
end
|
32
32
|
|
33
33
|
broadcast(:ok, @copied_assembly)
|
@@ -70,16 +70,16 @@ module Decidim
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
def
|
74
|
-
@assembly.
|
75
|
-
|
76
|
-
manifest_name:
|
77
|
-
name:
|
73
|
+
def copy_assembly_components
|
74
|
+
@assembly.components.each do |component|
|
75
|
+
new_component = Component.create!(
|
76
|
+
manifest_name: component.manifest_name,
|
77
|
+
name: component.name,
|
78
78
|
participatory_space: @copied_assembly,
|
79
|
-
settings:
|
80
|
-
step_settings:
|
79
|
+
settings: component.settings,
|
80
|
+
step_settings: component.step_settings
|
81
81
|
)
|
82
|
-
|
82
|
+
component.manifest.run_hooks(:copy, new_component: new_component, old_component: component)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -24,6 +24,8 @@ module Decidim
|
|
24
24
|
|
25
25
|
if assembly.persisted?
|
26
26
|
add_admins_as_followers(assembly)
|
27
|
+
link_participatory_processes(assembly)
|
28
|
+
|
27
29
|
broadcast(:ok, assembly)
|
28
30
|
else
|
29
31
|
form.errors.add(:hero_image, assembly.errors[:hero_image]) if assembly.errors.include? :hero_image
|
@@ -53,12 +55,34 @@ module Decidim
|
|
53
55
|
scopes_enabled: form.scopes_enabled,
|
54
56
|
scope: form.scope,
|
55
57
|
area: form.area,
|
58
|
+
parent: form.parent,
|
59
|
+
private_space: form.private_space,
|
56
60
|
developer_group: form.developer_group,
|
57
61
|
local_area: form.local_area,
|
58
62
|
target: form.target,
|
59
63
|
participatory_scope: form.participatory_scope,
|
60
64
|
participatory_structure: form.participatory_structure,
|
61
|
-
meta_scope: form.meta_scope
|
65
|
+
meta_scope: form.meta_scope,
|
66
|
+
show_statistics: form.show_statistics,
|
67
|
+
purpose_of_action: form.purpose_of_action,
|
68
|
+
composition: form.composition,
|
69
|
+
assembly_type: form.assembly_type,
|
70
|
+
assembly_type_other: form.assembly_type_other,
|
71
|
+
creation_date: form.creation_date,
|
72
|
+
created_by: form.created_by,
|
73
|
+
created_by_other: form.created_by_other,
|
74
|
+
duration: form.duration,
|
75
|
+
included_at: form.included_at,
|
76
|
+
closing_date: form.closing_date,
|
77
|
+
closing_date_reason: form.closing_date_reason,
|
78
|
+
internal_organisation: form.internal_organisation,
|
79
|
+
is_transparent: form.is_transparent,
|
80
|
+
special_features: form.special_features,
|
81
|
+
twitter_handler: form.twitter_handler,
|
82
|
+
facebook_handler: form.facebook_handler,
|
83
|
+
instagram_handler: form.instagram_handler,
|
84
|
+
youtube_handler: form.youtube_handler,
|
85
|
+
github_handler: form.github_handler
|
62
86
|
)
|
63
87
|
end
|
64
88
|
|
@@ -74,6 +98,14 @@ module Decidim
|
|
74
98
|
Decidim::CreateFollow.new(form, admin).call
|
75
99
|
end
|
76
100
|
end
|
101
|
+
|
102
|
+
def participatory_processes(assembly)
|
103
|
+
@participatory_processes ||= assembly.participatory_space_sibling_scope(:participatory_processes).where(id: @form.participatory_processes_ids)
|
104
|
+
end
|
105
|
+
|
106
|
+
def link_participatory_processes(assembly)
|
107
|
+
assembly.link_participatory_spaces_resources(participatory_processes(assembly), "included_participatory_processes")
|
108
|
+
end
|
77
109
|
end
|
78
110
|
end
|
79
111
|
end
|
@@ -62,10 +62,10 @@ module Decidim
|
|
62
62
|
def existing_user
|
63
63
|
return @existing_user if defined?(@existing_user)
|
64
64
|
|
65
|
-
@existing_user = User.
|
65
|
+
@existing_user = User.find_by(
|
66
66
|
email: form.email,
|
67
67
|
organization: assembly.organization
|
68
|
-
)
|
68
|
+
)
|
69
69
|
|
70
70
|
InviteUserAgain.call(@existing_user, invitation_instructions) if @existing_user && !@existing_user.invitation_accepted?
|
71
71
|
|
@@ -24,6 +24,7 @@ module Decidim
|
|
24
24
|
def call
|
25
25
|
return broadcast(:invalid) if form.invalid?
|
26
26
|
update_assembly
|
27
|
+
link_participatory_processes(@assembly)
|
27
28
|
|
28
29
|
if @assembly.valid?
|
29
30
|
broadcast(:ok, @assembly)
|
@@ -68,15 +69,44 @@ module Decidim
|
|
68
69
|
scopes_enabled: form.scopes_enabled,
|
69
70
|
scope: form.scope,
|
70
71
|
area: form.area,
|
72
|
+
parent: form.parent,
|
73
|
+
private_space: form.private_space,
|
71
74
|
developer_group: form.developer_group,
|
72
75
|
local_area: form.local_area,
|
73
76
|
target: form.target,
|
74
77
|
participatory_scope: form.participatory_scope,
|
75
78
|
participatory_structure: form.participatory_structure,
|
76
79
|
meta_scope: form.meta_scope,
|
77
|
-
show_statistics: form.show_statistics
|
80
|
+
show_statistics: form.show_statistics,
|
81
|
+
purpose_of_action: form.purpose_of_action,
|
82
|
+
composition: form.composition,
|
83
|
+
assembly_type: form.assembly_type,
|
84
|
+
assembly_type_other: form.assembly_type_other,
|
85
|
+
creation_date: form.creation_date,
|
86
|
+
created_by: form.created_by,
|
87
|
+
created_by_other: form.created_by_other,
|
88
|
+
duration: form.duration,
|
89
|
+
included_at: form.included_at,
|
90
|
+
closing_date: form.closing_date,
|
91
|
+
closing_date_reason: form.closing_date_reason,
|
92
|
+
internal_organisation: form.internal_organisation,
|
93
|
+
is_transparent: form.is_transparent,
|
94
|
+
special_features: form.special_features,
|
95
|
+
twitter_handler: form.twitter_handler,
|
96
|
+
facebook_handler: form.facebook_handler,
|
97
|
+
instagram_handler: form.instagram_handler,
|
98
|
+
youtube_handler: form.youtube_handler,
|
99
|
+
github_handler: form.github_handler
|
78
100
|
}
|
79
101
|
end
|
102
|
+
|
103
|
+
def participatory_processes(assembly)
|
104
|
+
@participatory_processes ||= assembly.participatory_space_sibling_scope(:participatory_processes).where(id: @form.participatory_processes_ids)
|
105
|
+
end
|
106
|
+
|
107
|
+
def link_participatory_processes(assembly)
|
108
|
+
assembly.link_participatory_spaces_resources(participatory_processes(assembly), "included_participatory_processes")
|
109
|
+
end
|
80
110
|
end
|
81
111
|
end
|
82
112
|
end
|
@@ -2,26 +2,26 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Assemblies
|
5
|
-
# This class infers the current
|
5
|
+
# This class infers the current component on an assembly context
|
6
6
|
# request parameters and injects it into the environment.
|
7
|
-
class
|
7
|
+
class CurrentComponent
|
8
8
|
# Public: Initializes the class.
|
9
9
|
#
|
10
|
-
# manifest - The manifest of the
|
10
|
+
# manifest - The manifest of the component to check against.
|
11
11
|
def initialize(manifest)
|
12
12
|
@manifest = manifest
|
13
13
|
end
|
14
14
|
|
15
|
-
# Public: Matches the request against a
|
15
|
+
# Public: Matches the request against a component and injects it into the
|
16
16
|
# environment.
|
17
17
|
#
|
18
|
-
# request - The request that holds the current
|
18
|
+
# request - The request that holds the current component relevant information.
|
19
19
|
#
|
20
20
|
# Returns a true if the request matches an assembly and a
|
21
|
-
#
|
21
|
+
# component belonging to that assembly, false otherwise
|
22
22
|
def matches?(request)
|
23
23
|
CurrentAssembly.new.matches?(request) &&
|
24
|
-
Decidim::
|
24
|
+
Decidim::CurrentComponent.new(@manifest).matches?(request)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -6,7 +6,7 @@ module Decidim
|
|
6
6
|
# Controller that allows managing assemblies.
|
7
7
|
#
|
8
8
|
class AssembliesController < Decidim::Admin::ApplicationController
|
9
|
-
helper_method :current_assembly, :current_participatory_space
|
9
|
+
helper_method :current_assembly, :parent_assembly, :parent_assemblies, :current_participatory_space
|
10
10
|
layout "decidim/admin/assemblies"
|
11
11
|
|
12
12
|
def index
|
@@ -17,6 +17,7 @@ module Decidim
|
|
17
17
|
def new
|
18
18
|
authorize! :new, Decidim::Assembly
|
19
19
|
@form = form(AssemblyForm).instance
|
20
|
+
@form.parent_id = params[:parent_id]
|
20
21
|
end
|
21
22
|
|
22
23
|
def create
|
@@ -24,9 +25,9 @@ module Decidim
|
|
24
25
|
@form = form(AssemblyForm).from_params(params)
|
25
26
|
|
26
27
|
CreateAssembly.call(@form) do
|
27
|
-
on(:ok) do
|
28
|
+
on(:ok) do |assembly|
|
28
29
|
flash[:notice] = I18n.t("assemblies.create.success", scope: "decidim.admin")
|
29
|
-
redirect_to assemblies_path
|
30
|
+
redirect_to assemblies_path(parent_id: assembly.parent_id)
|
30
31
|
end
|
31
32
|
|
32
33
|
on(:invalid) do
|
@@ -78,15 +79,25 @@ module Decidim
|
|
78
79
|
private
|
79
80
|
|
80
81
|
def current_assembly
|
81
|
-
|
82
|
-
|
82
|
+
scope = OrganizationAssemblies.new(current_user.organization).query
|
83
|
+
@current_assembly ||= scope.where(slug: params[:slug]).or(
|
84
|
+
scope.where(id: params[:slug])
|
83
85
|
).first
|
84
86
|
end
|
85
87
|
|
86
88
|
alias current_participatory_space current_assembly
|
87
89
|
|
90
|
+
def parent_assembly
|
91
|
+
@parent_assembly ||= OrganizationAssemblies.new(current_organization).query.find_by(id: params[:parent_id])
|
92
|
+
end
|
93
|
+
|
94
|
+
def parent_assemblies
|
95
|
+
@parent_assemblies ||= OrganizationAssemblies.new(current_user.organization).query.where(parent_id: nil)
|
96
|
+
end
|
97
|
+
|
88
98
|
def collection
|
89
|
-
|
99
|
+
parent_id = params[:parent_id].presence
|
100
|
+
@collection ||= OrganizationAssemblies.new(current_user.organization).query.where(parent_id: parent_id)
|
90
101
|
end
|
91
102
|
|
92
103
|
def ability_context
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Assemblies
|
5
5
|
module Admin
|
6
|
-
# Controller that allows managing the Assembly'
|
6
|
+
# Controller that allows managing the Assembly' Component
|
7
7
|
# permissions in the admin panel.
|
8
8
|
#
|
9
|
-
class
|
9
|
+
class ComponentPermissionsController < Decidim::Admin::ComponentPermissionsController
|
10
10
|
include Concerns::AssemblyAdmin
|
11
11
|
end
|
12
12
|
end
|
data/app/controllers/decidim/assemblies/admin/{features_controller.rb → components_controller.rb}
RENAMED
@@ -3,10 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Assemblies
|
5
5
|
module Admin
|
6
|
-
# Controller that allows managing the Assembly'
|
6
|
+
# Controller that allows managing the Assembly' Components in the
|
7
7
|
# admin panel.
|
8
8
|
#
|
9
|
-
class
|
9
|
+
class ComponentsController < Decidim::Admin::ComponentsController
|
10
10
|
include Concerns::AssemblyAdmin
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing assembly private users
|
7
|
+
# on assembies
|
8
|
+
class ParticipatorySpacePrivateUsersController < Decidim::Admin::ApplicationController
|
9
|
+
include Concerns::AssemblyAdmin
|
10
|
+
include Decidim::Admin::Concerns::HasPrivateUsers
|
11
|
+
|
12
|
+
def after_destroy_path
|
13
|
+
participatory_space_private_users_path(current_assembly)
|
14
|
+
end
|
15
|
+
|
16
|
+
def privatable_to
|
17
|
+
current_assembly
|
18
|
+
end
|
19
|
+
|
20
|
+
def authorization_object
|
21
|
+
@participatory_space_private_user || ParticipatorySpacePrivateUser
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -14,7 +14,7 @@ module Decidim
|
|
14
14
|
helper Decidim::SanitizeHelper
|
15
15
|
helper Decidim::ResourceReferenceHelper
|
16
16
|
|
17
|
-
helper_method :collection, :promoted_assemblies, :assemblies, :stats
|
17
|
+
helper_method :collection, :promoted_assemblies, :assemblies, :stats, :assembly_participatory_processes
|
18
18
|
|
19
19
|
def index
|
20
20
|
redirect_to "/404" if published_assemblies.none?
|
@@ -22,7 +22,9 @@ module Decidim
|
|
22
22
|
authorize! :read, Assembly
|
23
23
|
end
|
24
24
|
|
25
|
-
def show
|
25
|
+
def show
|
26
|
+
check_current_user_can_visit_space
|
27
|
+
end
|
26
28
|
|
27
29
|
private
|
28
30
|
|
@@ -35,11 +37,11 @@ module Decidim
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def published_assemblies
|
38
|
-
@published_assemblies ||= OrganizationPublishedAssemblies.new(current_organization)
|
40
|
+
@published_assemblies ||= OrganizationPublishedAssemblies.new(current_organization, current_user)
|
39
41
|
end
|
40
42
|
|
41
43
|
def assemblies
|
42
|
-
@assemblies ||= OrganizationPrioritizedAssemblies.new(current_organization)
|
44
|
+
@assemblies ||= OrganizationPrioritizedAssemblies.new(current_organization, current_user)
|
43
45
|
end
|
44
46
|
|
45
47
|
alias collection assemblies
|
@@ -51,6 +53,10 @@ module Decidim
|
|
51
53
|
def stats
|
52
54
|
@stats ||= AssemblyStatsPresenter.new(assembly: current_participatory_space)
|
53
55
|
end
|
56
|
+
|
57
|
+
def assembly_participatory_processes
|
58
|
+
@assembly_participatory_processes ||= @current_participatory_space.linked_participatory_space_resources(:participatory_processes, "included_participatory_processes")
|
59
|
+
end
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
|
16
16
|
attribute :slug, String
|
17
17
|
attribute :copy_categories, Boolean
|
18
|
-
attribute :
|
18
|
+
attribute :copy_components, Boolean
|
19
19
|
|
20
20
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
21
21
|
validates :title, translatable_presence: true
|
@@ -9,6 +9,9 @@ module Decidim
|
|
9
9
|
class AssemblyForm < Form
|
10
10
|
include TranslatableAttributes
|
11
11
|
|
12
|
+
ASSEMBLY_TYPES = %w(government executive consultative_advisory participatory working_group commission others).freeze
|
13
|
+
CREATED_BY = %w(city_council public others).freeze
|
14
|
+
|
12
15
|
translatable_attribute :title, String
|
13
16
|
translatable_attribute :subtitle, String
|
14
17
|
translatable_attribute :description, String
|
@@ -19,6 +22,13 @@ module Decidim
|
|
19
22
|
translatable_attribute :target, String
|
20
23
|
translatable_attribute :participatory_scope, String
|
21
24
|
translatable_attribute :participatory_structure, String
|
25
|
+
translatable_attribute :purpose_of_action, String
|
26
|
+
translatable_attribute :composition, String
|
27
|
+
translatable_attribute :assembly_type_other, String
|
28
|
+
translatable_attribute :created_by_other, String
|
29
|
+
translatable_attribute :closing_date_reason, String
|
30
|
+
translatable_attribute :internal_organisation, String
|
31
|
+
translatable_attribute :special_features, String
|
22
32
|
|
23
33
|
mimic :assembly
|
24
34
|
|
@@ -33,11 +43,30 @@ module Decidim
|
|
33
43
|
attribute :remove_banner_image
|
34
44
|
attribute :show_statistics, Boolean
|
35
45
|
attribute :area_id, Integer
|
46
|
+
attribute :parent_id, Integer
|
47
|
+
attribute :participatory_processes_ids, Array[Integer]
|
48
|
+
attribute :private_space, Boolean
|
49
|
+
attribute :assembly_type, String
|
50
|
+
attribute :creation_date, Decidim::Attributes::TimeWithZone
|
51
|
+
attribute :created_by, String
|
52
|
+
attribute :duration, Decidim::Attributes::TimeWithZone
|
53
|
+
attribute :included_at, Decidim::Attributes::TimeWithZone
|
54
|
+
attribute :closing_date, Decidim::Attributes::TimeWithZone
|
55
|
+
attribute :is_transparent, Boolean
|
56
|
+
attribute :twitter_handler, String
|
57
|
+
attribute :facebook_handler, String
|
58
|
+
attribute :instagram_handler, String
|
59
|
+
attribute :youtube_handler, String
|
60
|
+
attribute :github_handler, String
|
36
61
|
|
37
62
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
38
63
|
validates :title, :subtitle, :description, :short_description, translatable_presence: true
|
39
64
|
validates :scope, presence: true, if: proc { |object| object.scope_id.present? }
|
40
65
|
validates :area, presence: true, if: proc { |object| object.area_id.present? }
|
66
|
+
validates :parent, presence: true, if: ->(form) { form.parent_id.present? }
|
67
|
+
|
68
|
+
validates :assembly_type_other, translatable_presence: true, if: ->(form) { form.assembly_type == "others" }
|
69
|
+
validates :created_by_other, translatable_presence: true, if: ->(form) { form.created_by == "others" }
|
41
70
|
|
42
71
|
validate :slug_uniqueness
|
43
72
|
|
@@ -49,11 +78,43 @@ module Decidim
|
|
49
78
|
end
|
50
79
|
|
51
80
|
def scope
|
52
|
-
@scope ||= current_organization.scopes.
|
81
|
+
@scope ||= current_organization.scopes.find_by(id: scope_id)
|
53
82
|
end
|
54
83
|
|
55
84
|
def area
|
56
|
-
@area ||= current_organization.areas.
|
85
|
+
@area ||= current_organization.areas.find_by(id: area_id)
|
86
|
+
end
|
87
|
+
|
88
|
+
def assembly_types_for_select
|
89
|
+
ASSEMBLY_TYPES.map do |type|
|
90
|
+
[
|
91
|
+
I18n.t("assembly_types.#{type}", scope: "decidim.assemblies"),
|
92
|
+
type
|
93
|
+
]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def created_by_for_select
|
98
|
+
CREATED_BY.map do |by|
|
99
|
+
[
|
100
|
+
I18n.t("created_by.#{by}", scope: "decidim.assemblies"),
|
101
|
+
by
|
102
|
+
]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def parent
|
107
|
+
@parent ||= OrganizationAssemblies.new(current_organization).query.find_by(id: parent_id)
|
108
|
+
end
|
109
|
+
|
110
|
+
def processes_for_select
|
111
|
+
@processes_for_select ||= Decidim.find_participatory_space_manifest(:participatory_processes)
|
112
|
+
.participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |process|
|
113
|
+
[
|
114
|
+
translated_attribute(process.title),
|
115
|
+
process.id
|
116
|
+
]
|
117
|
+
end
|
57
118
|
end
|
58
119
|
|
59
120
|
private
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# This class contains helpers needed to format ParticipatoryProcesses
|
7
|
+
# in order to use them in select forms for AssemblyParticipatoryProcess.
|
8
|
+
#
|
9
|
+
module AssembliesHelper
|
10
|
+
# Public: A formatted collection of ParticipatoryProcesses to be used
|
11
|
+
# in forms.
|
12
|
+
def processes_selected
|
13
|
+
if current_assembly.present?
|
14
|
+
@processes_selected ||= current_assembly.linked_participatory_space_resources(:participatory_processes, "included_participatory_processes").pluck(:id)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
# Helpers related to the Assemblies layout.
|
6
|
+
module AssembliesHelper
|
7
|
+
include Decidim::ResourceHelper
|
8
|
+
# Public: Returns the characteristics of an assembly in a readable format like
|
9
|
+
# "title: close, no public, no transparent and is restricted to the members of the assembly"
|
10
|
+
def participatory_processes_for_assembly(assembly_participatory_processes)
|
11
|
+
html = ""
|
12
|
+
html += %( <div class="section"> ).html_safe
|
13
|
+
html += %( <h4 class="section-heading">#{t("assemblies.show.related_participatory_processes", scope: "decidim")}</h4> ).html_safe
|
14
|
+
html += %( <div class="row small-up-1 medium-up-2 card-grid"> ).html_safe
|
15
|
+
assembly_participatory_processes.each do |assembly_participatory_process|
|
16
|
+
html += render partial: "decidim/participatory_processes/participatory_process", locals: { participatory_process: assembly_participatory_process }
|
17
|
+
end
|
18
|
+
html += %( </div> ).html_safe
|
19
|
+
html += %( </div> ).html_safe
|
20
|
+
|
21
|
+
html.html_safe
|
22
|
+
end
|
23
|
+
|
24
|
+
def assembly_features(assembly)
|
25
|
+
html = "".html_safe
|
26
|
+
html += "<strong>#{translated_attribute(assembly.title)}: </strong>".html_safe
|
27
|
+
html += t("assemblies.show.private_space", scope: "decidim").to_s.html_safe
|
28
|
+
html += ", #{t("assemblies.show.is_transparent.#{assembly.is_transparent}", scope: "decidim")}".html_safe if assembly.is_transparent?
|
29
|
+
html += " #{decidim_sanitize translated_attribute(assembly.special_features)}".html_safe
|
30
|
+
html.html_safe
|
31
|
+
end
|
32
|
+
|
33
|
+
def social_handler_links(assembly)
|
34
|
+
html = "".html_safe
|
35
|
+
if Decidim::Assembly::SOCIAL_HANDLERS.any? { |h| assembly.try("#{h}_handler").present? }
|
36
|
+
html += "<div class='definition-data__item social_networks'>".html_safe
|
37
|
+
html += "<span class='definition-data__title'>#{t("assemblies.show.social_networks", scope: "decidim")}</span>".html_safe
|
38
|
+
Decidim::Assembly::SOCIAL_HANDLERS.each do |handler|
|
39
|
+
handler_name = "#{handler}_handler"
|
40
|
+
if assembly.send(handler_name).present?
|
41
|
+
html += link_to handler.capitalize, "https://#{handler}.com/#{assembly.send(handler_name)}", target: "_blank", class: "", title: handler.capitalize
|
42
|
+
end
|
43
|
+
end
|
44
|
+
html += "</div>".html_safe
|
45
|
+
end
|
46
|
+
|
47
|
+
html.html_safe
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|