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
@@ -4,15 +4,21 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# This form handles permissions for a particular action in the admin panel.
|
6
6
|
class PermissionForm < Form
|
7
|
-
attribute :authorization_handlers,
|
8
|
-
attribute
|
7
|
+
attribute :authorization_handlers, Array[String]
|
8
|
+
attribute(:authorization_handlers_options, { String => Object })
|
9
|
+
|
10
|
+
def authorization_handlers
|
11
|
+
handlers = super || []
|
12
|
+
|
13
|
+
handlers.index_with { |name| { "options" => authorization_handler_options(name) } }
|
14
|
+
end
|
9
15
|
|
10
16
|
def authorization_handlers_names
|
11
17
|
authorization_handlers.keys.map(&:to_s)
|
12
18
|
end
|
13
19
|
|
14
20
|
def authorization_handler_options(handler_name)
|
15
|
-
|
21
|
+
authorization_handlers_options&.dig(handler_name.to_s) || {}
|
16
22
|
end
|
17
23
|
|
18
24
|
def manifest(handler_name)
|
@@ -33,11 +39,6 @@ module Decidim
|
|
33
39
|
def options_manifest(handler_name)
|
34
40
|
manifest(handler_name).options
|
35
41
|
end
|
36
|
-
|
37
|
-
def find_handler(handler_name)
|
38
|
-
authorization_handlers[handler_name.to_s] ||
|
39
|
-
authorization_handlers[handler_name.to_sym]
|
40
|
-
end
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -7,16 +7,7 @@ module Decidim
|
|
7
7
|
class PermissionsForm < Form
|
8
8
|
mimic :component_permissions
|
9
9
|
|
10
|
-
attribute
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
# Overriding Rectify::Form#form_attributes_valid? to preserve errors from custom method validations.
|
15
|
-
def form_attributes_valid?
|
16
|
-
return false unless errors.empty? && permissions.each_value.map(&:errors).all?(&:empty?)
|
17
|
-
|
18
|
-
super && permissions.values.all?(&:valid?)
|
19
|
-
end
|
10
|
+
attribute(:permissions, { String => PermissionForm })
|
20
11
|
end
|
21
12
|
end
|
22
13
|
end
|
@@ -7,9 +7,9 @@ module Decidim
|
|
7
7
|
class UserGroupCsvVerificationForm < Form
|
8
8
|
include Decidim::HasUploadValidations
|
9
9
|
|
10
|
-
attribute :file
|
10
|
+
attribute :file, Decidim::Attributes::Blob
|
11
11
|
|
12
|
-
validates :file, presence: true
|
12
|
+
validates :file, presence: true, file_content_type: { allow: ["text/csv"] }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -3,10 +3,6 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
module BulkActionsHelper
|
6
|
-
def proposal_find(id)
|
7
|
-
Decidim::Proposals::Proposal.find(id)
|
8
|
-
end
|
9
|
-
|
10
6
|
# Public: Generates a select field with the categories. Only leaf categories can be set as selected.
|
11
7
|
#
|
12
8
|
# categories - A collection of categories.
|
@@ -14,8 +10,9 @@ module Decidim
|
|
14
10
|
# Returns a String.
|
15
11
|
def bulk_categories_select(collection)
|
16
12
|
categories = bulk_categories_for_select collection
|
13
|
+
disabled = bulk_disabled_categories_for collection
|
17
14
|
prompt = t("decidim.proposals.admin.proposals.index.change_category")
|
18
|
-
select(:category, :id, options_for_select(categories, selected: []), prompt: prompt)
|
15
|
+
select(:category, :id, options_for_select(categories, selected: [], disabled: disabled), prompt: prompt)
|
19
16
|
end
|
20
17
|
|
21
18
|
def bulk_categories_for_select(scope)
|
@@ -38,6 +35,10 @@ module Decidim
|
|
38
35
|
end
|
39
36
|
end
|
40
37
|
|
38
|
+
def bulk_disabled_categories_for(scope)
|
39
|
+
scope.first_class.joins(:subcategories).pluck(:id)
|
40
|
+
end
|
41
|
+
|
41
42
|
# Public: Generates a select field with the components.
|
42
43
|
#
|
43
44
|
# siblings - A collection of components.
|
@@ -6,22 +6,31 @@ module Decidim
|
|
6
6
|
# This module includes helpers to show moderation reports in admin
|
7
7
|
module ReportsHelper
|
8
8
|
include Decidim::Messaging::ConversationHelper
|
9
|
+
include Decidim::ResourceHelper
|
10
|
+
include Decidim::TranslationsHelper
|
9
11
|
|
10
12
|
# Public: Returns the reportable's author names separated by commas.
|
11
13
|
def reportable_author_name(reportable)
|
12
14
|
reportable_authors = reportable.try(:authors) || [reportable.try(:normalized_author)]
|
13
15
|
content_tag :ul, class: "reportable-authors" do
|
14
16
|
reportable_authors.select(&:present?).map do |author|
|
15
|
-
|
17
|
+
case author
|
18
|
+
when User
|
16
19
|
content_tag :li do
|
17
20
|
link_to current_or_new_conversation_path_with(author), target: "_blank", rel: "noopener" do
|
18
21
|
"#{author.name} #{icon "envelope-closed"}".html_safe
|
19
22
|
end
|
20
23
|
end
|
24
|
+
when Decidim::Meetings::Meeting
|
25
|
+
content_tag :li do
|
26
|
+
link_to resource_locator(author).path, target: "_blank", rel: "noopener" do
|
27
|
+
translated_attribute(author.title)
|
28
|
+
end
|
29
|
+
end
|
21
30
|
else
|
22
31
|
content_tag(:li, author.name)
|
23
32
|
end
|
24
|
-
end.join
|
33
|
+
end.join.html_safe
|
25
34
|
end
|
26
35
|
end
|
27
36
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
module RemindersHelper
|
6
|
+
# Route to the correct reminder for a component.
|
7
|
+
def admin_reminders_path(component, options = {})
|
8
|
+
EngineRouter.admin_proxy(component.participatory_space).new_component_reminder_path(options.merge(component_id: component))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -18,19 +18,16 @@ module Decidim
|
|
18
18
|
time: :datetime_field
|
19
19
|
}.freeze
|
20
20
|
|
21
|
-
# Renders a form field that matches a settings attribute's
|
22
|
-
#
|
21
|
+
# Public: Renders a form field that matches a settings attribute's
|
22
|
+
# type.
|
23
23
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
# It can be "global-settings" or "step-N-settings", where N is the number of the step.
|
32
|
-
# @option options [nil, Boolean] :readonly True if the input is readonly.
|
33
|
-
# @return [ActiveSupport::SafeBuffer] Rendered form field.
|
24
|
+
# form - The form in which to render the field.
|
25
|
+
# attribute - The Settings::Attribute instance with the
|
26
|
+
# description of the attribute.
|
27
|
+
# name - The name of the field.
|
28
|
+
# options - Extra options to be passed to the field helper.
|
29
|
+
#
|
30
|
+
# Returns a rendered form field.
|
34
31
|
def settings_attribute_input(form, attribute, name, i18n_scope, options = {})
|
35
32
|
form_method = form_method_for_attribute(attribute)
|
36
33
|
|
@@ -65,18 +62,6 @@ module Decidim
|
|
65
62
|
|
66
63
|
private
|
67
64
|
|
68
|
-
# Renders a select field collection input for the given attribute
|
69
|
-
#
|
70
|
-
# @param form (see #settings_attribute_input)
|
71
|
-
# @param attribute (see #settings_attribute_input)
|
72
|
-
# @param name (see #settings_attribute_input)
|
73
|
-
# @param i18n_scope (see #settings_attribute_input)
|
74
|
-
# @param options (see #settings_attribute_input)
|
75
|
-
# @option :tabs_prefix (see #settings_attribute_input)
|
76
|
-
# @option :readonly (see #settings_attribute_input)
|
77
|
-
# @option options [String] :label The label that this field has
|
78
|
-
# @option options [String] :help_text The help text shown after the input field
|
79
|
-
# @return (see #settings_attribute_input)
|
80
65
|
def render_select_form_field(form, attribute, name, i18n_scope, options)
|
81
66
|
html = form.select(
|
82
67
|
name,
|
@@ -88,17 +73,6 @@ module Decidim
|
|
88
73
|
end
|
89
74
|
|
90
75
|
# Returns a radio buttons collection input for the given attribute
|
91
|
-
#
|
92
|
-
# @param form (see #settings_attribute_input)
|
93
|
-
# @param attribute (see #settings_attribute_input)
|
94
|
-
# @param name (see #settings_attribute_input)
|
95
|
-
# @param i18n_scope (see #settings_attribute_input)
|
96
|
-
# @param options (see #settings_attribute_input)
|
97
|
-
# @option :tabs_prefix (see #settings_attribute_input)
|
98
|
-
# @option :readonly (see #settings_attribute_input)
|
99
|
-
# @option :label (see #render_select_form_field)
|
100
|
-
# @option :help_text (see #render_select_form_field)
|
101
|
-
# @return (see #settings_attribute_input)
|
102
76
|
def render_enum_form_field(form, attribute, name, i18n_scope, options)
|
103
77
|
html = label_tag(name) do
|
104
78
|
concat options[:label]
|
@@ -114,25 +88,13 @@ module Decidim
|
|
114
88
|
html
|
115
89
|
end
|
116
90
|
|
117
|
-
# Get the translation for a given attribute
|
118
91
|
# Returns a translation or nil. If nil, ZURB Foundation won't add the help_text.
|
119
|
-
#
|
120
|
-
# @param name (see #settings_attribute_input)
|
121
|
-
# @param suffix [String] What suffix the i18n key has
|
122
|
-
# @param i18n_scope (see #settings_attribute_input)
|
123
|
-
# @return [String, nil]
|
124
92
|
def text_for_setting(name, suffix, i18n_scope)
|
125
|
-
html_key = "#{i18n_scope}.#{name}_#{suffix}_html"
|
126
|
-
return t(html_key) if I18n.exists?(html_key)
|
127
|
-
|
128
93
|
key = "#{i18n_scope}.#{name}_#{suffix}"
|
129
94
|
return t(key) if I18n.exists?(key)
|
130
95
|
end
|
131
96
|
|
132
|
-
#
|
133
|
-
#
|
134
|
-
# @param attribute [Decidim::SettingsManifest::Attribute]
|
135
|
-
# @return [Symbol] The FormBuilder's method used to render
|
97
|
+
# Returns the FormBuilder's method used to render
|
136
98
|
def form_method_for_attribute(attribute)
|
137
99
|
return :editor if attribute.type.to_sym == :text && attribute.editor?
|
138
100
|
|
@@ -140,9 +102,7 @@ module Decidim
|
|
140
102
|
end
|
141
103
|
|
142
104
|
# Handles special cases.
|
143
|
-
#
|
144
|
-
# @param input_type [Symbol]
|
145
|
-
# @return [Hash] Empty Hash or a Hash with extra HTML options.
|
105
|
+
# Returns an empty Hash or a Hash with extra HTML options.
|
146
106
|
def extra_options_for_type(input_type)
|
147
107
|
case input_type
|
148
108
|
when :text_area
|
@@ -153,12 +113,6 @@ module Decidim
|
|
153
113
|
end
|
154
114
|
|
155
115
|
# Build options for enum attributes
|
156
|
-
# Get the translation for a given attribute of type choice
|
157
|
-
#
|
158
|
-
# @param name (see #settings_attribute_input)
|
159
|
-
# @param i18n_scope (see #settings_attribute_input)
|
160
|
-
# @param choices [Array<Symbol>]
|
161
|
-
# @return [Array<Array<String>>]
|
162
116
|
def build_enum_choices(name, i18n_scope, choices)
|
163
117
|
choices.map do |choice|
|
164
118
|
[t("#{name}_choices.#{choice}", scope: i18n_scope), choice]
|
@@ -41,26 +41,6 @@ module Decidim
|
|
41
41
|
nil
|
42
42
|
end
|
43
43
|
|
44
|
-
def draft?
|
45
|
-
true
|
46
|
-
end
|
47
|
-
|
48
|
-
def url(**_)
|
49
|
-
"#"
|
50
|
-
end
|
51
|
-
|
52
|
-
def notifications_settings_url(**_)
|
53
|
-
"#"
|
54
|
-
end
|
55
|
-
|
56
|
-
def unsubscribe_newsletters_url(**_)
|
57
|
-
"#"
|
58
|
-
end
|
59
|
-
|
60
|
-
def organization_official_url
|
61
|
-
"#"
|
62
|
-
end
|
63
|
-
|
64
44
|
private
|
65
45
|
|
66
46
|
attr_reader :organization, :manifest
|
@@ -10,11 +10,10 @@ import Rails from "@rails/ujs"
|
|
10
10
|
import "foundation-sites"
|
11
11
|
import "src/decidim/vendor/foundation-datepicker"
|
12
12
|
import "src/decidim/foundation_datepicker_locales"
|
13
|
-
import "jquery.autocomplete"
|
14
13
|
import "jquery-serializejson"
|
15
14
|
|
16
15
|
import "src/decidim/admin/tab_focus"
|
17
|
-
import
|
16
|
+
import "src/decidim/admin/choose_language"
|
18
17
|
import "src/decidim/admin/application"
|
19
18
|
import "src/decidim/admin/resources_permissions"
|
20
19
|
import "src/decidim/admin/welcome_notification"
|
@@ -34,13 +33,11 @@ import "src/decidim/ajax_modals"
|
|
34
33
|
import "src/decidim/admin/officializations"
|
35
34
|
import "src/decidim/session_timeouter"
|
36
35
|
import "src/decidim/slug_form"
|
36
|
+
import "src/decidim/direct_uploads/upload_field"
|
37
|
+
import "src/decidim/admin/admin_autocomplete"
|
37
38
|
|
38
39
|
// CSS
|
39
40
|
import "entrypoints/decidim_admin.scss";
|
40
41
|
|
41
42
|
// This needs to be loaded after confirm dialog to bind properly
|
42
43
|
Rails.start()
|
43
|
-
|
44
|
-
window.addEventListener("DOMContentLoaded", () => {
|
45
|
-
initLanguageChangeSelect(document.querySelectorAll("select.language-change"));
|
46
|
-
});
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import AutoComplete from "src/decidim/autocomplete";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* This function can be used to create an autocomplete input automatically
|
5
|
+
* from the following kind of div:
|
6
|
+
* <div data-autocomplete="{...}"></div>
|
7
|
+
*
|
8
|
+
* The data-autocomplete attribute should contain the following configuration
|
9
|
+
* as an encoded JSON, which is used to generate the AutoComplete options:
|
10
|
+
* - name: assembly_member[user_id],
|
11
|
+
* - options: [],
|
12
|
+
* - placeholder: "Select a participant",
|
13
|
+
* - searchURL: "http://..."
|
14
|
+
* - selected: "",
|
15
|
+
*
|
16
|
+
* @param {HTMLElement} el The element to generate the autocomplete for.
|
17
|
+
* @returns {AutoComplete} An instance of the AutoComplete class.
|
18
|
+
*/
|
19
|
+
const autoConfigure = (el) => {
|
20
|
+
const config = JSON.parse(el.dataset.autocomplete);
|
21
|
+
const textInput = document.createElement("input");
|
22
|
+
textInput.type = "text";
|
23
|
+
textInput.className = "autocomplete-input";
|
24
|
+
el.appendChild(textInput);
|
25
|
+
let mode = config.mode || "sticky"
|
26
|
+
let selected = null;
|
27
|
+
if (config.selected) {
|
28
|
+
switch (mode) {
|
29
|
+
case "multi":
|
30
|
+
selected = config.selected.map((item) => (
|
31
|
+
{
|
32
|
+
key: "label",
|
33
|
+
value: {
|
34
|
+
value: item.value,
|
35
|
+
label: item.label
|
36
|
+
}
|
37
|
+
}
|
38
|
+
));
|
39
|
+
break;
|
40
|
+
case "sticky":
|
41
|
+
selected = { key: "label", value: config.options[config.options.length - 1] };
|
42
|
+
break;
|
43
|
+
default:
|
44
|
+
selected = config.selected;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
const dataSource = (query, callback) => {
|
49
|
+
const params = new URLSearchParams({ term: query });
|
50
|
+
fetch(`${config.searchURL}?${params.toString()}`, {
|
51
|
+
method: "GET",
|
52
|
+
headers: { "Content-Type": "application/json" }
|
53
|
+
}).then((response) => response.json()).then((data) => {
|
54
|
+
callback(data)
|
55
|
+
});
|
56
|
+
};
|
57
|
+
|
58
|
+
const ac = new AutoComplete(textInput, {
|
59
|
+
name: config.name,
|
60
|
+
placeholder: config.placeholder,
|
61
|
+
selected: selected,
|
62
|
+
mode: mode,
|
63
|
+
searchPrompt: true,
|
64
|
+
searchPromptText: config.searchPromptText,
|
65
|
+
threshold: 3,
|
66
|
+
dataMatchKeys: ["label"],
|
67
|
+
dataSource
|
68
|
+
});
|
69
|
+
|
70
|
+
return ac;
|
71
|
+
}
|
72
|
+
|
73
|
+
$(() => {
|
74
|
+
const $autocompleteDiv = $("[data-autocomplete]");
|
75
|
+
if ($autocompleteDiv.length < 1) {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
|
79
|
+
$autocompleteDiv.each((_index, element) => {
|
80
|
+
autoConfigure(element);
|
81
|
+
})
|
82
|
+
})
|
@@ -1,13 +1,10 @@
|
|
1
1
|
/* eslint-disable no-invalid-this */
|
2
2
|
|
3
|
-
import * as React from "react";
|
4
|
-
import * as ReactDOM from "react-dom";
|
5
3
|
import toggleNav from "src/decidim/admin/toggle_nav"
|
6
4
|
import createSortList from "src/decidim/admin/sort_list.component"
|
7
5
|
import createQuillEditor from "src/decidim/editor"
|
8
6
|
import formDatePicker from "src/decidim/form_datepicker"
|
9
7
|
import DataPicker from "src/decidim/data_picker"
|
10
|
-
import Autocomplete from "src/decidim/admin/autocomplete.component";
|
11
8
|
import FormFilterComponent from "src/decidim/form_filter"
|
12
9
|
import Configuration from "src/decidim/configuration"
|
13
10
|
import InputCharacterCounter from "src/decidim/input_character_counter"
|
@@ -18,17 +15,6 @@ window.Decidim.managedUsersForm = managedUsersForm
|
|
18
15
|
window.Decidim.config = new Configuration()
|
19
16
|
window.Decidim.InputCharacterCounter = InputCharacterCounter;
|
20
17
|
|
21
|
-
const renderAutocompleteSelects = (nodeSelector) => {
|
22
|
-
window.$(nodeSelector).each((index, node) => {
|
23
|
-
const props = { ...window.$(node).data("autocomplete") };
|
24
|
-
|
25
|
-
ReactDOM.render(
|
26
|
-
React.createElement(Autocomplete, props),
|
27
|
-
node
|
28
|
-
);
|
29
|
-
});
|
30
|
-
};
|
31
|
-
|
32
18
|
$(() => {
|
33
19
|
window.theDataPicker = new DataPicker($(".data-picker"));
|
34
20
|
|
@@ -36,8 +22,6 @@ $(() => {
|
|
36
22
|
|
37
23
|
toggleNav();
|
38
24
|
|
39
|
-
renderAutocompleteSelects('[data-plugin="autocomplete"]');
|
40
|
-
|
41
25
|
createSortList("#steps tbody", {
|
42
26
|
placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4"> </td></tr>')[0],
|
43
27
|
onSortUpdate: ($children) => {
|
@@ -1,14 +1,12 @@
|
|
1
1
|
/* eslint-disable no-invalid-this */
|
2
|
-
/* eslint-disable require-jsdoc */
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
select
|
7
|
-
|
8
|
-
|
3
|
+
$(() => {
|
4
|
+
$("select.language-change").change(function () {
|
5
|
+
let $select = $(this);
|
6
|
+
let targetTabPaneSelector = $select.val();
|
7
|
+
let $tabsContent = $select.parent().parent().siblings();
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
9
|
+
$tabsContent.children(".is-active").removeClass("is-active");
|
10
|
+
$tabsContent.children(targetTabPaneSelector).addClass("is-active");
|
11
|
+
})
|
12
|
+
});
|
@@ -70,7 +70,6 @@ class DynamicFieldsComponent {
|
|
70
70
|
$(this).replaceAttribute("for", placeholder, value);
|
71
71
|
$(this).replaceAttribute("tabs_id", placeholder, value);
|
72
72
|
$(this).replaceAttribute("href", placeholder, value);
|
73
|
-
$(this).replaceAttribute("value", placeholder, value);
|
74
73
|
|
75
74
|
return this;
|
76
75
|
}
|
@@ -17,7 +17,6 @@
|
|
17
17
|
@import "stylesheets/decidim/admin/modules/modules";
|
18
18
|
@import "stylesheets/decidim/admin/plugins/jquery.auto-complete";
|
19
19
|
@import "stylesheets/decidim/admin/components/accordion";
|
20
|
-
@import "stylesheets/decidim/admin/components/autocomplete_select.component";
|
21
20
|
@import "stylesheets/decidim/admin/components/dropdown-menu";
|
22
21
|
@import "stylesheets/decidim/admin/components/sortable";
|
23
22
|
@import "stylesheets/decidim/vizzs";
|
@@ -4,6 +4,7 @@
|
|
4
4
|
@import "stylesheets/decidim/admin/modules/buttons";
|
5
5
|
@import "stylesheets/decidim/admin/modules/forms";
|
6
6
|
@import "stylesheets/decidim/admin/modules/tabs";
|
7
|
+
@import "stylesheets/decidim/admin/modules/autocomplete";
|
7
8
|
|
8
9
|
//General layout
|
9
10
|
@import "stylesheets/decidim/admin/modules/layout";
|
@@ -29,7 +30,9 @@
|
|
29
30
|
@import "stylesheets/decidim/admin/modules/agenda";
|
30
31
|
@import "stylesheets/decidim/admin/modules/draggable-list";
|
31
32
|
@import "stylesheets/decidim/admin/modules/loading-spinner";
|
33
|
+
@import "stylesheets/decidim/admin/modules/import_result";
|
32
34
|
@import "stylesheets/decidim/admin/modules/reveal";
|
35
|
+
@import "stylesheets/decidim/admin/modules/upload_modal";
|
33
36
|
|
34
37
|
// mentions__container
|
35
38
|
@import "stylesheets/decidim/modules/tags";
|
@@ -0,0 +1,42 @@
|
|
1
|
+
@import "stylesheets/decidim/modules/upload_modal";
|
2
|
+
|
3
|
+
.upload-modal{
|
4
|
+
button{
|
5
|
+
cursor: pointer;
|
6
|
+
}
|
7
|
+
|
8
|
+
.upload-items{
|
9
|
+
.upload-item-first-row{
|
10
|
+
display: flex;
|
11
|
+
|
12
|
+
.file-name-span{
|
13
|
+
flex: 4 1 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
.title-container{
|
17
|
+
flex: 3.5 1 0;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.upload-item-second-row{
|
22
|
+
display: flex;
|
23
|
+
|
24
|
+
.progress-bar-wrapper{
|
25
|
+
flex: 4 1 0;
|
26
|
+
margin-right: 1rem;
|
27
|
+
|
28
|
+
.progress-bar-border{
|
29
|
+
border: 1px solid map-get($foundation-palette, primary);
|
30
|
+
|
31
|
+
.progress-bar{
|
32
|
+
background-color: map-get($foundation-palette, primary);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
.remove-upload-item{
|
38
|
+
flex: 1 1 0;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|