decidim-assemblies 0.20.0 → 0.23.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/decidim/assemblies/assembly.svg +1 -3
- data/app/assets/javascripts/decidim/assemblies/orgchart.js.es6 +698 -0
- data/app/cells/decidim/assemblies/assembly_m/footer.erb +2 -2
- data/app/cells/decidim/assemblies/assembly_m_cell.rb +5 -5
- data/app/cells/decidim/assemblies/assembly_member/show.erb +4 -4
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +10 -11
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +1 -0
- data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +45 -0
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -2
- data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +2 -1
- data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +12 -3
- data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +45 -0
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +72 -0
- data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +22 -0
- data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +46 -0
- data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +46 -0
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +11 -7
- data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +2 -1
- data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +30 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +8 -23
- data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +49 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +107 -0
- data/app/controllers/decidim/assemblies/admin/assembly_exports_controller.rb +24 -0
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +31 -0
- data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +2 -1
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +6 -2
- data/app/controllers/decidim/assemblies/{assembly_widgets_controller.rb → widgets_controller.rb} +2 -2
- data/app/events/decidim/assemblies/create_assembly_member_event.rb +17 -0
- data/app/events/decidim/role_assigned_to_assembly_event.rb +28 -0
- data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +14 -0
- data/app/forms/decidim/assemblies/admin/assemblies_type_form.rb +17 -0
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +37 -19
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +83 -0
- data/app/forms/decidim/assemblies/admin/assembly_user_role_form.rb +8 -2
- data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +6 -0
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +6 -3
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +10 -7
- data/app/models/decidim/assemblies_setting.rb +17 -0
- data/app/models/decidim/assemblies_type.rb +27 -0
- data/app/models/decidim/assembly.rb +26 -3
- data/app/models/decidim/assembly_user_role.rb +1 -1
- data/app/permissions/decidim/assemblies/permissions.rb +60 -2
- data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +27 -0
- data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +43 -0
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -2
- data/app/presenters/decidim/assemblies/assembly_presenter.rb +29 -0
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/assembly_type_presenter.rb +29 -0
- data/app/queries/decidim/assemblies/filtered_assemblies.rb +2 -2
- data/app/queries/decidim/assemblies/parent_assemblies_for_select.rb +42 -0
- data/app/serializers/decidim/assemblies/assembly_importer.rb +172 -0
- data/app/serializers/decidim/assemblies/assembly_serializer.rb +147 -0
- data/app/services/decidim/assemblies/assembly_search.rb +3 -3
- data/app/types/decidim/assemblies/assemblies_type_type.rb +17 -0
- data/app/types/decidim/assemblies/assembly_member_type.rb +29 -0
- data/app/types/decidim/assemblies/assembly_type.rb +67 -0
- data/app/views/decidim/assemblies/_filter_by_type.html.erb +11 -7
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +2 -6
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +18 -4
- data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +10 -0
- data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +6 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +11 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +6 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +43 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +7 -0
- data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +46 -0
- data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +7 -0
- data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +30 -30
- data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +2 -2
- data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +3 -3
- data/app/views/decidim/assemblies/assemblies/index.html.erb +11 -8
- data/app/views/decidim/assemblies/assemblies/show.html.erb +11 -14
- data/app/views/decidim/assemblies/assembly_members/index.html.erb +1 -1
- data/app/views/layouts/decidim/admin/assemblies.html.erb +22 -0
- data/app/views/layouts/decidim/admin/assembly.html.erb +2 -2
- data/app/views/layouts/decidim/assembly.html.erb +1 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +60 -27
- data/config/locales/bg-BG.yml +7 -0
- data/config/locales/bg.yml +7 -0
- data/config/locales/ca.yml +101 -1
- data/config/locales/cs.yml +152 -52
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +99 -0
- data/config/locales/el-GR.yml +1 -0
- data/config/locales/el.yml +475 -0
- data/config/locales/en.yml +100 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +100 -0
- data/config/locales/es-PY.yml +100 -0
- data/config/locales/es.yml +100 -0
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +11 -0
- data/config/locales/fi-plain.yml +97 -0
- data/config/locales/fi.yml +103 -6
- data/config/locales/fr-CA.yml +478 -0
- data/config/locales/fr.yml +100 -0
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +11 -0
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +85 -2
- data/config/locales/id-ID.yml +11 -0
- data/config/locales/is-IS.yml +263 -0
- data/config/locales/is.yml +263 -0
- data/config/locales/it.yml +171 -74
- data/config/locales/ja-JP.yml +471 -0
- data/config/locales/ja.yml +471 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +454 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +103 -6
- data/config/locales/no.yml +349 -7
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +250 -151
- data/config/locales/pt-BR.yml +12 -1
- data/config/locales/pt.yml +217 -118
- data/config/locales/ro-RO.yml +441 -0
- data/config/locales/ru.yml +11 -0
- data/config/locales/sk-SK.yml +168 -0
- data/config/locales/sk.yml +172 -0
- data/config/locales/sl.yml +283 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +73 -0
- data/config/locales/sv.yml +188 -88
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +30 -0
- data/config/locales/uk.yml +11 -0
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +471 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200108113855_create_decidim_assembly_types.rb +19 -0
- data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +83 -0
- data/db/migrate/20200320105906_index_foreign_keys_in_decidim_assemblies.rb +7 -0
- data/db/migrate/20200320105907_index_foreign_keys_in_decidim_assembly_user_roles.rb +7 -0
- data/db/migrate/20200416132109_remove_legacy_decidim_assembly_type.rb +8 -0
- data/db/migrate/20200430202456_create_decidim_assemblies_settings.rb +10 -0
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/lib/decidim/assemblies/admin_engine.rb +10 -0
- data/lib/decidim/assemblies/engine.rb +8 -1
- data/lib/decidim/assemblies/participatory_space.rb +29 -15
- data/lib/decidim/assemblies/query_extensions.rb +40 -0
- data/lib/decidim/assemblies/test/factories.rb +32 -5
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +93 -13
- data/app/views/decidim/assemblies/assembly_widgets/show.html.erb +0 -11
@@ -2,14 +2,14 @@
|
|
2
2
|
<div class="card__support">
|
3
3
|
<% if has_assembly_type? %>
|
4
4
|
<div class="card__support__data--left">
|
5
|
-
|
5
|
+
<div><%= t("assemblies.show.assembly_type", scope: "decidim") %></div>
|
6
6
|
<div class="text-ellipsis"><strong><%= assembly_type %></strong></div>
|
7
7
|
</div>
|
8
8
|
<% end %>
|
9
9
|
<%= link_to(
|
10
10
|
t(model.cta_button_text_key, scope: "layouts.decidim.assemblies.assembly"),
|
11
11
|
resource_path,
|
12
|
-
class: "card__button button button--sc
|
12
|
+
class: "card__button button button--sc small"
|
13
13
|
) %>
|
14
14
|
</div>
|
15
15
|
</div>
|
@@ -36,6 +36,10 @@ module Decidim
|
|
36
36
|
[:creation_date, :follow, :children_count]
|
37
37
|
end
|
38
38
|
|
39
|
+
def creation_date_status
|
40
|
+
l(model.creation_date, format: :decidim_short) if model.creation_date
|
41
|
+
end
|
42
|
+
|
39
43
|
def children_count_status
|
40
44
|
content_tag(
|
41
45
|
:strong,
|
@@ -64,11 +68,7 @@ module Decidim
|
|
64
68
|
end
|
65
69
|
|
66
70
|
def assembly_type
|
67
|
-
|
68
|
-
translated_attribute(model.assembly_type_other)
|
69
|
-
else
|
70
|
-
t("assembly_types.#{model.assembly_type}", scope: "decidim.assemblies").to_s
|
71
|
-
end
|
71
|
+
translated_attribute model.assembly_type.title
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="column">
|
2
|
-
<
|
2
|
+
<div class="card card--member">
|
3
3
|
<div class="card__content">
|
4
4
|
<div class="card__header collapse">
|
5
5
|
<div class="author-data author-data--big">
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="author author--flex">
|
8
8
|
<% if has_profile? %>
|
9
9
|
<%= link_to profile_url, class: "author__avatar" do %>
|
10
|
-
<%= image_tag model.avatar_url(:big) %>
|
10
|
+
<%= image_tag model.avatar_url(:big), alt: "member-avatar" %>
|
11
11
|
<% end %>
|
12
12
|
<div>
|
13
13
|
<div class="author__name--container">
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<% end %>
|
25
25
|
</div>
|
26
26
|
<% else %>
|
27
|
-
<div class="author__avatar"><%= image_tag asset_path("decidim/default-avatar.svg") %></div>
|
27
|
+
<div class="author__avatar"><%= image_tag asset_path("decidim/default-avatar.svg"), alt: "member-avatar" %></div>
|
28
28
|
<div>
|
29
29
|
<div class="author__name--container">
|
30
30
|
<div class="author__name">
|
@@ -49,5 +49,5 @@
|
|
49
49
|
<div class="text-small mt-s"><%= personal_information %></div>
|
50
50
|
</div>
|
51
51
|
</div>
|
52
|
-
</
|
52
|
+
</div>
|
53
53
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<section class="wrapper-home home-section">
|
1
|
+
<section class="wrapper-home home-section" xmlns="http://www.w3.org/1999/xhtml">
|
2
2
|
<div class="row" id="highlighted-assemblies">
|
3
3
|
<h3 class="section-heading"><%= t("active_assemblies", scope: i18n_scope) %></h3>
|
4
4
|
<div class="row collapse">
|
@@ -6,17 +6,13 @@
|
|
6
6
|
large-up-4 card-grid">
|
7
7
|
<% highlighted_assemblies.each do |assembly| %>
|
8
8
|
<div class="column">
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
style="background-image:url(<%= assembly.hero_image.url %>)"></div>
|
13
|
-
<% end %>
|
9
|
+
<%= link_to decidim_assemblies.assembly_path(assembly), class: "card card--assembly card--mini" do %>
|
10
|
+
<div aria-hidden="true" class="card__image-top"
|
11
|
+
style="background-image:url(<%= assembly.hero_image.url %>)"></div>
|
14
12
|
<div class="card__content">
|
15
|
-
|
16
|
-
<h4 class="card__title"><%= translated_attribute assembly.title %></h4>
|
17
|
-
<% end %>
|
13
|
+
<span class="card__title card__link"><%= translated_attribute assembly.title %></span>
|
18
14
|
</div>
|
19
|
-
|
15
|
+
<% end %>
|
20
16
|
</div>
|
21
17
|
<% end %>
|
22
18
|
</div>
|
@@ -25,7 +21,10 @@
|
|
25
21
|
<div class="row" id="see-all-assemblies">
|
26
22
|
<div class="columns small-centered small-12
|
27
23
|
smallmedium-8 medium-6 large-4">
|
28
|
-
<%= link_to t("see_all_assemblies", scope: i18n_scope),
|
24
|
+
<%= link_to t("see_all_assemblies", scope: i18n_scope),
|
25
|
+
decidim_assemblies.assemblies_path,
|
26
|
+
class: "button expanded hollow button--sc home-section__cta",
|
27
|
+
title: t("assemblies_button_title", scope: i18n_scope) %>
|
29
28
|
</div>
|
30
29
|
</div>
|
31
30
|
</section>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic when creating a new assembly
|
7
|
+
# type in the system.
|
8
|
+
class CreateAssembliesType < Rectify::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# form - A form object with the params.
|
12
|
+
def initialize(form)
|
13
|
+
@form = form
|
14
|
+
end
|
15
|
+
|
16
|
+
# Executes the command. Broadcasts these events:
|
17
|
+
#
|
18
|
+
# - :ok when everything is valid.
|
19
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
20
|
+
#
|
21
|
+
# Returns nothing.
|
22
|
+
def call
|
23
|
+
return broadcast(:invalid) if form.invalid?
|
24
|
+
|
25
|
+
create_assemblies_type!
|
26
|
+
|
27
|
+
broadcast(:ok)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :form
|
33
|
+
|
34
|
+
def create_assemblies_type!
|
35
|
+
Decidim.traceability.create!(
|
36
|
+
AssembliesType,
|
37
|
+
form.current_user,
|
38
|
+
organization: form.current_organization,
|
39
|
+
title: form.title
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -67,7 +67,6 @@ module Decidim
|
|
67
67
|
purpose_of_action: form.purpose_of_action,
|
68
68
|
composition: form.composition,
|
69
69
|
assembly_type: form.assembly_type,
|
70
|
-
assembly_type_other: form.assembly_type_other,
|
71
70
|
creation_date: form.creation_date,
|
72
71
|
created_by: form.created_by,
|
73
72
|
created_by_other: form.created_by_other,
|
@@ -104,7 +103,7 @@ module Decidim
|
|
104
103
|
end
|
105
104
|
|
106
105
|
def link_participatory_processes(assembly)
|
107
|
-
assembly.
|
106
|
+
assembly.link_participatory_space_resources(participatory_processes(assembly), "included_participatory_processes")
|
108
107
|
end
|
109
108
|
end
|
110
109
|
end
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new participatory
|
7
7
|
# process admin in the system.
|
8
|
-
class CreateAssemblyAdmin <
|
8
|
+
class CreateAssemblyAdmin < NotifyRoleAssignedToAssembly
|
9
9
|
# Public: Initializes the command.
|
10
10
|
#
|
11
11
|
# form - A form object with the params.
|
@@ -57,6 +57,7 @@ module Decidim
|
|
57
57
|
assembly: @assembly
|
58
58
|
)
|
59
59
|
end
|
60
|
+
send_notification user
|
60
61
|
end
|
61
62
|
|
62
63
|
def existing_user
|
@@ -25,9 +25,8 @@ module Decidim
|
|
25
25
|
def call
|
26
26
|
return broadcast(:invalid) if form.invalid?
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
end
|
28
|
+
create_assembly_member!
|
29
|
+
notify_assembly_member_about_new_membership
|
31
30
|
|
32
31
|
broadcast(:ok)
|
33
32
|
end
|
@@ -67,6 +66,16 @@ module Decidim
|
|
67
66
|
log_info
|
68
67
|
)
|
69
68
|
end
|
69
|
+
|
70
|
+
def notify_assembly_member_about_new_membership
|
71
|
+
data = {
|
72
|
+
event: "decidim.events.assemblies.create_assembly_member",
|
73
|
+
event_class: Decidim::Assemblies::CreateAssemblyMemberEvent,
|
74
|
+
resource: assembly,
|
75
|
+
followers: [form.user]
|
76
|
+
}
|
77
|
+
Decidim::EventsManager.publish(data)
|
78
|
+
end
|
70
79
|
end
|
71
80
|
end
|
72
81
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic when destroying an assembly
|
7
|
+
# type in the system.
|
8
|
+
class DestroyAssembliesType < Rectify::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# assemblies_type - the AssemblyMember to destroy
|
12
|
+
# current_user - the user performing the action
|
13
|
+
def initialize(assemblies_type, current_user)
|
14
|
+
@assemblies_type = assemblies_type
|
15
|
+
@current_user = current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
destroy_assembly_type!
|
26
|
+
broadcast(:ok)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :current_user
|
32
|
+
|
33
|
+
def destroy_assembly_type!
|
34
|
+
Decidim.traceability.perform_action!(
|
35
|
+
"delete",
|
36
|
+
@assemblies_type,
|
37
|
+
current_user
|
38
|
+
) do
|
39
|
+
@assemblies_type.destroy!
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic to import a new assembly
|
7
|
+
# in the system.
|
8
|
+
class ImportAssembly < Rectify::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# form - A form object with the params.
|
12
|
+
# assembly - An assembly we want to duplicate
|
13
|
+
def initialize(form)
|
14
|
+
@form = form
|
15
|
+
end
|
16
|
+
|
17
|
+
# Executes the command. Broadcasts these events:
|
18
|
+
#
|
19
|
+
# - :ok when everything is valid.
|
20
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
21
|
+
#
|
22
|
+
# Returns nothing.
|
23
|
+
def call
|
24
|
+
return broadcast(:invalid) if form.invalid?
|
25
|
+
|
26
|
+
transaction do
|
27
|
+
import_assembly
|
28
|
+
add_admins_as_followers(@imported_assembly)
|
29
|
+
end
|
30
|
+
|
31
|
+
broadcast(:ok, @imported_assembly)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :form
|
37
|
+
|
38
|
+
def import_assembly
|
39
|
+
importer = Decidim::Assemblies::AssemblyImporter.new(form.current_organization, form.current_user)
|
40
|
+
assemblies.each do |original_assembly|
|
41
|
+
@imported_assembly = importer.import(original_assembly, form.current_user, title: form.title, slug: form.slug)
|
42
|
+
importer.import_assemblies_type(original_assembly["decidim_assemblies_type_id"])
|
43
|
+
importer.import_categories(original_assembly["assembly_categories"]) if form.import_categories?
|
44
|
+
importer.import_folders_and_attachments(original_assembly["attachments"]) if form.import_attachments?
|
45
|
+
importer.import_components(original_assembly["components"]) if form.import_components?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def assemblies
|
50
|
+
document_parsed(form.document_text)
|
51
|
+
end
|
52
|
+
|
53
|
+
def document_parsed(document_text)
|
54
|
+
JSON.parse(document_text)
|
55
|
+
end
|
56
|
+
|
57
|
+
def add_admins_as_followers(assembly)
|
58
|
+
assembly.organization.admins.each do |admin|
|
59
|
+
form = Decidim::FollowForm
|
60
|
+
.from_params(followable_gid: assembly.to_signed_global_id.to_s)
|
61
|
+
.with_context(
|
62
|
+
current_organization: assembly.organization,
|
63
|
+
current_user: admin
|
64
|
+
)
|
65
|
+
|
66
|
+
Decidim::CreateFollow.new(form, admin).call
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# A command to notify users when a role is assigned for an assembly
|
7
|
+
class NotifyRoleAssignedToAssembly < Rectify::Command
|
8
|
+
def send_notification(user)
|
9
|
+
Decidim::EventsManager.publish(
|
10
|
+
event: "decidim.events.assembly.role_assigned",
|
11
|
+
event_class: Decidim::RoleAssignedToAssemblyEvent,
|
12
|
+
resource: form.current_participatory_space,
|
13
|
+
affected_users: [user],
|
14
|
+
extra: {
|
15
|
+
role: form.role
|
16
|
+
}
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic when updating assemblies
|
7
|
+
# settings in admin area.
|
8
|
+
class UpdateAssembliesSetting < Rectify::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# assemblies_setting - A assemblies_setting object to update.
|
12
|
+
# form - A form object with the params.
|
13
|
+
def initialize(assemblies_settings, form)
|
14
|
+
@assemblies_settings = assemblies_settings
|
15
|
+
@form = form
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form or assemblies_settings isn't valid and we couldn't proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if form.invalid? || assemblies_settings.invalid?
|
26
|
+
|
27
|
+
update_assemblies_setting!
|
28
|
+
|
29
|
+
broadcast(:ok)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :form, :assemblies_settings
|
35
|
+
|
36
|
+
def update_assemblies_setting!
|
37
|
+
Decidim.traceability.update!(
|
38
|
+
@assemblies_settings,
|
39
|
+
form.current_user,
|
40
|
+
enable_organization_chart: form.enable_organization_chart
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic when updating a new assembly
|
7
|
+
# type in the system.
|
8
|
+
class UpdateAssembliesType < Rectify::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# assemblies_type - A assemblies_type object to update.
|
12
|
+
# form - A form object with the params.
|
13
|
+
def initialize(assemblies_type, form)
|
14
|
+
@assemblies_type = assemblies_type
|
15
|
+
@form = form
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if form.invalid?
|
26
|
+
|
27
|
+
update_assemblies_type!
|
28
|
+
|
29
|
+
broadcast(:ok)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :form
|
35
|
+
|
36
|
+
def update_assemblies_type!
|
37
|
+
Decidim.traceability.update!(
|
38
|
+
@assemblies_type,
|
39
|
+
form.current_user,
|
40
|
+
title: form.title
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|