decidim-assemblies 0.27.10 → 0.28.0.rc4
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/assemblies/show.erb +16 -0
- data/app/cells/decidim/assemblies/assemblies_cell.rb +24 -0
- data/app/cells/decidim/assemblies/assembly_cell.rb +7 -2
- data/app/cells/decidim/assemblies/assembly_dropdown_metadata_cell.rb +19 -0
- data/app/cells/decidim/assemblies/assembly_g_cell.rb +23 -0
- data/app/cells/decidim/assemblies/assembly_member/data.erb +19 -0
- data/app/cells/decidim/assemblies/assembly_member/name_and_position.erb +11 -0
- data/app/cells/decidim/assemblies/assembly_member/show.erb +8 -52
- data/app/cells/decidim/assemblies/assembly_metadata_g_cell.rb +46 -0
- data/app/cells/decidim/assemblies/assembly_s_cell.rb +15 -0
- data/app/cells/decidim/assemblies/content_block_cell.rb +21 -0
- data/app/cells/decidim/assemblies/content_blocks/children_assemblies_cell.rb +27 -0
- data/app/cells/decidim/assemblies/content_blocks/dates_metadata_cell.rb +23 -0
- data/app/cells/decidim/assemblies/content_blocks/extra_data_cell.rb +39 -0
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +15 -23
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form/show.erb +1 -1
- data/app/cells/decidim/assemblies/content_blocks/main_data_cell.rb +52 -0
- data/app/cells/decidim/assemblies/content_blocks/metadata_cell.rb +23 -0
- data/app/cells/decidim/assemblies/content_blocks/related_assemblies/content.erb +1 -0
- data/app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb +34 -0
- data/app/cells/decidim/assemblies/content_blocks/stats_cell.rb +15 -0
- data/app/commands/decidim/assemblies/admin/copy_assembly.rb +2 -2
- data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +2 -1
- data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +3 -3
- data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/destroy_assembly_member.rb +1 -1
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assembly_member.rb +1 -1
- data/app/constraints/decidim/assemblies/current_assembly.rb +1 -1
- data/app/controllers/concerns/decidim/assemblies/admin/assembly_context.rb +1 -1
- data/app/controllers/concerns/decidim/assemblies/admin/assembly_members/filterable.rb +39 -0
- data/app/controllers/concerns/decidim/assemblies/assembly_breadcrumb.rb +36 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +1 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/assembly_attachment_collections_controller.rb +5 -0
- data/app/controllers/decidim/assemblies/admin/assembly_attachments_controller.rb +5 -0
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +2 -0
- data/app/controllers/decidim/assemblies/admin/assembly_landing_page_content_blocks_controller.rb +35 -0
- data/app/controllers/decidim/assemblies/admin/assembly_landing_page_controller.rb +37 -0
- data/app/controllers/decidim/assemblies/admin/assembly_members_controller.rb +2 -6
- data/app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb +9 -29
- data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +8 -91
- data/app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb +1 -1
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +12 -7
- data/app/controllers/decidim/assemblies/assembly_members_controller.rb +2 -0
- data/app/events/decidim/assemblies/create_assembly_member_event.rb +1 -1
- data/app/events/decidim/role_assigned_to_assembly_event.rb +11 -6
- data/app/forms/decidim/assemblies/admin/assembly_copy_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_user_role_form.rb +2 -18
- data/app/helpers/decidim/assemblies/admin/assembly_members_helper.rb +11 -0
- data/app/helpers/decidim/assemblies/application_helper.rb +12 -0
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +21 -19
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +15 -30
- data/app/models/decidim/assembly.rb +6 -5
- data/app/models/decidim/assembly_user_role.rb +5 -33
- data/app/packs/entrypoints/decidim_assemblies.js +0 -1
- data/app/packs/src/decidim/assemblies/admin/assemblies.js +2 -2
- data/app/packs/src/decidim/assemblies/orgchart.js +0 -701
- data/app/permissions/decidim/assemblies/permissions.rb +14 -27
- data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_member_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_user_role_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/assembly_presenter.rb +38 -0
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +2 -41
- data/app/presenters/decidim/assembly_member_presenter.rb +18 -4
- data/app/queries/decidim/assemblies/admin/admin_users.rb +1 -1
- data/app/queries/decidim/assemblies/assemblies_with_user_role.rb +2 -2
- data/app/serializers/decidim/assemblies/assembly_importer.rb +3 -3
- data/app/serializers/decidim/assemblies/assembly_serializer.rb +1 -1
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +218 -176
- data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +25 -11
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +105 -115
- data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +16 -9
- data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +6 -8
- data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +11 -5
- data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +34 -35
- data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +16 -6
- data/app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb +12 -20
- data/app/views/decidim/assemblies/admin/assembly_copies/new.html.erb +17 -5
- data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +28 -37
- data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +17 -5
- data/app/views/decidim/assemblies/admin/assembly_members/_form.html.erb +45 -49
- data/app/views/decidim/assemblies/admin/assembly_members/edit.html.erb +17 -6
- data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +51 -88
- data/app/views/decidim/assemblies/admin/assembly_members/new.html.erb +17 -6
- data/app/views/decidim/assemblies/admin/assembly_user_roles/_form.html.erb +14 -18
- data/app/views/decidim/assemblies/admin/assembly_user_roles/edit.html.erb +17 -6
- data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +54 -55
- data/app/views/decidim/assemblies/admin/assembly_user_roles/new.html.erb +17 -6
- data/app/views/decidim/assemblies/assemblies/_collection.html.erb +7 -0
- data/app/views/decidim/assemblies/assemblies/index.html.erb +20 -19
- data/app/views/decidim/assemblies/assemblies/index.js.erb +1 -8
- data/app/views/decidim/assemblies/assemblies/show.html.erb +17 -207
- data/app/views/decidim/assemblies/assembly_members/index.html.erb +7 -5
- data/app/views/decidim/assemblies/pages/user_profile/_member_of.html.erb +6 -9
- data/app/views/layouts/decidim/admin/_manage_assemblies.html.erb +36 -0
- data/app/views/layouts/decidim/admin/assemblies.html.erb +13 -11
- data/app/views/layouts/decidim/admin/assemblies_imports.html.erb +9 -0
- data/app/views/layouts/decidim/admin/assemblies_types.html.erb +17 -0
- data/app/views/layouts/decidim/admin/assembly.html.erb +12 -13
- data/app/views/layouts/decidim/assembly.html.erb +7 -14
- data/config/locales/ar.yml +7 -68
- data/config/locales/bg.yml +0 -466
- data/config/locales/ca.yml +62 -71
- data/config/locales/cs.yml +59 -66
- data/config/locales/de.yml +60 -69
- data/config/locales/el.yml +11 -61
- data/config/locales/en.yml +57 -66
- data/config/locales/es-MX.yml +57 -66
- data/config/locales/es-PY.yml +57 -66
- data/config/locales/es.yml +63 -72
- data/config/locales/eu.yml +57 -70
- data/config/locales/fi-plain.yml +58 -67
- data/config/locales/fi.yml +57 -66
- data/config/locales/fr-CA.yml +57 -66
- data/config/locales/fr.yml +57 -66
- data/config/locales/ga-IE.yml +4 -15
- data/config/locales/gl.yml +4 -62
- data/config/locales/hu.yml +33 -65
- data/config/locales/id-ID.yml +6 -47
- data/config/locales/is-IS.yml +5 -40
- data/config/locales/it.yml +5 -62
- data/config/locales/ja.yml +51 -66
- data/config/locales/kaa.yml +0 -8
- data/config/locales/ko.yml +0 -92
- data/config/locales/lb.yml +5 -61
- data/config/locales/lt.yml +40 -63
- data/config/locales/lv.yml +5 -57
- data/config/locales/nl.yml +4 -62
- data/config/locales/no.yml +5 -62
- data/config/locales/pl.yml +3 -93
- data/config/locales/pt-BR.yml +77 -132
- data/config/locales/pt.yml +5 -62
- data/config/locales/ro-RO.yml +20 -63
- data/config/locales/ru.yml +4 -44
- data/config/locales/sk.yml +0 -26
- data/config/locales/sl.yml +5 -48
- data/config/locales/sq-AL.yml +0 -364
- data/config/locales/sr-CS.yml +0 -5
- data/config/locales/sv.yml +132 -193
- data/config/locales/tr-TR.yml +8 -69
- data/config/locales/uk.yml +4 -44
- data/config/locales/zh-CN.yml +5 -60
- data/config/locales/zh-TW.yml +7 -63
- data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +1 -1
- data/lib/decidim/api/assemblies_type_type.rb +1 -1
- data/lib/decidim/api/assembly_member_type.rb +1 -1
- data/lib/decidim/api/assembly_type.rb +1 -1
- data/lib/decidim/assemblies/admin_engine.rb +21 -126
- data/lib/decidim/assemblies/content_blocks/registry_manager.rb +184 -0
- data/lib/decidim/assemblies/engine.rb +15 -21
- data/lib/decidim/assemblies/menu.rb +161 -0
- data/lib/decidim/assemblies/participatory_space.rb +7 -229
- data/lib/decidim/assemblies/query_extensions.rb +6 -6
- data/lib/decidim/assemblies/seeds.rb +161 -0
- data/lib/decidim/assemblies/test/factories.rb +47 -55
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +54 -51
- data/app/cells/decidim/assemblies/assembly_m/footer.erb +0 -15
- data/app/cells/decidim/assemblies/assembly_m/tags.erb +0 -1
- data/app/cells/decidim/assemblies/assembly_m_cell.rb +0 -77
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +0 -30
- data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +0 -54
- data/app/commands/decidim/assemblies/admin/destroy_assembly_admin.rb +0 -58
- data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +0 -22
- data/app/commands/decidim/assemblies/admin/publish_assembly.rb +0 -39
- data/app/commands/decidim/assemblies/admin/unpublish_assembly.rb +0 -39
- data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +0 -46
- data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +0 -53
- data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +0 -49
- data/app/controllers/decidim/assemblies/widgets_controller.rb +0 -33
- data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +0 -14
- data/app/models/decidim/assemblies_setting.rb +0 -17
- data/app/queries/decidim/assemblies/admin/assembly_members.rb +0 -56
- data/app/views/decidim/assemblies/_filter_by_type.html.erb +0 -19
- data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +0 -10
- data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +0 -7
- data/app/views/decidim/assemblies/assemblies/_count.html.erb +0 -1
- data/app/views/decidim/assemblies/assemblies/_nav_breadcumb.html.erb +0 -11
- data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +0 -15
- data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +0 -27
- data/app/views/layouts/decidim/_assembly_header.html.erb +0 -27
- data/app/views/layouts/decidim/_assembly_navigation.html.erb +0 -24
- data/app/views/layouts/decidim/admin/assembly_members.html.erb +0 -18
- data/config/locales/he-IL.yml +0 -110
- data/db/seeds/Exampledocument.pdf +0 -0
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/db/seeds/homepage_image.jpg +0 -0
- data/decidim-assemblies.gemspec +0 -32
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
# Executes the command. Broadcasts these events:
|
22
22
|
#
|
23
23
|
# - :ok when everything is valid.
|
24
|
-
# - :invalid if the form
|
24
|
+
# - :invalid if the form was not valid and we could not proceed.
|
25
25
|
#
|
26
26
|
# Returns nothing.
|
27
27
|
def call
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
# Executes the command. Broadcasts these events:
|
21
21
|
#
|
22
22
|
# - :ok when everything is valid.
|
23
|
-
# - :invalid if the form
|
23
|
+
# - :invalid if the form was not valid and we could not proceed.
|
24
24
|
#
|
25
25
|
# Returns nothing.
|
26
26
|
def call
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Assemblies
|
5
|
-
# This class infers the current assembly we
|
5
|
+
# This class infers the current assembly we are scoped to by
|
6
6
|
# looking at the request parameters and the organization in the request
|
7
7
|
# environment, and injects it into the environment.
|
8
8
|
class CurrentAssembly
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Assemblies
|
5
5
|
module Admin
|
6
|
-
# This module, when injected into a controller, ensures there
|
6
|
+
# This module, when injected into a controller, ensures there is a
|
7
7
|
# Assembly available and deducts it from the context.
|
8
8
|
module AssemblyContext
|
9
9
|
def self.extended(base)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Assemblies
|
7
|
+
module Admin
|
8
|
+
module AssemblyMembers
|
9
|
+
module Filterable
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
include Decidim::Admin::Filterable
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def filters
|
18
|
+
[:ceased_date_not_null]
|
19
|
+
end
|
20
|
+
|
21
|
+
def filters_with_values
|
22
|
+
{
|
23
|
+
ceased_date_not_null: %w(true false)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def base_query
|
28
|
+
collection
|
29
|
+
end
|
30
|
+
|
31
|
+
def search_field_predicate
|
32
|
+
:full_name_or_user_name_or_user_nickname_cont
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
# Concern to provide a specific breadcrumb item to controllers using it
|
6
|
+
module AssemblyBreadcrumb
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def current_participatory_space_breadcrumb_item
|
12
|
+
return {} if current_participatory_space.blank?
|
13
|
+
|
14
|
+
dropdown_cell = current_participatory_space_manifest.breadcrumb_cell
|
15
|
+
|
16
|
+
items = current_participatory_space.ancestors.map do |participatory_space|
|
17
|
+
{
|
18
|
+
label: participatory_space.title,
|
19
|
+
url: Decidim::ResourceLocatorPresenter.new(participatory_space).path,
|
20
|
+
active: false,
|
21
|
+
dropdown_cell:,
|
22
|
+
resource: participatory_space
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
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
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -7,6 +7,7 @@ module Decidim
|
|
7
7
|
#
|
8
8
|
class AssembliesController < Decidim::Assemblies::Admin::ApplicationController
|
9
9
|
include Decidim::Assemblies::Admin::Filterable
|
10
|
+
include Decidim::Admin::ParticipatorySpaceAdminBreadcrumb
|
10
11
|
helper_method :current_assembly, :parent_assembly, :current_participatory_space
|
11
12
|
layout "decidim/admin/assemblies"
|
12
13
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
# This comment (and the i18n keys) may be removed in future versions
|
18
18
|
class AssembliesTypesController < Decidim::Assemblies::Admin::ApplicationController
|
19
19
|
helper_method :available_assemblies_types, :current_assembly_type
|
20
|
-
layout "decidim/admin/
|
20
|
+
layout "decidim/admin/assemblies_types"
|
21
21
|
|
22
22
|
# GET /admin/assemblies_types
|
23
23
|
def index
|
@@ -8,6 +8,7 @@ module Decidim
|
|
8
8
|
class AssemblyAttachmentCollectionsController < Decidim::Assemblies::Admin::ApplicationController
|
9
9
|
include Concerns::AssemblyAdmin
|
10
10
|
include Decidim::Admin::Concerns::HasAttachmentCollections
|
11
|
+
include Decidim::Admin::Concerns::HasTabbedMenu
|
11
12
|
|
12
13
|
def after_destroy_path
|
13
14
|
assembly_attachment_collections_path(current_assembly)
|
@@ -16,6 +17,10 @@ module Decidim
|
|
16
17
|
def collection_for
|
17
18
|
current_assembly
|
18
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def tab_menu_name = :assemblies_admin_attachments_menu
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
@@ -9,6 +9,7 @@ module Decidim
|
|
9
9
|
class AssemblyAttachmentsController < Decidim::Assemblies::Admin::ApplicationController
|
10
10
|
include Concerns::AssemblyAdmin
|
11
11
|
include Decidim::Admin::Concerns::HasAttachments
|
12
|
+
include Decidim::Admin::Concerns::HasTabbedMenu
|
12
13
|
|
13
14
|
def after_destroy_path
|
14
15
|
assembly_attachments_path(current_assembly)
|
@@ -17,6 +18,10 @@ module Decidim
|
|
17
18
|
def attached_to
|
18
19
|
current_assembly
|
19
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def tab_menu_name = :assemblies_admin_attachments_menu
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
@@ -4,6 +4,8 @@ module Decidim
|
|
4
4
|
module Assemblies
|
5
5
|
module Admin
|
6
6
|
class AssemblyImportsController < Decidim::Assemblies::Admin::ApplicationController
|
7
|
+
layout "decidim/admin/assemblies_imports"
|
8
|
+
|
7
9
|
def new
|
8
10
|
enforce_permission_to :import, :assembly
|
9
11
|
@form = form(AssemblyImportForm).instance
|
data/app/controllers/decidim/assemblies/admin/assembly_landing_page_content_blocks_controller.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# Controller that allows to manage the content from the assembly landing page content blocks
|
7
|
+
class AssemblyLandingPageContentBlocksController < Decidim::Assemblies::Admin::ApplicationController
|
8
|
+
include Decidim::Admin::ContentBlocks::LandingPageContentBlocks
|
9
|
+
include Concerns::AssemblyAdmin
|
10
|
+
|
11
|
+
layout "decidim/admin/assemblies"
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def content_block_scope
|
16
|
+
current_participatory_space_manifest.content_blocks_scope_name
|
17
|
+
end
|
18
|
+
|
19
|
+
alias scoped_resource current_participatory_space
|
20
|
+
|
21
|
+
def enforce_permission_to_update_resource
|
22
|
+
enforce_permission_to :update, :assembly, assembly: scoped_resource
|
23
|
+
end
|
24
|
+
|
25
|
+
def edit_resource_landing_page_path
|
26
|
+
edit_assembly_landing_page_path(scoped_resource)
|
27
|
+
end
|
28
|
+
|
29
|
+
def resource_landing_page_content_block_path
|
30
|
+
assembly_landing_page_content_block_path(scoped_resource, params[:id])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing the assembly landing page
|
7
|
+
class AssemblyLandingPageController < Decidim::Assemblies::Admin::ApplicationController
|
8
|
+
include Decidim::Admin::ContentBlocks::LandingPage
|
9
|
+
include Concerns::AssemblyAdmin
|
10
|
+
|
11
|
+
layout "decidim/admin/assembly"
|
12
|
+
|
13
|
+
def content_block_scope
|
14
|
+
current_participatory_space_manifest.content_blocks_scope_name
|
15
|
+
end
|
16
|
+
|
17
|
+
alias scoped_resource current_participatory_space
|
18
|
+
|
19
|
+
def enforce_permission_to_update_resource
|
20
|
+
enforce_permission_to :update, :assembly, assembly: scoped_resource
|
21
|
+
end
|
22
|
+
|
23
|
+
def resource_sort_url
|
24
|
+
assembly_landing_page_path(scoped_resource)
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_create_url(manifest_name)
|
28
|
+
assembly_landing_page_content_blocks_path(slug: params[:slug], manifest_name:)
|
29
|
+
end
|
30
|
+
|
31
|
+
def resource_content_block_cell
|
32
|
+
"decidim/assemblies/content_block"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -7,15 +7,11 @@ module Decidim
|
|
7
7
|
#
|
8
8
|
class AssemblyMembersController < Decidim::Assemblies::Admin::ApplicationController
|
9
9
|
include Concerns::AssemblyAdmin
|
10
|
-
|
10
|
+
include Decidim::Assemblies::Admin::AssemblyMembers::Filterable
|
11
11
|
|
12
12
|
def index
|
13
13
|
enforce_permission_to :index, :assembly_member
|
14
|
-
|
15
|
-
@query = params[:q]
|
16
|
-
@status = params[:status]
|
17
|
-
|
18
|
-
@assembly_members = Decidim::Assemblies::Admin::AssemblyMembers.for(collection, @query, @status).page(params[:page]).per(15)
|
14
|
+
@assembly_members = filtered_collection
|
19
15
|
end
|
20
16
|
|
21
17
|
def new
|
@@ -5,40 +5,20 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# Controller that allows managing assembly publications.
|
7
7
|
#
|
8
|
-
|
8
|
+
# i18n-tasks-use t('decidim.admin.assembly_publications.create.error')
|
9
|
+
# i18n-tasks-use t('decidim.admin.assembly_publications.create.success')
|
10
|
+
# i18n-tasks-use t('decidim.admin.assembly_publications.destroy.error')
|
11
|
+
# i18n-tasks-use t('decidim.admin.assembly_publications.destroy.success')
|
12
|
+
class AssemblyPublicationsController < Decidim::Admin::SpacePublicationsController
|
9
13
|
include Concerns::AssemblyAdmin
|
10
14
|
|
11
|
-
|
12
|
-
enforce_permission_to :publish, :assembly, assembly: current_assembly
|
15
|
+
private
|
13
16
|
|
14
|
-
|
15
|
-
on(:ok) do
|
16
|
-
flash[:notice] = I18n.t("assembly_publications.create.success", scope: "decidim.admin")
|
17
|
-
end
|
17
|
+
def enforce_permission_to_publish = enforce_permission_to(:publish, :assembly, assembly: current_assembly)
|
18
18
|
|
19
|
-
|
20
|
-
flash.now[:alert] = I18n.t("assembly_publications.create.error", scope: "decidim.admin")
|
21
|
-
end
|
19
|
+
def i18n_scope = "decidim.admin.assembly_publications"
|
22
20
|
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def destroy
|
28
|
-
enforce_permission_to :publish, :assembly, assembly: current_assembly
|
29
|
-
|
30
|
-
UnpublishAssembly.call(current_assembly, current_user) do
|
31
|
-
on(:ok) do
|
32
|
-
flash[:notice] = I18n.t("assembly_publications.destroy.success", scope: "decidim.admin")
|
33
|
-
end
|
34
|
-
|
35
|
-
on(:invalid) do
|
36
|
-
flash.now[:alert] = I18n.t("assembly_publications.destroy.error", scope: "decidim.admin")
|
37
|
-
end
|
38
|
-
|
39
|
-
redirect_back(fallback_location: assemblies_path)
|
40
|
-
end
|
41
|
-
end
|
21
|
+
def fallback_location = assemblies_path
|
42
22
|
end
|
43
23
|
end
|
44
24
|
end
|
@@ -5,105 +5,22 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# Controller that allows managing assembly user roles.
|
7
7
|
#
|
8
|
-
class AssemblyUserRolesController < Decidim::
|
8
|
+
class AssemblyUserRolesController < Decidim::Admin::ParticipatorySpace::UserRoleController
|
9
9
|
include Concerns::AssemblyAdmin
|
10
|
-
include Decidim::Admin::Officializations::Filterable
|
11
10
|
|
12
|
-
def
|
13
|
-
enforce_permission_to :index, :assembly_user_role
|
14
|
-
@assembly_user_roles = filtered_collection
|
15
|
-
end
|
11
|
+
def authorization_scope = :assembly_user_role
|
16
12
|
|
17
|
-
def
|
18
|
-
enforce_permission_to :create, :assembly_user_role
|
19
|
-
@form = form(AssemblyUserRoleForm).instance
|
20
|
-
end
|
13
|
+
def resource_form = form(AssemblyUserRoleForm)
|
21
14
|
|
22
|
-
def
|
23
|
-
enforce_permission_to :create, :assembly_user_role
|
24
|
-
@form = form(AssemblyUserRoleForm).from_params(params)
|
15
|
+
def space_index_path = assembly_user_roles_path(current_participatory_space)
|
25
16
|
|
26
|
-
|
27
|
-
on(:ok) do
|
28
|
-
flash[:notice] = I18n.t("assembly_user_roles.create.success", scope: "decidim.admin")
|
29
|
-
redirect_to assembly_user_roles_path(current_assembly)
|
30
|
-
end
|
17
|
+
def i18n_scope = "decidim.admin.assembly_user_roles"
|
31
18
|
|
32
|
-
|
33
|
-
flash[:alert] = I18n.t("assembly_user_roles.create.error", scope: "decidim.admin")
|
34
|
-
render :new
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
19
|
+
def role_class = Decidim::AssemblyUserRole
|
38
20
|
|
39
|
-
def
|
40
|
-
@user_role = collection.find(params[:id])
|
41
|
-
enforce_permission_to :update, :assembly_user_role, user_role: @user_role
|
42
|
-
@form = form(AssemblyUserRoleForm).from_model(@user_role.user)
|
43
|
-
end
|
21
|
+
def event = "decidim.events.assembly.role_assigned"
|
44
22
|
|
45
|
-
def
|
46
|
-
@user_role = collection.find(params[:id])
|
47
|
-
enforce_permission_to :update, :assembly_user_role, user_role: @user_role
|
48
|
-
@form = form(AssemblyUserRoleForm).from_params(params)
|
49
|
-
|
50
|
-
UpdateAssemblyAdmin.call(@form, @user_role) do
|
51
|
-
on(:ok) do
|
52
|
-
flash[:notice] = I18n.t("assembly_user_roles.update.success", scope: "decidim.admin")
|
53
|
-
redirect_to assembly_user_roles_path(current_assembly)
|
54
|
-
end
|
55
|
-
|
56
|
-
on(:invalid) do
|
57
|
-
flash.now[:alert] = I18n.t("assembly_user_roles.update.error", scope: "decidim.admin")
|
58
|
-
render :edit
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def destroy
|
64
|
-
@assembly_user_role = collection.find(params[:id])
|
65
|
-
enforce_permission_to :destroy, :assembly_user_role, user_role: @assembly_user_role
|
66
|
-
|
67
|
-
DestroyAssemblyAdmin.call(@assembly_user_role, current_user) do
|
68
|
-
on(:ok) do
|
69
|
-
flash[:notice] = I18n.t("assembly_user_roles.destroy.success", scope: "decidim.admin")
|
70
|
-
redirect_to assembly_user_roles_path(current_assembly)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def resend_invitation
|
76
|
-
@user_role = collection.find(params[:id])
|
77
|
-
enforce_permission_to :invite, :assembly_user_role, user_role: @user_role
|
78
|
-
|
79
|
-
InviteUserAgain.call(@user_role.user, "invite_admin") do
|
80
|
-
on(:ok) do
|
81
|
-
flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
|
82
|
-
end
|
83
|
-
|
84
|
-
on(:invalid) do
|
85
|
-
flash[:alert] = I18n.t("users.resend_invitation.error", scope: "decidim.admin")
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
redirect_to assembly_user_roles_path(current_assembly)
|
90
|
-
end
|
91
|
-
|
92
|
-
private
|
93
|
-
|
94
|
-
def search_field_predicate
|
95
|
-
:name_or_nickname_or_email_cont
|
96
|
-
end
|
97
|
-
|
98
|
-
def filters
|
99
|
-
[:invitation_accepted_at_present, :last_sign_in_at_present]
|
100
|
-
end
|
101
|
-
|
102
|
-
def collection
|
103
|
-
@collection ||= Decidim::AssemblyUserRole
|
104
|
-
.joins(:user)
|
105
|
-
.where(assembly: current_assembly)
|
106
|
-
end
|
23
|
+
def event_class = Decidim::RoleAssignedToAssemblyEvent
|
107
24
|
end
|
108
25
|
end
|
109
26
|
end
|
@@ -5,10 +5,15 @@ module Decidim
|
|
5
5
|
# A controller that holds the logic to show Assemblies in a public layout.
|
6
6
|
class AssembliesController < Decidim::Assemblies::ApplicationController
|
7
7
|
include ParticipatorySpaceContext
|
8
|
+
include AssemblyBreadcrumb
|
9
|
+
|
8
10
|
participatory_space_layout only: :show
|
11
|
+
|
9
12
|
include FilterResource
|
13
|
+
include Paginable
|
14
|
+
include HasParticipatorySpaceContentBlocks
|
10
15
|
|
11
|
-
helper_method :parent_assemblies, :promoted_assemblies, :stats, :assembly_participatory_processes
|
16
|
+
helper_method :collection, :parent_assemblies, :promoted_assemblies, :stats, :assembly_participatory_processes
|
12
17
|
|
13
18
|
def index
|
14
19
|
enforce_permission_to :list, :assembly
|
@@ -55,8 +60,8 @@ module Decidim
|
|
55
60
|
def default_filter_params
|
56
61
|
{
|
57
62
|
with_any_scope: nil,
|
58
|
-
|
59
|
-
|
63
|
+
with_any_area: nil,
|
64
|
+
with_any_type: nil
|
60
65
|
}
|
61
66
|
end
|
62
67
|
|
@@ -80,6 +85,10 @@ module Decidim
|
|
80
85
|
search.result.parent_assemblies.order(weight: :asc, promoted: :desc)
|
81
86
|
end
|
82
87
|
|
88
|
+
def collection
|
89
|
+
@collection ||= paginate(Kaminari.paginate_array(parent_assemblies))
|
90
|
+
end
|
91
|
+
|
83
92
|
def stats
|
84
93
|
@stats ||= AssemblyStatsPresenter.new(assembly: current_participatory_space)
|
85
94
|
end
|
@@ -87,10 +96,6 @@ module Decidim
|
|
87
96
|
def assembly_participatory_processes
|
88
97
|
@assembly_participatory_processes ||= @current_participatory_space.linked_participatory_space_resources(:participatory_processes, "included_participatory_processes")
|
89
98
|
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
|
94
99
|
end
|
95
100
|
end
|
96
101
|
end
|
@@ -1,21 +1,26 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
class RoleAssignedToAssemblyEvent < Decidim::Events::SimpleEvent
|
5
|
+
include Decidim::Events::NotificationEvent
|
5
6
|
include Decidim::Events::AuthorEvent
|
6
7
|
|
8
|
+
def notification_title
|
9
|
+
I18n.t("notification_title", **i18n_options).html_safe
|
10
|
+
end
|
11
|
+
|
7
12
|
def i18n_role
|
8
13
|
I18n.t(extra["role"], scope: "decidim.admin.models.assembly_user_role.roles", default: extra["role"])
|
9
14
|
end
|
10
15
|
|
11
16
|
def i18n_options
|
12
17
|
{
|
13
|
-
resource_path
|
14
|
-
resource_title
|
15
|
-
resource_url
|
18
|
+
resource_path:,
|
19
|
+
resource_title:,
|
20
|
+
resource_url:,
|
16
21
|
scope: event_name,
|
17
|
-
participatory_space_title
|
18
|
-
participatory_space_url
|
22
|
+
participatory_space_title:,
|
23
|
+
participatory_space_url:,
|
19
24
|
role: i18n_role
|
20
25
|
}
|
21
26
|
end
|
@@ -24,7 +24,7 @@ module Decidim
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def slug_uniqueness
|
27
|
-
return unless OrganizationAssemblies.new(current_organization).query.where(slug:
|
27
|
+
return unless OrganizationAssemblies.new(current_organization).query.where(slug:).where.not(id:).any?
|
28
28
|
|
29
29
|
errors.add(:slug, :taken)
|
30
30
|
end
|
@@ -73,7 +73,7 @@ module Decidim
|
|
73
73
|
private
|
74
74
|
|
75
75
|
def slug_uniqueness
|
76
|
-
return unless OrganizationAssemblies.new(current_organization).query.where(slug:
|
76
|
+
return unless OrganizationAssemblies.new(current_organization).query.where(slug:).where.not(id:).any?
|
77
77
|
|
78
78
|
errors.add(:slug, :taken)
|
79
79
|
end
|
@@ -5,26 +5,10 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A form object used to create assembly user roles from the admin dashboard.
|
7
7
|
#
|
8
|
-
class AssemblyUserRoleForm <
|
8
|
+
class AssemblyUserRoleForm < Decidim::Admin::ParticipatorySpaceAdminUserForm
|
9
9
|
mimic :assembly_user_role
|
10
10
|
|
11
|
-
|
12
|
-
attribute :email, String
|
13
|
-
attribute :role, String
|
14
|
-
|
15
|
-
validates :name, :email, :role, presence: true
|
16
|
-
validates :role, inclusion: { in: Decidim::AssemblyUserRole::ROLES }
|
17
|
-
|
18
|
-
validates :name, format: { with: UserBaseEntity::REGEXP_NAME }
|
19
|
-
|
20
|
-
def roles
|
21
|
-
Decidim::AssemblyUserRole::ROLES.map do |role|
|
22
|
-
[
|
23
|
-
I18n.t(role, scope: "decidim.admin.models.assembly_user_role.roles"),
|
24
|
-
role
|
25
|
-
]
|
26
|
-
end
|
27
|
-
end
|
11
|
+
def scope = "decidim.admin.models.assembly_user_role.roles"
|
28
12
|
end
|
29
13
|
end
|
30
14
|
end
|