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,22 +8,22 @@ FactoryBot.define do
|
|
8
8
|
factory :awesome_config, class: "Decidim::DecidimAwesome::AwesomeConfig" do
|
9
9
|
var { Faker::Hacker.noun }
|
10
10
|
value { Decidim::DecidimAwesome.config.to_a.sample(1).to_h }
|
11
|
-
organization
|
11
|
+
organization
|
12
12
|
end
|
13
13
|
|
14
14
|
factory :config_constraint, class: "Decidim::DecidimAwesome::ConfigConstraint" do
|
15
15
|
settings { { Faker::Hacker.noun => Faker::Hacker.noun } }
|
16
|
-
awesome_config
|
16
|
+
awesome_config
|
17
17
|
end
|
18
18
|
|
19
19
|
factory :awesome_editor_image, class: "Decidim::DecidimAwesome::EditorImage" do
|
20
20
|
file { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }
|
21
21
|
path { Faker::Internet.url(host: "", scheme: "") }
|
22
|
-
author {
|
23
|
-
organization
|
22
|
+
author { association :user }
|
23
|
+
organization
|
24
24
|
end
|
25
25
|
|
26
|
-
factory :paper_trail_version, class: Decidim::DecidimAwesome::PaperTrailVersion do
|
26
|
+
factory :paper_trail_version, class: "Decidim::DecidimAwesome::PaperTrailVersion" do
|
27
27
|
item_id { user.id }
|
28
28
|
item_type { "Decidim::ParticipatoryProcessUserRole" }
|
29
29
|
event { "create" }
|
@@ -33,28 +33,28 @@ FactoryBot.define do
|
|
33
33
|
factory :map_component, parent: :component do
|
34
34
|
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :proposals).i18n_name }
|
35
35
|
manifest_name { :awesome_map }
|
36
|
-
participatory_space {
|
36
|
+
participatory_space { association(:participatory_process, :with_steps, organization:) }
|
37
37
|
end
|
38
38
|
|
39
39
|
factory :iframe_component, parent: :component do
|
40
40
|
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :proposals).i18n_name }
|
41
41
|
manifest_name { :awesome_iframe }
|
42
|
-
participatory_space {
|
42
|
+
participatory_space { association(:participatory_process, :with_steps, organization:) }
|
43
43
|
end
|
44
44
|
|
45
45
|
factory :awesome_vote_weight, class: "Decidim::DecidimAwesome::VoteWeight" do
|
46
|
-
vote {
|
46
|
+
vote { association(:proposal_vote) }
|
47
47
|
sequence(:weight) { |n| n }
|
48
48
|
end
|
49
49
|
|
50
50
|
factory :awesome_proposal_extra_fields, class: "Decidim::DecidimAwesome::ProposalExtraField" do
|
51
|
-
proposal
|
51
|
+
proposal
|
52
52
|
|
53
53
|
trait :with_votes do
|
54
54
|
after :create do |weight|
|
55
55
|
5.times.collect do |n|
|
56
56
|
vote = create(:proposal_vote, proposal: weight.proposal, author: create(:user, organization: weight.proposal.organization))
|
57
|
-
create(:awesome_vote_weight, vote
|
57
|
+
create(:awesome_vote_weight, vote:, weight: n + 1)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -3,17 +3,17 @@
|
|
3
3
|
Decidim::DecidimAwesome.configure do |config|
|
4
4
|
if ENV.fetch("FEATURES", nil) == "disabled"
|
5
5
|
[
|
6
|
-
:
|
7
|
-
:
|
6
|
+
:allow_images_in_editors,
|
7
|
+
:allow_videos_in_editors,
|
8
8
|
:allow_images_in_proposals,
|
9
|
-
:use_markdown_editor,
|
10
|
-
:allow_images_in_markdown_editor,
|
11
9
|
:auto_save_forms,
|
12
10
|
:intergram_for_admins,
|
13
11
|
:intergram_for_public,
|
14
12
|
:scoped_styles,
|
15
13
|
:proposal_custom_fields,
|
14
|
+
:proposal_private_custom_fields,
|
16
15
|
:menu,
|
16
|
+
:home_content_block_menu,
|
17
17
|
:scoped_admins,
|
18
18
|
:custom_redirects,
|
19
19
|
:validate_title_min_length,
|
@@ -25,7 +25,9 @@ Decidim::DecidimAwesome.configure do |config|
|
|
25
25
|
:validate_body_max_marks_together,
|
26
26
|
:validate_body_start_with_caps,
|
27
27
|
:weighted_proposal_voting,
|
28
|
-
:
|
28
|
+
:additional_proposal_sortings,
|
29
|
+
:allow_limiting_amendments,
|
30
|
+
:proposal_private_custom_fields
|
29
31
|
].each do |conf|
|
30
32
|
config.send("#{conf}=", :disabled)
|
31
33
|
end
|
@@ -33,10 +35,3 @@ Decidim::DecidimAwesome.configure do |config|
|
|
33
35
|
config.disabled_components = [:awesome_map, :awesome_iframe]
|
34
36
|
end
|
35
37
|
end
|
36
|
-
|
37
|
-
if Decidim::DecidimAwesome.legacy_version?
|
38
|
-
Rails.application.config.to_prepare do
|
39
|
-
Decidim::Api::Schema.max_complexity = 5000
|
40
|
-
Decidim::Api::Schema.max_depth = 50
|
41
|
-
end
|
42
|
-
end
|
@@ -18,11 +18,11 @@
|
|
18
18
|
<meta property="og:image" content="<%= decidim_meta_image_url %>">
|
19
19
|
|
20
20
|
<%= favicon %>
|
21
|
-
<%=
|
21
|
+
<%= append_stylesheet_pack_tag "decidim_core", media: "all" %>
|
22
22
|
<%= invisible_captcha_styles %>
|
23
23
|
|
24
24
|
<%= organization_colors %>
|
25
|
-
<%=
|
25
|
+
<%= append_javascript_pack_tag "decidim_core", defer: false %>
|
26
26
|
|
27
27
|
<%= render partial: "layouts/decidim/head_extra" %>
|
28
28
|
<%== current_organization.header_snippets if Decidim.enable_html_header_snippets %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= csrf_meta_tags %>
|
3
3
|
<%= organization_colors %>
|
4
4
|
|
5
|
-
<%=
|
6
|
-
<%=
|
5
|
+
<%= append_stylesheet_pack_tag "decidim_admin", media: "all" %>
|
6
|
+
<%= append_javascript_pack_tag "decidim_admin", defer: false %>
|
7
7
|
|
8
8
|
<%= snippets.display(:head) %>
|
@@ -5,19 +5,19 @@ shared_examples "edits box label inline" do |test_case, key|
|
|
5
5
|
|
6
6
|
it "updates the label when no changes" do
|
7
7
|
link = find("[data-key=#{key}] a.awesome-auto-edit", match: :first)
|
8
|
-
expect(page).not_to
|
8
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
9
9
|
link.click
|
10
|
-
expect(page).to
|
10
|
+
expect(page).to have_field(class: "awesome-auto-edit")
|
11
11
|
find("body").click
|
12
|
-
expect(page).not_to
|
12
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
13
13
|
link.click
|
14
14
|
input = find("[data-key=#{key}] input.awesome-auto-edit")
|
15
15
|
input.fill_in with: "A new làbel\n"
|
16
16
|
sleep 1
|
17
|
-
expect(page).not_to
|
17
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
18
18
|
expect(page).to have_css("span.awesome-auto-edit[data-key=a_new_label]")
|
19
19
|
|
20
|
-
|
20
|
+
click_link_or_button "Update configuration"
|
21
21
|
case test_case
|
22
22
|
when :css
|
23
23
|
expect(page).to have_content("body {background: red;}")
|
@@ -48,19 +48,19 @@ shared_examples "edits box label inline" do |test_case, key|
|
|
48
48
|
end
|
49
49
|
|
50
50
|
link = find("[data-key=#{key}] a.awesome-auto-edit", match: :first)
|
51
|
-
expect(page).not_to
|
51
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
52
52
|
link.click
|
53
|
-
expect(page).to
|
53
|
+
expect(page).to have_field(class: "awesome-auto-edit")
|
54
54
|
find("body").click
|
55
|
-
expect(page).not_to
|
55
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
56
56
|
link.click
|
57
57
|
input = find("[data-key=#{key}] input.awesome-auto-edit")
|
58
58
|
input.fill_in with: "A new làbel\n"
|
59
59
|
sleep 1
|
60
|
-
expect(page).not_to
|
60
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
61
61
|
expect(page).to have_css("span.awesome-auto-edit[data-key=a_new_label]")
|
62
62
|
|
63
|
-
|
63
|
+
click_link_or_button "Update configuration"
|
64
64
|
case test_case
|
65
65
|
when :css
|
66
66
|
expect(page).to have_admin_callout("updated successfully")
|
@@ -78,34 +78,34 @@ shared_examples "edits box label inline" do |test_case, key|
|
|
78
78
|
|
79
79
|
it "updates the label with post changes" do
|
80
80
|
link = find("[data-key=#{key}] a.awesome-auto-edit", match: :first)
|
81
|
-
expect(page).not_to
|
81
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
82
82
|
link.click
|
83
|
-
expect(page).to
|
83
|
+
expect(page).to have_field(class: "awesome-auto-edit")
|
84
84
|
find("body").click
|
85
|
-
expect(page).not_to
|
85
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
86
86
|
link.click
|
87
87
|
input = find("[data-key=#{key}] input.awesome-auto-edit")
|
88
88
|
input.fill_in with: "A new làbel\n"
|
89
89
|
sleep 1
|
90
|
-
expect(page).not_to
|
90
|
+
expect(page).not_to have_field(class: "awesome-auto-edit")
|
91
91
|
expect(page).to have_css("span.awesome-auto-edit[data-key=a_new_label]")
|
92
92
|
|
93
93
|
case test_case
|
94
94
|
when :css
|
95
95
|
sleep 1
|
96
96
|
page.execute_script('document.querySelector("[data-key=a_new_label] .CodeMirror").CodeMirror.setValue("body {background: lilac;}");')
|
97
|
-
|
97
|
+
click_link_or_button "Update configuration"
|
98
98
|
expect(page).to have_admin_callout("updated successfully")
|
99
99
|
expect(page).to have_content("body {background: lilac;}")
|
100
100
|
when :fields
|
101
101
|
expect(page).to have_content("Full Name")
|
102
102
|
sleep 2
|
103
103
|
page.execute_script("$('.proposal_custom_fields_container[data-key=a_new_label] .proposal_custom_fields_editor')[0].FormBuilder.actions.setData(#{data})")
|
104
|
-
|
104
|
+
click_link_or_button "Update configuration"
|
105
105
|
expect(page).to have_content("Short Name")
|
106
106
|
when :admins
|
107
107
|
page.execute_script("$('.multiusers-select:first').append(new Option('#{user.name}', #{user.id}, true, true)).trigger('change');")
|
108
|
-
|
108
|
+
click_link_or_button "Update configuration"
|
109
109
|
expect(page).to have_content(user.name.to_s)
|
110
110
|
expect(page).to have_content(user2.name.to_s)
|
111
111
|
expect(page).to have_content(user3.name.to_s)
|
@@ -4,7 +4,7 @@ shared_examples "javascript config vars" do
|
|
4
4
|
it "has DecidimAwesome object" do
|
5
5
|
expect(page.body).to have_content("window.DecidimAwesome")
|
6
6
|
expect(page.body).to have_content("window.DecidimAwesome.version")
|
7
|
-
expect(page.body).to have_content("window.DecidimAwesome.
|
7
|
+
expect(page.body).to have_content("window.DecidimAwesome.editorUploaderPath")
|
8
8
|
expect(page.body).to have_content("window.DecidimAwesome.texts")
|
9
9
|
end
|
10
10
|
end
|
@@ -12,7 +12,7 @@ end
|
|
12
12
|
shared_examples "has menu link" do |item|
|
13
13
|
let(:prefix) { "config/" }
|
14
14
|
it "shows the feature link" do
|
15
|
-
within ".
|
15
|
+
within ".sidebar-menu" do
|
16
16
|
expect(page).to have_link(href: "/admin/decidim_awesome/#{prefix}#{item}")
|
17
17
|
end
|
18
18
|
end
|
@@ -21,13 +21,14 @@ end
|
|
21
21
|
shared_examples "do not have menu link" do |item|
|
22
22
|
let(:prefix) { "config/" }
|
23
23
|
it "do not show the feature link" do
|
24
|
-
within ".
|
24
|
+
within ".sidebar-menu" do
|
25
25
|
expect(page).not_to have_link(href: "/admin/decidim_awesome/#{prefix}#{item}")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
shared_examples "forbids disabled feature" do
|
30
|
+
shared_examples "forbids disabled feature without redirect" do
|
31
|
+
render_views
|
31
32
|
let(:feature) { :menu }
|
32
33
|
let(:features) { [feature] }
|
33
34
|
before do
|
@@ -36,7 +37,24 @@ shared_examples "forbids disabled feature" do
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
|
-
it "
|
40
|
+
it "fails with error" do
|
41
|
+
action
|
42
|
+
|
43
|
+
expect(response.body).to eq("no permissions for #{feature}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
shared_examples "forbids disabled feature with redirect" do
|
48
|
+
render_views
|
49
|
+
let(:feature) { :menu }
|
50
|
+
let(:features) { [feature] }
|
51
|
+
before do
|
52
|
+
features.each do |feat|
|
53
|
+
allow(Decidim::DecidimAwesome.config).to receive(feat).and_return(:disabled)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it "fails with error" do
|
40
58
|
action
|
41
59
|
|
42
60
|
expect(flash[:alert]).not_to be_empty
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples "creates a new box" do |name|
|
4
|
+
it "saves the content" do
|
5
|
+
click_on "Add a new \"#{name}\" box"
|
6
|
+
|
7
|
+
expect(page).to have_admin_callout("created successfully")
|
8
|
+
|
9
|
+
sleep 2
|
10
|
+
page.execute_script("document.querySelector('.proposal_custom_fields_editor').FormBuilder.actions.setData(#{data})")
|
11
|
+
|
12
|
+
click_on "Update configuration"
|
13
|
+
|
14
|
+
sleep 2
|
15
|
+
expect(page).to have_admin_callout("updated successfully")
|
16
|
+
expect(page).to have_content("Full Name")
|
17
|
+
expect(page).to have_content("Occupation")
|
18
|
+
expect(page).to have_content("Street Sweeper")
|
19
|
+
expect(page).to have_content("Short Bio")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
shared_examples "updates a box" do
|
24
|
+
it "updates the content" do
|
25
|
+
sleep 2
|
26
|
+
expect(page).to have_content("Full Name")
|
27
|
+
expect(page).to have_content("Occupation")
|
28
|
+
expect(page).to have_content("Street Sweeper")
|
29
|
+
expect(page).not_to have_content("Short Bio")
|
30
|
+
|
31
|
+
page.execute_script("$('.proposal_custom_fields_container[data-key=\"foo\"] .proposal_custom_fields_editor')[0].FormBuilder.actions.setData(#{data})")
|
32
|
+
click_on "Update configuration"
|
33
|
+
|
34
|
+
sleep 2
|
35
|
+
expect(page).to have_admin_callout("updated successfully")
|
36
|
+
expect(page).to have_content("Full Name")
|
37
|
+
expect(page).not_to have_content("Occupation")
|
38
|
+
expect(page).not_to have_content("Street Sweeper")
|
39
|
+
expect(page).to have_content("Short Bio")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
shared_examples "removes a box" do |name|
|
44
|
+
let(:custom_fields) do
|
45
|
+
{
|
46
|
+
"foo" => "[#{data1}]",
|
47
|
+
"bar" => "[#{data2}]"
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
it "updates the content" do
|
52
|
+
sleep 2
|
53
|
+
expect(page).to have_content("Full Name")
|
54
|
+
expect(page).to have_content("Occupation")
|
55
|
+
expect(page).to have_content("Street Sweeper")
|
56
|
+
expect(page).not_to have_content("Short Bio")
|
57
|
+
|
58
|
+
within ".proposal_custom_fields_container[data-key=\"foo\"]" do
|
59
|
+
accept_confirm { click_on "Remove this \"#{name}\" box" }
|
60
|
+
end
|
61
|
+
|
62
|
+
sleep 2
|
63
|
+
expect(page).to have_admin_callout("removed successfully")
|
64
|
+
expect(page).not_to have_content("Full Name")
|
65
|
+
expect(page).to have_content("Occupation")
|
66
|
+
expect(page).to have_content("Street Sweeper")
|
67
|
+
expect(page).not_to have_content("Short Bio")
|
68
|
+
|
69
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_foo")).not_to be_present
|
70
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar")).to be_present
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
shared_examples "adds a constraint" do
|
75
|
+
let(:custom_fields) do
|
76
|
+
{
|
77
|
+
"foo" => "[#{data1}]",
|
78
|
+
"bar" => "[#{data2}]"
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
it "adds a new config helper var" do
|
83
|
+
within ".proposal_custom_fields_container[data-key=\"foo\"]" do
|
84
|
+
click_on "Add case"
|
85
|
+
end
|
86
|
+
|
87
|
+
select "Processes", from: "constraint_participatory_space_manifest"
|
88
|
+
within "#new-modal-#{var_name}_foo" do
|
89
|
+
click_on "Save"
|
90
|
+
end
|
91
|
+
|
92
|
+
sleep 2
|
93
|
+
|
94
|
+
within ".proposal_custom_fields_container[data-key=\"foo\"] .constraints-editor" do
|
95
|
+
expect(page).to have_content("Processes")
|
96
|
+
end
|
97
|
+
|
98
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar")).to be_present
|
99
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar").constraints.first.settings).to eq(constraint.settings)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
shared_examples "removes a constraint" do
|
104
|
+
let(:custom_fields) do
|
105
|
+
{
|
106
|
+
"foo" => "[#{data1}]",
|
107
|
+
"bar" => "[#{data2}]"
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
it "removes the helper config var" do
|
112
|
+
within ".proposal_custom_fields_container[data-key=\"bar\"] .constraints-editor" do
|
113
|
+
expect(page).to have_content("Processes")
|
114
|
+
expect(page).to have_content("Proposals")
|
115
|
+
end
|
116
|
+
|
117
|
+
within ".proposal_custom_fields_container[data-key=\"bar\"] .constraints-editor" do
|
118
|
+
within first(".constraints-list li") do
|
119
|
+
click_on "Delete"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
within ".proposal_custom_fields_container[data-key=\"bar\"] .constraints-editor" do
|
124
|
+
expect(page).not_to have_content("Proposals")
|
125
|
+
end
|
126
|
+
|
127
|
+
visit decidim_admin_decidim_awesome.config_path("#{var_name}s")
|
128
|
+
|
129
|
+
within ".proposal_custom_fields_container[data-key=\"bar\"] .constraints-editor" do
|
130
|
+
expect(page).not_to have_content("Proposals")
|
131
|
+
end
|
132
|
+
|
133
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar")).to be_present
|
134
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar").constraints.count).to eq(1)
|
135
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar").constraints.first).to eq(another_constraint)
|
136
|
+
end
|
137
|
+
|
138
|
+
context "and there is only one constraint" do
|
139
|
+
let!(:another_constraint) { nil }
|
140
|
+
|
141
|
+
it "do not remove the helper config var" do
|
142
|
+
within ".proposal_custom_fields_container[data-key=\"bar\"] .constraints-editor" do
|
143
|
+
click_on "Delete"
|
144
|
+
end
|
145
|
+
|
146
|
+
within ".proposal_custom_fields_container[data-key=\"bar\"] .constraints-editor" do
|
147
|
+
expect(page).to have_content("Proposals")
|
148
|
+
end
|
149
|
+
|
150
|
+
expect(page).to have_content("Sorry, this cannot be deleted")
|
151
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar").constraints.count).to eq(1)
|
152
|
+
expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar").constraints.first).to eq(constraint)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -4,16 +4,16 @@ shared_context "with custom redirects params" do
|
|
4
4
|
let(:organization) { create(:organization) }
|
5
5
|
let(:context) do
|
6
6
|
{
|
7
|
-
current_user: create(:user, organization:
|
7
|
+
current_user: create(:user, organization:),
|
8
8
|
current_organization: organization
|
9
9
|
}
|
10
10
|
end
|
11
11
|
let(:params) do
|
12
12
|
{
|
13
|
-
origin
|
14
|
-
destination
|
15
|
-
active
|
16
|
-
pass_query:
|
13
|
+
origin:,
|
14
|
+
destination:,
|
15
|
+
active:,
|
16
|
+
pass_query:
|
17
17
|
}
|
18
18
|
end
|
19
19
|
let(:attributes) do
|
@@ -33,8 +33,8 @@ shared_context "with custom redirects params" do
|
|
33
33
|
|
34
34
|
let(:another_params) do
|
35
35
|
{
|
36
|
-
|
37
|
-
|
36
|
+
allow_images_in_editors: true,
|
37
|
+
allow_videos_in_editors: true
|
38
38
|
}
|
39
39
|
end
|
40
40
|
let(:form) do
|
@@ -1,75 +1,59 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
shared_examples "has no
|
4
|
-
it "has no
|
5
|
-
expect(page).not_to
|
6
|
-
end
|
7
|
-
|
8
|
-
if rte
|
9
|
-
it "has image button" do
|
10
|
-
expect(page).not_to have_xpath("//button[@class='ql-image']")
|
11
|
-
end
|
12
|
-
else
|
13
|
-
it "has no paste event" do
|
14
|
-
sleep 1
|
15
|
-
expect(page.execute_script("return typeof $._data($('#{editor_selector}')[0], 'events').paste")).to eq("undefined")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "has no drop event" do
|
19
|
-
sleep 1
|
20
|
-
expect(page.execute_script("return typeof $._data($('#{editor_selector}')[0], 'events').drop")).to eq("undefined")
|
21
|
-
end
|
3
|
+
shared_examples "has no image support" do
|
4
|
+
it "has no image button" do
|
5
|
+
expect(page).not_to have_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='image']")
|
22
6
|
end
|
23
7
|
end
|
24
8
|
|
25
|
-
shared_examples "has
|
26
|
-
it "has
|
27
|
-
expect(page).to
|
28
|
-
end
|
29
|
-
|
30
|
-
if rte
|
31
|
-
it "has image button" do
|
32
|
-
expect(page).to have_xpath("//button[@class='ql-image']")
|
33
|
-
end
|
34
|
-
else
|
35
|
-
it "has paste event" do
|
36
|
-
sleep 1
|
37
|
-
expect(page.execute_script("return typeof $._data($('#{editor_selector}')[0], 'events').paste")).to eq("object")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "has drop event" do
|
41
|
-
sleep 1
|
42
|
-
expect(page.execute_script("return typeof $._data($('#{editor_selector}')[0], 'events').drop")).to eq("object")
|
43
|
-
end
|
9
|
+
shared_examples "has image support" do
|
10
|
+
it "has image button" do
|
11
|
+
expect(page).to have_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='image']")
|
44
12
|
end
|
45
13
|
end
|
46
14
|
|
47
|
-
shared_examples "has
|
48
|
-
it "has
|
49
|
-
expect(page).
|
15
|
+
shared_examples "has no video support" do
|
16
|
+
it "has no video button" do
|
17
|
+
expect(page).not_to have_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='videoEmbed']")
|
50
18
|
end
|
19
|
+
end
|
51
20
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
if images
|
57
|
-
it "has help text" do
|
58
|
-
expect(page).to have_content("Add images by dragging & dropping or pasting them.")
|
59
|
-
end
|
60
|
-
else
|
61
|
-
it "has no help text" do
|
62
|
-
expect(page).not_to have_content("Add images by dragging & dropping or pasting them.")
|
63
|
-
end
|
21
|
+
shared_examples "has video support" do
|
22
|
+
it "has video button" do
|
23
|
+
expect(page).to have_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='videoEmbed']")
|
64
24
|
end
|
65
25
|
end
|
66
26
|
|
67
|
-
shared_examples "has no
|
68
|
-
it "
|
69
|
-
expect(page).not_to
|
27
|
+
shared_examples "has no drag and drop" do
|
28
|
+
it "cannot drop a file" do
|
29
|
+
expect(page).not_to have_content("Add images by dragging & dropping or pasting them.")
|
30
|
+
find(editor_selector).drop(image)
|
31
|
+
expect(page.execute_script("return document.querySelector('#{editor_selector}').value")).not_to eq("[Uploading file...]")
|
32
|
+
sleep 1
|
33
|
+
last_image = Decidim::DecidimAwesome::EditorImage.last
|
34
|
+
expect(last_image).to be_nil
|
70
35
|
end
|
36
|
+
end
|
71
37
|
|
72
|
-
|
73
|
-
|
38
|
+
shared_examples "has drag and drop" do
|
39
|
+
it "can drop a file" do
|
40
|
+
within "form.edit_proposal" do
|
41
|
+
expect(page).to have_content("Add images by dragging & dropping or pasting them.")
|
42
|
+
fill_in :proposal_body, with: ""
|
43
|
+
end
|
44
|
+
find(editor_selector).drop(image)
|
45
|
+
expect(page.execute_script("return document.querySelector('#{editor_selector}').value")).to include("[Uploading file...]")
|
46
|
+
sleep 1
|
47
|
+
last_image = Decidim::DecidimAwesome::EditorImage.last
|
48
|
+
expect(last_image).to be_present
|
49
|
+
content = page.execute_script("return document.querySelector('#{editor_selector}').value")
|
50
|
+
expect(content).to include(last_image.attached_uploader(:file).path)
|
51
|
+
within "form.edit_proposal" do
|
52
|
+
# ensures valid body validations
|
53
|
+
fill_in :proposal_body, with: "This is a super test with lots of downcases characters to be sure that the image name does not mess with percentage of caps.\n#{content}"
|
54
|
+
fill_in :proposal_title, with: "This is a test proposal"
|
55
|
+
click_on "Send"
|
56
|
+
end
|
57
|
+
expect(proposal.reload.body["en"]).to include(last_image.attached_uploader(:file).path)
|
74
58
|
end
|
75
59
|
end
|
@@ -4,19 +4,21 @@ shared_context "with menu hacks params" do
|
|
4
4
|
let(:organization) { create(:organization) }
|
5
5
|
let(:context) do
|
6
6
|
{
|
7
|
-
current_user: create(:user, organization:
|
7
|
+
current_user: create(:user, organization:),
|
8
8
|
current_organization: organization
|
9
9
|
}
|
10
10
|
end
|
11
11
|
let(:params) do
|
12
12
|
{
|
13
|
+
menu_id:,
|
13
14
|
raw_label: label,
|
14
|
-
url
|
15
|
-
position
|
16
|
-
target
|
17
|
-
visibility:
|
15
|
+
url:,
|
16
|
+
position:,
|
17
|
+
target:,
|
18
|
+
visibility:
|
18
19
|
}
|
19
20
|
end
|
21
|
+
let(:menu_id) { menu_name.to_sym }
|
20
22
|
let(:attributes) do
|
21
23
|
{
|
22
24
|
"label" => label,
|
@@ -36,12 +38,11 @@ shared_context "with menu hacks params" do
|
|
36
38
|
let(:position) { 2 }
|
37
39
|
let(:target) { "_blank" }
|
38
40
|
let(:visibility) { "hidden" }
|
39
|
-
let(:menu_name) { "menu" }
|
40
41
|
|
41
42
|
let(:another_params) do
|
42
43
|
{
|
43
|
-
|
44
|
-
|
44
|
+
allow_images_in_editors: true,
|
45
|
+
allow_videos_in_editors: true
|
45
46
|
}
|
46
47
|
end
|
47
48
|
let(:form) do
|