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
@@ -62,10 +62,6 @@ module Decidim
|
|
62
62
|
subtitle: form.subtitle,
|
63
63
|
slug: form.slug,
|
64
64
|
hashtag: form.hashtag,
|
65
|
-
hero_image: form.hero_image,
|
66
|
-
remove_hero_image: form.remove_hero_image,
|
67
|
-
banner_image: form.banner_image,
|
68
|
-
remove_banner_image: form.remove_banner_image,
|
69
65
|
promoted: form.promoted,
|
70
66
|
description: form.description,
|
71
67
|
short_description: form.short_description,
|
@@ -84,7 +80,6 @@ module Decidim
|
|
84
80
|
purpose_of_action: form.purpose_of_action,
|
85
81
|
composition: form.composition,
|
86
82
|
assembly_type: form.assembly_type,
|
87
|
-
assembly_type_other: form.assembly_type_other,
|
88
83
|
creation_date: form.creation_date,
|
89
84
|
created_by: form.created_by,
|
90
85
|
created_by_other: form.created_by_other,
|
@@ -100,7 +95,16 @@ module Decidim
|
|
100
95
|
instagram_handler: form.instagram_handler,
|
101
96
|
youtube_handler: form.youtube_handler,
|
102
97
|
github_handler: form.github_handler
|
103
|
-
}
|
98
|
+
}.merge(uploader_attributes)
|
99
|
+
end
|
100
|
+
|
101
|
+
def uploader_attributes
|
102
|
+
{
|
103
|
+
hero_image: form.hero_image,
|
104
|
+
remove_hero_image: form.remove_hero_image,
|
105
|
+
banner_image: form.banner_image,
|
106
|
+
remove_banner_image: form.remove_banner_image
|
107
|
+
}.delete_if { |_k, val| val.is_a?(Decidim::ApplicationUploader) }
|
104
108
|
end
|
105
109
|
|
106
110
|
def participatory_processes(assembly)
|
@@ -108,7 +112,7 @@ module Decidim
|
|
108
112
|
end
|
109
113
|
|
110
114
|
def link_participatory_processes(assembly)
|
111
|
-
assembly.
|
115
|
+
assembly.link_participatory_space_resources(participatory_processes(assembly), "included_participatory_processes")
|
112
116
|
end
|
113
117
|
|
114
118
|
# Resets the children counter cache to its correct value using an SQL count query.
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when updated a participatory
|
7
7
|
# process admin in the system.
|
8
|
-
class UpdateAssemblyAdmin <
|
8
|
+
class UpdateAssemblyAdmin < NotifyRoleAssignedToAssembly
|
9
9
|
# Public: Initializes the command.
|
10
10
|
#
|
11
11
|
# form - A form object with the params.
|
@@ -45,6 +45,7 @@ module Decidim
|
|
45
45
|
{ role: form.role },
|
46
46
|
log_info
|
47
47
|
)
|
48
|
+
send_notification user_role.user
|
48
49
|
end
|
49
50
|
end
|
50
51
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Assemblies
|
7
|
+
module Admin
|
8
|
+
module Filterable
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
include Decidim::Admin::Filterable
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# Unless we are explicitly looking for child assemblies, we filter them out.
|
17
|
+
def base_query
|
18
|
+
return collection if ransack_params[:parent_id_eq]
|
19
|
+
|
20
|
+
collection.parent_assemblies
|
21
|
+
end
|
22
|
+
|
23
|
+
def extra_filters
|
24
|
+
[:parent_id_eq]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -6,13 +6,13 @@ module Decidim
|
|
6
6
|
# Controller that allows managing assemblies.
|
7
7
|
#
|
8
8
|
class AssembliesController < Decidim::Assemblies::Admin::ApplicationController
|
9
|
-
include Decidim::
|
10
|
-
helper_method :current_assembly, :parent_assembly, :
|
9
|
+
include Decidim::Assemblies::Admin::Filterable
|
10
|
+
helper_method :current_assembly, :parent_assembly, :current_participatory_space
|
11
11
|
layout "decidim/admin/assemblies"
|
12
12
|
|
13
13
|
def index
|
14
14
|
enforce_permission_to :read, :assembly_list
|
15
|
-
@assemblies =
|
15
|
+
@assemblies = filtered_collection
|
16
16
|
end
|
17
17
|
|
18
18
|
def new
|
@@ -28,7 +28,7 @@ module Decidim
|
|
28
28
|
CreateAssembly.call(@form) do
|
29
29
|
on(:ok) do |assembly|
|
30
30
|
flash[:notice] = I18n.t("assemblies.create.success", scope: "decidim.admin")
|
31
|
-
redirect_to assemblies_path(
|
31
|
+
redirect_to assemblies_path(q: { parent_id_eq: assembly.parent_id })
|
32
32
|
end
|
33
33
|
|
34
34
|
on(:invalid) do
|
@@ -70,35 +70,20 @@ module Decidim
|
|
70
70
|
|
71
71
|
private
|
72
72
|
|
73
|
-
def organization_assemblies
|
74
|
-
@organization_assemblies ||= OrganizationAssemblies.new(current_user.organization).query
|
75
|
-
end
|
76
|
-
|
77
|
-
def query
|
78
|
-
organization_assemblies
|
79
|
-
.where(parent_id: params[:parent_id])
|
80
|
-
.ransack(params[:q])
|
81
|
-
end
|
82
|
-
|
83
73
|
def collection
|
84
|
-
@collection ||=
|
74
|
+
@collection ||= OrganizationAssemblies.new(current_user.organization).query
|
85
75
|
end
|
86
76
|
|
87
77
|
def current_assembly
|
88
|
-
|
89
|
-
|
90
|
-
scope.where(id: params[:slug])
|
78
|
+
@current_assembly ||= collection.where(slug: params[:slug]).or(
|
79
|
+
collection.where(id: params[:slug])
|
91
80
|
).first
|
92
81
|
end
|
93
82
|
|
94
83
|
alias current_participatory_space current_assembly
|
95
84
|
|
96
85
|
def parent_assembly
|
97
|
-
@parent_assembly ||=
|
98
|
-
end
|
99
|
-
|
100
|
-
def parent_assemblies
|
101
|
-
@parent_assemblies ||= organization_assemblies.where.not(id: current_assembly)
|
86
|
+
@parent_assembly ||= collection.find_by(id: ransack_params[:parent_id_eq])
|
102
87
|
end
|
103
88
|
|
104
89
|
def assembly_params
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# Controller used to manage the assemblies settings for the current
|
7
|
+
# organization.
|
8
|
+
class AssembliesSettingsController < Decidim::Assemblies::Admin::ApplicationController
|
9
|
+
layout "decidim/admin/assemblies"
|
10
|
+
|
11
|
+
# GET /admin/assemblies_settings/edit
|
12
|
+
def edit
|
13
|
+
enforce_permission_to :edit, :assemblies_setting, assemblies_settings: current_assemblies_settings
|
14
|
+
@form = assemblies_settings_form.from_model(current_assemblies_settings)
|
15
|
+
end
|
16
|
+
|
17
|
+
# PUT /admin/assemblies_settings/:id
|
18
|
+
def update
|
19
|
+
enforce_permission_to :update, :assemblies_setting, assemblies_settings: current_assemblies_settings
|
20
|
+
|
21
|
+
@form = assemblies_settings_form
|
22
|
+
.from_params(params, assemblies_settings: current_assemblies_settings)
|
23
|
+
|
24
|
+
UpdateAssembliesSetting.call(current_assemblies_settings, @form) do
|
25
|
+
on(:ok) do
|
26
|
+
flash[:notice] = I18n.t("assemblies_settings.update.success", scope: "decidim.admin")
|
27
|
+
redirect_to edit_assemblies_settings_path
|
28
|
+
end
|
29
|
+
|
30
|
+
on(:invalid) do
|
31
|
+
flash.now[:alert] = I18n.t("assemblies_settings.update.error", scope: "decidim.admin")
|
32
|
+
render :edit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def current_assemblies_settings
|
40
|
+
@current_assemblies_settings ||= Decidim::AssembliesSetting.find_or_create_by!(decidim_organization_id: current_organization.id)
|
41
|
+
end
|
42
|
+
|
43
|
+
def assemblies_settings_form
|
44
|
+
form(Decidim::Assemblies::Admin::AssembliesSettingForm)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# Controller used to manage the available assemblies types for the current
|
7
|
+
# organization.
|
8
|
+
# As this substitues former i18n simple hash we need to keep these i18n keys for migrations
|
9
|
+
# and rollbakcs. So let i18n-tasks know about:
|
10
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.government')
|
11
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.commission')
|
12
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.consultative_advisory')
|
13
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.executive')
|
14
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.others')
|
15
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.participatory')
|
16
|
+
# i18n-tasks-use t('decidim.assemblies.assembly_types.working_group')
|
17
|
+
# This comment (and the i18n keys) may be removed in future versions
|
18
|
+
class AssembliesTypesController < Decidim::Assemblies::Admin::ApplicationController
|
19
|
+
helper_method :available_assemblies_types, :current_assembly_type
|
20
|
+
layout "decidim/admin/assemblies"
|
21
|
+
|
22
|
+
# GET /admin/assemblies_types
|
23
|
+
def index
|
24
|
+
enforce_permission_to :index, :assembly_type
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /admin/assemblies_types/new
|
28
|
+
def new
|
29
|
+
enforce_permission_to :create, :assembly_type
|
30
|
+
@form = assembly_type_form.instance
|
31
|
+
end
|
32
|
+
|
33
|
+
# POST /admin/assemblies_types
|
34
|
+
def create
|
35
|
+
enforce_permission_to :create, :assembly_type
|
36
|
+
@form = assembly_type_form.from_params(params)
|
37
|
+
|
38
|
+
CreateAssembliesType.call(@form) do
|
39
|
+
on(:ok) do |_assembly_type|
|
40
|
+
flash[:notice] = I18n.t("assemblies_types.create.success", scope: "decidim.admin")
|
41
|
+
redirect_to assemblies_types_path
|
42
|
+
end
|
43
|
+
|
44
|
+
on(:invalid) do
|
45
|
+
flash.now[:alert] = I18n.t("assemblies_types.create.error", scope: "decidim.admin")
|
46
|
+
render :new
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# GET /admin/assemblies_types/:id/edit
|
52
|
+
def edit
|
53
|
+
enforce_permission_to :edit, :assembly_type, assembly_type: current_assembly_type
|
54
|
+
@form = assembly_type_form
|
55
|
+
.from_model(current_assembly_type,
|
56
|
+
assembly_type: current_assembly_type)
|
57
|
+
end
|
58
|
+
|
59
|
+
# PUT /admin/assemblies_types/:id
|
60
|
+
def update
|
61
|
+
enforce_permission_to :update, :assembly_type, assembly_type: current_assembly_type
|
62
|
+
|
63
|
+
@form = assembly_type_form
|
64
|
+
.from_params(params, assembly_type: current_assembly_type)
|
65
|
+
|
66
|
+
UpdateAssembliesType.call(current_assembly_type, @form) do
|
67
|
+
on(:ok) do
|
68
|
+
flash[:notice] = I18n.t("assemblies_types.update.success", scope: "decidim.admin")
|
69
|
+
redirect_to assemblies_types_path
|
70
|
+
end
|
71
|
+
|
72
|
+
on(:invalid) do
|
73
|
+
flash.now[:alert] = I18n.t("assemblies_types.update.error", scope: "decidim.admin")
|
74
|
+
render :edit
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# DELETE /admin/assemblies_types/:id
|
80
|
+
def destroy
|
81
|
+
enforce_permission_to :destroy, :assembly_type, assembly_type: current_assembly_type
|
82
|
+
|
83
|
+
DestroyAssembliesType.call(current_assembly_type, current_user) do
|
84
|
+
on(:ok) do
|
85
|
+
flash[:notice] = I18n.t("assemblies_types.destroy.success", scope: "decidim.admin")
|
86
|
+
redirect_to assemblies_types_path
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def available_assemblies_types
|
94
|
+
@available_assemblies_types ||= AssembliesType.where(organization: current_organization)
|
95
|
+
end
|
96
|
+
|
97
|
+
def current_assembly_type
|
98
|
+
@current_assembly_type ||= AssembliesType.find(params[:id])
|
99
|
+
end
|
100
|
+
|
101
|
+
def assembly_type_form
|
102
|
+
form(Decidim::Assemblies::Admin::AssembliesTypeForm)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
class AssemblyExportsController < Decidim::Admin::ApplicationController
|
7
|
+
include Concerns::AssemblyAdmin
|
8
|
+
include Decidim::Admin::ParticipatorySpaceExport
|
9
|
+
|
10
|
+
def exportable_space
|
11
|
+
current_assembly
|
12
|
+
end
|
13
|
+
|
14
|
+
def manifest_name
|
15
|
+
current_assembly.manifest.name.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def after_export_path
|
19
|
+
assembly_path(current_assembly.slug)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
class AssemblyImportsController < Decidim::Assemblies::Admin::ApplicationController
|
7
|
+
def new
|
8
|
+
enforce_permission_to :import, :assembly
|
9
|
+
@form = form(AssemblyImportForm).instance
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
enforce_permission_to :import, :assembly
|
14
|
+
@form = form(AssemblyImportForm).from_params(params)
|
15
|
+
|
16
|
+
ImportAssembly.call(@form) do
|
17
|
+
on(:ok) do
|
18
|
+
flash[:notice] = I18n.t("assembly_imports.create.success", scope: "decidim.admin")
|
19
|
+
redirect_to assemblies_path
|
20
|
+
end
|
21
|
+
|
22
|
+
on(:invalid) do
|
23
|
+
flash.now[:alert] = I18n.t("assembly_imports.create.error", scope: "decidim.admin")
|
24
|
+
render :new
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -25,12 +25,13 @@ module Decidim
|
|
25
25
|
CreateAssemblyAdmin.call(@form, current_user, current_assembly) do
|
26
26
|
on(:ok) do
|
27
27
|
flash[:notice] = I18n.t("assembly_user_roles.create.success", scope: "decidim.admin")
|
28
|
+
redirect_to assembly_user_roles_path(current_assembly)
|
28
29
|
end
|
29
30
|
|
30
31
|
on(:invalid) do
|
31
32
|
flash[:alert] = I18n.t("assembly_user_roles.create.error", scope: "decidim.admin")
|
33
|
+
render :new
|
32
34
|
end
|
33
|
-
redirect_to assembly_user_roles_path(current_assembly)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
participatory_space_layout only: :show
|
9
9
|
include FilterResource
|
10
10
|
|
11
|
-
helper_method :parent_assemblies, :promoted_assemblies, :stats, :assembly_participatory_processes
|
11
|
+
helper_method :parent_assemblies, :promoted_assemblies, :stats, :assembly_participatory_processes, :current_assemblies_settings
|
12
12
|
|
13
13
|
def index
|
14
14
|
enforce_permission_to :list, :assembly
|
@@ -56,7 +56,7 @@ module Decidim
|
|
56
56
|
{
|
57
57
|
scope_id: nil,
|
58
58
|
area_id: nil,
|
59
|
-
|
59
|
+
type_id: nil
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
@@ -87,6 +87,10 @@ module Decidim
|
|
87
87
|
def assembly_participatory_processes
|
88
88
|
@assembly_participatory_processes ||= @current_participatory_space.linked_participatory_space_resources(:participatory_processes, "included_participatory_processes")
|
89
89
|
end
|
90
|
+
|
91
|
+
def current_assemblies_settings
|
92
|
+
@current_assemblies_settings ||= Decidim::AssembliesSetting.find_or_create_by(decidim_organization_id: current_organization.id)
|
93
|
+
end
|
90
94
|
end
|
91
95
|
end
|
92
96
|
end
|
data/app/controllers/decidim/assemblies/{assembly_widgets_controller.rb → widgets_controller.rb}
RENAMED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Assemblies
|
5
|
-
class
|
5
|
+
class WidgetsController < Decidim::WidgetsController
|
6
6
|
helper Decidim::SanitizeHelper
|
7
7
|
|
8
8
|
private
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def iframe_url
|
19
|
-
@iframe_url ||=
|
19
|
+
@iframe_url ||= assembly_widget_url(model)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
class CreateAssemblyMemberEvent < Decidim::Events::SimpleEvent
|
6
|
+
i18n_attributes :resource_name
|
7
|
+
|
8
|
+
def resource_name
|
9
|
+
@resource_name ||= translated_attribute(assembly.title)
|
10
|
+
end
|
11
|
+
|
12
|
+
def assembly
|
13
|
+
@assembly ||= resource
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|