decidim-decidim_awesome 0.10.3 → 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 +14 -5
- data/README.md +65 -67
- data/app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb +20 -0
- data/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb +44 -0
- data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +5 -12
- 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 +1 -1
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +2 -2
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +2 -2
- data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
- 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/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 +1 -1
- data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +3 -4
- data/app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb +34 -0
- data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +1 -1
- data/app/controllers/concerns/decidim/decidim_awesome/proposals/orderable_override.rb +22 -9
- data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +3 -3
- data/app/controllers/decidim/decidim_awesome/admin/admin_accountability_controller.rb +7 -7
- data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +7 -7
- data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +8 -10
- data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +20 -19
- data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -8
- data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +2 -2
- data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -8
- data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +2 -2
- 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 +11 -5
- data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +1 -1
- data/app/forms/decidim/decidim_awesome/admin/config_form.rb +13 -25
- 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 +8 -1
- 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 +23 -39
- data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +2 -2
- data/app/helpers/decidim/decidim_awesome/map_helper.rb +8 -27
- 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 +1 -1
- data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -1
- data/app/models/decidim/decidim_awesome/paper_trail_version.rb +4 -8
- data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +1 -1
- data/app/models/decidim/decidim_awesome/vote_weight.rb +2 -2
- data/app/overrides/decidim/proposals/proposals/{show → _proposal_aside}/limit_amendments_modal.html.erb.deface +1 -1
- 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_editor.js +14 -0
- data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +95 -70
- 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 +4 -1
- 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/user_picker.js +34 -21
- data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +20 -22
- 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 +0 -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 +9 -14
- data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +27 -32
- 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 +19 -12
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +8 -32
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -78
- 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 +15 -24
- data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +9 -47
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +3 -12
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +3 -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 +27 -21
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +32 -101
- data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +5 -26
- data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +34 -52
- 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/concerns/decidim/decidim_awesome/menu_item_presenter_override.rb +10 -2
- data/app/presenters/concerns/decidim/decidim_awesome/menu_presenter_override.rb +8 -0
- data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +1 -1
- data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +11 -11
- data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +1 -1
- data/app/queries/decidim/decidim_awesome/private_data_finder.rb +1 -1
- data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +0 -8
- 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 +1 -3
- data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +3 -3
- data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +20 -21
- data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +6 -5
- data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +2 -2
- 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 +4 -6
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +64 -76
- data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +15 -11
- 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 +15 -15
- 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 +4 -4
- 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 +16 -18
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
- 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 +18 -11
- data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +3 -5
- 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 +3 -12
- data/config/assets.rb +3 -33
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/ca.yml +17 -94
- data/config/locales/cs.yml +15 -93
- data/config/locales/de.yml +15 -91
- data/config/locales/en.yml +24 -28
- data/config/locales/es.yml +18 -96
- data/config/locales/eu.yml +8 -18
- data/config/locales/fr.yml +15 -94
- data/config/locales/hu.yml +4 -18
- data/config/locales/it.yml +9 -26
- data/config/locales/ja.yml +16 -93
- data/config/locales/lt.yml +2 -4
- data/config/locales/nl.yml +8 -18
- data/config/locales/pt-BR.yml +11 -25
- data/config/locales/ro-RO.yml +2 -14
- data/config/locales/sv.yml +10 -21
- 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/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +1 -1
- data/db/seeds.rb +3 -3
- data/lib/decidim/decidim_awesome/admin_engine.rb +4 -1
- data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +2 -3
- data/lib/decidim/decidim_awesome/awesome.rb +42 -28
- data/lib/decidim/decidim_awesome/awesome_helpers.rb +1 -1
- data/lib/decidim/decidim_awesome/checksums.yml +39 -60
- data/lib/decidim/decidim_awesome/config.rb +1 -1
- data/lib/decidim/decidim_awesome/custom_fields.rb +5 -5
- data/lib/decidim/decidim_awesome/engine.rb +24 -6
- data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -2
- data/lib/decidim/decidim_awesome/lock.rb +2 -2
- data/lib/decidim/decidim_awesome/map_component/component.rb +1 -1
- data/lib/decidim/decidim_awesome/menu.rb +33 -14
- 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 +3 -11
- 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_examples.rb +18 -18
- data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +3 -3
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +11 -11
- 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 +26 -66
- data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +10 -9
- data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +30 -20
- data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +19 -10
- 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 +19 -28
- metadata +40 -56
- data/app/cells/concerns/decidim/decidim_awesome/proposal_m_cell_override.rb +0 -18
- 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/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 -213
- 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 -65
- 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
- /data/app/packs/src/decidim/decidim_awesome/{editors/tabs_focus.js → admin/tabs_change.js} +0 -0
@@ -21,6 +21,10 @@ module Decidim
|
|
21
21
|
@form = form(MenuForm).instance
|
22
22
|
end
|
23
23
|
|
24
|
+
def edit
|
25
|
+
@form = form(MenuForm).from_model(menu_item)
|
26
|
+
end
|
27
|
+
|
24
28
|
def create
|
25
29
|
@form = form(MenuForm).from_params(params)
|
26
30
|
CreateMenuHack.call(@form, current_menu_name) do
|
@@ -36,10 +40,6 @@ module Decidim
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
|
-
def edit
|
40
|
-
@form = form(MenuForm).from_model(menu_item)
|
41
|
-
end
|
42
|
-
|
43
43
|
def update
|
44
44
|
@form = form(MenuForm).from_params(params)
|
45
45
|
UpdateMenuHack.call(@form, current_menu_name) do
|
@@ -61,7 +61,7 @@ module Decidim
|
|
61
61
|
flash[:notice] = I18n.t("menu_hacks.destroy.success", scope: "decidim.decidim_awesome.admin")
|
62
62
|
end
|
63
63
|
on(:invalid) do |error|
|
64
|
-
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:)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
redirect_to decidim_admin_decidim_awesome.menu_hacks_path
|
@@ -69,7 +69,6 @@ module Decidim
|
|
69
69
|
|
70
70
|
private
|
71
71
|
|
72
|
-
# rubocop:disable Style/OpenStructUse
|
73
72
|
def menu_item
|
74
73
|
item = current_items.find { |i| md5(i.url) == params[:id] }
|
75
74
|
raise ActiveRecord::RecordNotFound unless item
|
@@ -83,7 +82,6 @@ module Decidim
|
|
83
82
|
native?: !item.respond_to?(:overrided?)
|
84
83
|
)
|
85
84
|
end
|
86
|
-
# rubocop:enable Style/OpenStructUse
|
87
85
|
|
88
86
|
def current_items
|
89
87
|
@current_items ||= current_menu.items(include_invisible: true)
|
@@ -94,7 +92,7 @@ module Decidim
|
|
94
92
|
end
|
95
93
|
|
96
94
|
def current_menu_name
|
97
|
-
:
|
95
|
+
params[:menu_id].to_sym
|
98
96
|
end
|
99
97
|
|
100
98
|
def visibility_options
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
def create
|
9
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|
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
def destroy
|
23
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|
|
@@ -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
|
|
@@ -27,13 +28,18 @@ module Decidim
|
|
27
28
|
document.to_s
|
28
29
|
end
|
29
30
|
|
30
|
-
def remove_margins?
|
31
|
-
current_component.settings.no_margins
|
32
|
-
end
|
33
|
-
|
34
31
|
def viewport_width?
|
35
32
|
current_component.settings.viewport_width
|
36
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
|
37
43
|
end
|
38
44
|
end
|
39
45
|
end
|
@@ -28,7 +28,7 @@ module Decidim
|
|
28
28
|
def override_validations?
|
29
29
|
return false if context.current_component.settings.participatory_texts_enabled
|
30
30
|
|
31
|
-
custom_fields.present?
|
31
|
+
custom_fields.present?
|
32
32
|
end
|
33
33
|
|
34
34
|
def minimum_title_length
|
@@ -8,13 +8,9 @@ module Decidim
|
|
8
8
|
class ConfigForm < Decidim::Form
|
9
9
|
include ActionView::Helpers::SanitizeHelper
|
10
10
|
|
11
|
-
attribute :
|
12
|
-
attribute :allow_images_in_small_editor, Boolean
|
11
|
+
attribute :allow_images_in_editors, Boolean
|
13
12
|
attribute :allow_videos_in_editors, Boolean
|
14
13
|
attribute :allow_images_in_proposals, Boolean
|
15
|
-
attribute :use_markdown_editor, Boolean
|
16
|
-
attribute :allow_images_in_markdown_editor, Boolean
|
17
|
-
attribute :auto_save_forms, Boolean
|
18
14
|
attribute :auto_save_forms, Boolean
|
19
15
|
attribute :scoped_styles, Hash
|
20
16
|
attribute :proposal_custom_fields, Hash
|
@@ -69,7 +65,7 @@ module Decidim
|
|
69
65
|
|
70
66
|
SassC::Engine.new(code).render
|
71
67
|
rescue SassC::SyntaxError => e
|
72
|
-
errors.add(:scoped_styles, I18n.t("config.form.errors.incorrect_css", key
|
68
|
+
errors.add(:scoped_styles, I18n.t("config.form.errors.incorrect_css", key:, scope: "decidim.decidim_awesome.admin"))
|
73
69
|
errors.add(key.to_sym, e.message)
|
74
70
|
end
|
75
71
|
end
|
@@ -83,32 +79,26 @@ module Decidim
|
|
83
79
|
|
84
80
|
values.each { |code| JSON.parse(code) }
|
85
81
|
rescue JSON::JSONError => e
|
86
|
-
errors.add(key, I18n.t("config.form.errors.incorrect_json", key
|
82
|
+
errors.add(key, I18n.t("config.form.errors.incorrect_json", key:, scope: "decidim.decidim_awesome.admin"))
|
87
83
|
errors.add(key.to_sym, e.message)
|
88
84
|
end
|
89
85
|
end
|
90
86
|
|
91
87
|
# formBuilder has a bug and do not sanitize text if users copy/paste text with format in the label input
|
92
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
93
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
94
88
|
def sanitize_labels!
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
item
|
103
|
-
end
|
104
|
-
JSON.generate(json)
|
105
|
-
rescue JSON::ParserError
|
106
|
-
code
|
89
|
+
proposal_custom_fields.transform_values! do |code|
|
90
|
+
next unless code
|
91
|
+
|
92
|
+
json = JSON.parse(code)
|
93
|
+
json.map! do |item|
|
94
|
+
item["label"] = strip_tags(item["label"])
|
95
|
+
item
|
107
96
|
end
|
97
|
+
JSON.generate(json)
|
98
|
+
rescue JSON::ParserError
|
99
|
+
code
|
108
100
|
end
|
109
101
|
|
110
|
-
return unless proposal_private_custom_fields
|
111
|
-
|
112
102
|
proposal_private_custom_fields.transform_values! do |code|
|
113
103
|
next unless code
|
114
104
|
|
@@ -122,8 +112,6 @@ module Decidim
|
|
122
112
|
code
|
123
113
|
end
|
124
114
|
end
|
125
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
126
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
127
115
|
end
|
128
116
|
end
|
129
117
|
end
|
@@ -27,13 +27,20 @@ module Decidim
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def render_amendment_custom_fields_override(custom_fields, attribute, form, original_resource)
|
30
|
+
# ensure decidim_editor is available as it is only required if the original FormBuilder is called
|
31
|
+
append_stylesheet_pack_tag "decidim_editor"
|
32
|
+
append_javascript_pack_tag "decidim_editor", defer: false
|
33
|
+
|
30
34
|
custom_fields.translate!
|
31
35
|
body = amendments_form_fields_value(original_resource, attribute)
|
32
36
|
custom_fields.apply_xml(body) if body.present?
|
33
37
|
# TODO: find a way to add errors as form is not the parent form
|
34
38
|
# form.object.errors.add(attribute, custom_fields.errors) if custom_fields.errors
|
35
39
|
|
36
|
-
|
40
|
+
editor_image = Decidim::EditorImage.new
|
41
|
+
editor_options = form.send(:editor_options, editor_image, { context: "participant", lines: 10 })
|
42
|
+
editor_upload = form.send(:editor_upload, editor_image, editor_options[:upload])
|
43
|
+
render partial: "decidim/decidim_awesome/custom_fields/form_render", locals: { spec: custom_fields.to_json, editor_options:, editor_upload:, form:, name: attribute }
|
37
44
|
end
|
38
45
|
|
39
46
|
# Amendments don't use a URL specifying participatory space and component
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DecidimAwesome
|
5
|
+
module BreadcrumbHelperOverride
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
def active_breadcrumb_item(target_menu)
|
10
|
+
active_item = ::Decidim::MenuPresenter.new(target_menu, self).active_item_for_breadcrumb
|
11
|
+
|
12
|
+
return if active_item.blank?
|
13
|
+
|
14
|
+
{
|
15
|
+
label: active_item.label,
|
16
|
+
url: active_item.url,
|
17
|
+
active: active_item.active?
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -12,7 +12,7 @@ module Decidim
|
|
12
12
|
|
13
13
|
# If the content is safe, HTML tags are sanitized, otherwise, they are stripped.
|
14
14
|
def render_proposal_body(proposal)
|
15
|
-
if awesome_proposal_custom_fields.present? || awesome_config[:
|
15
|
+
if awesome_proposal_custom_fields.present? || awesome_config[:allow_images_in_editors]
|
16
16
|
content = present(proposal).body(links: true, strip_tags: false)
|
17
17
|
sanitized = decidim_sanitize_editor_admin(content, {})
|
18
18
|
Decidim::ContentProcessor.render_without_format(sanitized).html_safe
|
@@ -70,12 +70,30 @@ module Decidim
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def render_proposal_custom_fields_override(custom_fields, form, name, locale = nil)
|
73
|
-
|
73
|
+
# ensure decidim_editor is available as it is only required if the original FormBuilder is called
|
74
|
+
append_stylesheet_pack_tag "decidim_editor"
|
75
|
+
append_javascript_pack_tag "decidim_editor", defer: false
|
74
76
|
|
75
|
-
|
76
|
-
apply_custom_fields(custom_fields, body, form, name)
|
77
|
+
custom_fields.translate!
|
77
78
|
|
78
|
-
|
79
|
+
body = if name == :private_body
|
80
|
+
if form_presenter.proposal.private_body.is_a?(Hash) && locale.present?
|
81
|
+
form_presenter.private_body(extras: false, all_locales: locale.present?).with_indifferent_access[locale]
|
82
|
+
else
|
83
|
+
form_presenter.private_body(extras: false)
|
84
|
+
end
|
85
|
+
elsif form_presenter.proposal.body.is_a?(Hash) && locale.present?
|
86
|
+
form_presenter.body(extras: false, all_locales: locale.present?).with_indifferent_access[locale]
|
87
|
+
else
|
88
|
+
form_presenter.body(extras: false)
|
89
|
+
end
|
90
|
+
|
91
|
+
custom_fields.apply_xml(body) if body.present?
|
92
|
+
form.object.errors.add(name, custom_fields.errors) if custom_fields.errors
|
93
|
+
editor_image = Decidim::EditorImage.new
|
94
|
+
editor_options = form.send(:editor_options, editor_image, { context: "participant", lines: 10 })
|
95
|
+
editor_upload = form.send(:editor_upload, editor_image, editor_options[:upload])
|
96
|
+
render partial: "decidim/decidim_awesome/custom_fields/form_render", locals: { spec: custom_fields.to_json, editor_options:, editor_upload:, form:, name: }
|
79
97
|
end
|
80
98
|
|
81
99
|
def awesome_proposal_custom_fields_for(name)
|
@@ -85,40 +103,6 @@ module Decidim
|
|
85
103
|
Decidim::DecidimAwesome::CustomFields.new(awesome_proposal_custom_fields)
|
86
104
|
end
|
87
105
|
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def extract_body_content(name, locale)
|
92
|
-
case name
|
93
|
-
when :private_body
|
94
|
-
extract_private_body(locale)
|
95
|
-
else
|
96
|
-
extract_body(locale)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def extract_private_body(locale)
|
101
|
-
if form_presenter.proposal.private_body.is_a?(Hash) && locale.present?
|
102
|
-
form_presenter.private_body(extras: false, all_locales: locale.present?).with_indifferent_access[locale]
|
103
|
-
else
|
104
|
-
form_presenter.private_body(extras: false)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def extract_body(locale)
|
109
|
-
if form_presenter.proposal.body.is_a?(Hash) && locale.present?
|
110
|
-
form_presenter.body(extras: false, all_locales: locale.present?).with_indifferent_access[locale]
|
111
|
-
else
|
112
|
-
form_presenter.body(extras: false)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def apply_custom_fields(custom_fields, body, form, name)
|
117
|
-
if body.present?
|
118
|
-
custom_fields.apply_xml(body)
|
119
|
-
form.object.errors.add(name, custom_fields.errors) if custom_fields.errors
|
120
|
-
end
|
121
|
-
end
|
122
106
|
end
|
123
107
|
end
|
124
108
|
end
|
@@ -11,7 +11,7 @@ module Decidim
|
|
11
11
|
delegate :menus, :config_enabled?, to: "Decidim::DecidimAwesome::Menu"
|
12
12
|
|
13
13
|
def check(status)
|
14
|
-
content_tag(:span, icon(status ? "check" : "close", class: "inline-block", aria_label: status, role: "img"), class: "
|
14
|
+
content_tag(:span, icon(status ? "check-line" : "close-line", class: "inline-block", aria_label: status, role: "img"), class: "fill-#{status ? "success" : "alert"}")
|
15
15
|
end
|
16
16
|
|
17
17
|
# returns only non :disabled vars in config
|
@@ -50,7 +50,7 @@ module Decidim
|
|
50
50
|
space = model_for_manifest(manifest)
|
51
51
|
return {} unless space&.column_names&.include? "slug"
|
52
52
|
|
53
|
-
components = Component.where(participatory_space: space.find_by(slug:
|
53
|
+
components = Component.where(participatory_space: space.find_by(slug:))
|
54
54
|
components.to_h do |item|
|
55
55
|
[item.id, "#{item.id}: #{translated_attribute(item.name)}"]
|
56
56
|
end
|
@@ -11,14 +11,12 @@ module Decidim
|
|
11
11
|
|
12
12
|
# rubocop:disable Metrics/CyclomaticComplexity
|
13
13
|
# rubocop:disable Metrics/PerceivedComplexity:
|
14
|
-
def awesome_map_for(components, &
|
14
|
+
def awesome_map_for(components, &)
|
15
15
|
return unless map_utility_dynamic
|
16
16
|
|
17
|
-
map = awesome_builder.map_element({ class: "
|
18
|
-
help = content_tag(:div, class: "
|
19
|
-
|
20
|
-
|
21
|
-
sr_content
|
17
|
+
map = awesome_builder.map_element({ class: "dynamic-map", id: "awesome-map-container" }, &)
|
18
|
+
help = content_tag(:div, class: "map__skip-container") do
|
19
|
+
content_tag(:p, t("screen_reader_explanation", scope: "decidim.map.dynamic"), class: "sr-only")
|
22
20
|
end
|
23
21
|
|
24
22
|
html_options = {
|
@@ -30,7 +28,7 @@ module Decidim
|
|
30
28
|
type: component.manifest.name,
|
31
29
|
name: translated_attribute(component.name),
|
32
30
|
url: Decidim::EngineRouter.main_proxy(component).root_path,
|
33
|
-
amendments: component.manifest.name == :proposals ? Decidim::Proposals::Proposal.where(component:
|
31
|
+
amendments: component.manifest.name == :proposals ? Decidim::Proposals::Proposal.where(component:).only_emendations.count : 0
|
34
32
|
}
|
35
33
|
end.to_json,
|
36
34
|
"data-hide-controls" => settings_source.try(:hide_controls),
|
@@ -51,7 +49,7 @@ module Decidim
|
|
51
49
|
}
|
52
50
|
|
53
51
|
content_tag(:div, html_options) do
|
54
|
-
content_tag :div, class: "
|
52
|
+
content_tag :div, class: "w-full" do
|
55
53
|
help + map
|
56
54
|
end
|
57
55
|
end
|
@@ -71,7 +69,6 @@ module Decidim
|
|
71
69
|
try(:current_component) || self
|
72
70
|
end
|
73
71
|
|
74
|
-
# rubocop:disable Rails/HelperInstanceVariable
|
75
72
|
def current_categories(categories)
|
76
73
|
return @current_categories if @current_categories
|
77
74
|
|
@@ -97,26 +94,12 @@ module Decidim
|
|
97
94
|
}
|
98
95
|
builder = map_utility_dynamic.create_builder(self, options)
|
99
96
|
|
100
|
-
|
101
|
-
|
102
|
-
snippets.add(:awesome_map_styles, stylesheet_pack_tag("decidim_decidim_awesome_map"))
|
103
|
-
snippets.add(:awesome_map_scripts, javascript_pack_tag("decidim_decidim_awesome_map", defer: false))
|
104
|
-
snippets.add(:head, snippets.for(:awesome_map_styles))
|
105
|
-
snippets.add(DecidimAwesome.legacy_version? ? :head : :foot, snippets.for(:awesome_map_scripts))
|
106
|
-
end
|
107
|
-
|
108
|
-
unless snippets.any?(:map_styles) || snippets.any?(:map_scripts)
|
109
|
-
snippets.add(:map_styles, builder.stylesheet_snippets)
|
110
|
-
snippets.add(:map_scripts, builder.javascript_snippets)
|
111
|
-
|
112
|
-
snippets.add(:head, snippets.for(:map_styles))
|
113
|
-
snippets.add(DecidimAwesome.legacy_version? ? :head : :foot, snippets.for(:map_scripts))
|
114
|
-
end
|
97
|
+
append_stylesheet_pack_tag("decidim_decidim_awesome_map")
|
98
|
+
append_javascript_pack_tag("decidim_decidim_awesome_map")
|
115
99
|
|
116
100
|
builder
|
117
101
|
end
|
118
102
|
|
119
|
-
# rubocop:disable Style/FormatStringToken
|
120
103
|
def append_category(category)
|
121
104
|
@h += @golden_ratio_conjugate
|
122
105
|
@h %= 1
|
@@ -129,8 +112,6 @@ module Decidim
|
|
129
112
|
color: format("#%02x%02x%02x", r, g, b)
|
130
113
|
)
|
131
114
|
end
|
132
|
-
# rubocop:enable Style/FormatStringToken
|
133
|
-
# rubocop:enable Rails/HelperInstanceVariable
|
134
115
|
|
135
116
|
# HSV values in [0..1[
|
136
117
|
# returns [r, g, b] values from 0 to 255
|
@@ -25,7 +25,7 @@ module Decidim
|
|
25
25
|
cw_uploader: Decidim::Cw::DecidimAwesome::ImageUploader,
|
26
26
|
as_attribute: "file",
|
27
27
|
logger: @logger,
|
28
|
-
routes_mappings:
|
28
|
+
routes_mappings:
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
@@ -34,11 +34,11 @@ module Decidim
|
|
34
34
|
klass, id = mapping[:instance].split("#")
|
35
35
|
next unless klass == "Decidim::DecidimAwesome::EditorImage"
|
36
36
|
|
37
|
-
instance = Decidim::DecidimAwesome::EditorImage.find_by(id:
|
37
|
+
instance = Decidim::DecidimAwesome::EditorImage.find_by(id:)
|
38
38
|
|
39
39
|
next if instance.blank?
|
40
40
|
|
41
|
-
mapping.merge!(instance:
|
41
|
+
mapping.merge!(instance:)
|
42
42
|
end.compact
|
43
43
|
|
44
44
|
editor_images_available_attributes.each do |model, attributes|
|
@@ -75,7 +75,8 @@ module Decidim
|
|
75
75
|
"Decidim::Assembly" => %w(short_description description purpose_of_action composition internal_organisation announcement closing_date_reason special_features),
|
76
76
|
"Decidim::Forms::Questionnaire" => %w(description tos),
|
77
77
|
"Decidim::Forms::Question" => %w(description),
|
78
|
-
"Decidim::Organization" => %w(welcome_notification_body
|
78
|
+
"Decidim::Organization" => %w(welcome_notification_body admin_terms_of_service_body description highlighted_content_banner_short_description
|
79
|
+
id_documents_explanation_text),
|
79
80
|
"Decidim::StaticPage" => %w(content),
|
80
81
|
"Decidim::ContextualHelpSection" => %w(content),
|
81
82
|
"Decidim::Category" => %w(description),
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# rubocop:disable Style/OpenStructUse
|
4
3
|
module Decidim
|
5
4
|
module DecidimAwesome
|
6
5
|
# A middleware that stores the current awesome context by parsing the request
|
@@ -101,7 +100,7 @@ module Decidim
|
|
101
100
|
end
|
102
101
|
|
103
102
|
def safe_get_route?
|
104
|
-
return unless @request.get?
|
103
|
+
return false unless @request.get?
|
105
104
|
|
106
105
|
case @request.path
|
107
106
|
when "/"
|
@@ -116,7 +115,7 @@ module Decidim
|
|
116
115
|
end
|
117
116
|
|
118
117
|
def safe_post_route?
|
119
|
-
return unless @request.post? || @request.put? || @request.patch?
|
118
|
+
return false unless @request.post? || @request.put? || @request.patch?
|
120
119
|
|
121
120
|
case @request.path
|
122
121
|
when %r{^/admin/admin_terms}
|
@@ -171,7 +170,7 @@ module Decidim
|
|
171
170
|
next unless model
|
172
171
|
|
173
172
|
settings["participatory_space_slug"] = model.find_by(slug: settings["participatory_space_slug"])&.id
|
174
|
-
OpenStruct.new(settings:
|
173
|
+
OpenStruct.new(settings:) if settings["participatory_space_slug"]
|
175
174
|
end
|
176
175
|
end
|
177
176
|
# rubocop:enable Metrics/CyclomaticComplexity
|
@@ -183,4 +182,3 @@ module Decidim
|
|
183
182
|
end
|
184
183
|
end
|
185
184
|
end
|
186
|
-
# rubocop:enable Style/OpenStructUse
|
@@ -70,7 +70,7 @@ module Decidim
|
|
70
70
|
def self.all_vote_weights_for(component)
|
71
71
|
Decidim::DecidimAwesome::VoteWeight.where(
|
72
72
|
proposal_vote_id: Decidim::Proposals::ProposalVote.where(
|
73
|
-
proposal: Decidim::Proposals::Proposal.where(component:
|
73
|
+
proposal: Decidim::Proposals::Proposal.where(component:)
|
74
74
|
)
|
75
75
|
).pluck(:weight)
|
76
76
|
end
|