decidim-core 0.28.0 → 0.28.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +2 -2
- data/app/cells/decidim/address/online.erb +27 -9
- data/app/cells/decidim/address/show.erb +27 -12
- data/app/cells/decidim/address_cell.rb +29 -0
- data/app/cells/decidim/announcement/show.erb +2 -2
- data/app/cells/decidim/author/show.erb +5 -5
- data/app/cells/decidim/authorization_modal/show.erb +8 -4
- data/app/cells/decidim/authorization_modal_cell.rb +1 -0
- data/app/cells/decidim/card/show.erb +1 -1
- data/app/cells/decidim/card_metadata/show.erb +2 -2
- data/app/cells/decidim/card_metadata_cell.rb +3 -3
- data/app/cells/decidim/coauthorships_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +6 -0
- data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +20 -4
- data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +8 -0
- data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb +13 -0
- data/app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb +1 -1
- data/app/cells/decidim/data_consent/category.erb +1 -1
- data/app/cells/decidim/footer_pages_cell.rb +3 -3
- data/app/cells/decidim/nav_links/show.erb +2 -2
- data/app/cells/decidim/notification/moderated.erb +12 -0
- data/app/cells/decidim/notification_cell.rb +5 -1
- data/app/cells/decidim/profile/details.erb +1 -1
- data/app/cells/decidim/profile/tabs.erb +3 -2
- data/app/cells/decidim/progress_bar/show.erb +1 -1
- data/app/cells/decidim/progress_bar_cell.rb +2 -0
- data/app/cells/decidim/report_button/flag_modal.erb +5 -1
- data/app/cells/decidim/resource_types_filter/show.erb +3 -3
- data/app/cells/decidim/statistic/show.erb +2 -2
- data/app/cells/decidim/tags_cell.rb +3 -1
- data/app/cells/decidim/upload_modal/modal.erb +1 -2
- data/app/commands/decidim/create_omniauth_registration.rb +1 -3
- data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
- data/app/commands/decidim/messaging/start_conversation.rb +3 -0
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
- data/app/controllers/concerns/decidim/paginable.rb +1 -1
- data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
- data/app/controllers/decidim/gamification/badges_controller.rb +2 -0
- data/app/controllers/decidim/links_controller.rb +15 -2
- data/app/events/decidim/welcome_notification_event.rb +6 -9
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +2 -2
- data/app/helpers/decidim/application_helper.rb +0 -18
- data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +7 -8
- data/app/helpers/decidim/layout_helper.rb +1 -1
- data/app/helpers/decidim/map_helper.rb +1 -1
- data/app/helpers/decidim/menu_helper.rb +2 -0
- data/app/helpers/decidim/newsletters_helper.rb +83 -16
- data/app/helpers/decidim/paginate_helper.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +9 -0
- data/app/helpers/decidim/social_share_button_helper.rb +1 -1
- data/app/helpers/decidim/user_profile_helper.rb +7 -2
- data/app/mailers/decidim/application_mailer.rb +40 -6
- data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
- data/app/models/decidim/push_notification_message.rb +38 -0
- data/app/packs/entrypoints/decidim_overrides.scss +2 -0
- data/app/packs/images/decidim/.keep +0 -0
- data/app/packs/src/decidim/a11y.js +15 -1
- data/app/packs/src/decidim/abide_form_validator_fixer.js +44 -0
- data/app/packs/src/decidim/account_form.js +1 -1
- data/app/packs/src/decidim/data_consent/consent_manager.test.js +1 -1
- data/app/packs/src/decidim/data_consent/index.js +1 -1
- data/app/packs/src/decidim/direct_uploads/upload_field.js +1 -1
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +5 -5
- data/app/packs/src/decidim/editor/extensions/hashtag/index.js +1 -1
- data/app/packs/src/decidim/editor/extensions/mention/index.js +1 -1
- data/app/packs/src/decidim/editor/extensions/video_embed/index.js +3 -0
- data/app/packs/src/decidim/editor/test/editor/create.test.js +1 -1
- data/app/packs/src/decidim/editor/test/extensions/bold.test.js +2 -3
- data/app/packs/src/decidim/editor/test/extensions/character_count.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +2 -3
- data/app/packs/src/decidim/editor/test/extensions/dialog.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/emoji.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/hashtag.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/heading.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/image.test.js +4 -4
- data/app/packs/src/decidim/editor/test/extensions/indent.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/link.test.js +3 -3
- data/app/packs/src/decidim/editor/test/extensions/mention.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/ordered_list.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +3 -3
- data/app/packs/src/decidim/editor/test/helpers.js +5 -4
- data/app/packs/src/decidim/editor/test/toolbar/basic.test.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/content.test.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/full.test.js +3 -3
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic.js +6 -6
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +1 -1
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content.js +7 -7
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/context.js +1 -1
- data/app/packs/src/decidim/editor/test/utilities/paste_transform.test.js +2 -2
- data/app/packs/src/decidim/external_domain_warning.js +13 -0
- data/app/packs/src/decidim/external_domain_warning.test.js +1 -1
- data/app/packs/src/decidim/external_link.js +48 -9
- data/app/packs/src/decidim/external_link.test.js +1 -1
- data/app/packs/src/decidim/focus_guard.js +8 -20
- data/app/packs/src/decidim/form_filter.component_for_testing.js +1 -1
- data/app/packs/src/decidim/form_filter.js +3 -3
- data/app/packs/src/decidim/geocoding/attach_input.js +1 -1
- data/app/packs/src/decidim/i18n.test.js +1 -1
- data/app/packs/src/decidim/index.js +33 -2
- data/app/packs/src/decidim/input_hashtags.js +1 -1
- data/app/packs/src/decidim/input_mentions.js +1 -1
- data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
- data/app/packs/src/decidim/sw/index.js +3 -3
- data/app/packs/src/decidim/user_registrations.js +1 -1
- data/app/packs/src/decidim/vizzs/index.js +1 -1
- data/app/packs/stylesheets/decidim/_accordion.scss +2 -2
- data/app/packs/stylesheets/decidim/_cards.scss +4 -4
- data/app/packs/stylesheets/decidim/_dropdown.scss +2 -2
- data/app/packs/stylesheets/decidim/_layout.scss +7 -7
- data/app/packs/stylesheets/decidim/_modal_update.scss +1 -3
- data/app/packs/stylesheets/decidim/application.scss +0 -3
- data/app/packs/stylesheets/decidim/decidim_application.scss +4 -0
- data/app/packs/stylesheets/decidim/legacy/leaflet.scss +88 -107
- data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
- data/app/presenters/decidim/log/diff_presenter.rb +1 -1
- data/app/presenters/decidim/log/resource_presenter.rb +7 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
- data/app/services/decidim/events_manager.rb +6 -0
- data/app/services/decidim/iframe_disabler.rb +4 -0
- data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
- data/app/services/decidim/push_notification_message_sender.rb +40 -0
- data/app/services/decidim/send_push_notification.rb +22 -8
- data/app/uploaders/decidim/background_image_uploader.rb +11 -0
- data/app/views/decidim/account/show.html.erb +2 -2
- data/app/views/decidim/application/_collection.html.erb +2 -2
- data/app/views/decidim/application/_document.html.erb +3 -3
- data/app/views/decidim/devise/registrations/new.html.erb +2 -2
- data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +2 -1
- data/app/views/decidim/gamification/badges/index.html.erb +34 -33
- data/app/views/decidim/links/_modal.html.erb +1 -1
- data/app/views/decidim/links/new.html.erb +3 -1
- data/app/views/decidim/manifests/show.json.erb +1 -1
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
- data/app/views/decidim/notifications_settings/show.html.erb +6 -6
- data/app/views/decidim/offline/show.html.erb +15 -9
- data/app/views/decidim/pages/_tabbed.html.erb +2 -2
- data/app/views/decidim/searches/_filters.html.erb +2 -2
- data/app/views/decidim/shared/_filters.html.erb +2 -2
- data/app/views/decidim/shared/_orders.html.erb +2 -2
- data/app/views/decidim/shared/filters/_collection.html.erb +5 -3
- data/app/views/decidim/shared/filters/_dropdown_label.html.erb +21 -19
- data/app/views/layouts/decidim/_head.html.erb +1 -0
- data/app/views/layouts/decidim/_js_configuration.html.erb +3 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
- data/app/views/layouts/decidim/footer/_main_links.html.erb +3 -1
- data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +5 -5
- data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
- data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +4 -2
- data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
- data/config/assets.rb +1 -0
- data/config/locales/ar.yml +60 -8
- data/config/locales/bg.yml +909 -2
- data/config/locales/ca.yml +31 -24
- data/config/locales/cs.yml +7 -3
- data/config/locales/de.yml +37 -30
- data/config/locales/el.yml +11 -7
- data/config/locales/en.yml +10 -3
- data/config/locales/es-MX.yml +17 -10
- data/config/locales/es-PY.yml +17 -10
- data/config/locales/es.yml +59 -52
- data/config/locales/eu.yml +26 -10
- data/config/locales/fi-plain.yml +11 -4
- data/config/locales/fi.yml +14 -7
- data/config/locales/fr-CA.yml +14 -7
- data/config/locales/fr.yml +14 -7
- data/config/locales/ga-IE.yml +9 -0
- data/config/locales/gl.yml +5 -2
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +264 -8
- data/config/locales/id-ID.yml +0 -2
- data/config/locales/it.yml +9 -6
- data/config/locales/ja.yml +14 -7
- data/config/locales/kaa.yml +5 -0
- data/config/locales/lb.yml +9 -6
- data/config/locales/lt.yml +8 -12
- data/config/locales/lv.yml +8 -3
- data/config/locales/nl.yml +8 -3
- data/config/locales/no.yml +9 -6
- data/config/locales/pl.yml +616 -2
- data/config/locales/pt-BR.yml +202 -19
- data/config/locales/pt.yml +9 -6
- data/config/locales/ro-RO.yml +10 -5
- data/config/locales/ru.yml +15 -2
- data/config/locales/sk.yml +8 -3
- data/config/locales/sl.yml +8 -0
- data/config/locales/sv.yml +32 -6
- data/config/locales/tr-TR.yml +24 -9
- data/config/locales/uk.yml +22 -2
- data/config/locales/zh-CN.yml +0 -6
- data/config/locales/zh-TW.yml +10 -11
- data/decidim-core.gemspec +90 -0
- data/lib/decidim/asset_router/storage.rb +2 -0
- data/lib/decidim/attribute_encryptor.rb +6 -4
- data/lib/decidim/attributes/time_with_zone.rb +1 -1
- data/lib/decidim/core/engine.rb +7 -6
- data/lib/decidim/core/seeds.rb +37 -33
- data/lib/decidim/core/test/factories.rb +296 -89
- data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +76 -6
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +8 -8
- data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
- data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
- data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/logo_email.rb +2 -2
- data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -0
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +5 -2
- data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
- data/lib/decidim/core/test/shared_examples/simple_event.rb +18 -2
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +7 -1
- data/lib/decidim/engine_router.rb +17 -4
- data/lib/decidim/events/base_event.rb +7 -3
- data/lib/decidim/events/simple_event.rb +3 -17
- data/lib/decidim/form_builder.rb +8 -2
- data/lib/decidim/has_category.rb +1 -1
- data/lib/decidim/has_conversations.rb +91 -0
- data/lib/decidim/organization_settings.rb +10 -2
- data/lib/decidim/participable.rb +17 -0
- data/lib/decidim/upgrade/wysiwyg_migrator.rb +7 -0
- data/lib/decidim/view_model.rb +1 -0
- data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
- data/lib/premailer/adapter/decidim.rb +5 -4
- data/lib/tasks/decidim_reminders_tasks.rake +1 -0
- data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
- metadata +26 -27
- data/app/views/decidim/searches/index.js.erb +0 -7
- data/config/brakeman.ignore +0 -37
- data/config/environment.rb +0 -3
@@ -5,74 +5,12 @@ module Decidim
|
|
5
5
|
# A custom mailer for sending notifications to users when they receive
|
6
6
|
# private messages
|
7
7
|
class ConversationMailer < Decidim::ApplicationMailer
|
8
|
-
|
9
|
-
notification_mail(
|
10
|
-
from: originator,
|
11
|
-
to: user,
|
12
|
-
conversation:,
|
13
|
-
message: conversation.messages.first.body,
|
14
|
-
action: "new_conversation"
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def new_group_conversation(originator, manager, conversation, group)
|
19
|
-
notification_mail(
|
20
|
-
from: originator,
|
21
|
-
to: manager,
|
22
|
-
conversation:,
|
23
|
-
message: conversation.messages.first.body,
|
24
|
-
action: "new_group_conversation",
|
25
|
-
third_party: group
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
def comanagers_new_conversation(group, user, conversation, manager)
|
30
|
-
notification_mail(
|
31
|
-
from: group,
|
32
|
-
to: user,
|
33
|
-
conversation:,
|
34
|
-
message: conversation.messages.first.body,
|
35
|
-
action: "comanagers_new_conversation",
|
36
|
-
third_party: manager
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
def new_message(sender, user, conversation, message)
|
41
|
-
notification_mail(
|
42
|
-
from: sender,
|
43
|
-
to: user,
|
44
|
-
conversation:,
|
45
|
-
message: message.body,
|
46
|
-
action: "new_message"
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
def new_group_message(sender, user, conversation, message, group)
|
51
|
-
notification_mail(
|
52
|
-
from: sender,
|
53
|
-
to: user,
|
54
|
-
conversation:,
|
55
|
-
message: message.body,
|
56
|
-
action: "new_group_message",
|
57
|
-
third_party: group
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
def comanagers_new_message(sender, user, conversation, message, manager)
|
62
|
-
notification_mail(
|
63
|
-
from: sender,
|
64
|
-
to: user,
|
65
|
-
conversation:,
|
66
|
-
message: message.body,
|
67
|
-
action: "comanagers_new_message",
|
68
|
-
third_party: manager
|
69
|
-
)
|
70
|
-
end
|
8
|
+
include HasConversations
|
71
9
|
|
72
10
|
private
|
73
11
|
|
74
12
|
# rubocop:disable Metrics/ParameterLists
|
75
|
-
def
|
13
|
+
def send_notification(from:, to:, conversation:, action:, message: nil, third_party: nil)
|
76
14
|
with_user(to) do
|
77
15
|
@organization = to.organization
|
78
16
|
@conversation = conversation
|
@@ -81,14 +19,7 @@ module Decidim
|
|
81
19
|
@third_party = third_party
|
82
20
|
@message = message
|
83
21
|
@host = @organization.host
|
84
|
-
|
85
|
-
subject = I18n.t(
|
86
|
-
"conversation_mailer.#{action}.subject",
|
87
|
-
scope: "decidim.messaging",
|
88
|
-
sender: @sender.name,
|
89
|
-
manager: @third_party&.name,
|
90
|
-
group: @third_party&.name
|
91
|
-
)
|
22
|
+
subject = get_subject(action:, sender: @sender, third_party: @third_party)
|
92
23
|
|
93
24
|
mail(to: to.email, subject:)
|
94
25
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A messsage from a conversation that will be sent as a push notification
|
5
|
+
class PushNotificationMessage
|
6
|
+
class InvalidActionError < StandardError; end
|
7
|
+
|
8
|
+
include SanitizeHelper
|
9
|
+
|
10
|
+
def initialize(recipient:, conversation:, message:)
|
11
|
+
@recipient = recipient
|
12
|
+
@conversation = conversation
|
13
|
+
@message = message
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :recipient, :conversation, :message
|
17
|
+
|
18
|
+
alias user recipient
|
19
|
+
|
20
|
+
def body
|
21
|
+
decidim_escape_translated(message)
|
22
|
+
end
|
23
|
+
|
24
|
+
def icon
|
25
|
+
organization.attached_uploader(:favicon).variant_url(:big, host: organization.host)
|
26
|
+
end
|
27
|
+
|
28
|
+
def url
|
29
|
+
EngineRouter.new("decidim", {}).public_send(:conversation_path, host: organization.host, id: @conversation)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def organization
|
35
|
+
@organization ||= recipient.organization
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
File without changes
|
@@ -104,6 +104,20 @@ const createDropdown = (component) => {
|
|
104
104
|
});
|
105
105
|
}
|
106
106
|
|
107
|
+
// Disable focus on children elements so we can pass the AXE accessibility tests
|
108
|
+
const dropdownMenu = document.getElementById(dropdownOptions.dropdown);
|
109
|
+
if (dropdownMenu.getAttribute("aria-hidden") === "true") {
|
110
|
+
dropdownMenu.
|
111
|
+
querySelectorAll("a, input, button").
|
112
|
+
forEach((element) => { element.tabIndex = -1 })
|
113
|
+
}
|
114
|
+
|
115
|
+
component.addEventListener("click", () => {
|
116
|
+
dropdownMenu.
|
117
|
+
querySelectorAll("a, input, button").
|
118
|
+
forEach((element) => { element.tabIndex = 0 })
|
119
|
+
})
|
120
|
+
|
107
121
|
Dropdowns.render(component.id, dropdownOptions);
|
108
122
|
}
|
109
123
|
|
@@ -136,7 +150,7 @@ const createDialog = (component) => {
|
|
136
150
|
enableAutoFocus: false,
|
137
151
|
onOpen: (params, trigger) => {
|
138
152
|
setFocusOnTitle(params);
|
139
|
-
window.focusGuard.trap(trigger);
|
153
|
+
window.focusGuard.trap(params, trigger);
|
140
154
|
params.dispatchEvent(new CustomEvent("open.dialog"));
|
141
155
|
},
|
142
156
|
onClose: (params) => {
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/**
|
2
|
+
* This script modifies the behavior of Abide form validation to address the issue of form validation errors
|
3
|
+
* appearing prematurely in input fields.
|
4
|
+
*
|
5
|
+
* The primary goal is to hide error messages until the input field loses focus.
|
6
|
+
*/
|
7
|
+
|
8
|
+
class AbideFormValidatorFixer {
|
9
|
+
initialize() {
|
10
|
+
const forms = document.querySelectorAll("main [data-live-validate='true']");
|
11
|
+
|
12
|
+
forms.forEach((form) => {
|
13
|
+
if (this.isElementVisible(form)) {
|
14
|
+
this.setupForm(form);
|
15
|
+
}
|
16
|
+
});
|
17
|
+
}
|
18
|
+
|
19
|
+
isElementVisible(element) {
|
20
|
+
return element.offsetParent !== null && getComputedStyle(element).display !== "none";
|
21
|
+
}
|
22
|
+
|
23
|
+
setupForm(form) {
|
24
|
+
const inputs = form.querySelectorAll("input");
|
25
|
+
|
26
|
+
inputs.forEach((input) => {
|
27
|
+
const errorElement = input.closest("label")?.querySelector(".form-error") || input.parentElement.querySelector(".form-error");
|
28
|
+
if (!errorElement) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
form.removeAttribute("data-live-validate");
|
32
|
+
input.addEventListener("input", this.hideErrorElement.bind(this, errorElement));
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
hideErrorElement(errorElement) {
|
37
|
+
errorElement.classList.remove("is-visible");
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
document.addEventListener("DOMContentLoaded", () => {
|
42
|
+
const validatorFixer = new AbideFormValidatorFixer();
|
43
|
+
validatorFixer.initialize();
|
44
|
+
});
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* global global, jest */
|
2
2
|
|
3
3
|
import Cookies from "js-cookie";
|
4
|
-
import ConsentManager from "
|
4
|
+
import ConsentManager from "src/decidim/data_consent/consent_manager";
|
5
5
|
|
6
6
|
// Mock js-cookie so that we can store the return values from the "set" method
|
7
7
|
// in order to inspect their flags.
|
@@ -66,7 +66,7 @@ const updateActiveUploads = (modal) => {
|
|
66
66
|
|
67
67
|
const template = `
|
68
68
|
<div ${attachmentIdOrHiddenField} data-filename="${escapeQuotes(file.name)}" data-title="${escapeQuotes(title)}">
|
69
|
-
${(/image/).test(file.type) && `<div><img src="" alt="${escapeQuotes(file.name)}" /></div>` || ""}
|
69
|
+
${(/image/).test(file.type) && `<div><img src="data:," alt="${escapeQuotes(file.name)}" /></div>` || ""}
|
70
70
|
<span>${escapeHtml(title)} (${escapeHtml(truncateFilename(file.name))})</span>
|
71
71
|
${hidden}
|
72
72
|
</div>
|
@@ -122,8 +122,8 @@ export default class UploadModal {
|
|
122
122
|
if (src) {
|
123
123
|
buffer = await fetch(src).then((res) => res.arrayBuffer())
|
124
124
|
// since we cannot know the exact mime-type of the file,
|
125
|
-
// we assume as "image" if it has the src attribute in order to load the preview
|
126
|
-
type = "image"
|
125
|
+
// we assume as "image/*" if it has the src attribute in order to load the preview
|
126
|
+
type = "image/*"
|
127
127
|
}
|
128
128
|
|
129
129
|
const file = new File([buffer], element.dataset.filename, { type })
|
@@ -162,13 +162,13 @@ export default class UploadModal {
|
|
162
162
|
this.emptyItems.querySelector("label").removeAttribute("disabled");
|
163
163
|
} else {
|
164
164
|
this.emptyItems.classList.add("is-disabled");
|
165
|
-
this.emptyItems.querySelector("label").
|
165
|
+
this.emptyItems.querySelector("label").disabled = true;
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
169
|
createUploadItem(file, errors, opts = {}) {
|
170
170
|
const okTemplate = `
|
171
|
-
<img src="" alt="${escapeQuotes(file.name)}" />
|
171
|
+
<img src="data:," alt="${escapeQuotes(file.name)}" />
|
172
172
|
<span>${escapeHtml(truncateFilename(file.name))}</span>
|
173
173
|
`
|
174
174
|
|
@@ -182,7 +182,7 @@ export default class UploadModal {
|
|
182
182
|
`
|
183
183
|
|
184
184
|
const titleTemplate = `
|
185
|
-
<img src="" alt="${escapeQuotes(file.name)}" />
|
185
|
+
<img src="data:," alt="${escapeQuotes(file.name)}" />
|
186
186
|
<div>
|
187
187
|
<div>
|
188
188
|
<label>${this.locales.filename}</label>
|
@@ -6,7 +6,7 @@ import { createSuggestionRenderer, createNodeView } from "src/decidim/editor/com
|
|
6
6
|
export const HashtagPluginKey = new PluginKey("hashtag");
|
7
7
|
|
8
8
|
const searchHashtags = async (queryText) => {
|
9
|
-
return fetch("
|
9
|
+
return fetch(window.Decidim.config.get("api_path"), {
|
10
10
|
method: "POST",
|
11
11
|
cache: "no-cache",
|
12
12
|
headers: { "Content-Type": "application/json" },
|
@@ -165,6 +165,9 @@ export default Node.create({
|
|
165
165
|
|
166
166
|
src = videoDialog.getValue("src");
|
167
167
|
title = videoDialog.getValue("title");
|
168
|
+
if (title && title.trim().length < 1) {
|
169
|
+
title = null;
|
170
|
+
}
|
168
171
|
if (!src || src.length < 1) {
|
169
172
|
this.editor.commands.focus(null, { scrollIntoView: false });
|
170
173
|
return false;
|
@@ -6,10 +6,9 @@ import OrderedList from "@tiptap/extension-ordered-list";
|
|
6
6
|
import ListItem from "@tiptap/extension-list-item";
|
7
7
|
import Text from "@tiptap/extension-text";
|
8
8
|
|
9
|
-
import Bold from "
|
10
|
-
// import OrderedList from "../../extensions/ordered_list";
|
9
|
+
import Bold from "src/decidim/editor/extensions/bold";
|
11
10
|
|
12
|
-
import { updateContent } from "
|
11
|
+
import { updateContent } from "src/decidim/editor/test/helpers";
|
13
12
|
|
14
13
|
const createBasicEditor = () => {
|
15
14
|
const element = document.createElement("div");
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { createBasicEditor, updateContent } from "
|
1
|
+
import { createBasicEditor, updateContent } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import CharacterCount from "
|
3
|
+
import CharacterCount from "src/decidim/editor/extensions/character_count";
|
4
4
|
|
5
5
|
describe("CharacterCount", () => {
|
6
6
|
let editor = null;
|
@@ -1,11 +1,10 @@
|
|
1
1
|
/* global jest */
|
2
2
|
|
3
|
-
// import { createBasicEditor } from "../helpers";
|
4
3
|
import { Editor } from "@tiptap/core";
|
5
4
|
|
6
|
-
import DecidimKit from "
|
5
|
+
import DecidimKit from "src/decidim/editor/extensions/decidim_kit";
|
7
6
|
|
8
|
-
import { createEditorContainer } from "
|
7
|
+
import { createEditorContainer } from "src/decidim/editor/test/helpers";
|
9
8
|
|
10
9
|
// Mock picmo as it is distributed as an ES6 module that is not fully compatible
|
11
10
|
// with Jest without configuration changes.
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { createBasicEditor } from "
|
1
|
+
import { createBasicEditor } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import Dialog from "
|
3
|
+
import Dialog from "src/decidim/editor/extensions/dialog";
|
4
4
|
|
5
5
|
describe("Dialog", () => {
|
6
6
|
let editor = null;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* eslint-disable no-undef */
|
2
2
|
|
3
|
-
import { createBasicEditor, sleep } from "
|
3
|
+
import { createBasicEditor, sleep } from "src/decidim/editor/test/helpers";
|
4
4
|
|
5
|
-
import Emoji from "
|
5
|
+
import Emoji from "src/decidim/editor/extensions/emoji";
|
6
6
|
|
7
7
|
Reflect.defineProperty(window, "matchMedia", {
|
8
8
|
writable: true,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* global jest, global */
|
2
2
|
|
3
|
-
import { createBasicEditor, updateContent } from "
|
3
|
+
import { createBasicEditor, updateContent } from "src/decidim/editor/test/helpers";
|
4
4
|
|
5
|
-
import Hashtag from "
|
5
|
+
import Hashtag from "src/decidim/editor/extensions/hashtag";
|
6
6
|
|
7
7
|
const hashtagsResponse = [
|
8
8
|
{ name: "apples" },
|
@@ -6,9 +6,9 @@ import OrderedList from "@tiptap/extension-ordered-list";
|
|
6
6
|
import ListItem from "@tiptap/extension-list-item";
|
7
7
|
import Text from "@tiptap/extension-text";
|
8
8
|
|
9
|
-
import { updateContent } from "
|
9
|
+
import { updateContent } from "src/decidim/editor/test/helpers";
|
10
10
|
|
11
|
-
import Heading from "
|
11
|
+
import Heading from "src/decidim/editor/extensions/heading";
|
12
12
|
|
13
13
|
const createBasicEditor = () => {
|
14
14
|
const element = document.createElement("div");
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/* global jest, global */
|
2
2
|
|
3
|
-
import { createBasicEditor, updateContent, sleep, pasteFixtureFile, dropFixtureFile } from "
|
3
|
+
import { createBasicEditor, updateContent, sleep, pasteFixtureFile, dropFixtureFile } from "src/decidim/editor/test/helpers";
|
4
4
|
|
5
|
-
import Dialog from "
|
6
|
-
import Image from "
|
7
|
-
import uploadTemplates from "
|
5
|
+
import Dialog from "src/decidim/editor/extensions/dialog";
|
6
|
+
import Image from "src/decidim/editor/extensions/image";
|
7
|
+
import uploadTemplates from "src/decidim/editor/test/fixtures/upload_templates";
|
8
8
|
|
9
9
|
class DummyDialog {
|
10
10
|
constructor(element) { this.element = element; }
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { createBasicEditor, updateContent, selectRange } from "
|
1
|
+
import { createBasicEditor, updateContent, selectRange } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import Indent from "
|
3
|
+
import Indent from "src/decidim/editor/extensions/indent";
|
4
4
|
|
5
5
|
describe("Indent", () => {
|
6
6
|
let editor = null;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { createBasicEditor, updateContent, selectRange, sleep } from "
|
1
|
+
import { createBasicEditor, updateContent, selectRange, sleep } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import Dialog from "
|
4
|
-
import Link from "
|
3
|
+
import Dialog from "src/decidim/editor/extensions/dialog";
|
4
|
+
import Link from "src/decidim/editor/extensions/link";
|
5
5
|
|
6
6
|
describe("Link", () => {
|
7
7
|
let editor = null;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* global jest, global */
|
2
2
|
|
3
|
-
import { createBasicEditor, updateContent } from "
|
3
|
+
import { createBasicEditor, updateContent } from "src/decidim/editor/test/helpers";
|
4
4
|
|
5
|
-
import Mention from "
|
5
|
+
import Mention from "src/decidim/editor/extensions/mention";
|
6
6
|
|
7
7
|
const mentionsResponse = [
|
8
8
|
{
|
@@ -5,9 +5,9 @@ import BulletList from "@tiptap/extension-bullet-list";
|
|
5
5
|
import ListItem from "@tiptap/extension-list-item";
|
6
6
|
import Text from "@tiptap/extension-text";
|
7
7
|
|
8
|
-
import { updateContent, pasteContent } from "
|
8
|
+
import { updateContent, pasteContent } from "src/decidim/editor/test/helpers";
|
9
9
|
|
10
|
-
import OrderedList from "
|
10
|
+
import OrderedList from "src/decidim/editor/extensions/ordered_list";
|
11
11
|
|
12
12
|
const createBasicEditor = () => {
|
13
13
|
const element = document.createElement("div");
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/* global jest */
|
2
2
|
|
3
|
-
import { createBasicEditor, updateContent, sleep, pasteContent } from "
|
3
|
+
import { createBasicEditor, updateContent, sleep, pasteContent } from "src/decidim/editor/test/helpers";
|
4
4
|
|
5
|
-
import Dialog from "
|
6
|
-
import VideoEmbed from "
|
5
|
+
import Dialog from "src/decidim/editor/extensions/dialog";
|
6
|
+
import VideoEmbed from "src/decidim/editor/extensions/video_embed";
|
7
7
|
|
8
8
|
describe("VideoEmbed", () => {
|
9
9
|
let editor = null;
|
@@ -21,12 +21,13 @@ import OrderedList from "@tiptap/extension-ordered-list";
|
|
21
21
|
import ListItem from "@tiptap/extension-list-item";
|
22
22
|
import Text from "@tiptap/extension-text";
|
23
23
|
|
24
|
-
import createEditor from "
|
24
|
+
import createEditor from "src/decidim/editor/index";
|
25
25
|
|
26
|
-
import editorMessages from "
|
27
|
-
import uploadTemplates from "
|
26
|
+
import editorMessages from "src/decidim/editor/test/fixtures/editor_messages";
|
27
|
+
import uploadTemplates from "src/decidim/editor/test/fixtures/upload_templates";
|
28
28
|
|
29
|
-
|
29
|
+
// eslint-disable-next-line camelcase
|
30
|
+
const config = { api_path: "/api", messages: { editor: editorMessages } };
|
30
31
|
window.Decidim = { config: { get: (key) => config[key] } };
|
31
32
|
window.ClipboardEvent = class ClipboardEvent extends Event {};
|
32
33
|
window.DragEvent = class DragEvent extends Event {};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { createEditorContainer } from "
|
2
|
-
import itBehavesLikeBasicToolbar from "
|
1
|
+
import { createEditorContainer } from "src/decidim/editor/test/helpers";
|
2
|
+
import itBehavesLikeBasicToolbar from "src/decidim/editor/test/toolbar/shared/behaves_like_basic";
|
3
3
|
|
4
4
|
describe("basic toolbar", () => {
|
5
5
|
const ctx = {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { createEditorContainer } from "
|
2
|
-
import itBehavesLikeContentToolbar from "
|
1
|
+
import { createEditorContainer } from "src/decidim/editor/test/helpers";
|
2
|
+
import itBehavesLikeContentToolbar from "src/decidim/editor/test/toolbar/shared/behaves_like_content";
|
3
3
|
|
4
4
|
describe("content toolbar", () => {
|
5
5
|
const ctx = {
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
import Dialog from "a11y-dialog-component";
|
4
4
|
|
5
|
-
import { createEditorContainer, sleep, updateContent, selectContent, dropFixtureFile } from "
|
6
|
-
import contextHelpers from "
|
7
|
-
import itBehavesLikeContentToolbar from "
|
5
|
+
import { createEditorContainer, sleep, updateContent, selectContent, dropFixtureFile } from "src/decidim/editor/test/helpers";
|
6
|
+
import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
|
7
|
+
import itBehavesLikeContentToolbar from "src/decidim/editor/test/toolbar/shared/behaves_like_content";
|
8
8
|
|
9
9
|
describe("full toolbar", () => {
|
10
10
|
const ctx = {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import itBehavesLikeBasicToolbarStyling from "
|
2
|
-
import itBehavesLikeBasicToolbarFormatting from "
|
3
|
-
import itBehavesLikeBasicToolbarList from "
|
4
|
-
import itBehavesLikeBasicToolbarBlock from "
|
5
|
-
import itBehavesLikeBasicToolbarLink from "
|
6
|
-
import itBehavesLikeBasicToolbarIndent from "
|
1
|
+
import itBehavesLikeBasicToolbarStyling from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling";
|
2
|
+
import itBehavesLikeBasicToolbarFormatting from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting";
|
3
|
+
import itBehavesLikeBasicToolbarList from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_list";
|
4
|
+
import itBehavesLikeBasicToolbarBlock from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_block";
|
5
|
+
import itBehavesLikeBasicToolbarLink from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_link";
|
6
|
+
import itBehavesLikeBasicToolbarIndent from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent";
|
7
7
|
|
8
8
|
export default (ctx) => {
|
9
9
|
ctx.prosemirror = null;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { selectContent } from "
|
1
|
+
import { selectContent } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import contextHelpers from "
|
3
|
+
import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
|
4
4
|
|
5
5
|
export default (ctx) => {
|
6
6
|
const { getControl, setContent } = contextHelpers(ctx);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { selectContent, selectRange } from "
|
1
|
+
import { selectContent, selectRange } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import contextHelpers from "
|
3
|
+
import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
|
4
4
|
|
5
5
|
export default (ctx) => {
|
6
6
|
const { getControl, setContent } = contextHelpers(ctx);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { sleep, selectRange } from "
|
1
|
+
import { sleep, selectRange } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import contextHelpers from "
|
3
|
+
import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
|
4
4
|
|
5
5
|
export default (ctx) => {
|
6
6
|
const { getControl, setContent } = contextHelpers(ctx);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { selectContent } from "
|
1
|
+
import { selectContent } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import contextHelpers from "
|
3
|
+
import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
|
4
4
|
|
5
5
|
export default (ctx) => {
|
6
6
|
const { getControl, setContent } = contextHelpers(ctx);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { selectContent } from "
|
1
|
+
import { selectContent } from "src/decidim/editor/test/helpers";
|
2
2
|
|
3
|
-
import contextHelpers from "
|
3
|
+
import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
|
4
4
|
|
5
5
|
export default (ctx) => {
|
6
6
|
const { getControl, setContent } = contextHelpers(ctx);
|