decidim-admin 0.31.8 → 0.32.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -12
- data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +1 -1
- data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +2 -6
- data/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb +1 -1
- data/app/commands/decidim/admin/create_newsletter.rb +1 -1
- data/app/commands/decidim/admin/create_taxonomy_filter.rb +2 -16
- data/app/commands/decidim/admin/participatory_space/create_member.rb +99 -0
- data/app/commands/decidim/admin/participatory_space/destroy_member.rb +30 -0
- data/app/commands/decidim/admin/participatory_space/import_member_csv.rb +46 -0
- data/app/commands/decidim/admin/participatory_space/publish_all_members.rb +52 -0
- data/app/commands/decidim/admin/participatory_space/unpublish_all_members.rb +52 -0
- data/app/commands/decidim/admin/participatory_space/update_member.rb +13 -0
- data/app/commands/decidim/admin/reorder_components.rb +1 -1
- data/app/commands/decidim/admin/reorder_taxonomies.rb +1 -1
- data/app/commands/decidim/admin/update_organization.rb +1 -1
- data/app/commands/decidim/admin/update_taxonomy_filter.rb +6 -24
- data/app/controllers/concerns/decidim/admin/component_taxonomies_helper.rb +1 -1
- data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +6 -5
- data/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb +3 -2
- data/app/controllers/concerns/decidim/admin/filterable.rb +4 -4
- data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +0 -2
- data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +1 -2
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -3
- data/app/controllers/decidim/admin/admin_terms_controller.rb +0 -1
- data/app/controllers/decidim/admin/application_controller.rb +0 -2
- data/app/controllers/decidim/admin/area_types_controller.rb +2 -2
- data/app/controllers/decidim/admin/areas_controller.rb +3 -2
- data/app/controllers/decidim/admin/block_user_controller.rb +2 -6
- data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/components/base_controller.rb +3 -4
- data/app/controllers/decidim/admin/components_controller.rb +5 -4
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -4
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -4
- data/app/controllers/decidim/admin/concerns/has_breadcrumb_items.rb +0 -4
- data/app/controllers/decidim/admin/conflicts_controller.rb +6 -6
- data/app/controllers/decidim/admin/exports_controller.rb +1 -1
- data/app/controllers/decidim/admin/global_moderations/reports_controller.rb +0 -2
- data/app/controllers/decidim/admin/global_moderations_controller.rb +0 -2
- data/app/controllers/decidim/admin/help_sections_controller.rb +3 -3
- data/app/controllers/decidim/admin/impersonations_controller.rb +2 -3
- data/app/controllers/decidim/admin/imports_controller.rb +2 -1
- data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +1 -1
- data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
- data/app/controllers/decidim/admin/moderated_users_controller.rb +0 -3
- data/app/controllers/decidim/admin/moderations_controller.rb +0 -4
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -4
- data/app/controllers/decidim/admin/newsletters_controller.rb +9 -12
- data/app/controllers/decidim/admin/officializations_controller.rb +0 -2
- data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +30 -1
- data/app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_homepage_controller.rb +3 -7
- data/app/controllers/decidim/admin/participatory_space/concerns/has_members.rb +166 -0
- data/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb +67 -0
- data/app/controllers/decidim/admin/participatory_space/concerns/members_filterable.rb +36 -0
- data/app/controllers/decidim/admin/participatory_space/user_role_controller.rb +2 -2
- data/app/controllers/decidim/admin/reminders_controller.rb +1 -1
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -5
- data/app/controllers/decidim/admin/scope_types_controller.rb +2 -2
- data/app/controllers/decidim/admin/scopes_controller.rb +3 -2
- data/app/controllers/decidim/admin/share_tokens_controller.rb +2 -2
- data/app/controllers/decidim/admin/space_publications_controller.rb +2 -2
- data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
- data/app/controllers/decidim/admin/static_pages_controller.rb +27 -29
- data/app/controllers/decidim/admin/taxonomies_controller.rb +3 -3
- data/app/controllers/decidim/admin/taxonomy_filters_controller.rb +5 -5
- data/app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb +1 -1
- data/app/controllers/decidim/admin/taxonomy_items_controller.rb +3 -3
- data/app/controllers/decidim/admin/users_controller.rb +1 -1
- data/app/forms/decidim/admin/content_block_form.rb +28 -1
- data/app/forms/decidim/admin/organization_form.rb +0 -1
- data/app/forms/decidim/admin/participatory_space/member_csv_import_form.rb +33 -0
- data/app/forms/decidim/admin/participatory_space/member_form.rb +26 -0
- data/app/forms/decidim/admin/participatory_space_admin_user_form.rb +1 -1
- data/app/forms/decidim/admin/selective_newsletter_form.rb +7 -7
- data/app/forms/decidim/admin/taxonomy_filter_form.rb +10 -11
- data/app/helpers/decidim/admin/newsletters_helper.rb +8 -5
- data/app/helpers/decidim/admin/search_form_helper.rb +17 -0
- data/app/helpers/decidim/admin/settings_helper.rb +2 -0
- data/app/jobs/decidim/admin/newsletter_job.rb +2 -1
- data/app/jobs/decidim/admin/participatory_space/destroy_members_follows_job.rb +36 -0
- data/app/jobs/decidim/admin/participatory_space/import_member_csv_job.rb +29 -0
- data/app/packs/src/decidim/admin/admin_autocomplete.js +10 -16
- data/app/packs/src/decidim/admin/controllers/access_mode/access_mode.test.js +68 -0
- data/app/packs/src/decidim/admin/controllers/access_mode/controller.js +52 -0
- data/app/packs/src/decidim/admin/newsletters.js +2 -2
- data/app/packs/stylesheets/decidim/admin/_datepicker.scss +0 -4
- data/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +1 -3
- data/app/packs/stylesheets/decidim/admin/application.scss +1 -1
- data/app/permissions/decidim/admin/permissions.rb +0 -16
- data/app/queries/decidim/admin/newsletter_recipients.rb +8 -8
- data/app/views/decidim/admin/admin_terms/show.html.erb +3 -1
- data/app/views/decidim/admin/area_types/index.html.erb +3 -2
- data/app/views/decidim/admin/areas/index.html.erb +3 -2
- data/app/views/decidim/admin/attachment_collections/edit.html.erb +2 -2
- data/app/views/decidim/admin/attachment_collections/index.html.erb +3 -3
- data/app/views/decidim/admin/attachment_collections/new.html.erb +2 -2
- data/app/views/decidim/admin/attachments/index.html.erb +3 -2
- data/app/views/decidim/admin/authorization_workflows/index.html.erb +2 -2
- data/app/views/decidim/admin/block_user/new.html.erb +1 -0
- data/app/views/decidim/admin/components/_actions.html.erb +1 -1
- data/app/views/decidim/admin/components/index.html.erb +2 -2
- data/app/views/decidim/admin/components/manage_trash.html.erb +2 -2
- data/app/views/decidim/admin/conflicts/edit.html.erb +3 -1
- data/app/views/decidim/admin/conflicts/index.html.erb +3 -2
- data/app/views/decidim/admin/dashboard/show.html.erb +4 -4
- data/app/views/decidim/admin/help_sections/update.html.erb +2 -0
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -2
- data/app/views/decidim/admin/impersonations/_form.html.erb +2 -2
- data/app/views/decidim/admin/impersonations/new.html.erb +3 -2
- data/app/views/decidim/admin/imports/new.html.erb +1 -0
- data/app/views/decidim/admin/logs/_logs_list.html.erb +1 -1
- data/app/views/decidim/admin/logs/index.html.erb +1 -1
- data/app/views/decidim/admin/managed_users/impersonation_logs/index.html.erb +6 -5
- data/app/views/decidim/admin/managed_users/promotions/new.html.erb +3 -2
- data/app/views/decidim/admin/{participatory_space_private_users → members}/edit.html.erb +2 -2
- data/app/views/decidim/admin/{participatory_space_private_users → members}/index.html.erb +25 -25
- data/app/views/decidim/admin/{participatory_space_private_users → members}/new.html.erb +2 -2
- data/app/views/decidim/admin/{participatory_space_private_users_csv_imports → members_csv_imports}/new.html.erb +2 -2
- data/app/views/decidim/admin/moderations/_moderation-tr.html.erb +3 -7
- data/app/views/decidim/admin/moderations/_moderations-thead.html.erb +0 -1
- data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -1
- data/app/views/decidim/admin/newsletter_templates/show.html.erb +3 -2
- data/app/views/decidim/admin/newsletters/confirm_recipients.html.erb +4 -6
- data/app/views/decidim/admin/newsletters/index.html.erb +2 -2
- data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +2 -2
- data/app/views/decidim/admin/newsletters/show.html.erb +3 -2
- data/app/views/decidim/admin/officializations/index.html.erb +6 -4
- data/app/views/decidim/admin/officializations/show_email.html.erb +3 -7
- data/app/views/decidim/admin/organization/form/_extra_features.html.erb +2 -22
- data/app/views/decidim/admin/organization_external_domain_allowlist/_form.html.erb +2 -2
- data/app/views/decidim/admin/organization_external_domain_allowlist/edit.html.erb +2 -2
- data/app/views/decidim/admin/reminders/new.html.erb +8 -1
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
- data/app/views/decidim/admin/scope_types/index.html.erb +3 -2
- data/app/views/decidim/admin/scopes/index.html.erb +2 -2
- data/app/views/decidim/admin/share_tokens/index.html.erb +2 -0
- data/app/views/decidim/admin/shared/_gallery.html.erb +15 -0
- data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +0 -2
- data/app/views/decidim/admin/shared/landing_page/edit.html.erb +2 -0
- data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +1 -0
- data/app/views/decidim/admin/static_page_topics/index.html.erb +2 -2
- data/app/views/decidim/admin/static_pages/edit.html.erb +2 -1
- data/app/views/decidim/admin/static_pages/index.html.erb +2 -2
- data/app/views/decidim/admin/statistics/_statistics.html.erb +1 -1
- data/app/views/decidim/admin/statistics/index.html.erb +2 -0
- data/app/views/decidim/admin/taxonomies/_row.html.erb +1 -1
- data/app/views/decidim/admin/taxonomies/_row_children.html.erb +1 -1
- data/app/views/decidim/admin/taxonomies/_table.html.erb +1 -1
- data/app/views/decidim/admin/taxonomies/edit.html.erb +2 -2
- data/app/views/decidim/admin/taxonomies/index.html.erb +4 -4
- data/app/views/decidim/admin/taxonomy_filters/_table.html.erb +2 -2
- data/app/views/decidim/admin/taxonomy_filters/index.html.erb +2 -2
- data/app/views/decidim/admin/taxonomy_filters_selector/index.html.erb +2 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/new.html.erb +2 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/show.html.erb +2 -0
- data/app/views/decidim/admin/taxonomy_items/edit.html.erb +2 -0
- data/app/views/decidim/admin/taxonomy_items/new.html.erb +2 -0
- data/app/views/decidim/admin/users/index.html.erb +3 -2
- data/app/views/layouts/decidim/admin/_application.html.erb +1 -1
- data/config/locales/ar.yml +9 -49
- data/config/locales/bg.yml +9 -57
- data/config/locales/bs-BA.yml +4 -24
- data/config/locales/ca-IT.yml +130 -117
- data/config/locales/ca.yml +130 -117
- data/config/locales/cs.yml +126 -116
- data/config/locales/de.yml +114 -123
- data/config/locales/el.yml +17 -45
- data/config/locales/en.yml +130 -116
- data/config/locales/eo.yml +0 -7
- data/config/locales/es-MX.yml +130 -117
- data/config/locales/es-PY.yml +130 -117
- data/config/locales/es.yml +130 -117
- data/config/locales/eu.yml +189 -176
- data/config/locales/fi-plain.yml +129 -116
- data/config/locales/fi.yml +129 -116
- data/config/locales/fr-CA.yml +91 -149
- data/config/locales/fr.yml +91 -149
- data/config/locales/ga-IE.yml +0 -13
- data/config/locales/gl.yml +57 -649
- data/config/locales/he-IL.yml +1 -5
- data/config/locales/hu.yml +10 -52
- data/config/locales/id-ID.yml +4 -34
- data/config/locales/is-IS.yml +1 -16
- data/config/locales/it.yml +8 -69
- data/config/locales/ja.yml +129 -118
- data/config/locales/kaa.yml +4 -16
- data/config/locales/ko.yml +6 -40
- data/config/locales/lb.yml +9 -41
- data/config/locales/lt.yml +10 -52
- data/config/locales/lv.yml +8 -38
- data/config/locales/nl.yml +10 -46
- data/config/locales/no.yml +10 -46
- data/config/locales/pl.yml +9 -54
- data/config/locales/pt-BR.yml +121 -104
- data/config/locales/pt.yml +9 -42
- data/config/locales/ro-RO.yml +15 -51
- data/config/locales/ru.yml +4 -35
- data/config/locales/sk.yml +8 -814
- data/config/locales/sl.yml +1 -7
- data/config/locales/sq-AL.yml +1 -21
- data/config/locales/sr-CS.yml +4 -24
- data/config/locales/sv.yml +80 -121
- data/config/locales/th-TH.yml +0 -8
- data/config/locales/tr-TR.yml +33 -93
- data/config/locales/uk.yml +0 -26
- data/config/locales/val-ES.yml +0 -1
- data/config/locales/zh-CN.yml +9 -38
- data/config/locales/zh-TW.yml +10 -52
- data/config/routes.rb +4 -0
- data/decidim-admin.gemspec +7 -10
- data/lib/decidim/admin/engine.rb +5 -2
- data/lib/decidim/admin/form_builder.rb +3 -1
- data/lib/decidim/admin/menu.rb +1 -1
- data/lib/decidim/admin/test/admin_members_shared_examples.rb +119 -0
- data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +3 -3
- data/lib/decidim/admin/test/filterable_examples.rb +20 -11
- data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +17 -17
- data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +1 -1
- data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +1 -1
- data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +1 -1
- data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +3 -3
- data/lib/decidim/admin/test/manage_attachments_examples.rb +6 -6
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_moderations_examples.rb +6 -6
- data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
- data/lib/decidim/admin/test/manage_resource_soft_deletion_examples.rb +3 -3
- data/lib/decidim/admin/version.rb +1 -1
- data/lib/decidim/admin.rb +0 -2
- metadata +40 -36
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +0 -98
- data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +0 -28
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +0 -44
- data/app/commands/decidim/admin/publish_all_participatory_space_private_users.rb +0 -50
- data/app/commands/decidim/admin/unpublish_all_participatory_space_private_users.rb +0 -50
- data/app/commands/decidim/admin/update_participatory_space_private_user.rb +0 -11
- data/app/controllers/concerns/decidim/participatory_space_private_users/admin/filterable.rb +0 -34
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +0 -173
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +0 -67
- data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +0 -31
- data/app/forms/decidim/admin/participatory_space_private_user_form.rb +0 -24
- data/app/jobs/decidim/admin/destroy_private_users_follows_job.rb +0 -37
- data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +0 -27
- data/app/views/decidim/admin/devise/mailers/password_change.html.erb +0 -3
- data/app/views/decidim/admin/devise/mailers/reset_password_instructions.html.erb +0 -8
- data/app/views/decidim/admin/shared/_attachments.html.erb +0 -15
- /data/app/views/decidim/admin/{participatory_space_private_users → members}/_form.html.erb +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
module ParticipatorySpace
|
|
6
|
+
module Concerns
|
|
7
|
+
# Members can be related to any ParticipatorySpace, in order to
|
|
8
|
+
# manage the members for a given type, you should create a new
|
|
9
|
+
# controller and include this concern.
|
|
10
|
+
#
|
|
11
|
+
# It takes the current_participatory_space that is defined
|
|
12
|
+
# in the controller, so there is no need to define any method
|
|
13
|
+
module HasMembers
|
|
14
|
+
extend ActiveSupport::Concern
|
|
15
|
+
|
|
16
|
+
included do
|
|
17
|
+
include Decidim::Admin::ParticipatorySpace::Concerns::MembersFilterable
|
|
18
|
+
|
|
19
|
+
helper PaginateHelper
|
|
20
|
+
helper_method :members
|
|
21
|
+
|
|
22
|
+
# rubocop:disable Rails/LexicallyScopedActionFilter
|
|
23
|
+
before_action :set_member, only: [:edit, :update, :destroy, :resend_invitation]
|
|
24
|
+
# rubocop:enable Rails/LexicallyScopedActionFilter
|
|
25
|
+
|
|
26
|
+
def index
|
|
27
|
+
enforce_permission_to :read, :space_member
|
|
28
|
+
|
|
29
|
+
render template: "decidim/admin/members/index"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def new
|
|
33
|
+
enforce_permission_to :create, :space_member
|
|
34
|
+
@form = form(MemberForm).from_params({})
|
|
35
|
+
render template: "decidim/admin/members/new"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def edit
|
|
39
|
+
enforce_permission_to :update, :space_member, member: @member
|
|
40
|
+
@form = form(MemberForm).from_model(@member)
|
|
41
|
+
render template: "decidim/admin/members/edit"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update
|
|
45
|
+
enforce_permission_to :update, :space_member, member: @member
|
|
46
|
+
@form = form(MemberForm).from_params(params)
|
|
47
|
+
|
|
48
|
+
UpdateMember.call(@form, @member) do
|
|
49
|
+
on(:ok) do
|
|
50
|
+
flash[:notice] = I18n.t("members.update.success", scope: "decidim.admin")
|
|
51
|
+
redirect_to action: :index
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
on(:invalid) do
|
|
55
|
+
flash.now[:alert] = I18n.t("members.update.error", scope: "decidim.admin")
|
|
56
|
+
render template: "decidim/admin/members/edit", status: :unprocessable_content
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def create
|
|
62
|
+
enforce_permission_to :create, :space_member
|
|
63
|
+
@form = form(MemberForm).from_params(params)
|
|
64
|
+
|
|
65
|
+
CreateMember.call(@form, current_participatory_space) do
|
|
66
|
+
on(:ok) do
|
|
67
|
+
flash[:notice] = I18n.t("members.create.success", scope: "decidim.admin")
|
|
68
|
+
redirect_to action: :index
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
on(:invalid) do
|
|
72
|
+
flash.now[:alert] = I18n.t("members.create.error", scope: "decidim.admin")
|
|
73
|
+
render template: "decidim/admin/members/new", status: :unprocessable_content
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def destroy
|
|
79
|
+
enforce_permission_to :destroy, :space_member, member: @member
|
|
80
|
+
|
|
81
|
+
DestroyMember.call(@member, current_user) do
|
|
82
|
+
on(:ok) do
|
|
83
|
+
flash[:notice] = I18n.t("members.destroy.success", scope: "decidim.admin")
|
|
84
|
+
redirect_to after_destroy_path
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
on(:invalid) do
|
|
88
|
+
flash.now[:alert] = I18n.t("members.destroy.error", scope: "decidim.admin")
|
|
89
|
+
render template: "decidim/admin/members/index", status: :unprocessable_content
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def resend_invitation
|
|
95
|
+
enforce_permission_to :invite, :space_member, member: @member
|
|
96
|
+
InviteUserAgain.call(@member.user, "invite_member") do
|
|
97
|
+
on(:ok) do
|
|
98
|
+
flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
on(:invalid) do
|
|
102
|
+
flash[:alert] = I18n.t("users.resend_invitation.error", scope: "decidim.admin")
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
redirect_to after_destroy_path
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def publish_all
|
|
110
|
+
PublishAllMembers.call(current_participatory_space, current_user) do
|
|
111
|
+
on(:ok) do
|
|
112
|
+
flash[:notice] = I18n.t("members.publish_all.success", scope: "decidim.admin")
|
|
113
|
+
redirect_to action: :index
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
on(:invalid) do
|
|
117
|
+
flash[:alert] = I18n.t("members.publish_all.error", scope: "decidim.admin")
|
|
118
|
+
redirect_to action: :index
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def unpublish_all
|
|
124
|
+
UnpublishAllMembers.call(current_participatory_space, current_user) do
|
|
125
|
+
on(:ok) do
|
|
126
|
+
flash[:notice] = I18n.t("members.unpublish_all.success", scope: "decidim.admin")
|
|
127
|
+
redirect_to action: :index
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
on(:invalid) do
|
|
131
|
+
flash[:alert] = I18n.t("members.unpublish_all.error", scope: "decidim.admin")
|
|
132
|
+
redirect_to action: :index
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
138
|
+
# destroying a member. By default it redirects to the participatory_space.
|
|
139
|
+
#
|
|
140
|
+
# It can be redefined at controller level if you need to redirect elsewhere.
|
|
141
|
+
def after_destroy_path
|
|
142
|
+
members_path(current_participatory_space)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def collection
|
|
146
|
+
# there is an unidentified corner case where Decidim::User
|
|
147
|
+
# may have been destroyed, but the related Member
|
|
148
|
+
# remains in the database. That is why filtering by not null users
|
|
149
|
+
@collection ||= current_participatory_space
|
|
150
|
+
.members
|
|
151
|
+
.includes(:user).where.not("decidim_users.id" => nil)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def members
|
|
155
|
+
filtered_collection
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def set_member
|
|
159
|
+
@member = collection.find(params[:id])
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
module ParticipatorySpace
|
|
6
|
+
module Concerns
|
|
7
|
+
# Members can be related to any ParticipatorySpace, in order to
|
|
8
|
+
# import members from csv for a given type, you should create a new
|
|
9
|
+
# controller and include this concern.
|
|
10
|
+
#
|
|
11
|
+
# The only requirement is to define a `participatory_space` method that
|
|
12
|
+
# returns an instance of the model to relate the member to.
|
|
13
|
+
module HasMembersCsvImport
|
|
14
|
+
extend ActiveSupport::Concern
|
|
15
|
+
|
|
16
|
+
included do
|
|
17
|
+
helper_method :participatory_space
|
|
18
|
+
|
|
19
|
+
def new
|
|
20
|
+
enforce_permission_to :csv_import, :space_member
|
|
21
|
+
@form = form(MemberCsvImportForm).from_params({}, participatory_space:)
|
|
22
|
+
@count = Decidim::ParticipatorySpace::Member.by_participatory_space(participatory_space).count
|
|
23
|
+
render template: "decidim/admin/members_csv_imports/new"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create
|
|
27
|
+
enforce_permission_to :csv_import, :space_member
|
|
28
|
+
@form = form(MemberCsvImportForm).from_params(params, participatory_space:)
|
|
29
|
+
|
|
30
|
+
ImportMemberCsv.call(@form, current_participatory_space) do
|
|
31
|
+
on(:ok) do
|
|
32
|
+
flash[:notice] = I18n.t("members_csv_imports.create.success", scope: "decidim.admin")
|
|
33
|
+
redirect_to after_import_path
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
on(:invalid) do
|
|
37
|
+
flash[:alert] = I18n.t("members_csv_imports.create.invalid", scope: "decidim.admin")
|
|
38
|
+
render template: "decidim/admin/members_csv_imports/new", status: :unprocessable_content
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def destroy_all
|
|
44
|
+
enforce_permission_to :csv_import, :space_member
|
|
45
|
+
Decidim::ParticipatorySpace::Member.by_participatory_space(participatory_space).delete_all
|
|
46
|
+
redirect_to new_members_csv_imports_path
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
50
|
+
# importing members. By default it redirects to the participatory_space.
|
|
51
|
+
#
|
|
52
|
+
# It can be redefined at controller level if you need to redirect elsewhere.
|
|
53
|
+
def after_import_path
|
|
54
|
+
participatory_space
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Public: The only method to be implemented at the controller. You need to
|
|
58
|
+
# return the object where the attachment will be attached to.
|
|
59
|
+
def participatory_space
|
|
60
|
+
raise NotImplementedError
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support/concern"
|
|
4
|
+
|
|
5
|
+
module Decidim
|
|
6
|
+
module Admin
|
|
7
|
+
module ParticipatorySpace
|
|
8
|
+
module Concerns
|
|
9
|
+
module MembersFilterable
|
|
10
|
+
extend ActiveSupport::Concern
|
|
11
|
+
|
|
12
|
+
included do
|
|
13
|
+
include Decidim::Admin::Filterable
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def base_query
|
|
18
|
+
collection
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def filters
|
|
22
|
+
[
|
|
23
|
+
:user_invitation_sent_at_not_null,
|
|
24
|
+
:user_invitation_accepted_at_not_null
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def search_field_predicate
|
|
29
|
+
:user_name_or_user_email_cont
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -38,7 +38,7 @@ module Decidim
|
|
|
38
38
|
|
|
39
39
|
on(:invalid) do
|
|
40
40
|
flash[:alert] = I18n.t("create.error", scope: i18n_scope)
|
|
41
|
-
render :new, status: :
|
|
41
|
+
render :new, status: :unprocessable_content
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -56,7 +56,7 @@ module Decidim
|
|
|
56
56
|
|
|
57
57
|
on(:invalid) do
|
|
58
58
|
flash.now[:alert] = I18n.t("update.error", scope: i18n_scope)
|
|
59
|
-
render :edit, status: :
|
|
59
|
+
render :edit, status: :unprocessable_content
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
end
|
|
@@ -10,16 +10,12 @@ module Decidim
|
|
|
10
10
|
helper_method :authorizations, :other_authorizations_for, :resource_params, :resource
|
|
11
11
|
|
|
12
12
|
def edit
|
|
13
|
-
enforce_permission_to :update, :resource_permission, resource:
|
|
14
|
-
|
|
15
13
|
@permissions_form = PermissionsForm.new(
|
|
16
14
|
permissions: permission_forms
|
|
17
15
|
)
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
def update
|
|
21
|
-
enforce_permission_to :update, :resource_permission, resource:
|
|
22
|
-
|
|
23
19
|
@permissions_form = PermissionsForm.from_params(params).with_context(current_organization:)
|
|
24
20
|
|
|
25
21
|
UpdateResourcePermissions.call(@permissions_form, resource) do
|
|
@@ -29,7 +25,7 @@ module Decidim
|
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
on(:invalid) do
|
|
32
|
-
render action: :edit, status: :
|
|
28
|
+
render action: :edit, status: :unprocessable_content
|
|
33
29
|
end
|
|
34
30
|
end
|
|
35
31
|
end
|
|
@@ -34,7 +34,7 @@ module Decidim
|
|
|
34
34
|
|
|
35
35
|
on(:invalid) do
|
|
36
36
|
flash.now[:alert] = I18n.t("scope_types.create.error", scope: "decidim.admin")
|
|
37
|
-
render :new, status: :
|
|
37
|
+
render :new, status: :unprocessable_content
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -56,7 +56,7 @@ module Decidim
|
|
|
56
56
|
|
|
57
57
|
on(:invalid) do
|
|
58
58
|
flash.now[:alert] = I18n.t("scope_types.update.error", scope: "decidim.admin")
|
|
59
|
-
render :edit, status: :
|
|
59
|
+
render :edit, status: :unprocessable_content
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
end
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
|
6
6
|
#
|
|
7
7
|
class ScopesController < Decidim::Admin::ApplicationController
|
|
8
8
|
include Decidim::Admin::Concerns::HasTabbedMenu
|
|
9
|
+
|
|
9
10
|
helper Decidim::Admin::ScopesHelper
|
|
10
11
|
|
|
11
12
|
layout "decidim/admin/settings"
|
|
@@ -36,7 +37,7 @@ module Decidim
|
|
|
36
37
|
|
|
37
38
|
on(:invalid) do
|
|
38
39
|
flash.now[:alert] = I18n.t("scopes.create.error", scope: "decidim.admin")
|
|
39
|
-
render :new, status: :
|
|
40
|
+
render :new, status: :unprocessable_content
|
|
40
41
|
end
|
|
41
42
|
end
|
|
42
43
|
end
|
|
@@ -58,7 +59,7 @@ module Decidim
|
|
|
58
59
|
|
|
59
60
|
on(:invalid) do
|
|
60
61
|
flash.now[:alert] = I18n.t("scopes.update.error", scope: "decidim.admin")
|
|
61
|
-
render :edit, status: :
|
|
62
|
+
render :edit, status: :unprocessable_content
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
end
|
|
@@ -31,7 +31,7 @@ module Decidim
|
|
|
31
31
|
|
|
32
32
|
on(:invalid) do
|
|
33
33
|
flash.now[:alert] = I18n.t("share_tokens.create.invalid", scope: "decidim.admin")
|
|
34
|
-
render action: "new", status: :
|
|
34
|
+
render action: "new", status: :unprocessable_content
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -53,7 +53,7 @@ module Decidim
|
|
|
53
53
|
|
|
54
54
|
on(:invalid) do
|
|
55
55
|
flash.now[:alert] = I18n.t("share_tokens.update.error", scope: "decidim.admin")
|
|
56
|
-
render :edit, status: :
|
|
56
|
+
render :edit, status: :unprocessable_content
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
|
17
17
|
flash.now[:alert] = I18n.t("create.error", scope: i18n_scope)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
redirect_back_or_to(fallback_location)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -33,7 +33,7 @@ module Decidim
|
|
|
33
33
|
flash.now[:alert] = I18n.t("destroy.error", scope: i18n_scope)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
redirect_back_or_to(fallback_location)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -30,7 +30,7 @@ module Decidim
|
|
|
30
30
|
|
|
31
31
|
on(:invalid) do
|
|
32
32
|
flash.now[:alert] = I18n.t("static_page_topics.create.error", scope: "decidim.admin")
|
|
33
|
-
render :new, status: :
|
|
33
|
+
render :new, status: :unprocessable_content
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -52,7 +52,7 @@ module Decidim
|
|
|
52
52
|
|
|
53
53
|
on(:invalid) do
|
|
54
54
|
flash.now[:alert] = I18n.t("static_page_topics.update.error", scope: "decidim.admin")
|
|
55
|
-
render :edit, status: :
|
|
55
|
+
render :edit, status: :unprocessable_content
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -11,10 +11,34 @@ module Decidim
|
|
|
11
11
|
|
|
12
12
|
before_action :tos_version_formatted, only: [:index, :edit]
|
|
13
13
|
|
|
14
|
-
helper_method :topics
|
|
14
|
+
helper_method :topics
|
|
15
15
|
|
|
16
16
|
alias update_content_blocks update
|
|
17
17
|
|
|
18
|
+
def content_block_scope
|
|
19
|
+
:static_page
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def scoped_resource
|
|
23
|
+
@scoped_resource ||= collection.find_by(slug: params[:id])
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def enforce_permission_to_update_resource
|
|
27
|
+
enforce_permission_to :update, :static_page, static_page: scoped_resource
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def resource_sort_url
|
|
31
|
+
update_content_blocks_static_page_path(scoped_resource)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def resource_create_url(manifest_name)
|
|
35
|
+
static_page_content_blocks_path(scoped_resource, manifest_name:)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def resource_content_block_cell
|
|
39
|
+
"decidim/admin/static_page_content_block"
|
|
40
|
+
end
|
|
41
|
+
|
|
18
42
|
def index
|
|
19
43
|
enforce_permission_to :read, :static_page
|
|
20
44
|
@topics = Decidim::StaticPageTopic.where(organization: current_organization)
|
|
@@ -38,7 +62,7 @@ module Decidim
|
|
|
38
62
|
|
|
39
63
|
on(:invalid) do
|
|
40
64
|
flash.now[:alert] = I18n.t("static_pages.create.error", scope: "decidim.admin")
|
|
41
|
-
render :new, status: :
|
|
65
|
+
render :new, status: :unprocessable_content
|
|
42
66
|
end
|
|
43
67
|
end
|
|
44
68
|
end
|
|
@@ -61,7 +85,7 @@ module Decidim
|
|
|
61
85
|
|
|
62
86
|
on(:invalid) do
|
|
63
87
|
flash.now[:alert] = I18n.t("static_pages.update.error", scope: "decidim.admin")
|
|
64
|
-
render :edit, status: :
|
|
88
|
+
render :edit, status: :unprocessable_content
|
|
65
89
|
end
|
|
66
90
|
end
|
|
67
91
|
end
|
|
@@ -77,32 +101,8 @@ module Decidim
|
|
|
77
101
|
end
|
|
78
102
|
end
|
|
79
103
|
|
|
80
|
-
def scoped_resource
|
|
81
|
-
@scoped_resource ||= collection.find_by(slug: params[:id])
|
|
82
|
-
end
|
|
83
|
-
|
|
84
104
|
private
|
|
85
105
|
|
|
86
|
-
def content_block_scope
|
|
87
|
-
:static_page
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def enforce_permission_to_update_resource
|
|
91
|
-
enforce_permission_to :update, :static_page, static_page: scoped_resource
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def resource_sort_url
|
|
95
|
-
update_content_blocks_static_page_path(scoped_resource)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def resource_create_url(manifest_name)
|
|
99
|
-
static_page_content_blocks_path(scoped_resource, manifest_name:)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def resource_content_block_cell
|
|
103
|
-
"decidim/admin/static_page_content_block"
|
|
104
|
-
end
|
|
105
|
-
|
|
106
106
|
def tab_menu_name = :admin_static_pages_menu
|
|
107
107
|
|
|
108
108
|
def form_params
|
|
@@ -121,8 +121,6 @@ module Decidim
|
|
|
121
121
|
@page ||= scoped_resource
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
protected
|
|
125
|
-
|
|
126
124
|
def collection
|
|
127
125
|
current_organization.static_pages
|
|
128
126
|
end
|
|
@@ -39,7 +39,7 @@ module Decidim
|
|
|
39
39
|
|
|
40
40
|
on(:invalid) do
|
|
41
41
|
flash.now[:alert] = I18n.t("create.invalid", scope: "decidim.admin.taxonomies")
|
|
42
|
-
render action: "new", status: :
|
|
42
|
+
render action: "new", status: :unprocessable_content
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -66,7 +66,7 @@ module Decidim
|
|
|
66
66
|
|
|
67
67
|
on(:invalid) do
|
|
68
68
|
flash.now[:alert] = I18n.t("update.invalid", scope: "decidim.admin.taxonomies")
|
|
69
|
-
render action: "edit", status: :
|
|
69
|
+
render action: "edit", status: :unprocessable_content
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
end
|
|
@@ -83,7 +83,7 @@ module Decidim
|
|
|
83
83
|
flash.now[:alert] = I18n.t("destroy.invalid", scope: "decidim.admin.taxonomies")
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
|
-
|
|
86
|
+
redirect_back_or_to(taxonomies_path)
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def reorder
|
|
@@ -41,7 +41,7 @@ module Decidim
|
|
|
41
41
|
|
|
42
42
|
on(:invalid) do
|
|
43
43
|
flash.now[:alert] = I18n.t("create.error", scope: "decidim.admin.taxonomy_filters")
|
|
44
|
-
render :new, status: :
|
|
44
|
+
render :new, status: :unprocessable_content
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -63,7 +63,7 @@ module Decidim
|
|
|
63
63
|
end
|
|
64
64
|
on(:invalid) do
|
|
65
65
|
flash.now[:alert] = I18n.t("update.error", scope: "decidim.admin.taxonomy_filters")
|
|
66
|
-
render :edit, status: :
|
|
66
|
+
render :edit, status: :unprocessable_content
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
end
|
|
@@ -78,7 +78,7 @@ module Decidim
|
|
|
78
78
|
flash[:alert] = I18n.t("destroy.error", scope: "decidim.admin.taxonomy_filters")
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
|
-
|
|
81
|
+
redirect_back_or_to(decidim_admin.taxonomy_filters_path(root_taxonomy))
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
private
|
|
@@ -88,11 +88,11 @@ module Decidim
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def root_taxonomy
|
|
91
|
-
@root_taxonomy ||= Taxonomy.
|
|
91
|
+
@root_taxonomy ||= Taxonomy.roots.find(params[:taxonomy_id])
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def taxonomy_filter
|
|
95
|
-
@taxonomy_filter ||=
|
|
95
|
+
@taxonomy_filter ||= TaxonomyFilter.find_by(id: params[:id])
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def set_taxonomies_breadcrumb_item
|
|
@@ -66,7 +66,7 @@ module Decidim
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def component
|
|
69
|
-
@component ||= Component.find_by(id: params[:component_id])
|
|
69
|
+
@component ||= Component.find_by(id: params[:component_id])
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def root_taxonomy
|
|
@@ -9,7 +9,7 @@ module Decidim
|
|
|
9
9
|
before_action do
|
|
10
10
|
if taxonomy_item && taxonomy_item.parent_ids.exclude?(taxonomy.id)
|
|
11
11
|
flash[:alert] = I18n.t("update.invalid", scope: "decidim.admin.taxonomies")
|
|
12
|
-
render plain: I18n.t("update.invalid", scope: "decidim.admin.taxonomies"), status: :
|
|
12
|
+
render plain: I18n.t("update.invalid", scope: "decidim.admin.taxonomies"), status: :unprocessable_content
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ module Decidim
|
|
|
29
29
|
|
|
30
30
|
on(:invalid) do
|
|
31
31
|
flash.now[:alert] = I18n.t("create.invalid", scope: "decidim.admin.taxonomies")
|
|
32
|
-
render action: "new", status: :
|
|
32
|
+
render action: "new", status: :unprocessable_content
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -50,7 +50,7 @@ module Decidim
|
|
|
50
50
|
|
|
51
51
|
on(:invalid) do
|
|
52
52
|
flash.now[:alert] = I18n.t("update.invalid", scope: "decidim.admin.taxonomies")
|
|
53
|
-
render action: "edit", status: :
|
|
53
|
+
render action: "edit", status: :unprocessable_content
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
@@ -12,12 +12,39 @@ module Decidim
|
|
|
12
12
|
attribute :settings, Object
|
|
13
13
|
attribute :images, Hash
|
|
14
14
|
|
|
15
|
+
validate :validate_settings
|
|
16
|
+
|
|
15
17
|
def map_model(model)
|
|
16
18
|
self.images = model.images_container
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
def settings?
|
|
20
|
-
settings.manifest
|
|
22
|
+
return false unless settings.respond_to?(:manifest)
|
|
23
|
+
|
|
24
|
+
settings.manifest.attributes.any?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def validate_settings
|
|
30
|
+
coerce_settings if settings.respond_to?(:to_h) && !settings.respond_to?(:valid?)
|
|
31
|
+
|
|
32
|
+
return unless settings.respond_to?(:valid?)
|
|
33
|
+
return if settings.valid?
|
|
34
|
+
|
|
35
|
+
settings.errors.each do |error|
|
|
36
|
+
errors.add(:settings, error.message)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def coerce_settings
|
|
41
|
+
content_block = context[:content_block]
|
|
42
|
+
return unless content_block
|
|
43
|
+
|
|
44
|
+
self.settings = content_block.manifest.settings.schema.new(
|
|
45
|
+
settings.to_h,
|
|
46
|
+
content_block.organization.default_locale
|
|
47
|
+
)
|
|
21
48
|
end
|
|
22
49
|
end
|
|
23
50
|
end
|