decidim-admin 0.26.10 → 0.27.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +3 -0
- data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +19 -0
- data/app/commands/decidim/admin/block_user.rb +3 -8
- data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
- data/app/commands/decidim/admin/create_area.rb +1 -1
- data/app/commands/decidim/admin/create_area_type.rb +6 -3
- data/app/commands/decidim/admin/create_attachment.rb +14 -6
- data/app/commands/decidim/admin/create_attachment_collection.rb +13 -4
- data/app/commands/decidim/admin/create_category.rb +6 -4
- data/app/commands/decidim/admin/create_component.rb +1 -1
- data/app/commands/decidim/admin/create_import.rb +4 -5
- data/app/commands/decidim/admin/create_import_example.rb +1 -1
- data/app/commands/decidim/admin/create_newsletter.rb +1 -1
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +1 -1
- data/app/commands/decidim/admin/create_scope.rb +1 -1
- data/app/commands/decidim/admin/create_scope_type.rb +6 -3
- data/app/commands/decidim/admin/create_static_page.rb +1 -1
- data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/deliver_newsletter.rb +6 -6
- data/app/commands/decidim/admin/destroy_area.rb +1 -1
- data/app/commands/decidim/admin/destroy_category.rb +6 -3
- data/app/commands/decidim/admin/destroy_component.rb +1 -1
- data/app/commands/decidim/admin/destroy_newsletter.rb +1 -1
- data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
- data/app/commands/decidim/admin/destroy_scope.rb +1 -1
- data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
- data/app/commands/decidim/admin/destroy_static_page.rb +1 -1
- data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/hide_resource.rb +2 -2
- data/app/commands/decidim/admin/impersonate_user.rb +1 -1
- data/app/commands/decidim/admin/invite_admin.rb +1 -1
- data/app/commands/decidim/admin/officialize_user.rb +1 -1
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +7 -3
- data/app/commands/decidim/admin/process_user_group_verification_csv.rb +8 -4
- data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
- data/app/commands/decidim/admin/publish_component.rb +2 -2
- data/app/commands/decidim/admin/reject_user_group.rb +1 -1
- data/app/commands/decidim/admin/remove_admin.rb +1 -1
- data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
- data/app/commands/decidim/admin/transfer_user.rb +1 -1
- data/app/commands/decidim/admin/unblock_user.rb +2 -2
- data/app/commands/decidim/admin/unhide_resource.rb +1 -1
- data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
- data/app/commands/decidim/admin/unpublish_component.rb +1 -1
- data/app/commands/decidim/admin/unreport_resource.rb +1 -1
- data/app/commands/decidim/admin/unreport_user.rb +1 -1
- data/app/commands/decidim/admin/update_area.rb +1 -1
- data/app/commands/decidim/admin/update_area_type.rb +8 -3
- data/app/commands/decidim/admin/update_attachment.rb +4 -3
- data/app/commands/decidim/admin/update_attachment_collection.rb +8 -3
- data/app/commands/decidim/admin/update_category.rb +9 -5
- data/app/commands/decidim/admin/update_component.rb +8 -5
- data/app/commands/decidim/admin/update_component_permissions.rb +9 -6
- data/app/commands/decidim/admin/update_content_block.rb +1 -1
- data/app/commands/decidim/admin/update_external_domain_whitelist.rb +6 -3
- data/app/commands/decidim/admin/update_help_sections.rb +17 -3
- data/app/commands/decidim/admin/update_newsletter.rb +1 -1
- data/app/commands/decidim/admin/update_organization.rb +1 -1
- data/app/commands/decidim/admin/update_organization_appearance.rb +1 -1
- data/app/commands/decidim/admin/update_organization_tos_version.rb +1 -1
- data/app/commands/decidim/admin/update_resource_permissions.rb +2 -2
- data/app/commands/decidim/admin/update_scope.rb +1 -1
- data/app/commands/decidim/admin/update_scope_type.rb +8 -3
- data/app/commands/decidim/admin/update_static_page.rb +1 -1
- data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/update_user_groups.rb +1 -1
- data/app/commands/decidim/admin/verify_user_group.rb +1 -1
- data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +3 -1
- data/app/controllers/concerns/decidim/moderations/admin/filterable.rb +0 -4
- data/app/controllers/decidim/admin/admin_terms_controller.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +1 -2
- data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
- data/app/controllers/decidim/admin/block_user_controller.rb +3 -3
- data/app/controllers/decidim/admin/categories_controller.rb +3 -3
- data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
- data/app/controllers/decidim/admin/components_controller.rb +1 -1
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
- data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
- data/app/controllers/decidim/admin/exports_controller.rb +4 -1
- data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
- data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
- data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +3 -4
- data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
- data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +3 -3
- data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
- data/app/controllers/decidim/admin/static_page_topics_controller.rb +3 -1
- data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
- data/app/forms/decidim/admin/block_user_form.rb +2 -2
- data/app/forms/decidim/admin/category_form.rb +1 -2
- data/app/forms/decidim/admin/component_form.rb +16 -7
- data/app/forms/decidim/admin/import_example_form.rb +1 -5
- data/app/forms/decidim/admin/import_form.rb +7 -10
- data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
- data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
- data/app/forms/decidim/admin/permission_form.rb +9 -8
- data/app/forms/decidim/admin/permissions_form.rb +1 -10
- data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
- data/app/helpers/decidim/admin/bulk_actions_helper.rb +6 -5
- data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
- data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
- data/app/helpers/decidim/admin/settings_helper.rb +11 -57
- data/app/models/decidim/admin/fake_newsletter.rb +0 -20
- data/app/packs/entrypoints/decidim_admin.js +3 -6
- data/app/packs/src/decidim/admin/admin_autocomplete.js +82 -0
- data/app/packs/src/decidim/admin/application.js +0 -16
- data/app/packs/src/decidim/admin/choose_language.js +9 -11
- data/app/packs/src/decidim/admin/draggable-list.js +1 -1
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +0 -1
- data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
- data/app/packs/stylesheets/decidim/admin/extra/_quill.scss +0 -7
- data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
- data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +0 -6
- data/app/packs/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
- data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +3 -0
- data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
- data/app/permissions/decidim/admin/permissions.rb +4 -46
- data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
- data/app/queries/decidim/admin/active_users_counter.rb +1 -1
- data/app/queries/decidim/admin/newsletter_recipients.rb +2 -2
- data/app/queries/decidim/admin/user_filter.rb +1 -1
- data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
- data/app/views/decidim/admin/area_types/edit.html.erb +0 -1
- data/app/views/decidim/admin/area_types/index.html.erb +0 -1
- data/app/views/decidim/admin/area_types/new.html.erb +0 -1
- data/app/views/decidim/admin/areas/edit.html.erb +0 -1
- data/app/views/decidim/admin/areas/index.html.erb +0 -1
- data/app/views/decidim/admin/areas/new.html.erb +0 -1
- data/app/views/decidim/admin/attachment_collections/edit.html.erb +0 -1
- data/app/views/decidim/admin/attachment_collections/index.html.erb +0 -1
- data/app/views/decidim/admin/attachment_collections/new.html.erb +0 -1
- data/app/views/decidim/admin/attachments/edit.html.erb +0 -1
- data/app/views/decidim/admin/attachments/index.html.erb +1 -1
- data/app/views/decidim/admin/attachments/new.html.erb +0 -1
- data/app/views/decidim/admin/authorization_workflows/index.html.erb +0 -1
- data/app/views/decidim/admin/categories/_form.html.erb +0 -4
- data/app/views/decidim/admin/categories/edit.html.erb +0 -1
- data/app/views/decidim/admin/categories/index.html.erb +0 -1
- data/app/views/decidim/admin/categories/new.html.erb +0 -1
- data/app/views/decidim/admin/categories/show.html.erb +1 -2
- data/app/views/decidim/admin/components/_component.html.erb +41 -3
- data/app/views/decidim/admin/components/edit.html.erb +0 -1
- data/app/views/decidim/admin/components/index.html.erb +0 -1
- data/app/views/decidim/admin/components/new.html.erb +1 -1
- data/app/views/decidim/admin/conflicts/index.html.erb +0 -1
- data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
- data/app/views/decidim/admin/help_sections/show.erb +0 -1
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +0 -1
- data/app/views/decidim/admin/impersonations/new.html.erb +0 -1
- data/app/views/decidim/admin/imports/new.html.erb +1 -1
- data/app/views/decidim/admin/logs/index.html.erb +0 -1
- data/app/views/decidim/admin/moderated_users/index.html.erb +1 -2
- data/app/views/decidim/admin/moderations/index.html.erb +4 -9
- data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -5
- data/app/views/decidim/admin/newsletter_templates/index.html.erb +0 -1
- data/app/views/decidim/admin/newsletter_templates/show.html.erb +0 -1
- data/app/views/decidim/admin/newsletters/index.html.erb +0 -1
- data/app/views/decidim/admin/newsletters/new.html.erb +0 -1
- data/app/views/decidim/admin/newsletters/show.html.erb +0 -1
- data/app/views/decidim/admin/officializations/index.html.erb +10 -15
- data/app/views/decidim/admin/officializations/new.html.erb +0 -1
- data/app/views/decidim/admin/organization/edit.html.erb +0 -1
- data/app/views/decidim/admin/organization_appearance/edit.html.erb +0 -1
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
- data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +0 -1
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
- data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +20 -1
- data/app/views/decidim/admin/reminders/new.html.erb +21 -0
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
- data/app/views/decidim/admin/scope_types/edit.html.erb +0 -1
- data/app/views/decidim/admin/scope_types/index.html.erb +0 -1
- data/app/views/decidim/admin/scope_types/new.html.erb +0 -1
- data/app/views/decidim/admin/scopes/edit.html.erb +0 -1
- data/app/views/decidim/admin/scopes/index.html.erb +0 -1
- data/app/views/decidim/admin/scopes/new.html.erb +0 -1
- data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
- data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
- data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +0 -1
- data/app/views/decidim/admin/static_page_topics/edit.html.erb +0 -1
- data/app/views/decidim/admin/static_page_topics/new.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/edit.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/index.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/new.html.erb +0 -1
- data/app/views/decidim/admin/user_groups/index.html.erb +0 -1
- data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +0 -1
- data/app/views/decidim/admin/users/index.html.erb +0 -1
- data/app/views/decidim/admin/users/new.html.erb +0 -1
- data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
- data/app/views/layouts/decidim/admin/global_moderations.html.erb +0 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +44 -38
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +39 -36
- data/config/locales/cs.yml +47 -42
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +52 -52
- data/config/locales/el.yml +14 -65
- data/config/locales/en.yml +25 -23
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +36 -33
- data/config/locales/es-PY.yml +36 -33
- data/config/locales/es.yml +39 -36
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +291 -324
- data/config/locales/fi-plain.yml +31 -28
- data/config/locales/fi.yml +36 -33
- data/config/locales/fr-CA.yml +35 -32
- data/config/locales/fr.yml +52 -49
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +33 -6
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +44 -222
- data/config/locales/id-ID.yml +10 -10
- data/config/locales/is-IS.yml +6 -9
- data/config/locales/it.yml +22 -6
- data/config/locales/ja.yml +39 -37
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +18 -7
- data/config/locales/lt.yml +21 -156
- data/config/locales/lv.yml +15 -4
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +19 -68
- data/config/locales/no.yml +27 -10
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +29 -25
- data/config/locales/pt-BR.yml +16 -85
- data/config/locales/pt.yml +19 -8
- data/config/locales/ro-RO.yml +32 -38
- data/config/locales/ru.yml +10 -9
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +15 -4
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +9 -20
- data/config/locales/sv.yml +39 -19
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +19 -11
- data/config/locales/uk.yml +10 -6
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +15 -4
- data/config/locales/zh-TW.yml +1 -1066
- data/config/routes.rb +0 -2
- data/lib/decidim/admin/engine.rb +1 -12
- data/lib/decidim/admin/form_builder.rb +2 -1
- data/lib/decidim/admin/import/importer.rb +9 -7
- data/lib/decidim/admin/import/readers/json.rb +1 -1
- data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
- data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
- data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
- data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
- data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
- data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
- data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
- data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
- data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
- data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
- data/lib/decidim/admin/test/manage_moderations_examples.rb +27 -79
- data/lib/decidim/admin/test.rb +0 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +22 -34
- data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -78
- data/app/packs/src/decidim/admin/autocomplete.component.js +0 -144
- data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
- data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
- data/app/views/decidim/admin/components/_actions.html.erb +0 -43
- data/config/environment.rb +0 -3
- data/config/locales/fa-IR.yml +0 -1
- data/config/locales/gn-PY.yml +0 -1
- data/config/locales/ka-GE.yml +0 -1
- data/config/locales/kaa.yml +0 -214
- data/config/locales/lo-LA.yml +0 -1
- data/config/locales/oc-FR.yml +0 -1
- data/config/locales/sq-AL.yml +0 -65
- data/config/locales/th-TH.yml +0 -1
- data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +0 -49
- data/lib/decidim/admin/test/needs_admin_tos_accepted_examples.rb +0 -9
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
BlockUser.call(@form) do
|
22
22
|
on(:ok) do
|
23
23
|
flash[:notice] = I18n.t("officializations.block.success", scope: "decidim.admin")
|
24
|
-
redirect_to
|
24
|
+
redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice: notice
|
25
25
|
end
|
26
26
|
|
27
27
|
on(:invalid) do
|
@@ -44,13 +44,13 @@ module Decidim
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
redirect_to
|
47
|
+
redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice: notice
|
48
48
|
end
|
49
49
|
|
50
50
|
private
|
51
51
|
|
52
52
|
def user
|
53
|
-
@user ||= Decidim::
|
53
|
+
@user ||= Decidim::User.find_by(
|
54
54
|
id: params[:user_id],
|
55
55
|
organization: current_organization
|
56
56
|
)
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
enforce_permission_to :create, :category
|
22
22
|
@form = form(CategoryForm).from_params(params, current_participatory_space: current_participatory_space)
|
23
23
|
|
24
|
-
CreateCategory.call(@form, current_participatory_space) do
|
24
|
+
CreateCategory.call(@form, current_participatory_space, current_user) do
|
25
25
|
on(:ok) do
|
26
26
|
flash[:notice] = I18n.t("categories.create.success", scope: "decidim.admin")
|
27
27
|
redirect_to categories_path(current_participatory_space)
|
@@ -45,7 +45,7 @@ module Decidim
|
|
45
45
|
enforce_permission_to :update, :category, category: @category
|
46
46
|
@form = form(CategoryForm).from_params(params, current_participatory_space: current_participatory_space)
|
47
47
|
|
48
|
-
UpdateCategory.call(@category, @form) do
|
48
|
+
UpdateCategory.call(@category, @form, current_user) do
|
49
49
|
on(:ok) do
|
50
50
|
flash[:notice] = I18n.t("categories.update.success", scope: "decidim.admin")
|
51
51
|
redirect_to categories_path(current_participatory_space)
|
@@ -67,7 +67,7 @@ module Decidim
|
|
67
67
|
@category = collection.find(params[:id])
|
68
68
|
enforce_permission_to :destroy, :category, category: @category
|
69
69
|
|
70
|
-
DestroyCategory.call(@category) do
|
70
|
+
DestroyCategory.call(@category, current_user) do
|
71
71
|
on(:ok) do
|
72
72
|
flash[:notice] = I18n.t("categories.destroy.success", scope: "decidim.admin")
|
73
73
|
end
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
enforce_permission_to :update, :component, component: component
|
21
21
|
@permissions_form = PermissionsForm.from_params(params)
|
22
22
|
|
23
|
-
UpdateComponentPermissions.call(@permissions_form, component, resource) do
|
23
|
+
UpdateComponentPermissions.call(@permissions_form, component, resource, current_user) do
|
24
24
|
on(:ok) do
|
25
25
|
flash[:notice] = t("component_permissions.update.success", scope: "decidim.admin")
|
26
26
|
redirect_to return_path
|
@@ -15,6 +15,7 @@ module Decidim
|
|
15
15
|
helper Decidim::ResourceHelper
|
16
16
|
helper Decidim::Admin::ExportsHelper
|
17
17
|
helper Decidim::Admin::ImportsHelper
|
18
|
+
helper Decidim::Admin::RemindersHelper
|
18
19
|
helper Decidim::Admin::BulkActionsHelper
|
19
20
|
helper Decidim::Admin::ResourcePermissionsHelper
|
20
21
|
|
@@ -58,7 +58,7 @@ module Decidim
|
|
58
58
|
@form = form(@component.form_class).from_params(component_params)
|
59
59
|
enforce_permission_to :update, :component, component: @component
|
60
60
|
|
61
|
-
UpdateComponent.call(@form, @component) do
|
61
|
+
UpdateComponent.call(@form, @component, current_user) do
|
62
62
|
on(:ok) do |settings_changed, previous_settings, current_settings|
|
63
63
|
handle_component_settings_change(previous_settings, current_settings) if settings_changed
|
64
64
|
|
@@ -31,7 +31,7 @@ module Decidim
|
|
31
31
|
enforce_permission_to :create, :attachment_collection
|
32
32
|
@form = form(AttachmentCollectionForm).from_params(params, collection_for: collection_for)
|
33
33
|
|
34
|
-
CreateAttachmentCollection.call(@form, collection_for) do
|
34
|
+
CreateAttachmentCollection.call(@form, collection_for, current_user) do
|
35
35
|
on(:ok) do
|
36
36
|
flash[:notice] = I18n.t("attachment_collections.create.success", scope: "decidim.admin")
|
37
37
|
redirect_to action: :index
|
@@ -56,7 +56,7 @@ module Decidim
|
|
56
56
|
enforce_permission_to :update, :attachment_collection, attachment_collection: @attachment_collection
|
57
57
|
@form = form(AttachmentCollectionForm).from_params(params, collection_for: collection_for)
|
58
58
|
|
59
|
-
UpdateAttachmentCollection.call(@attachment_collection, @form) do
|
59
|
+
UpdateAttachmentCollection.call(@attachment_collection, @form, current_user) do
|
60
60
|
on(:ok) do
|
61
61
|
flash[:notice] = I18n.t("attachment_collections.update.success", scope: "decidim.admin")
|
62
62
|
redirect_to action: :index
|
@@ -78,7 +78,10 @@ module Decidim
|
|
78
78
|
def destroy
|
79
79
|
@attachment_collection = collection.find(params[:id])
|
80
80
|
enforce_permission_to :destroy, :attachment_collection, attachment_collection: @attachment_collection
|
81
|
-
|
81
|
+
|
82
|
+
Decidim.traceability.perform_action!("delete", @attachment_collection, current_user) do
|
83
|
+
@attachment_collection.destroy!
|
84
|
+
end
|
82
85
|
|
83
86
|
flash[:notice] = I18n.t("attachment_collections.destroy.success", scope: "decidim.admin")
|
84
87
|
|
@@ -31,7 +31,7 @@ module Decidim
|
|
31
31
|
enforce_permission_to :create, :attachment, attached_to: attached_to
|
32
32
|
@form = form(::Decidim::Admin::AttachmentForm).from_params(params, attached_to: attached_to)
|
33
33
|
|
34
|
-
CreateAttachment.call(@form, attached_to) do
|
34
|
+
CreateAttachment.call(@form, attached_to, current_user) do
|
35
35
|
on(:ok) do
|
36
36
|
flash[:notice] = I18n.t("attachments.create.success", scope: "decidim.admin")
|
37
37
|
redirect_to action: :index
|
@@ -56,7 +56,7 @@ module Decidim
|
|
56
56
|
enforce_permission_to :update, :attachment, attachment: attachment
|
57
57
|
@form = form(::Decidim::Admin::AttachmentForm).from_params(attachment_params, attached_to: attached_to)
|
58
58
|
|
59
|
-
UpdateAttachment.call(@attachment, @form) do
|
59
|
+
UpdateAttachment.call(@attachment, @form, current_user) do
|
60
60
|
on(:ok) do
|
61
61
|
flash[:notice] = I18n.t("attachments.update.success", scope: "decidim.admin")
|
62
62
|
redirect_to action: :index
|
@@ -78,7 +78,10 @@ module Decidim
|
|
78
78
|
def destroy
|
79
79
|
@attachment = collection.find(params[:id])
|
80
80
|
enforce_permission_to :destroy, :attachment, attachment: attachment
|
81
|
-
|
81
|
+
|
82
|
+
Decidim.traceability.perform_action!("delete", @attachment, current_user) do
|
83
|
+
@attachment.destroy!
|
84
|
+
end
|
82
85
|
|
83
86
|
flash[:notice] = I18n.t("attachments.destroy.success", scope: "decidim.admin")
|
84
87
|
|
@@ -18,6 +18,7 @@ module Decidim
|
|
18
18
|
def new
|
19
19
|
enforce_permission_to :csv_import, :space_private_user
|
20
20
|
@form = form(ParticipatorySpacePrivateUserCsvImportForm).from_params({}, privatable_to: privatable_to)
|
21
|
+
@count = Decidim::ParticipatorySpacePrivateUser.by_participatory_space(privatable_to).count
|
21
22
|
render template: "decidim/admin/participatory_space_private_users_csv_imports/new"
|
22
23
|
end
|
23
24
|
|
@@ -38,6 +39,12 @@ module Decidim
|
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
42
|
+
def destroy_all
|
43
|
+
enforce_permission_to :csv_import, :space_private_user
|
44
|
+
Decidim::ParticipatorySpacePrivateUser.by_participatory_space(privatable_to).delete_all
|
45
|
+
redirect_to new_participatory_space_private_users_csv_imports_path
|
46
|
+
end
|
47
|
+
|
41
48
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
42
49
|
# importing private users. By default it redirects to the privatable_to.
|
43
50
|
#
|
@@ -27,7 +27,8 @@ module Decidim
|
|
27
27
|
def metrics_presenter
|
28
28
|
@metrics_presenter ||= Decidim::Admin::DashboardMetricChartsPresenter.new(
|
29
29
|
summary: true,
|
30
|
-
organization: current_organization
|
30
|
+
organization: current_organization,
|
31
|
+
view_context: view_context
|
31
32
|
)
|
32
33
|
end
|
33
34
|
|
@@ -37,10 +38,10 @@ module Decidim
|
|
37
38
|
last_month = Time.zone.today.prev_month
|
38
39
|
|
39
40
|
{
|
40
|
-
|
41
|
+
total_admins_last_day: users_count(last_day, true),
|
41
42
|
total_admins_last_week: users_count(last_week, true),
|
42
43
|
total_admins_last_month: users_count(last_month, true),
|
43
|
-
|
44
|
+
total_participants_last_day: users_count(last_day, false),
|
44
45
|
total_participants_last_week: users_count(last_week, false),
|
45
46
|
total_participants_last_month: users_count(last_month, false)
|
46
47
|
}
|
@@ -9,7 +9,10 @@ module Decidim
|
|
9
9
|
def create
|
10
10
|
enforce_permission_to :export, :component_data, component: component
|
11
11
|
name = params[:id]
|
12
|
-
|
12
|
+
|
13
|
+
Decidim.traceability.perform_action!("export_component", component, current_user, { name: name, format: params[:format] || default_format }) do
|
14
|
+
ExportJob.perform_later(current_user, component, name, params[:format] || default_format, params[:resource_id].presence)
|
15
|
+
end
|
13
16
|
|
14
17
|
flash[:notice] = t("decidim.admin.exports.notice")
|
15
18
|
|
@@ -25,7 +25,7 @@ module Decidim
|
|
25
25
|
params[:help_sections]
|
26
26
|
)
|
27
27
|
|
28
|
-
UpdateHelpSections.call(@form, current_organization) do
|
28
|
+
UpdateHelpSections.call(@form, current_organization, current_user) do
|
29
29
|
on(:ok) do
|
30
30
|
flash[:notice] = t("help_sections.success", scope: "decidim.admin")
|
31
31
|
redirect_to action: :show
|
@@ -14,7 +14,8 @@ module Decidim
|
|
14
14
|
def metrics_presenter
|
15
15
|
@metrics_presenter ||= Decidim::Admin::DashboardMetricChartsPresenter.new(
|
16
16
|
summary: false,
|
17
|
-
organization: current_organization
|
17
|
+
organization: current_organization,
|
18
|
+
view_context: view_context
|
18
19
|
)
|
19
20
|
end
|
20
21
|
end
|
@@ -67,16 +67,18 @@ module Decidim
|
|
67
67
|
|
68
68
|
private
|
69
69
|
|
70
|
+
def ransack_params
|
71
|
+
query_params[:q] || { s: "created_at desc" }
|
72
|
+
end
|
73
|
+
|
70
74
|
# Private: This method is used by the `Filterable` concern as the base query
|
71
75
|
# without applying filtering and/or sorting options.
|
72
76
|
def collection
|
73
|
-
@collection ||=
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
77
|
+
@collection ||= if params[:hidden]
|
78
|
+
participatory_space_moderations.hidden
|
79
|
+
else
|
80
|
+
participatory_space_moderations.not_hidden
|
81
|
+
end
|
80
82
|
end
|
81
83
|
|
82
84
|
# Private: Returns a collection of `Moderation` filtered and/or sorted by
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
def show; end
|
16
16
|
|
17
17
|
def preview
|
18
|
-
email = NewsletterMailer.newsletter(current_user, fake_newsletter
|
18
|
+
email = NewsletterMailer.newsletter(current_user, fake_newsletter)
|
19
19
|
Premailer::Rails::Hook.perform(email)
|
20
20
|
render html: email.html_part.body.decoded.html_safe
|
21
21
|
end
|
@@ -28,7 +28,7 @@ module Decidim
|
|
28
28
|
def preview
|
29
29
|
enforce_permission_to :read, :newsletter, newsletter: newsletter
|
30
30
|
|
31
|
-
email = NewsletterMailer.newsletter(current_user, newsletter
|
31
|
+
email = NewsletterMailer.newsletter(current_user, newsletter)
|
32
32
|
Premailer::Rails::Hook.perform(email)
|
33
33
|
render html: email.html_part.body.decoded.html_safe
|
34
34
|
end
|
@@ -15,7 +15,6 @@ module Decidim
|
|
15
15
|
def update
|
16
16
|
enforce_permission_to :update, :organization, organization: current_organization
|
17
17
|
@form = form(OrganizationForm).from_params(params)
|
18
|
-
@form.id = current_organization.id
|
19
18
|
|
20
19
|
UpdateOrganization.call(current_organization, @form) do
|
21
20
|
on(:ok) do
|
@@ -31,11 +30,11 @@ module Decidim
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def users
|
34
|
-
search(current_organization.users
|
33
|
+
search(current_organization.users)
|
35
34
|
end
|
36
35
|
|
37
36
|
def user_entities
|
38
|
-
search(current_organization.user_entities
|
37
|
+
search(current_organization.user_entities)
|
39
38
|
end
|
40
39
|
|
41
40
|
private
|
@@ -52,7 +51,7 @@ module Decidim
|
|
52
51
|
query.where("email ILIKE ?", "%#{term}%")
|
53
52
|
)
|
54
53
|
end
|
55
|
-
render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname})" } }
|
54
|
+
render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname}) #{u.email}" } }
|
56
55
|
else
|
57
56
|
render json: []
|
58
57
|
end
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
enforce_permission_to :update, :organization, organization: current_organization
|
17
17
|
@form = form(OrganizationExternalDomainWhitelistForm).from_params(params)
|
18
18
|
|
19
|
-
UpdateExternalDomainWhitelist.call(@form, current_organization) do
|
19
|
+
UpdateExternalDomainWhitelist.call(@form, current_organization, current_user) do
|
20
20
|
on(:ok) do
|
21
21
|
flash[:notice] = t("domain_whitelist.update.success", scope: "decidim.admin")
|
22
22
|
redirect_to edit_organization_external_domain_whitelist_path
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
class RemindersController < Admin::ApplicationController
|
6
|
+
include Decidim::ComponentPathHelper
|
7
|
+
|
8
|
+
helper_method :reminder_manifest
|
9
|
+
|
10
|
+
def new
|
11
|
+
enforce_permission_to :create, :reminder
|
12
|
+
|
13
|
+
@form = reminder_form_from_params(name: reminder_manifest.name)
|
14
|
+
render :new
|
15
|
+
end
|
16
|
+
|
17
|
+
def create
|
18
|
+
enforce_permission_to :create, :reminder
|
19
|
+
|
20
|
+
@form = reminder_form_from_params(params)
|
21
|
+
|
22
|
+
command_class.call(@form) do
|
23
|
+
on(:ok) do |reminders_queued|
|
24
|
+
flash[:notice] = t("decidim.admin.reminders.create.success", count: reminders_queued)
|
25
|
+
redirect_to manage_component_path(current_component)
|
26
|
+
end
|
27
|
+
|
28
|
+
on(:invalid) do
|
29
|
+
flash.now[:alert] = t("decidim.admin.reminders.create.error")
|
30
|
+
render :new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def reminder_form_from_params(params)
|
38
|
+
form(reminder_manifest.form_class).from_params(
|
39
|
+
params,
|
40
|
+
current_component: current_component
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def reminder_manifest
|
45
|
+
@reminder_manifest ||= Decidim.reminders_registry.for(reminder_name)
|
46
|
+
end
|
47
|
+
|
48
|
+
def reminder_name
|
49
|
+
params[:name]
|
50
|
+
end
|
51
|
+
|
52
|
+
def command_class
|
53
|
+
reminder_manifest.command_class
|
54
|
+
end
|
55
|
+
|
56
|
+
def current_component
|
57
|
+
@current_component ||= current_participatory_space.components.find(params[:component_id])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -47,8 +47,8 @@ module Decidim
|
|
47
47
|
def permission_forms
|
48
48
|
actions.inject({}) do |result, action|
|
49
49
|
form = PermissionForm.new(
|
50
|
-
authorization_handlers: authorizations_for(action),
|
51
|
-
|
50
|
+
authorization_handlers: authorizations_for(action).keys,
|
51
|
+
authorization_handlers_options: options_for(action)
|
52
52
|
)
|
53
53
|
|
54
54
|
result.update(action => form)
|
@@ -83,7 +83,7 @@ module Decidim
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def manifest_name
|
86
|
-
@manifest_name ||= resource.
|
86
|
+
@manifest_name ||= resource.manifest.name
|
87
87
|
end
|
88
88
|
|
89
89
|
def permissions
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
enforce_permission_to :create, :scope_type
|
22
22
|
@form = form(ScopeTypeForm).from_params(params)
|
23
23
|
|
24
|
-
CreateScopeType.call(@form) do
|
24
|
+
CreateScopeType.call(@form, current_user) do
|
25
25
|
on(:ok) do
|
26
26
|
flash[:notice] = I18n.t("scope_types.create.success", scope: "decidim.admin")
|
27
27
|
redirect_to scope_types_path
|
@@ -43,7 +43,7 @@ module Decidim
|
|
43
43
|
enforce_permission_to :update, :scope_type, scope_type: scope_type
|
44
44
|
@form = form(ScopeTypeForm).from_params(params)
|
45
45
|
|
46
|
-
UpdateScopeType.call(scope_type, @form) do
|
46
|
+
UpdateScopeType.call(scope_type, @form, current_user) do
|
47
47
|
on(:ok) do
|
48
48
|
flash[:notice] = I18n.t("scope_types.update.success", scope: "decidim.admin")
|
49
49
|
redirect_to scope_types_path
|
@@ -58,7 +58,10 @@ module Decidim
|
|
58
58
|
|
59
59
|
def destroy
|
60
60
|
enforce_permission_to :destroy, :scope_type, scope_type: scope_type
|
61
|
-
|
61
|
+
|
62
|
+
Decidim.traceability.perform_action!("delete", scope_type, current_user) do
|
63
|
+
scope_type.destroy!
|
64
|
+
end
|
62
65
|
|
63
66
|
flash[:notice] = I18n.t("scope_types.destroy.success", scope: "decidim.admin")
|
64
67
|
|
@@ -82,13 +82,7 @@ module Decidim
|
|
82
82
|
form_params = params.to_unsafe_hash
|
83
83
|
form_params["static_page"] ||= {}
|
84
84
|
form_params["static_page"]["organization"] = current_organization
|
85
|
-
form_params["static_page"]["allow_public_access"] ||=
|
86
|
-
if page
|
87
|
-
page.allow_public_access
|
88
|
-
else
|
89
|
-
false
|
90
|
-
end
|
91
|
-
end
|
85
|
+
form_params["static_page"]["allow_public_access"] ||= page ? page.allow_public_access : false
|
92
86
|
|
93
87
|
return form_params unless page
|
94
88
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
|
-
# A form object used to
|
5
|
+
# A form object used to officialize users from the admin dashboard.
|
6
6
|
class BlockUserForm < Form
|
7
7
|
attribute :user_id, Integer
|
8
8
|
attribute :justification, String
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def user
|
18
|
-
@user ||= Decidim::
|
18
|
+
@user ||= Decidim::User.find_by(
|
19
19
|
id: user_id,
|
20
20
|
organization: current_organization
|
21
21
|
)
|
@@ -9,12 +9,11 @@ module Decidim
|
|
9
9
|
|
10
10
|
translatable_attribute :name, String
|
11
11
|
attribute :weight, Integer, default: 0
|
12
|
-
translatable_attribute :description, String
|
13
12
|
attribute :parent_id, Integer
|
14
13
|
|
15
14
|
mimic :category
|
16
15
|
|
17
|
-
validates :name,
|
16
|
+
validates :name, translatable_presence: true
|
18
17
|
validates :parent_id, inclusion: { in: :parent_categories_ids }, allow_blank: true
|
19
18
|
|
20
19
|
delegate :current_participatory_space, to: :context, prefix: false
|
@@ -21,10 +21,12 @@ module Decidim
|
|
21
21
|
|
22
22
|
attribute :settings, Object
|
23
23
|
attribute :default_step_settings, Object
|
24
|
-
attribute
|
24
|
+
attribute(:step_settings, { String => Object })
|
25
25
|
|
26
26
|
attribute :share_tokens, Array[ShareToken]
|
27
27
|
|
28
|
+
validate :validate_settings, :validate_step_settings
|
29
|
+
|
28
30
|
def settings?
|
29
31
|
settings.manifest.attributes.any?
|
30
32
|
end
|
@@ -39,13 +41,20 @@ module Decidim
|
|
39
41
|
|
40
42
|
private
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
def validate_settings
|
45
|
+
return unless errors.empty? && settings_errors_empty? # Preserves errors from custom validation methods
|
46
|
+
|
47
|
+
attributes.each do |key, value|
|
48
|
+
next unless value.respond_to?(:valid?)
|
49
|
+
|
50
|
+
errors.add(key, :invalid) unless value.valid?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def validate_step_settings
|
55
|
+
return unless step_settings.respond_to?(:attributes)
|
45
56
|
|
46
|
-
|
47
|
-
step_settings.each_value.select { |attribute| attribute.respond_to?(:valid?) }
|
48
|
-
).all?(&:valid?)
|
57
|
+
errors.add(:step_settings, :invalid) unless step_settings.attributes.values.all? { |v| !v.respond_to?(:valid?) || v.valid? }
|
49
58
|
end
|
50
59
|
|
51
60
|
def settings_errors_empty?
|
@@ -5,9 +5,10 @@ module Decidim
|
|
5
5
|
class ImportForm < Form
|
6
6
|
ACCEPTED_MIME_TYPES = Decidim::Admin::Import::Readers::ACCEPTED_MIME_TYPES
|
7
7
|
include Decidim::HasUploadValidations
|
8
|
+
include Decidim::ProcessesFileLocally
|
8
9
|
|
9
10
|
attribute :name, String
|
10
|
-
attribute :file
|
11
|
+
attribute :file, Decidim::Attributes::Blob
|
11
12
|
|
12
13
|
validates :file, presence: true
|
13
14
|
validates :name, presence: true
|
@@ -16,7 +17,7 @@ module Decidim
|
|
16
17
|
validate :verify_import, if: -> { file.present? && accepted_mime_type? && !importer.invalid_file? }
|
17
18
|
|
18
19
|
def importer
|
19
|
-
@importer ||= importer_for(
|
20
|
+
@importer ||= importer_for(file, mime_type)
|
20
21
|
end
|
21
22
|
|
22
23
|
private
|
@@ -44,15 +45,11 @@ module Decidim
|
|
44
45
|
def verify_import
|
45
46
|
return if importer.verify
|
46
47
|
|
47
|
-
importer.errors.each do |
|
48
|
-
errors.add(:file, message)
|
48
|
+
importer.errors.each do |error|
|
49
|
+
errors.add(:file, error.message)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
|
-
def file_path
|
53
|
-
file&.path
|
54
|
-
end
|
55
|
-
|
56
53
|
def mime_type
|
57
54
|
file&.content_type
|
58
55
|
end
|
@@ -61,9 +58,9 @@ module Decidim
|
|
61
58
|
manifest.creator
|
62
59
|
end
|
63
60
|
|
64
|
-
def importer_for(
|
61
|
+
def importer_for(path, mime_type)
|
65
62
|
Import::ImporterFactory.build(
|
66
|
-
|
63
|
+
path,
|
67
64
|
mime_type,
|
68
65
|
context: importer_context,
|
69
66
|
creator: creator_class
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
class ManagedUserPromotionForm < Form
|
8
8
|
attribute :email, String
|
9
9
|
|
10
|
-
validates :email, presence: true,
|
10
|
+
validates :email, presence: true, "valid_email_2/email": { disposable: true }
|
11
11
|
validate :unique_email
|
12
12
|
|
13
13
|
private
|
@@ -8,19 +8,22 @@ module Decidim
|
|
8
8
|
#
|
9
9
|
class ParticipatorySpacePrivateUserCsvImportForm < Form
|
10
10
|
include Decidim::HasUploadValidations
|
11
|
+
include Decidim::ProcessesFileLocally
|
11
12
|
|
12
|
-
attribute :file
|
13
|
+
attribute :file, Decidim::Attributes::Blob
|
13
14
|
attribute :user_name, String
|
14
15
|
attribute :email, String
|
15
16
|
|
16
|
-
validates :file, presence: true
|
17
|
+
validates :file, presence: true, file_content_type: { allow: ["text/csv"] }
|
17
18
|
validate :validate_csv
|
18
19
|
|
19
20
|
def validate_csv
|
20
21
|
return if file.blank?
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
process_file_locally(file) do |file_path|
|
24
|
+
CSV.foreach(file_path) do |_email, user_name|
|
25
|
+
errors.add(:user_name, :invalid) unless user_name.match?(UserBaseEntity::REGEXP_NAME)
|
26
|
+
end
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|