decidim-admin 0.24.1 → 0.25.0.rc2
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/content_block/show.erb +2 -2
- data/app/commands/decidim/admin/block_user.rb +6 -0
- data/app/commands/decidim/admin/create_attachment.rb +2 -1
- data/app/commands/decidim/admin/hide_resource.rb +1 -0
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +1 -1
- data/app/commands/decidim/admin/update_attachment.rb +5 -1
- data/app/commands/decidim/admin/update_content_block.rb +1 -1
- data/app/commands/decidim/admin/update_external_domain_whitelist.rb +32 -0
- data/app/commands/decidim/admin/update_organization.rb +2 -1
- data/app/commands/decidim/admin/update_organization_appearance.rb +4 -14
- data/app/controllers/concerns/decidim/admin/filterable.rb +1 -3
- data/app/controllers/concerns/decidim/participatory_space_private_users/admin/filterable.rb +34 -0
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +1 -4
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +6 -3
- data/app/controllers/decidim/admin/imports_controller.rb +1 -0
- data/app/controllers/decidim/admin/moderated_users_controller.rb +6 -2
- data/app/controllers/decidim/admin/organization_controller.rb +11 -1
- data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +38 -0
- data/app/controllers/decidim/admin/users_controller.rb +7 -1
- data/app/forms/decidim/admin/external_domain_form.rb +19 -0
- data/app/forms/decidim/admin/import_form.rb +1 -0
- data/app/forms/decidim/admin/organization_appearance_form.rb +7 -7
- data/app/forms/decidim/admin/organization_external_domain_whitelist_form.rb +23 -0
- data/app/forms/decidim/admin/organization_form.rb +1 -0
- data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +2 -0
- data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -0
- data/app/helpers/decidim/admin/filterable_helper.rb +1 -1
- data/app/helpers/decidim/admin/menu_helper.rb +7 -7
- data/app/helpers/decidim/admin/uploader_image_dimensions_helper.rb +2 -1
- data/app/jobs/decidim/admin/expire_impersonation_job.rb +1 -2
- data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +1 -1
- data/app/packs/entrypoints/decidim_admin.js +43 -0
- data/app/packs/entrypoints/decidim_admin.scss +1 -0
- data/app/packs/src/decidim/admin/application.js +68 -0
- data/app/packs/src/decidim/admin/auto_buttons_by_position.component.js +37 -0
- data/app/packs/src/decidim/admin/auto_label_by_position.component.js +28 -0
- data/app/packs/src/decidim/admin/autocomplete.component.js +146 -0
- data/app/{frontend/components/autocomplete.component.test.tsx → packs/src/decidim/admin/autocomplete.component.test.js} +1 -2
- data/app/packs/src/decidim/admin/budget_rule_toggler.component.js +50 -0
- data/app/{assets/javascripts → packs/src}/decidim/admin/choose_language.js +0 -0
- data/app/packs/src/decidim/admin/draggable-list.js +30 -0
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +230 -0
- data/app/packs/src/decidim/admin/external_domain_whitelist.js +100 -0
- data/app/packs/src/decidim/admin/field_dependent_inputs.component.js +37 -0
- data/app/{assets/javascripts/decidim/admin/form.js.es6 → packs/src/decidim/admin/form.js} +6 -9
- data/app/{assets/javascripts/decidim/admin/import_guidance.js.es6 → packs/src/decidim/admin/import_guidance.js} +2 -3
- data/app/{assets/javascripts/decidim/admin/managed_users.js.es6 → packs/src/decidim/admin/managed_users.js} +4 -4
- data/app/packs/src/decidim/admin/moderations.js +20 -0
- data/app/{assets/javascripts/decidim/admin/newsletters.js.es6 → packs/src/decidim/admin/newsletters.js} +0 -0
- data/app/{assets/javascripts/decidim/admin/officializations.js.es6 → packs/src/decidim/admin/officializations.js} +0 -0
- data/app/{assets/javascripts/decidim/admin/proposal_infinite_edit.js.es6 → packs/src/decidim/admin/proposal_infinite_edit.js} +0 -0
- data/app/{assets/javascripts/decidim/admin/resources_permissions.js.es6 → packs/src/decidim/admin/resources_permissions.js} +3 -5
- data/app/packs/src/decidim/admin/scope_picker_enabler.component.js +12 -0
- data/app/packs/src/decidim/admin/sort_list.component.js +31 -0
- data/app/packs/src/decidim/admin/sortable.js +21 -0
- data/app/packs/src/decidim/admin/subform_multi_toggler.component.js +38 -0
- data/app/packs/src/decidim/admin/subform_toggler.component.js +38 -0
- data/app/{assets/javascripts/decidim/admin/tab_focus.js.es6 → packs/src/decidim/admin/tab_focus.js} +0 -2
- data/app/packs/src/decidim/admin/toggle_nav.js +14 -0
- data/app/{assets/javascripts/decidim/admin/welcome_notification.js.es6 → packs/src/decidim/admin/welcome_notification.js} +2 -2
- data/app/packs/stylesheets/decidim/admin/_decidim.scss +24 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/_variables.scss +0 -0
- data/app/packs/stylesheets/decidim/admin/application.scss +22 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/bundle.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/components/_accordion.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/components/_dropdown-menu.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/components/_sortable.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_action-icon.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_block_user.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_cards.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_categories.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_dropdown_inverted.scss +0 -0
- data/app/packs/stylesheets/decidim/admin/extra/_editor.scss +1 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_email_preview.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_label-required.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_login.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_logs.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_newsletter-templates-gallery.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_organization-appearance.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_quill.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_select_multiple.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_show_email.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_sort.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/extra/_title_bar.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_action-icon.scss +1 -1
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_agenda.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_buttons.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_callouts.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_card-grid.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_cards.scss +1 -1
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_char-counter.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_component-counter.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_draggable-list.scss +2 -2
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_dropdown.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_filters.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_forms.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_icons.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_import_result.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_layout.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_loading-spinner.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_main-nav.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_moderations.scss +0 -0
- data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +43 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_pics.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_process-header.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_reveal.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_secondary-nav.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_table-list.scss +13 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_tabs.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_title-bar.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_typography.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_user-login.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/modules/_users_statistics.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/plugins/_foundation-datepicker.scss +0 -0
- data/{vendor/assets/stylesheets → app/packs/stylesheets/decidim/admin}/plugins/jquery.auto-complete.css +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/user_moderations.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/utils/_flex.scss +2 -2
- data/app/{assets → packs}/stylesheets/decidim/admin/utils/_helpers.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/utils/_keyframes.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/utils/_mixins.scss +30 -3
- data/app/{assets → packs}/stylesheets/decidim/admin/utils/_settings.scss +11 -3
- data/app/{assets → packs}/stylesheets/decidim/admin/utils/_toggle-expand.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/_constants.scss +1 -1
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/_math.scss +0 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_acos.scss +14 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_asin.scss +16 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss +36 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss +46 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_cos.scss +17 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/functions/_cot.scss +6 -3
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/functions/_csc.scss +6 -3
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/functions/_exp.scss +10 -6
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_fact.scss +21 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_frexp.scss +25 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_ldexp.scss +20 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_log.scss +39 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss +34 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/functions/_sec.scss +6 -3
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/functions/_sin.scss +4 -3
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_sqrt.scss +21 -0
- data/app/{assets → packs}/stylesheets/decidim/admin/vendor/mathsass/functions/_tan.scss +6 -3
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_deg-to-rad.scss +6 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_rad-to-deg.scss +6 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_strip-unit.scss +11 -0
- data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_unitless-rad.scss +19 -0
- data/app/presenters/decidim/admin/simple_menu_presenter.rb +11 -0
- data/app/queries/decidim/admin/newsletter_recipients.rb +3 -1
- data/app/views/decidim/admin/area_types/index.html.erb +2 -2
- data/app/views/decidim/admin/areas/index.html.erb +1 -1
- data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
- data/app/views/decidim/admin/categories/index.html.erb +1 -1
- data/app/views/decidim/admin/components/_form.html.erb +0 -2
- data/app/views/decidim/admin/impersonations/_form.html.erb +3 -1
- data/app/views/decidim/admin/imports/new.html.erb +1 -9
- data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +1 -3
- data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
- data/app/views/decidim/admin/officializations/index.html.erb +3 -3
- data/app/views/decidim/admin/organization/_form.html.erb +6 -2
- data/app/views/decidim/admin/organization_appearance/_form.html.erb +0 -2
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +20 -4
- data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +7 -7
- data/app/views/decidim/admin/organization_external_domain_whitelist/_external_domain.html.erb +31 -0
- data/app/views/decidim/admin/organization_external_domain_whitelist/_form.html.erb +37 -0
- data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +6 -0
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +4 -4
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +0 -2
- data/app/views/decidim/admin/scope_types/index.html.erb +3 -3
- data/app/views/decidim/admin/scopes/index.html.erb +1 -1
- data/app/views/decidim/admin/shared/_gallery.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/_form.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/_topic.html.erb +3 -3
- data/app/views/decidim/admin/user_groups/index.html.erb +2 -2
- data/app/views/decidim/admin/users/index.html.erb +10 -9
- data/app/views/layouts/decidim/admin/_application.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_header.html.erb +2 -3
- data/app/views/layouts/decidim/admin/_js_configuration.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_title_bar.html.erb +1 -1
- data/app/views/layouts/decidim/admin/global_moderations.html.erb +1 -1
- data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
- data/app/views/layouts/decidim/admin/pages.html.erb +2 -2
- data/app/views/layouts/decidim/admin/settings.html.erb +1 -1
- data/app/views/layouts/decidim/admin/users.html.erb +2 -52
- data/config/assets.rb +8 -0
- data/config/locales/ar.yml +0 -4
- data/config/locales/bg.yml +0 -3
- data/config/locales/ca.yml +36 -6
- data/config/locales/cs.yml +48 -6
- data/config/locales/de.yml +18 -6
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +58 -16
- data/config/locales/eo.yml +0 -1
- data/config/locales/es-MX.yml +19 -6
- data/config/locales/es-PY.yml +19 -6
- data/config/locales/es.yml +19 -6
- data/config/locales/eu.yml +0 -4
- data/config/locales/fi-plain.yml +48 -6
- data/config/locales/fi.yml +48 -6
- data/config/locales/fr-CA.yml +53 -6
- data/config/locales/fr-LU.yml +1029 -0
- data/config/locales/fr.yml +53 -6
- data/config/locales/gl.yml +71 -6
- data/config/locales/hu.yml +70 -4
- data/config/locales/id-ID.yml +0 -4
- data/config/locales/is-IS.yml +0 -4
- data/config/locales/it.yml +161 -10
- data/config/locales/ja.yml +152 -5
- data/config/locales/lb-LU.yml +1 -0
- data/config/locales/lv.yml +0 -4
- data/config/locales/nl.yml +17 -6
- data/config/locales/no.yml +6 -4
- data/config/locales/pl.yml +45 -24
- data/config/locales/pt-BR.yml +346 -4
- data/config/locales/pt.yml +6 -4
- data/config/locales/ro-RO.yml +112 -4
- data/config/locales/ru.yml +0 -4
- data/config/locales/sk.yml +0 -4
- data/config/locales/sl.yml +0 -4
- data/config/locales/sr-CS.yml +0 -4
- data/config/locales/sv.yml +45 -2
- data/config/locales/tr-TR.yml +0 -4
- data/config/locales/uk.yml +0 -2
- data/config/locales/zh-CN.yml +0 -4
- data/config/routes.rb +2 -0
- data/lib/decidim/admin/engine.rb +210 -137
- data/lib/decidim/admin/import/readers/xlsx.rb +25 -0
- data/lib/decidim/admin/import/readers.rb +3 -3
- data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +73 -0
- data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +1 -1
- data/lib/decidim/admin/test/manage_attachments_examples.rb +1 -1
- data/lib/decidim/admin/test.rb +1 -0
- data/lib/decidim/admin/version.rb +1 -1
- metadata +141 -180
- data/app/assets/config/decidim_admin_manifest.js +0 -8
- data/app/assets/javascripts/decidim/admin/application.js.es6 +0 -78
- data/app/assets/javascripts/decidim/admin/auto_buttons_by_position.component.js.es6 +0 -42
- data/app/assets/javascripts/decidim/admin/auto_label_by_position.component.js.es6 +0 -33
- data/app/assets/javascripts/decidim/admin/budget_rule_toggler.component.js.es6 +0 -55
- data/app/assets/javascripts/decidim/admin/bundle.js +0 -34
- data/app/assets/javascripts/decidim/admin/bundle.js.map +0 -1
- data/app/assets/javascripts/decidim/admin/draggable-list.js.es6 +0 -30
- data/app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6 +0 -233
- data/app/assets/javascripts/decidim/admin/field_dependent_inputs.component.js.es6 +0 -39
- data/app/assets/javascripts/decidim/admin/moderations.js.es6 +0 -24
- data/app/assets/javascripts/decidim/admin/scope_picker_enabler.component.js.es6 +0 -14
- data/app/assets/javascripts/decidim/admin/sort_list.component.js.es6 +0 -35
- data/app/assets/javascripts/decidim/admin/sortable.js.es6 +0 -22
- data/app/assets/javascripts/decidim/admin/subform_multi_toggler.component.js.es6 +0 -43
- data/app/assets/javascripts/decidim/admin/subform_toggler.component.js.es6 +0 -42
- data/app/assets/javascripts/decidim/admin/toggle_nav.js.es6 +0 -17
- data/app/assets/javascripts/decidim/admin/user_moderations.js +0 -2
- data/app/assets/stylesheets/decidim/admin/_decidim.scss +0 -20
- data/app/assets/stylesheets/decidim/admin/application.scss.erb +0 -6
- data/app/assets/stylesheets/decidim/admin/extra/_editor.scss +0 -1
- data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +0 -43
- data/app/assets/stylesheets/decidim/admin/utils/_fontface.scss +0 -29
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_acos.scss +0 -12
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_asin.scss +0 -12
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss +0 -28
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss +0 -37
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_cos.scss +0 -13
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_fact.scss +0 -18
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_frexp.scss +0 -21
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_ldexp.scss +0 -17
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_log.scss +0 -34
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss +0 -28
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_sqrt.scss +0 -16
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_deg-to-rad.scss +0 -4
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_rad-to-deg.scss +0 -4
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_strip-unit.scss +0 -8
- data/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_unitless-rad.scss +0 -13
- data/app/frontend/components/autocomplete.component.tsx +0 -198
- data/app/frontend/entry.ts +0 -17
- data/app/frontend/entry_test.ts +0 -4
- data/app/helpers/decidim/admin/sidebar_menu_helper.rb +0 -13
- data/config/locales/ja-JP.yml +0 -855
- data/lib/decidim/admin/import/readers/xls.rb +0 -25
- data/vendor/assets/javascripts/html.sortable.js +0 -691
- data/vendor/assets/javascripts/jquery.auto-complete.js +0 -171
- data/vendor/assets/javascripts/jquery.serializejson.js +0 -344
- data/vendor/assets/javascripts/moment.min.js +0 -1
@@ -1,12 +1,11 @@
|
|
1
1
|
import { shallow } from "enzyme";
|
2
2
|
import * as React from "react";
|
3
|
-
|
4
3
|
import Autocomplete from "./autocomplete.component";
|
5
4
|
|
6
5
|
describe("<Autocomplete />", () => {
|
7
6
|
const name = "custom[name]";
|
8
7
|
const selected = "";
|
9
|
-
const options =
|
8
|
+
const options = [];
|
10
9
|
const placeholder = "Pick a value";
|
11
10
|
const noResultsText = "No results found";
|
12
11
|
const searchPromptText = "Type to search";
|
@@ -0,0 +1,50 @@
|
|
1
|
+
export default class BudgetRuleTogglerComponent {
|
2
|
+
constructor(options = {}) {
|
3
|
+
this.ruleCheckboxes = options.ruleCheckboxes;
|
4
|
+
this._runAll();
|
5
|
+
}
|
6
|
+
|
7
|
+
_runAll() {
|
8
|
+
this.ruleCheckboxes.each((_i, checkbox) => {
|
9
|
+
this._bindEvent(checkbox);
|
10
|
+
this.run(checkbox);
|
11
|
+
});
|
12
|
+
}
|
13
|
+
|
14
|
+
_bindEvent(target) {
|
15
|
+
$(target).on("change", (event) => {
|
16
|
+
this.run(event.target);
|
17
|
+
});
|
18
|
+
}
|
19
|
+
|
20
|
+
run(target) {
|
21
|
+
this.toggleTextInput(target);
|
22
|
+
|
23
|
+
if ($(target).prop("checked")) {
|
24
|
+
this.ruleCheckboxes.filter(
|
25
|
+
(_i, checkbox) => {
|
26
|
+
return checkbox !== target;
|
27
|
+
}).prop("checked", false).each(
|
28
|
+
(_i, checkbox) => {
|
29
|
+
this.toggleTextInput(checkbox);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
toggleTextInput(target) {
|
35
|
+
const container = $(target).closest("div");
|
36
|
+
if (container.length < 1) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const containerClassPrefix = container.attr("class").
|
40
|
+
replace(/^vote_rule_/, "vote_").
|
41
|
+
replace(/_enabled_container$/, "");
|
42
|
+
const input = $(`[class^="${containerClassPrefix}"][class$="_container"]`);
|
43
|
+
|
44
|
+
if ($(target).prop("checked")) {
|
45
|
+
input.slideDown();
|
46
|
+
} else {
|
47
|
+
input.slideUp();
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
2
|
+
import createSortList from "src/decidim/admin/sort_list.component"
|
3
|
+
|
4
|
+
export default function createSortableList(lists) {
|
5
|
+
createSortList(lists, {
|
6
|
+
handle: "li",
|
7
|
+
forcePlaceholderSize: true,
|
8
|
+
connectWith: ".js-connect"
|
9
|
+
})
|
10
|
+
}
|
11
|
+
|
12
|
+
// Once in DOM
|
13
|
+
$(() => {
|
14
|
+
const $draggables = $(".draggable-list")
|
15
|
+
let draggablesClassNames = []
|
16
|
+
|
17
|
+
$draggables.each((index, elem) => {
|
18
|
+
draggablesClassNames = [...draggablesClassNames, `.${elem.className.split(" ").filter((name) => (/js-list.*/).test(name))[0]}`]
|
19
|
+
})
|
20
|
+
|
21
|
+
document.addEventListener("drag", function (event) {
|
22
|
+
$draggables.not(event.target.parentElement).addClass("dragging")
|
23
|
+
})
|
24
|
+
|
25
|
+
document.addEventListener("dragend", function() {
|
26
|
+
$draggables.removeClass("dragging")
|
27
|
+
})
|
28
|
+
|
29
|
+
createSortableList(draggablesClassNames.join(", "))
|
30
|
+
})
|
@@ -0,0 +1,230 @@
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
2
|
+
class DynamicFieldsComponent {
|
3
|
+
constructor(options = {}) {
|
4
|
+
this.wrapperSelector = options.wrapperSelector;
|
5
|
+
this.containerSelector = options.containerSelector;
|
6
|
+
this.fieldSelector = options.fieldSelector;
|
7
|
+
this.addFieldButtonSelector = options.addFieldButtonSelector;
|
8
|
+
this.addSeparatorButtonSelector = options.addSeparatorButtonSelector;
|
9
|
+
this.fieldTemplateSelector = options.fieldTemplateSelector;
|
10
|
+
this.separatorTemplateSelector = options.separatorTemplateSelector;
|
11
|
+
this.removeFieldButtonSelector = options.removeFieldButtonSelector;
|
12
|
+
this.moveUpFieldButtonSelector = options.moveUpFieldButtonSelector;
|
13
|
+
this.moveDownFieldButtonSelector = options.moveDownFieldButtonSelector;
|
14
|
+
this.onAddField = options.onAddField;
|
15
|
+
this.onRemoveField = options.onRemoveField;
|
16
|
+
this.onMoveUpField = options.onMoveUpField;
|
17
|
+
this.onMoveDownField = options.onMoveDownField;
|
18
|
+
this.placeholderId = options.placeholderId;
|
19
|
+
this.elementCounter = 0;
|
20
|
+
this._enableInterpolation();
|
21
|
+
this._activateFields();
|
22
|
+
this._bindEvents();
|
23
|
+
}
|
24
|
+
|
25
|
+
_enableInterpolation() {
|
26
|
+
$.fn.replaceAttribute = function(attribute, placeholder, value) {
|
27
|
+
$(this).find(`[${attribute}*=${placeholder}]`).addBack(`[${attribute}*=${placeholder}]`).each((index, element) => {
|
28
|
+
$(element).attr(attribute, $(element).attr(attribute).replace(placeholder, value));
|
29
|
+
});
|
30
|
+
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
|
34
|
+
$.fn.template = function(placeholder, value) {
|
35
|
+
// See the comment below in the `_addField()` method regarding the
|
36
|
+
// `<template>` tag support in IE11.
|
37
|
+
const $subtemplate = $(this).find("template, .decidim-template");
|
38
|
+
|
39
|
+
if ($subtemplate.length > 0) {
|
40
|
+
$subtemplate.html((index, oldHtml) => $(oldHtml).template(placeholder, value)[0].outerHTML);
|
41
|
+
}
|
42
|
+
|
43
|
+
// Handle those subtemplates that are mapped with the `data-template`
|
44
|
+
// attribute. This is also because of the IE11 support.
|
45
|
+
const $subtemplateParents = $(this).find("[data-template]");
|
46
|
+
|
47
|
+
if ($subtemplateParents.length > 0) {
|
48
|
+
$subtemplateParents.each((_i, elem) => {
|
49
|
+
const $self = $(elem);
|
50
|
+
const $tpl = $($self.data("template"));
|
51
|
+
|
52
|
+
// Duplicate the sub-template with a unique ID as there may be
|
53
|
+
// multiple parent templates referring to the same sub-template.
|
54
|
+
const $subtpl = $($tpl[0].outerHTML);
|
55
|
+
const subtemplateId = `${$tpl.attr("id")}-${value}`;
|
56
|
+
const subtemplateSelector = `#${subtemplateId}`;
|
57
|
+
$subtpl.attr("id", subtemplateId);
|
58
|
+
$self.attr("data-template", subtemplateSelector).data("template", subtemplateSelector);
|
59
|
+
$tpl.after($subtpl);
|
60
|
+
|
61
|
+
$subtpl.html((index, oldHtml) => $(oldHtml).template(placeholder, value)[0].outerHTML);
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
$(this).replaceAttribute("id", placeholder, value);
|
66
|
+
$(this).replaceAttribute("name", placeholder, value);
|
67
|
+
$(this).replaceAttribute("data-tabs-content", placeholder, value);
|
68
|
+
$(this).replaceAttribute("for", placeholder, value);
|
69
|
+
$(this).replaceAttribute("tabs_id", placeholder, value);
|
70
|
+
$(this).replaceAttribute("href", placeholder, value);
|
71
|
+
|
72
|
+
return this;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
_bindEvents() {
|
77
|
+
$(this.wrapperSelector).on("click", this.addFieldButtonSelector, (event) =>
|
78
|
+
this._bindSafeEvent(event, () => this._addField(this.fieldTemplateSelector))
|
79
|
+
);
|
80
|
+
|
81
|
+
if (this.addSeparatorButtonSelector) {
|
82
|
+
$(this.wrapperSelector).on("click", this.addSeparatorButtonSelector, (event) =>
|
83
|
+
this._bindSafeEvent(event, () => this._addField(this.separatorTemplateSelector))
|
84
|
+
);
|
85
|
+
}
|
86
|
+
|
87
|
+
$(this.wrapperSelector).on("click", this.removeFieldButtonSelector, (event) =>
|
88
|
+
this._bindSafeEvent(event, (target) => this._removeField(target))
|
89
|
+
);
|
90
|
+
|
91
|
+
if (this.moveUpFieldButtonSelector) {
|
92
|
+
$(this.wrapperSelector).on("click", this.moveUpFieldButtonSelector, (event) =>
|
93
|
+
this._bindSafeEvent(event, (target) => this._moveUpField(target))
|
94
|
+
);
|
95
|
+
}
|
96
|
+
|
97
|
+
if (this.moveDownFieldButtonSelector) {
|
98
|
+
$(this.wrapperSelector).on("click", this.moveDownFieldButtonSelector, (event) =>
|
99
|
+
this._bindSafeEvent(event, (target) => this._moveDownField(target))
|
100
|
+
);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
_bindSafeEvent(event, cb) {
|
105
|
+
event.preventDefault();
|
106
|
+
event.stopPropagation();
|
107
|
+
|
108
|
+
try {
|
109
|
+
return cb(event.target);
|
110
|
+
} catch (error) {
|
111
|
+
console.error(error); // eslint-disable-line no-console
|
112
|
+
return error;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
// Adds a field.
|
117
|
+
//
|
118
|
+
// template - A String matching the type of the template. Expected to be
|
119
|
+
// either ".decidim-question-template" or ".decidim-separator-template".
|
120
|
+
_addField(templateClass = ".decidim-template") {
|
121
|
+
const $wrapper = $(this.wrapperSelector);
|
122
|
+
const $container = $wrapper.find(this.containerSelector);
|
123
|
+
|
124
|
+
// Allow defining the template using a `data-template` attribute on the
|
125
|
+
// wrapper element. This is to allow child templates which would otherwise
|
126
|
+
// be impossible using `<script type="text/template">`. See the comment
|
127
|
+
// below regarding the `<template>` tag and IE11.
|
128
|
+
const templateSelector = $wrapper.data("template");
|
129
|
+
let $template = null;
|
130
|
+
if (templateSelector) {
|
131
|
+
$template = $(templateSelector);
|
132
|
+
}
|
133
|
+
if ($template === null || $template.length < 1) {
|
134
|
+
// To preserve IE11 backwards compatibility, the views are using
|
135
|
+
// `<script type="text/template">` with a given `class` instead of
|
136
|
+
// `<template>`. The `<template> tags are parsed in IE11 along with the
|
137
|
+
// DOM which may cause the form elements inside them to break the forms
|
138
|
+
// as they are submitted with them.
|
139
|
+
$template = $wrapper.children(`template, ${templateClass}`);
|
140
|
+
}
|
141
|
+
|
142
|
+
const $newField = $($template.html()).template(this.placeholderId, this._getUID());
|
143
|
+
|
144
|
+
$newField.find("ul.tabs").attr("data-tabs", true);
|
145
|
+
|
146
|
+
const $lastQuestion = $container.find(this.fieldSelector).last()
|
147
|
+
if ($lastQuestion.length > 0) {
|
148
|
+
$lastQuestion.after($newField);
|
149
|
+
} else {
|
150
|
+
$newField.appendTo($container);
|
151
|
+
}
|
152
|
+
|
153
|
+
$newField.foundation();
|
154
|
+
|
155
|
+
if (this.onAddField) {
|
156
|
+
this.onAddField($newField);
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
_removeField(target) {
|
161
|
+
const $target = $(target);
|
162
|
+
const $removedField = $target.parents(this.fieldSelector);
|
163
|
+
const idInput = $removedField.find("input").filter((idx, input) => input.name.match(/id/));
|
164
|
+
|
165
|
+
if (idInput.length > 0) {
|
166
|
+
const deletedInput = $removedField.find("input").filter((idx, input) => input.name.match(/delete/));
|
167
|
+
|
168
|
+
if (deletedInput.length > 0) {
|
169
|
+
$(deletedInput[0]).val(true);
|
170
|
+
}
|
171
|
+
|
172
|
+
$removedField.addClass("hidden");
|
173
|
+
$removedField.hide();
|
174
|
+
} else {
|
175
|
+
$removedField.remove();
|
176
|
+
}
|
177
|
+
|
178
|
+
if (this.onRemoveField) {
|
179
|
+
this.onRemoveField($removedField);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
_moveUpField(target) {
|
184
|
+
const $target = $(target);
|
185
|
+
const $movedUpField = $target.parents(this.fieldSelector);
|
186
|
+
|
187
|
+
$movedUpField.prev().before($movedUpField);
|
188
|
+
|
189
|
+
if (this.onMoveUpField) {
|
190
|
+
this.onMoveUpField($movedUpField);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
_moveDownField(target) {
|
195
|
+
const $target = $(target);
|
196
|
+
const $movedDownField = $target.parents(this.fieldSelector);
|
197
|
+
|
198
|
+
$movedDownField.next().after($movedDownField);
|
199
|
+
|
200
|
+
if (this.onMoveDownField) {
|
201
|
+
this.onMoveDownField($movedDownField);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
_activateFields() {
|
206
|
+
// Move the `<script type="text/template">` elements to the bottom of the
|
207
|
+
// list container so that they will not cause the question moving
|
208
|
+
// functionality to break since it assumes that all children elements are
|
209
|
+
// the dynamic field list child items.
|
210
|
+
const $wrapper = $(this.wrapperSelector);
|
211
|
+
const $container = $wrapper.find(this.containerSelector);
|
212
|
+
$container.append($container.find("script"));
|
213
|
+
|
214
|
+
$(this.fieldSelector).each((idx, el) => {
|
215
|
+
$(el).template(this.placeholderId, this._getUID());
|
216
|
+
|
217
|
+
$(el).find("ul.tabs").attr("data-tabs", true);
|
218
|
+
})
|
219
|
+
}
|
220
|
+
|
221
|
+
_getUID() {
|
222
|
+
this.elementCounter += 1;
|
223
|
+
|
224
|
+
return (new Date().getTime()) + this.elementCounter;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
export default function createDynamicFields(options) {
|
229
|
+
return new DynamicFieldsComponent(options);
|
230
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import AutoButtonsByPositionComponent from "src/decidim/admin/auto_buttons_by_position.component"
|
2
|
+
import AutoLabelByPositionComponent from "src/decidim/admin/auto_label_by_position.component"
|
3
|
+
import createDynamicFields from "src/decidim/admin/dynamic_fields.component"
|
4
|
+
import createSortList from "src/decidim/admin/sort_list.component"
|
5
|
+
|
6
|
+
$(() => {
|
7
|
+
const dynamicFieldDefinitions = [
|
8
|
+
{
|
9
|
+
placeHolderId: "external-domain-id",
|
10
|
+
wrapperSelector: ".external-domains",
|
11
|
+
fieldSelector: ".external-domain",
|
12
|
+
addFieldSelector: ".add-external-domain"
|
13
|
+
}
|
14
|
+
];
|
15
|
+
|
16
|
+
dynamicFieldDefinitions.forEach((section) => {
|
17
|
+
const fieldSelectorSuffix = section.fieldSelector.replace(".", "");
|
18
|
+
|
19
|
+
const autoButtonsByPosition = new AutoButtonsByPositionComponent({
|
20
|
+
listSelector: `${section.fieldSelector}:not(.hidden)`,
|
21
|
+
hideOnFirstSelector: ".move-up-question",
|
22
|
+
hideOnLastSelector: ".move-down-question"
|
23
|
+
});
|
24
|
+
|
25
|
+
const autoLabelByPosition = new AutoLabelByPositionComponent({
|
26
|
+
listSelector: `${section.fieldSelector}:not(.hidden)`,
|
27
|
+
labelSelector: ".card-title span:first",
|
28
|
+
onPositionComputed: (el, idx) => {
|
29
|
+
$(el).find("input[name$=\\[position\\]]").val(idx);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
|
33
|
+
const createSortableList = () => {
|
34
|
+
createSortList(".external-domains-list:not(.published)", {
|
35
|
+
handle: ".external-domain-divider",
|
36
|
+
placeholder: '<div style="border-style: dashed; border-color: #000"></div>',
|
37
|
+
forcePlaceholderSize: true,
|
38
|
+
onSortUpdate: () => {
|
39
|
+
autoLabelByPosition.run();
|
40
|
+
autoButtonsByPosition.run();
|
41
|
+
}
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
const hideDeletedItem = ($target) => {
|
46
|
+
const inputDeleted = $target.find("input[name$=\\[deleted\\]]").val();
|
47
|
+
|
48
|
+
if (inputDeleted === "true") {
|
49
|
+
$target.addClass("hidden");
|
50
|
+
$target.hide();
|
51
|
+
|
52
|
+
// Allows re-submitting of the form
|
53
|
+
$("input", $target).removeAttr("required");
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
createDynamicFields({
|
58
|
+
placeholderId: section.placeHolderId,
|
59
|
+
wrapperSelector: section.wrapperSelector,
|
60
|
+
containerSelector: `${section.wrapperSelector}-list`,
|
61
|
+
fieldSelector: section.fieldSelector,
|
62
|
+
addFieldButtonSelector: section.addFieldSelector,
|
63
|
+
removeFieldButtonSelector: `.remove-${fieldSelectorSuffix}`,
|
64
|
+
moveUpFieldButtonSelector: ".move-up-question",
|
65
|
+
moveDownFieldButtonSelector: ".move-down-question",
|
66
|
+
onAddField: () => {
|
67
|
+
createSortableList();
|
68
|
+
|
69
|
+
autoLabelByPosition.run();
|
70
|
+
autoButtonsByPosition.run();
|
71
|
+
},
|
72
|
+
onRemoveField: ($field) => {
|
73
|
+
autoLabelByPosition.run();
|
74
|
+
autoButtonsByPosition.run();
|
75
|
+
|
76
|
+
// Allows re-submitting of the form
|
77
|
+
$("input", $field).removeAttr("required");
|
78
|
+
},
|
79
|
+
onMoveUpField: () => {
|
80
|
+
autoLabelByPosition.run();
|
81
|
+
autoButtonsByPosition.run();
|
82
|
+
},
|
83
|
+
onMoveDownField: () => {
|
84
|
+
autoLabelByPosition.run();
|
85
|
+
autoButtonsByPosition.run();
|
86
|
+
}
|
87
|
+
});
|
88
|
+
|
89
|
+
createSortableList();
|
90
|
+
|
91
|
+
$(section.fieldSelector).each((_idx, el) => {
|
92
|
+
const $target = $(el);
|
93
|
+
|
94
|
+
hideDeletedItem($target);
|
95
|
+
});
|
96
|
+
|
97
|
+
autoLabelByPosition.run();
|
98
|
+
autoButtonsByPosition.run();
|
99
|
+
});
|
100
|
+
});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
2
|
+
class FieldDependentInputsComponent {
|
3
|
+
constructor(options = {}) {
|
4
|
+
this.controllerField = options.controllerField;
|
5
|
+
this.wrapperSelector = options.wrapperSelector;
|
6
|
+
this.dependentFieldsSelector = options.dependentFieldsSelector;
|
7
|
+
this.dependentInputSelector = options.dependentInputSelector;
|
8
|
+
this.enablingCondition = options.enablingCondition;
|
9
|
+
this._bindEvent();
|
10
|
+
this._run();
|
11
|
+
}
|
12
|
+
|
13
|
+
_run() {
|
14
|
+
const $controllerField = this.controllerField;
|
15
|
+
const $dependentFields = $controllerField.parents(this.wrapperSelector).find(this.dependentFieldsSelector);
|
16
|
+
const $dependentInputs = $dependentFields.find(this.dependentInputSelector);
|
17
|
+
|
18
|
+
if (this.enablingCondition($controllerField)) {
|
19
|
+
$dependentInputs.prop("disabled", false);
|
20
|
+
$dependentFields.show();
|
21
|
+
} else {
|
22
|
+
$dependentInputs.prop("disabled", true);
|
23
|
+
$dependentFields.hide();
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
_bindEvent() {
|
28
|
+
this.controllerField.on("change", () => {
|
29
|
+
this._run();
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
export default function createFieldDependentInputs(options) {
|
35
|
+
return new FieldDependentInputsComponent(options);
|
36
|
+
}
|
37
|
+
|