decidim-decidim_awesome 0.10.2 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-decidim_awesome might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +177 -60
- data/app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb +20 -0
- data/app/cells/concerns/decidim/decidim_awesome/{proposal_m_cell_override.rb → proposal_l_cell_override.rb} +10 -4
- data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +5 -12
- data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +9 -5
- data/app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb +54 -0
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/modal.erb +18 -0
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +37 -32
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +9 -4
- data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +2 -2
- data/app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb +31 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +26 -0
- data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
- data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +4 -3
- data/app/commands/decidim/decidim_awesome/admin/destroy_custom_redirect.rb +1 -1
- data/app/commands/decidim/decidim_awesome/admin/destroy_menu_hack.rb +1 -1
- data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +6 -3
- data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +1 -1
- data/app/commands/decidim/decidim_awesome/admin/update_constraint.rb +1 -1
- data/app/commands/decidim/decidim_awesome/admin/update_custom_redirect.rb +2 -2
- data/app/commands/decidim/decidim_awesome/command.rb +1 -7
- data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +43 -0
- data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +1 -1
- data/app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb +34 -0
- data/app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb +35 -0
- data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +1 -1
- data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +3 -3
- data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
- data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +14 -10
- data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +10 -9
- data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +23 -20
- data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -10
- data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
- data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -10
- data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +14 -6
- data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +2 -2
- data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +2 -2
- data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +8 -3
- data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +3 -3
- data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +18 -5
- data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
- data/app/forms/{decidim → concerns/decidim}/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +2 -1
- data/app/forms/decidim/decidim_awesome/admin/config_form.rb +28 -14
- data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +2 -2
- data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +4 -0
- data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +4 -4
- data/app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb +65 -0
- data/app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb +23 -0
- data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +110 -0
- data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +6 -27
- data/app/helpers/decidim/decidim_awesome/map_helper.rb +8 -27
- data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
- data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +5 -4
- data/app/middleware/decidim/decidim_awesome/current_config.rb +3 -5
- data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +39 -10
- data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -1
- data/app/models/decidim/decidim_awesome/paper_trail_version.rb +3 -3
- data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +35 -1
- data/app/models/decidim/decidim_awesome/vote_weight.rb +2 -2
- data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
- data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
- data/app/overrides/decidim/proposals/proposals/_proposal_aside/limit_amendments_modal.html.erb.deface +5 -0
- data/app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface +1 -1
- data/app/overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface +6 -0
- data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +4 -11
- data/app/overrides/layouts/decidim/admin/_header/{replace_scripts.html.erb.deface → add_awesome_tags.html.erb.deface} +4 -4
- data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +1 -2
- data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.js +4 -0
- data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss +1 -0
- data/app/packs/entrypoints/decidim_decidim_awesome.js +2 -2
- data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
- data/app/packs/entrypoints/decidim_editor.js +14 -0
- data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +96 -69
- data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +46 -41
- data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +3 -3
- data/app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js +115 -0
- data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +9 -5
- data/app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js +22 -11
- data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +26 -8
- data/app/packs/src/decidim/decidim_awesome/admin/tabs_change.js +31 -0
- data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +34 -21
- data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +28 -0
- data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +5 -16
- data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +1 -0
- data/app/packs/src/decidim/decidim_awesome/awesome_application.js +1 -15
- data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +33 -11
- data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +9 -12
- data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +28 -0
- data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +3 -4
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +12 -12
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +11 -7
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +6 -13
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +51 -20
- data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +27 -18
- data/app/packs/src/decidim/decidim_awesome/editor/index.js +94 -0
- data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +28 -23
- data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +29 -25
- data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +27 -32
- data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +31 -15
- data/app/packs/src/decidim/decidim_awesome/proposals/images.js +16 -10
- data/app/packs/src/decidim/decidim_awesome/voting/voting_cards.js +47 -38
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +11 -12
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +15 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +24 -12
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +49 -29
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -71
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss +48 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss +11 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +17 -26
- data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +11 -49
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +19 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +4 -19
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +1 -1
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +41 -35
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +118 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +26 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +41 -59
- data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +14 -3
- data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -4
- data/app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb +23 -0
- data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +10 -2
- data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +8 -0
- data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
- data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +30 -0
- data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +1 -1
- data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
- data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +1 -1
- data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
- data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +34 -0
- data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
- data/app/types/concerns/decidim/decidim_awesome/{proposal_type_override.rb → add_proposal_type_vote_weights.rb} +3 -1
- data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +23 -17
- data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +50 -48
- data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
- data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +25 -18
- data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +7 -6
- data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
- data/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +39 -23
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -17
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +68 -80
- data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +16 -12
- data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +8 -6
- data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +22 -12
- data/app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb +1 -49
- data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +14 -9
- data/app/views/decidim/decidim_awesome/admin/constraints/show.html.erb +14 -9
- data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +20 -5
- data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +5 -5
- data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
- data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +5 -5
- data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +6 -6
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +21 -12
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +39 -42
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
- data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
- data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
- data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +14 -18
- data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +23 -0
- data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +8 -2
- data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +7 -12
- data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +53 -37
- data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +14 -5
- data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb +0 -3
- data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +9 -7
- data/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +9 -6
- data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +12 -0
- data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +1 -73
- data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
- data/config/assets.rb +3 -33
- data/config/i18n-tasks.yml +23 -3
- data/config/locales/ca.yml +28 -17
- data/config/locales/cs.yml +39 -14
- data/config/locales/de.yml +25 -15
- data/config/locales/en.yml +125 -35
- data/config/locales/es.yml +26 -16
- data/config/locales/eu.yml +7 -3
- data/config/locales/fr.yml +25 -16
- data/config/locales/hu.yml +43 -8
- data/config/locales/it.yml +8 -15
- data/config/locales/ja.yml +26 -15
- data/config/locales/lt.yml +0 -4
- data/config/locales/nl.yml +9 -14
- data/config/locales/pt-BR.yml +9 -14
- data/config/locales/ro-RO.yml +0 -3
- data/config/locales/sv.yml +9 -9
- data/config/rubocop/disabled.yml +11 -0
- data/config/rubocop/faker.yml +480 -0
- data/config/rubocop/rails.yml +88 -0
- data/config/rubocop/rspec.yml +65 -0
- data/config/rubocop/ruby.yml +1210 -0
- data/db/migrate/20240306175331_rename_editor_images_awesome_config.rb +18 -0
- data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
- data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
- data/db/seeds.rb +3 -3
- data/lib/decidim/decidim_awesome/admin_engine.rb +26 -7
- data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
- data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +51 -0
- data/lib/decidim/decidim_awesome/awesome.rb +70 -19
- data/lib/decidim/decidim_awesome/awesome_helpers.rb +6 -2
- data/lib/decidim/decidim_awesome/checksums.yml +46 -44
- data/lib/decidim/decidim_awesome/config.rb +1 -1
- data/lib/decidim/decidim_awesome/custom_fields.rb +13 -5
- data/lib/decidim/decidim_awesome/engine.rb +165 -56
- data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -2
- data/lib/decidim/decidim_awesome/lock.rb +47 -0
- data/lib/decidim/decidim_awesome/map_component/component.rb +1 -1
- data/lib/decidim/decidim_awesome/menu.rb +165 -0
- data/lib/decidim/decidim_awesome/menu_hacker.rb +4 -8
- data/lib/decidim/decidim_awesome/system_checker.rb +2 -4
- data/lib/decidim/decidim_awesome/test/factories.rb +10 -10
- data/lib/decidim/decidim_awesome/test/initializer.rb +7 -12
- data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +2 -2
- data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +2 -2
- data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +17 -17
- data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +23 -5
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +7 -7
- data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +42 -58
- data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +9 -8
- data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +32 -24
- data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +97 -22
- data/lib/decidim/decidim_awesome/version.rb +2 -2
- data/lib/decidim/decidim_awesome/voting_manifest.rb +5 -10
- data/lib/decidim/decidim_awesome.rb +1 -2
- data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +1 -1
- data/lib/tasks/decidim_awesome_upgrade_tasks.rake +4 -0
- data/package.json +21 -30
- metadata +83 -60
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/show.erb +0 -15
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/vote_button.erb +0 -15
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter_cell.rb +0 -21
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal/show.erb +0 -16
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal_cell.rb +0 -20
- data/app/cells/decidim/proposals/proposal_m/footer.erb +0 -13
- data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +0 -48
- data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
- data/app/overrides/layouts/decidim/_head/add_awesome_legacy_scripts.rb +0 -14
- data/app/overrides/layouts/decidim/admin/_header/replace_styles.html.erb.deface +0 -3
- data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
- data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
- data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
- data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -218
- data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +0 -22
- data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
- data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
- data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
- data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +0 -64
- data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
- data/app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb +0 -15
@@ -8,17 +8,17 @@ module Decidim
|
|
8
8
|
# System compatibility analyzer
|
9
9
|
class ChecksController < DecidimAwesome::Admin::ApplicationController
|
10
10
|
include NeedsAwesomeConfig
|
11
|
+
include MaintenanceContext
|
12
|
+
|
11
13
|
helper ConfigConstraintsHelpers
|
12
14
|
helper SystemCheckerHelpers
|
13
15
|
|
14
|
-
layout "decidim/decidim_awesome/admin/application"
|
15
|
-
|
16
16
|
helper_method :head, :admin_head, :head_addons, :admin_addons
|
17
17
|
|
18
18
|
def migrate_images
|
19
19
|
Decidim::DecidimAwesome::MigrateLegacyImagesJob.perform_later(current_organization.id)
|
20
20
|
flash[:notice] = I18n.t("image_migrations_started", scope: "decidim.decidim_awesome.admin.checks.index")
|
21
|
-
redirect_to
|
21
|
+
redirect_to checks_maintenance_index_path
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -34,30 +34,34 @@ module Decidim
|
|
34
34
|
def head_addons(part)
|
35
35
|
case part
|
36
36
|
when :CSS
|
37
|
-
['<%=
|
37
|
+
['<%= append_stylesheet_pack_tag "decidim_decidim_awesome", media: "all" %>',
|
38
38
|
'<%= render(partial: "layouts/decidim/decidim_awesome/custom_styles") if awesome_custom_styles %>'].join("\n")
|
39
39
|
when :JavaScript
|
40
40
|
['<%= render partial: "layouts/decidim/decidim_awesome/awesome_config" %>',
|
41
|
-
'<%=
|
42
|
-
'<%=
|
41
|
+
'<%= append_javascript_pack_tag "decidim_decidim_awesome", defer: false %>',
|
42
|
+
'<%= append_javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>'].join("\n")
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
def admin_addons(part)
|
47
47
|
case part
|
48
48
|
when :CSS
|
49
|
-
'<%=
|
49
|
+
'<%= append_stylesheet_pack_tag "decidim_admin_decidim_awesome", media: "all" %>'
|
50
50
|
when :JavaScript
|
51
|
-
['<%=
|
52
|
-
'<%=
|
51
|
+
['<%= append_javascript_pack_tag "decidim_admin_decidim_awesome", defer: false %>',
|
52
|
+
'<%= append_javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>'].join("\n")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def render_template(partial)
|
57
|
-
render_to_string(partial:
|
57
|
+
render_to_string(partial:)
|
58
58
|
rescue ActionView::Template::Error => e
|
59
59
|
flash.now[:alert] = "Partial [#{partial}] has thrown an error: #{e.message}"
|
60
60
|
end
|
61
|
+
|
62
|
+
def current_view
|
63
|
+
"checks"
|
64
|
+
end
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
@@ -9,8 +9,6 @@ module Decidim
|
|
9
9
|
include ConfigConstraintsHelpers
|
10
10
|
helper ConfigConstraintsHelpers
|
11
11
|
|
12
|
-
layout "decidim/decidim_awesome/admin/application"
|
13
|
-
|
14
12
|
helper_method :constraints_for, :users_for, :config_var
|
15
13
|
before_action do
|
16
14
|
enforce_permission_to :edit_config, configs
|
@@ -19,7 +17,7 @@ module Decidim
|
|
19
17
|
def show
|
20
18
|
@form = form(ConfigForm).from_params(organization_awesome_config)
|
21
19
|
|
22
|
-
redirect_to decidim_admin_decidim_awesome.
|
20
|
+
redirect_to decidim_admin_decidim_awesome.checks_maintenance_index_path unless config_var
|
23
21
|
end
|
24
22
|
|
25
23
|
def update
|
@@ -43,8 +41,13 @@ module Decidim
|
|
43
41
|
if (term = params[:term].to_s).present?
|
44
42
|
query = current_organization.users.order(name: :asc)
|
45
43
|
query = query.where("name ILIKE :term OR nickname ILIKE :term OR email ILIKE :term", term: "%#{term}%")
|
46
|
-
|
47
|
-
|
44
|
+
render json: query.all.collect { |u|
|
45
|
+
{
|
46
|
+
value: u.id,
|
47
|
+
text: format_user_name(u),
|
48
|
+
is_admin: u.read_attribute("admin")
|
49
|
+
}
|
50
|
+
}
|
48
51
|
else
|
49
52
|
render json: []
|
50
53
|
end
|
@@ -88,14 +91,12 @@ module Decidim
|
|
88
91
|
DecidimAwesome.config.keys
|
89
92
|
end
|
90
93
|
|
91
|
-
# rubocop:disable Style/OpenStructUse
|
92
94
|
def users_for(ids_list)
|
93
|
-
Decidim::User.where(id: ids_list).map { |user|
|
95
|
+
Decidim::User.where(id: ids_list).map { |user| [format_user_name(user), user.id, { data: { is_admin: user.read_attribute("admin") } }] }
|
94
96
|
end
|
95
|
-
# rubocop:enable Style/OpenStructUse
|
96
97
|
|
97
98
|
def format_user_name(user)
|
98
|
-
"
|
99
|
+
"#{user.name} (@#{user.nickname} - #{user.email})"
|
99
100
|
end
|
100
101
|
end
|
101
102
|
end
|
@@ -6,21 +6,22 @@ module Decidim
|
|
6
6
|
# Constraints configuration controller for config keys
|
7
7
|
class ConstraintsController < DecidimAwesome::Admin::ApplicationController
|
8
8
|
include NeedsAwesomeConfig
|
9
|
+
include Decidim::Headers::HttpCachingDisabler
|
9
10
|
helper ConfigConstraintsHelpers
|
10
11
|
|
11
12
|
layout false
|
12
13
|
before_action do
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def new
|
17
|
-
@form = form(ConstraintForm).from_params(filtered_params, setting: current_setting)
|
14
|
+
render plain: "no permissions for #{constraint_key}" unless allowed_to? :edit_config, constraint_key
|
18
15
|
end
|
19
16
|
|
20
17
|
def show
|
21
18
|
@form = form(ConstraintForm).from_params(constraint.settings.merge(filtered_params))
|
22
19
|
end
|
23
20
|
|
21
|
+
def new
|
22
|
+
@form = form(ConstraintForm).from_params(filtered_params, setting: current_setting)
|
23
|
+
end
|
24
|
+
|
24
25
|
def create
|
25
26
|
@form = form(ConstraintForm).from_params(params, setting: current_setting)
|
26
27
|
CreateConstraint.call(@form) do
|
@@ -39,11 +40,11 @@ module Decidim
|
|
39
40
|
|
40
41
|
on(:invalid) do |message|
|
41
42
|
render json: {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
id: params[:id],
|
44
|
+
key: current_setting.var,
|
45
|
+
message: I18n.t("decidim_awesome.admin.constraints.create.error", scope: "decidim"),
|
46
|
+
error: message
|
47
|
+
},
|
47
48
|
status: :unprocessable_entity
|
48
49
|
end
|
49
50
|
end
|
@@ -67,11 +68,11 @@ module Decidim
|
|
67
68
|
|
68
69
|
on(:invalid) do |message|
|
69
70
|
render json: {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
id: params[:id],
|
72
|
+
key: constraint.awesome_config.var,
|
73
|
+
message: I18n.t("decidim_awesome.admin.constraints.update.error", scope: "decidim"),
|
74
|
+
error: message
|
75
|
+
},
|
75
76
|
status: :unprocessable_entity
|
76
77
|
end
|
77
78
|
end
|
@@ -94,11 +95,11 @@ module Decidim
|
|
94
95
|
|
95
96
|
on(:invalid) do |message|
|
96
97
|
render json: {
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
98
|
+
id: params[:id],
|
99
|
+
key: constraint.awesome_config.var,
|
100
|
+
message: I18n.t("decidim_awesome.admin.constraints.destroy.error", scope: "decidim"),
|
101
|
+
error: message
|
102
|
+
},
|
102
103
|
status: :unprocessable_entity
|
103
104
|
end
|
104
105
|
end
|
@@ -131,6 +132,8 @@ module Decidim
|
|
131
132
|
:scoped_admins
|
132
133
|
when /^proposal_custom_field_/
|
133
134
|
:proposal_custom_fields
|
135
|
+
when /^proposal_private_custom_field_/
|
136
|
+
:proposal_private_custom_fields
|
134
137
|
else
|
135
138
|
key
|
136
139
|
end
|
@@ -8,8 +8,6 @@ module Decidim
|
|
8
8
|
include NeedsAwesomeConfig
|
9
9
|
include ConfigConstraintsHelpers
|
10
10
|
|
11
|
-
layout "decidim/decidim_awesome/admin/application"
|
12
|
-
|
13
11
|
before_action do
|
14
12
|
enforce_permission_to :edit_config, :menu
|
15
13
|
end
|
@@ -23,6 +21,10 @@ module Decidim
|
|
23
21
|
@form = form(CustomRedirectForm).instance
|
24
22
|
end
|
25
23
|
|
24
|
+
def edit
|
25
|
+
@form = form(CustomRedirectForm).from_model(redirect_item)
|
26
|
+
end
|
27
|
+
|
26
28
|
def create
|
27
29
|
@form = form(CustomRedirectForm).from_params(params)
|
28
30
|
CreateCustomRedirect.call(@form) do
|
@@ -38,10 +40,6 @@ module Decidim
|
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
|
-
def edit
|
42
|
-
@form = form(CustomRedirectForm).from_model(redirect_item)
|
43
|
-
end
|
44
|
-
|
45
43
|
def update
|
46
44
|
@form = form(CustomRedirectForm).from_params(params)
|
47
45
|
UpdateCustomRedirect.call(@form, redirect_item) do
|
@@ -63,7 +61,7 @@ module Decidim
|
|
63
61
|
flash[:notice] = I18n.t("custom_redirects.destroy.success", scope: "decidim.decidim_awesome.admin")
|
64
62
|
end
|
65
63
|
on(:invalid) do |error|
|
66
|
-
flash[:alert] = I18n.t("custom_redirects.destroy.error", scope: "decidim.decidim_awesome.admin", error:
|
64
|
+
flash[:alert] = I18n.t("custom_redirects.destroy.error", scope: "decidim.decidim_awesome.admin", error:)
|
67
65
|
end
|
68
66
|
end
|
69
67
|
redirect_to decidim_admin_decidim_awesome.custom_redirects_path
|
@@ -75,13 +73,11 @@ module Decidim
|
|
75
73
|
origin, item = current_config.find { |origin, _| md5(origin) == params[:id] }
|
76
74
|
raise ActiveRecord::RecordNotFound unless item
|
77
75
|
|
78
|
-
# rubocop:disable Style/OpenStructUse
|
79
76
|
OpenStruct.new(
|
80
|
-
origin
|
77
|
+
origin:,
|
81
78
|
destination: item["destination"],
|
82
79
|
active: item["active"]
|
83
80
|
)
|
84
|
-
# rubocop:enable Style/OpenStructUse
|
85
81
|
end
|
86
82
|
|
87
83
|
def current_config
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/decidim_awesome/version"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module DecidimAwesome
|
7
|
+
module Admin
|
8
|
+
# System compatibility analyzer
|
9
|
+
class MaintenanceController < DecidimAwesome::Admin::ApplicationController
|
10
|
+
include NeedsAwesomeConfig
|
11
|
+
include MaintenanceContext
|
12
|
+
include Decidim::Admin::Filterable
|
13
|
+
include ActionView::Helpers::DateHelper
|
14
|
+
|
15
|
+
helper ConfigConstraintsHelpers
|
16
|
+
helper_method :collection, :resource, :present, :time_ago
|
17
|
+
|
18
|
+
before_action do
|
19
|
+
enforce_permission_to :edit_config, :private_data, private_data:
|
20
|
+
end
|
21
|
+
|
22
|
+
def show
|
23
|
+
respond_to do |format|
|
24
|
+
format.json do
|
25
|
+
render json: private_data_finder.for(params[:resources].to_s.split(",")).map { |resource| present(resource) }
|
26
|
+
end
|
27
|
+
format.all do
|
28
|
+
render :show
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def destroy_private_data
|
34
|
+
if private_data && private_data.total.to_i.positive?
|
35
|
+
Decidim::ActionLogger.log("destroy_private_data", current_user, resource, nil, count: private_data.total)
|
36
|
+
|
37
|
+
Lock.new(current_organization).get!(resource)
|
38
|
+
DestroyPrivateDataJob.set(wait: 1.second).perform_later(resource)
|
39
|
+
end
|
40
|
+
redirect_to decidim_admin_decidim_awesome.maintenance_path("private_data"),
|
41
|
+
notice: I18n.t("destroying_private_data", scope: "decidim.decidim_awesome.admin.maintenance.private_data", title: present_private_data(resource).name)
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def resource
|
47
|
+
@resource ||= Component.find_by(id: params[:resource_id])
|
48
|
+
end
|
49
|
+
|
50
|
+
def private_data
|
51
|
+
@private_data ||= present_private_data(resource) if resource
|
52
|
+
end
|
53
|
+
|
54
|
+
def collection
|
55
|
+
filtered_collection
|
56
|
+
end
|
57
|
+
|
58
|
+
def base_query
|
59
|
+
private_data_finder.query
|
60
|
+
end
|
61
|
+
|
62
|
+
def present(resource)
|
63
|
+
present_private_data(resource)
|
64
|
+
end
|
65
|
+
|
66
|
+
def private_data_finder
|
67
|
+
@private_data ||= PrivateDataFinder.new
|
68
|
+
end
|
69
|
+
|
70
|
+
def time_ago
|
71
|
+
@time_ago ||= time_ago_in_words(Time.current - Decidim::DecidimAwesome.private_data_expiration_time)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -8,8 +8,6 @@ module Decidim
|
|
8
8
|
include NeedsAwesomeConfig
|
9
9
|
include ConfigConstraintsHelpers
|
10
10
|
|
11
|
-
layout "decidim/decidim_awesome/admin/application"
|
12
|
-
|
13
11
|
helper ConfigConstraintsHelpers
|
14
12
|
helper_method :current_items, :visibility_options, :target_options
|
15
13
|
|
@@ -23,6 +21,10 @@ module Decidim
|
|
23
21
|
@form = form(MenuForm).instance
|
24
22
|
end
|
25
23
|
|
24
|
+
def edit
|
25
|
+
@form = form(MenuForm).from_model(menu_item)
|
26
|
+
end
|
27
|
+
|
26
28
|
def create
|
27
29
|
@form = form(MenuForm).from_params(params)
|
28
30
|
CreateMenuHack.call(@form, current_menu_name) do
|
@@ -38,10 +40,6 @@ module Decidim
|
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
|
-
def edit
|
42
|
-
@form = form(MenuForm).from_model(menu_item)
|
43
|
-
end
|
44
|
-
|
45
43
|
def update
|
46
44
|
@form = form(MenuForm).from_params(params)
|
47
45
|
UpdateMenuHack.call(@form, current_menu_name) do
|
@@ -63,7 +61,7 @@ module Decidim
|
|
63
61
|
flash[:notice] = I18n.t("menu_hacks.destroy.success", scope: "decidim.decidim_awesome.admin")
|
64
62
|
end
|
65
63
|
on(:invalid) do |error|
|
66
|
-
flash[:alert] = I18n.t("menu_hacks.destroy.error", scope: "decidim.decidim_awesome.admin", error:
|
64
|
+
flash[:alert] = I18n.t("menu_hacks.destroy.error", scope: "decidim.decidim_awesome.admin", error:)
|
67
65
|
end
|
68
66
|
end
|
69
67
|
redirect_to decidim_admin_decidim_awesome.menu_hacks_path
|
@@ -71,7 +69,6 @@ module Decidim
|
|
71
69
|
|
72
70
|
private
|
73
71
|
|
74
|
-
# rubocop:disable Style/OpenStructUse
|
75
72
|
def menu_item
|
76
73
|
item = current_items.find { |i| md5(i.url) == params[:id] }
|
77
74
|
raise ActiveRecord::RecordNotFound unless item
|
@@ -85,7 +82,6 @@ module Decidim
|
|
85
82
|
native?: !item.respond_to?(:overrided?)
|
86
83
|
)
|
87
84
|
end
|
88
|
-
# rubocop:enable Style/OpenStructUse
|
89
85
|
|
90
86
|
def current_items
|
91
87
|
@current_items ||= current_menu.items(include_invisible: true)
|
@@ -96,7 +92,7 @@ module Decidim
|
|
96
92
|
end
|
97
93
|
|
98
94
|
def current_menu_name
|
99
|
-
:
|
95
|
+
params[:menu_id].to_sym
|
100
96
|
end
|
101
97
|
|
102
98
|
def visibility_options
|
@@ -6,9 +6,9 @@ module Decidim
|
|
6
6
|
# Global configuration controller
|
7
7
|
class ProposalCustomFieldsController < DecidimAwesome::Admin::ConfigController
|
8
8
|
def create
|
9
|
-
CreateProposalCustomField.call(current_organization) do
|
9
|
+
CreateProposalCustomField.call(current_organization, config_var) do
|
10
10
|
on(:ok) do |key|
|
11
|
-
flash[:notice] = I18n.t("config.create_proposal_custom_field.success", key
|
11
|
+
flash[:notice] = I18n.t("config.create_proposal_custom_field.success", key:, scope: "decidim.decidim_awesome.admin")
|
12
12
|
end
|
13
13
|
|
14
14
|
on(:invalid) do |message|
|
@@ -16,13 +16,13 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
redirect_to decidim_admin_decidim_awesome.config_path(
|
19
|
+
redirect_to decidim_admin_decidim_awesome.config_path(config_var)
|
20
20
|
end
|
21
21
|
|
22
22
|
def destroy
|
23
|
-
DestroyProposalCustomField.call(params[:key], current_organization) do
|
23
|
+
DestroyProposalCustomField.call(params[:key], current_organization, config_var) do
|
24
24
|
on(:ok) do |key|
|
25
|
-
flash[:notice] = I18n.t("config.destroy_proposal_custom_field.success", key
|
25
|
+
flash[:notice] = I18n.t("config.destroy_proposal_custom_field.success", key:, scope: "decidim.decidim_awesome.admin")
|
26
26
|
end
|
27
27
|
|
28
28
|
on(:invalid) do |message|
|
@@ -30,7 +30,15 @@ module Decidim
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
redirect_to decidim_admin_decidim_awesome.config_path(
|
33
|
+
redirect_to decidim_admin_decidim_awesome.config_path(config_var)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def config_var
|
39
|
+
return :proposal_private_custom_fields if params[:private] == "true"
|
40
|
+
|
41
|
+
:proposal_custom_fields
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
def create
|
9
9
|
CreateScopedAdmin.call(current_organization) do
|
10
10
|
on(:ok) do |key|
|
11
|
-
flash[:notice] = I18n.t("config.create_scoped_admin.success", key
|
11
|
+
flash[:notice] = I18n.t("config.create_scoped_admin.success", key:, scope: "decidim.decidim_awesome.admin")
|
12
12
|
end
|
13
13
|
|
14
14
|
on(:invalid) do |message|
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
def destroy
|
23
23
|
DestroyScopedAdmin.call(params[:key], current_organization) do
|
24
24
|
on(:ok) do |key|
|
25
|
-
flash[:notice] = I18n.t("config.destroy_scoped_admin.success", key
|
25
|
+
flash[:notice] = I18n.t("config.destroy_scoped_admin.success", key:, scope: "decidim.decidim_awesome.admin")
|
26
26
|
end
|
27
27
|
|
28
28
|
on(:invalid) do |message|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
def create
|
9
9
|
CreateScopedStyle.call(current_organization) do
|
10
10
|
on(:ok) do |key|
|
11
|
-
flash[:notice] = I18n.t("config.create_scoped_style.success", key
|
11
|
+
flash[:notice] = I18n.t("config.create_scoped_style.success", key:, scope: "decidim.decidim_awesome.admin")
|
12
12
|
end
|
13
13
|
|
14
14
|
on(:invalid) do |message|
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
def destroy
|
23
23
|
DestroyScopedStyle.call(params[:key], current_organization) do
|
24
24
|
on(:ok) do |key|
|
25
|
-
flash[:notice] = I18n.t("config.destroy_scoped_style.success", key
|
25
|
+
flash[:notice] = I18n.t("config.destroy_scoped_style.success", key:, scope: "decidim.decidim_awesome.admin")
|
26
26
|
end
|
27
27
|
|
28
28
|
on(:invalid) do |message|
|
@@ -6,13 +6,18 @@ module Decidim
|
|
6
6
|
class BlankComponentController < Decidim::Components::BaseController
|
7
7
|
# just redirects to settings
|
8
8
|
def settings
|
9
|
-
redirect_to EngineRouter.admin_proxy(
|
9
|
+
redirect_to EngineRouter.admin_proxy(current_component.participatory_space).edit_component_path(id: current_component)
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def set_component_breadcrumb_item
|
15
|
+
context_breadcrumb_items << {
|
16
|
+
label: current_component.name,
|
17
|
+
url: EngineRouter.admin_proxy(current_component.participatory_space).edit_component_path(id: current_component),
|
18
|
+
active: false,
|
19
|
+
resource: current_component
|
20
|
+
}
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module DecidimAwesome
|
5
|
-
# This controller handles image uploads for the
|
5
|
+
# This controller handles image uploads for the Tiptap editor
|
6
6
|
class EditorImagesController < DecidimAwesome::ApplicationController
|
7
7
|
include FormFactory
|
8
8
|
include NeedsAwesomeConfig
|
@@ -11,14 +11,14 @@ module Decidim
|
|
11
11
|
rescue_from Decidim::ActionForbidden, with: :ajax_user_has_no_permission
|
12
12
|
|
13
13
|
def create
|
14
|
-
enforce_permission_to
|
14
|
+
enforce_permission_to(:create, :editor_image, awesome_config:)
|
15
15
|
|
16
16
|
@form = form(EditorImageForm).from_params(form_values)
|
17
17
|
CreateEditorImage.call(@form) do
|
18
18
|
on(:ok) do |image|
|
19
19
|
url = image.attached_uploader(:file).path
|
20
20
|
url = "#{request.base_url}#{url}" unless url&.start_with?("http")
|
21
|
-
render json: { url
|
21
|
+
render json: { url:, message: I18n.t("decidim_awesome.editor_images.create.success", scope: "decidim") }
|
22
22
|
end
|
23
23
|
|
24
24
|
on(:invalid) do |_message|
|
@@ -5,7 +5,8 @@ module Decidim
|
|
5
5
|
module IframeComponent
|
6
6
|
class IframeController < DecidimAwesome::BlankComponentController
|
7
7
|
ALLOWED_ATTRIBUTES = %w(src width height frameborder title allow allowpaymentrequest name referrerpolicy sandbox srcdoc allowfullscreen).freeze
|
8
|
-
helper_method :iframe, :
|
8
|
+
helper_method :iframe, :viewport_width?
|
9
|
+
before_action :add_additional_csp_directives, only: :show
|
9
10
|
|
10
11
|
def show; end
|
11
12
|
|
@@ -17,16 +18,28 @@ module Decidim
|
|
17
18
|
|
18
19
|
def sanitize(html)
|
19
20
|
sanitizer = Rails::Html::SafeListSanitizer.new
|
20
|
-
sanitizer.sanitize(html, tags: %w(iframe), attributes: ALLOWED_ATTRIBUTES)
|
21
|
-
|
21
|
+
partially_sanitized_html = sanitizer.sanitize(html, tags: %w(iframe), attributes: ALLOWED_ATTRIBUTES)
|
22
|
+
|
23
|
+
document = Nokogiri::HTML::DocumentFragment.parse(partially_sanitized_html)
|
24
|
+
document.css("iframe").each do |iframe|
|
25
|
+
iframe["srcdoc"] = Loofah.fragment(iframe["srcdoc"]).scrub!(:prune).to_s if iframe["srcdoc"]
|
26
|
+
end
|
22
27
|
|
23
|
-
|
24
|
-
current_component.settings.no_margins
|
28
|
+
document.to_s
|
25
29
|
end
|
26
30
|
|
27
31
|
def viewport_width?
|
28
32
|
current_component.settings.viewport_width
|
29
33
|
end
|
34
|
+
|
35
|
+
def add_additional_csp_directives
|
36
|
+
iframe_urls = Nokogiri::HTML::DocumentFragment.parse(iframe).children.select { |x| x.name == "iframe" }.filter_map { |x| x.attribute("src")&.value }
|
37
|
+
return if iframe_urls.blank?
|
38
|
+
|
39
|
+
iframe_urls.each do |url|
|
40
|
+
content_security_policy.append_csp_directive("frame-src", url)
|
41
|
+
end
|
42
|
+
end
|
30
43
|
end
|
31
44
|
end
|
32
45
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DecidimAwesome
|
5
|
+
module Proposals
|
6
|
+
module ProposalFormOverride
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
alias_method :decidim_original_map_model, :map_model
|
11
|
+
attribute :private_body, String
|
12
|
+
|
13
|
+
def map_model(model)
|
14
|
+
decidim_original_map_model(model)
|
15
|
+
self.private_body = model.private_body
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -15,6 +15,7 @@ module Decidim
|
|
15
15
|
minimum: ->(form) { form.minimum_title_length },
|
16
16
|
maximum: 150
|
17
17
|
}
|
18
|
+
|
18
19
|
validates :body, presence: true, unless: ->(form) { form.override_validations? || form.minimum_body_length.zero? }
|
19
20
|
validates :body, etiquette: true, unless: ->(form) { form.override_validations? }
|
20
21
|
validates :body, proposal_length: {
|
@@ -27,7 +28,7 @@ module Decidim
|
|
27
28
|
def override_validations?
|
28
29
|
return false if context.current_component.settings.participatory_texts_enabled
|
29
30
|
|
30
|
-
custom_fields.present?
|
31
|
+
custom_fields.present?
|
31
32
|
end
|
32
33
|
|
33
34
|
def minimum_title_length
|