decidim-core 0.28.0 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/activity_cell.rb +2 -2
  3. data/app/cells/decidim/address/online.erb +27 -9
  4. data/app/cells/decidim/address/show.erb +27 -12
  5. data/app/cells/decidim/address_cell.rb +29 -0
  6. data/app/cells/decidim/authorization_modal/show.erb +8 -4
  7. data/app/cells/decidim/authorization_modal_cell.rb +1 -0
  8. data/app/cells/decidim/card_metadata_cell.rb +3 -3
  9. data/app/cells/decidim/coauthorships_cell.rb +1 -1
  10. data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +6 -0
  11. data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +20 -4
  12. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +8 -0
  13. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb +13 -0
  14. data/app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb +1 -1
  15. data/app/cells/decidim/footer_pages_cell.rb +3 -3
  16. data/app/cells/decidim/profile/tabs.erb +3 -2
  17. data/app/cells/decidim/tags_cell.rb +3 -1
  18. data/app/cells/decidim/upload_modal/modal.erb +2 -2
  19. data/app/commands/decidim/create_omniauth_registration.rb +1 -3
  20. data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
  21. data/app/commands/decidim/messaging/start_conversation.rb +3 -0
  22. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
  23. data/app/controllers/concerns/decidim/paginable.rb +1 -1
  24. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
  25. data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
  26. data/app/events/decidim/welcome_notification_event.rb +6 -9
  27. data/app/helpers/decidim/application_helper.rb +0 -18
  28. data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
  29. data/app/helpers/decidim/check_boxes_tree_helper.rb +6 -6
  30. data/app/helpers/decidim/layout_helper.rb +1 -1
  31. data/app/helpers/decidim/map_helper.rb +1 -1
  32. data/app/helpers/decidim/menu_helper.rb +2 -0
  33. data/app/helpers/decidim/newsletters_helper.rb +83 -16
  34. data/app/helpers/decidim/paginate_helper.rb +1 -1
  35. data/app/helpers/decidim/sanitize_helper.rb +9 -0
  36. data/app/helpers/decidim/social_share_button_helper.rb +1 -1
  37. data/app/helpers/decidim/user_profile_helper.rb +7 -2
  38. data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
  39. data/app/models/decidim/push_notification_message.rb +38 -0
  40. data/app/packs/entrypoints/decidim_overrides.scss +2 -0
  41. data/app/packs/images/decidim/.keep +0 -0
  42. data/app/packs/src/decidim/a11y.js +1 -1
  43. data/app/packs/src/decidim/account_form.js +1 -1
  44. data/app/packs/src/decidim/data_consent/consent_manager.test.js +1 -1
  45. data/app/packs/src/decidim/data_consent/index.js +1 -1
  46. data/app/packs/src/decidim/direct_uploads/upload_field.js +1 -1
  47. data/app/packs/src/decidim/direct_uploads/upload_modal.js +10 -6
  48. data/app/packs/src/decidim/editor/extensions/hashtag/index.js +1 -1
  49. data/app/packs/src/decidim/editor/extensions/mention/index.js +1 -1
  50. data/app/packs/src/decidim/editor/extensions/video_embed/index.js +3 -0
  51. data/app/packs/src/decidim/editor/test/editor/create.test.js +1 -1
  52. data/app/packs/src/decidim/editor/test/extensions/bold.test.js +2 -3
  53. data/app/packs/src/decidim/editor/test/extensions/character_count.test.js +2 -2
  54. data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +2 -3
  55. data/app/packs/src/decidim/editor/test/extensions/dialog.test.js +2 -2
  56. data/app/packs/src/decidim/editor/test/extensions/emoji.test.js +2 -2
  57. data/app/packs/src/decidim/editor/test/extensions/hashtag.test.js +2 -2
  58. data/app/packs/src/decidim/editor/test/extensions/heading.test.js +2 -2
  59. data/app/packs/src/decidim/editor/test/extensions/image.test.js +4 -4
  60. data/app/packs/src/decidim/editor/test/extensions/indent.test.js +2 -2
  61. data/app/packs/src/decidim/editor/test/extensions/link.test.js +3 -3
  62. data/app/packs/src/decidim/editor/test/extensions/mention.test.js +2 -2
  63. data/app/packs/src/decidim/editor/test/extensions/ordered_list.test.js +2 -2
  64. data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +3 -3
  65. data/app/packs/src/decidim/editor/test/helpers.js +5 -4
  66. data/app/packs/src/decidim/editor/test/toolbar/basic.test.js +2 -2
  67. data/app/packs/src/decidim/editor/test/toolbar/content.test.js +2 -2
  68. data/app/packs/src/decidim/editor/test/toolbar/full.test.js +3 -3
  69. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic.js +6 -6
  70. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +2 -2
  71. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +1 -1
  72. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +2 -2
  73. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +2 -2
  74. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +2 -2
  75. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +2 -2
  76. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content.js +7 -7
  77. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +2 -2
  78. data/app/packs/src/decidim/editor/test/toolbar/shared/context.js +1 -1
  79. data/app/packs/src/decidim/editor/test/utilities/paste_transform.test.js +2 -2
  80. data/app/packs/src/decidim/external_domain_warning.js +13 -0
  81. data/app/packs/src/decidim/external_domain_warning.test.js +1 -1
  82. data/app/packs/src/decidim/external_link.js +48 -9
  83. data/app/packs/src/decidim/external_link.test.js +1 -1
  84. data/app/packs/src/decidim/focus_guard.js +8 -20
  85. data/app/packs/src/decidim/form_filter.component_for_testing.js +1 -1
  86. data/app/packs/src/decidim/form_filter.js +3 -3
  87. data/app/packs/src/decidim/geocoding/attach_input.js +1 -1
  88. data/app/packs/src/decidim/i18n.test.js +1 -1
  89. data/app/packs/src/decidim/index.js +4 -1
  90. data/app/packs/src/decidim/input_hashtags.js +1 -1
  91. data/app/packs/src/decidim/input_mentions.js +1 -1
  92. data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
  93. data/app/packs/src/decidim/sw/index.js +3 -3
  94. data/app/packs/src/decidim/user_registrations.js +1 -1
  95. data/app/packs/src/decidim/vizzs/index.js +1 -1
  96. data/app/packs/stylesheets/decidim/_cards.scss +2 -2
  97. data/app/packs/stylesheets/decidim/_dropdown.scss +2 -2
  98. data/app/packs/stylesheets/decidim/_layout.scss +4 -4
  99. data/app/packs/stylesheets/decidim/application.scss +0 -3
  100. data/app/packs/stylesheets/decidim/decidim_application.scss +4 -0
  101. data/app/packs/stylesheets/decidim/legacy/leaflet.scss +88 -107
  102. data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
  103. data/app/presenters/decidim/log/diff_presenter.rb +1 -1
  104. data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
  105. data/app/services/decidim/events_manager.rb +6 -0
  106. data/app/services/decidim/iframe_disabler.rb +4 -0
  107. data/app/services/decidim/push_notification_message_sender.rb +40 -0
  108. data/app/services/decidim/send_push_notification.rb +22 -8
  109. data/app/uploaders/decidim/background_image_uploader.rb +11 -0
  110. data/app/views/decidim/application/_collection.html.erb +2 -2
  111. data/app/views/decidim/application/_document.html.erb +1 -1
  112. data/app/views/decidim/devise/registrations/new.html.erb +2 -2
  113. data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
  114. data/app/views/decidim/offline/show.html.erb +15 -9
  115. data/app/views/layouts/decidim/_head.html.erb +1 -0
  116. data/app/views/layouts/decidim/_js_configuration.html.erb +3 -1
  117. data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +5 -5
  118. data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
  119. data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
  120. data/config/assets.rb +1 -0
  121. data/config/locales/ar.yml +63 -7
  122. data/config/locales/bg.yml +32 -2
  123. data/config/locales/ca.yml +29 -24
  124. data/config/locales/cs.yml +6 -2
  125. data/config/locales/de.yml +34 -29
  126. data/config/locales/el.yml +3 -6
  127. data/config/locales/en.yml +7 -2
  128. data/config/locales/es-MX.yml +9 -4
  129. data/config/locales/es-PY.yml +9 -4
  130. data/config/locales/es.yml +27 -22
  131. data/config/locales/eu.yml +22 -8
  132. data/config/locales/fi-plain.yml +8 -3
  133. data/config/locales/fi.yml +10 -5
  134. data/config/locales/fr-CA.yml +12 -7
  135. data/config/locales/fr.yml +12 -7
  136. data/config/locales/ga-IE.yml +1 -0
  137. data/config/locales/gl.yml +4 -2
  138. data/config/locales/he-IL.yml +1 -0
  139. data/config/locales/hu.yml +264 -7
  140. data/config/locales/id-ID.yml +0 -2
  141. data/config/locales/it.yml +2 -5
  142. data/config/locales/ja.yml +11 -6
  143. data/config/locales/lb.yml +2 -5
  144. data/config/locales/lt.yml +0 -10
  145. data/config/locales/lv.yml +0 -2
  146. data/config/locales/nl.yml +1 -2
  147. data/config/locales/no.yml +2 -5
  148. data/config/locales/pl.yml +581 -2
  149. data/config/locales/pt-BR.yml +202 -18
  150. data/config/locales/pt.yml +2 -5
  151. data/config/locales/ro-RO.yml +2 -5
  152. data/config/locales/ru.yml +7 -2
  153. data/config/locales/sk.yml +0 -2
  154. data/config/locales/sv.yml +24 -5
  155. data/config/locales/tr-TR.yml +3 -5
  156. data/config/locales/uk.yml +12 -2
  157. data/config/locales/zh-CN.yml +0 -5
  158. data/config/locales/zh-TW.yml +2 -10
  159. data/decidim-core.gemspec +90 -0
  160. data/lib/decidim/asset_router/storage.rb +2 -0
  161. data/lib/decidim/attribute_encryptor.rb +6 -4
  162. data/lib/decidim/attributes/time_with_zone.rb +1 -1
  163. data/lib/decidim/core/engine.rb +7 -6
  164. data/lib/decidim/core/seeds.rb +36 -32
  165. data/lib/decidim/core/test/factories.rb +296 -89
  166. data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
  167. data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
  168. data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
  169. data/lib/decidim/core/test/shared_examples/has_attachments.rb +8 -8
  170. data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
  171. data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
  172. data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -1
  173. data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -0
  174. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +5 -2
  175. data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
  176. data/lib/decidim/core/test/shared_examples/simple_event.rb +18 -2
  177. data/lib/decidim/core/test.rb +1 -0
  178. data/lib/decidim/core/version.rb +1 -1
  179. data/lib/decidim/core.rb +1 -0
  180. data/lib/decidim/engine_router.rb +17 -4
  181. data/lib/decidim/events/base_event.rb +3 -3
  182. data/lib/decidim/events/simple_event.rb +3 -17
  183. data/lib/decidim/form_builder.rb +8 -2
  184. data/lib/decidim/has_category.rb +1 -1
  185. data/lib/decidim/has_conversations.rb +91 -0
  186. data/lib/decidim/participable.rb +17 -0
  187. data/lib/decidim/upgrade/wysiwyg_migrator.rb +7 -0
  188. data/lib/decidim/view_model.rb +1 -0
  189. data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
  190. data/lib/premailer/adapter/decidim.rb +5 -4
  191. data/lib/tasks/decidim_reminders_tasks.rake +1 -0
  192. data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
  193. metadata +27 -30
  194. data/app/views/decidim/searches/index.js.erb +0 -7
  195. data/config/brakeman.ignore +0 -37
  196. data/config/environment.rb +0 -3
@@ -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 "../index";
24
+ import createEditor from "src/decidim/editor/index";
25
25
 
26
- import editorMessages from "./fixtures/editor_messages";
27
- import uploadTemplates from "./fixtures/upload_templates";
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
- const config = { messages: { editor: editorMessages } };
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 "../helpers";
2
- import itBehavesLikeBasicToolbar from "./shared/behaves_like_basic";
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 "../helpers";
2
- import itBehavesLikeContentToolbar from "./shared/behaves_like_content";
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 "../helpers";
6
- import contextHelpers from "./shared/context";
7
- import itBehavesLikeContentToolbar from "./shared/behaves_like_content";
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 "./behaves_like_basic_styling";
2
- import itBehavesLikeBasicToolbarFormatting from "./behaves_like_basic_formatting";
3
- import itBehavesLikeBasicToolbarList from "./behaves_like_basic_list";
4
- import itBehavesLikeBasicToolbarBlock from "./behaves_like_basic_block";
5
- import itBehavesLikeBasicToolbarLink from "./behaves_like_basic_link";
6
- import itBehavesLikeBasicToolbarIndent from "./behaves_like_basic_indent";
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 "../../helpers";
1
+ import { selectContent } from "src/decidim/editor/test/helpers";
2
2
 
3
- import contextHelpers from "./context";
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,4 +1,4 @@
1
- import contextHelpers from "./context";
1
+ import contextHelpers from "src/decidim/editor/test/toolbar/shared/context";
2
2
 
3
3
  export default (ctx) => {
4
4
  const { getControl, setContent } = contextHelpers(ctx);
@@ -1,6 +1,6 @@
1
- import { selectContent, selectRange } from "../../helpers";
1
+ import { selectContent, selectRange } from "src/decidim/editor/test/helpers";
2
2
 
3
- import contextHelpers from "./context";
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 "../../helpers";
1
+ import { sleep, selectRange } from "src/decidim/editor/test/helpers";
2
2
 
3
- import contextHelpers from "./context";
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 "../../helpers";
1
+ import { selectContent } from "src/decidim/editor/test/helpers";
2
2
 
3
- import contextHelpers from "./context";
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 "../../helpers";
1
+ import { selectContent } from "src/decidim/editor/test/helpers";
2
2
 
3
- import contextHelpers from "./context";
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,10 +1,10 @@
1
- import itBehavesLikeBasicToolbarStyling from "./behaves_like_basic_styling";
2
- import itBehavesLikeContentToolbarStyling from "./behaves_like_content_styling";
3
- import itBehavesLikeBasicToolbarFormatting from "./behaves_like_basic_formatting";
4
- import itBehavesLikeBasicToolbarList from "./behaves_like_basic_list";
5
- import itBehavesLikeBasicToolbarBlock from "./behaves_like_basic_block";
6
- import itBehavesLikeBasicToolbarLink from "./behaves_like_basic_link";
7
- import itBehavesLikeBasicToolbarIndent from "./behaves_like_basic_indent";
1
+ import itBehavesLikeBasicToolbarStyling from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling";
2
+ import itBehavesLikeContentToolbarStyling from "src/decidim/editor/test/toolbar/shared/behaves_like_content_styling";
3
+ import itBehavesLikeBasicToolbarFormatting from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting";
4
+ import itBehavesLikeBasicToolbarList from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_list";
5
+ import itBehavesLikeBasicToolbarBlock from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_block";
6
+ import itBehavesLikeBasicToolbarLink from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_link";
7
+ import itBehavesLikeBasicToolbarIndent from "src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent";
8
8
 
9
9
  export default (ctx) => {
10
10
  ctx.prosemirror = null;
@@ -1,6 +1,6 @@
1
- import { selectContent } from "../../helpers";
1
+ import { selectContent } from "src/decidim/editor/test/helpers";
2
2
 
3
- import contextHelpers from "./context";
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,4 +1,4 @@
1
- import { updateContent } from "../../helpers";
1
+ import { updateContent } from "src/decidim/editor/test/helpers";
2
2
 
3
3
  export default (ctx) => {
4
4
  return {
@@ -1,6 +1,6 @@
1
- import { transformMsDesktop, transformMsCould } from "../../utilities/paste_transform";
1
+ import { transformMsDesktop, transformMsCould } from "src/decidim/editor/utilities/paste_transform";
2
2
 
3
- import "../helpers";
3
+ import "src/decidim/editor/test/helpers";
4
4
 
5
5
  const uglifyHtml = (html) => html.replace(/[\r\n]+\s+/g, " ").replace(/>\s+</g, "><").trim();
6
6
 
@@ -1,5 +1,14 @@
1
1
  /* eslint-disable require-jsdoc */
2
2
 
3
+ /**
4
+ * If you want to disable the warning but indicate that the link is an external
5
+ * link, please define the `data-external-link-warning="false"` attribute for
6
+ * the link,
7
+ * e.g. <a href="https://..." target="_blank" data-external-link="text-only" data-external-domain-link="false">...</a>
8
+ *
9
+ * @param {HTMLElement} element The element for which to replace the link href for.
10
+ * @returns {void} Nothing
11
+ */
3
12
  export default function updateExternalDomainLinks(element) {
4
13
  if (window.location.pathname === "/link") {
5
14
  return;
@@ -9,6 +18,10 @@ export default function updateExternalDomainLinks(element) {
9
18
  return;
10
19
  }
11
20
 
21
+ if (element.dataset.externalDomainLink === "false") {
22
+ return;
23
+ }
24
+
12
25
  const parts = element.href.match(/^(([a-z]+):)?\/\/([^/:]+)(:[0-9]*)?(\/.*)?$/) || null;
13
26
  if (!parts) {
14
27
  return;
@@ -1,4 +1,4 @@
1
- import ExternalDomainLink from "./external_domain_warning";
1
+ import ExternalDomainLink from "src/decidim/external_domain_warning";
2
2
 
3
3
  describe("ExternalDomainLink", () => {
4
4
  const content = `
@@ -1,28 +1,43 @@
1
1
  import icon from "src/decidim/icon"
2
2
 
3
+ const DEFAULT_MESSAGES = {
4
+ externalLink: "External link",
5
+ opensInNewTab: "Opens in new tab"
6
+ };
7
+ let MESSAGES = DEFAULT_MESSAGES;
8
+
3
9
  /**
4
10
  * Appends an icon to distinguish those links pointing out of decidim.
5
11
  * It will apply to all a[target="_blank"] found in the document
6
12
  *
7
13
  * This behaviour can be omitted adding data-external-link="false" attribute to the anchor tag
8
14
  * e.g. <a href="https://..." target="_blank" data-external-link="false">...</a>
15
+ *
16
+ * If you do not want to display the external link indicator, you still need to indicate that
17
+ * the link opens in a new tab to the screen readers. This can be done by adding
18
+ * data-external-link="text-only" attribute to the anchor tag,
19
+ * e.g. <a href="https://..." target="_blank" data-external-link="text-only">...</a>
20
+ *
21
+ * In addition, if you want to disable the external link warning for the link, you can add the
22
+ * data-external-domain-link="false" attribute to the anchor tag,
23
+ * e.g. <a href="https://..." target="_blank" data-external-link="text-only" data-external-domain-link="false">...</a>
9
24
  */
10
25
  export default class ExternalLink {
11
26
  static configureMessages(messages) {
12
- this.MESSAGES = { ...this.MESSAGES, ...messages };
27
+ MESSAGES = { ...DEFAULT_MESSAGES, ...messages };
13
28
  }
14
29
 
15
30
  constructor(node) {
16
- this.MESSAGES = {
17
- externalLink: "External link"
18
- };
19
-
20
31
  if (node.closest(".editor-container")) {
21
32
  return;
22
33
  }
23
34
 
24
35
  if (!node.querySelector("span[data-external-link]")) {
25
- this.setup(node);
36
+ if (node.dataset.externalLink === "text-only") {
37
+ this.setupTextOnly(node);
38
+ } else {
39
+ this.setup(node);
40
+ }
26
41
  }
27
42
  }
28
43
 
@@ -30,17 +45,41 @@ export default class ExternalLink {
30
45
  const span = document.createElement("span");
31
46
 
32
47
  span.dataset.externalLink = true;
33
- span.innerHTML = `${this.generateIcon()}${this.generateScreenReaderLabel()}`
48
+ span.innerHTML = `${this.generateIcon()}${this.generateScreenReaderLabel(node)}`
34
49
  span.classList.add("inline-block", "mx-0.5");
35
50
 
36
51
  return node.appendChild(span);
37
52
  }
38
53
 
54
+ setupTextOnly(node) {
55
+ const dummy = document.createElement("span");
56
+ dummy.innerHTML = this.generateScreenReaderLabel(node);
57
+
58
+ return node.appendChild(dummy.firstChild);
59
+ }
60
+
39
61
  generateIcon() {
40
62
  return icon("external-link-line", { class: "fill-current" });
41
63
  }
42
64
 
43
- generateScreenReaderLabel() {
44
- return `<span class="sr-only">(${this.MESSAGES.externalLink})</span>`;
65
+ generateScreenReaderLabel(node) {
66
+ let text = MESSAGES.opensInNewTab;
67
+ if (this._isExternalLink(node)) {
68
+ text = MESSAGES.externalLink;
69
+ }
70
+
71
+ return `<span class="sr-only">(${text})</span>`;
72
+ }
73
+
74
+ _isExternalLink(node) {
75
+ const externalMatches = [
76
+ // Links to the internal link page /link?external_url=https%3A%2F%2Fdecidim.org
77
+ new RegExp("^/link\\?external_url="),
78
+ // Links starting with http/s and not to the current host
79
+ new RegExp(`^https?://((?!${location.host}).)+`)
80
+ ];
81
+
82
+ const href = node.getAttribute("href") || "";
83
+ return externalMatches.some(((regexp) => href.match(regexp)));
45
84
  }
46
85
  }
@@ -1,6 +1,6 @@
1
1
  import $ from "jquery"; // eslint-disable-line id-length
2
2
 
3
- import ExternalLink from "./external_link";
3
+ import ExternalLink from "src/decidim/external_link";
4
4
 
5
5
  describe("ExternalLink", () => {
6
6
  const content = `
@@ -1,5 +1,3 @@
1
- import { Keyboard } from "foundation-sites"
2
-
3
1
  const focusGuardClass = "focusguard";
4
2
  const focusableNodes = ["A", "IFRAME", "OBJECT", "EMBED"];
5
3
  const focusableDisableableNodes = ["BUTTON", "INPUT", "TEXTAREA", "SELECT"];
@@ -8,21 +6,13 @@ export default class FocusGuard {
8
6
  constructor(container) {
9
7
  this.container = container;
10
8
  this.guardedElement = null;
9
+ this.triggerElement = null;
11
10
  }
12
11
 
13
- trap(element) {
14
- if (this.guardedElement) {
15
- Keyboard.releaseFocus($(this.guardedElement));
16
- }
17
-
12
+ trap(element, trigger) {
18
13
  this.enable();
19
14
  this.guardedElement = element;
20
-
21
- // Call the release focus first so that we do not accidentally add the
22
- // keyboard trap twice. Note that the Foundation methods expect the elements
23
- // to be jQuery elements which is why we pass them through jQuery.
24
- Keyboard.releaseFocus($(element));
25
- Keyboard.trapFocus($(element));
15
+ this.triggerElement = trigger;
26
16
  }
27
17
 
28
18
  enable() {
@@ -58,12 +48,11 @@ export default class FocusGuard {
58
48
  const guards = this.container.querySelectorAll(`:scope > .${focusGuardClass}`);
59
49
  guards.forEach((guard) => guard.remove());
60
50
 
61
- if (this.guardedElement) {
62
- // Note that the Foundation methods expect the elements to be jQuery
63
- // elements which is why we pass them through jQuery.
64
- Keyboard.releaseFocus($(this.guardedElement));
65
- this.guardedElement.focus();
66
- this.guardedElement = null;
51
+ this.guardedElement = null;
52
+
53
+ if (this.triggerElement) {
54
+ this.triggerElement.focus();
55
+ this.triggerElement = null;
67
56
  }
68
57
  }
69
58
 
@@ -89,7 +78,6 @@ export default class FocusGuard {
89
78
 
90
79
  let target = null;
91
80
  if (guard.dataset.position === "start") {
92
-
93
81
  // Focus at the start guard, so focus the first focusable element after that
94
82
  for (let ind = 0; ind < visibleNodes.length; ind += 1) {
95
83
  if (!this.isFocusGuard(visibleNodes[ind]) && this.isFocusable(visibleNodes[ind])) {
@@ -1,6 +1,6 @@
1
1
  /* eslint no-undef: 0 */
2
2
 
3
- import FormFilterComponent from "./form_filter"
3
+ import FormFilterComponent from "src/decidim/form_filter"
4
4
 
5
5
  // This module.exports is necessary for the tests to load
6
6
  // does not conflict with import/export
@@ -7,9 +7,9 @@
7
7
  * @augments Component
8
8
  */
9
9
 
10
- import delayed from "./delayed"
11
- import CheckBoxesTree from "./check_boxes_tree"
12
- import { registerCallback, unregisterCallback, pushState, replaceState, state } from "./history"
10
+ import delayed from "src/decidim/delayed"
11
+ import CheckBoxesTree from "src/decidim/check_boxes_tree"
12
+ import { registerCallback, unregisterCallback, pushState, replaceState, state } from "src/decidim/history"
13
13
 
14
14
  export default class FormFilterComponent {
15
15
  constructor($form) {
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable require-jsdoc */
2
- import getCoordinateInputName from "./coordinate_input"
2
+ import getCoordinateInputName from "src/decidim/geocoding/coordinate_input"
3
3
 
4
4
  /**
5
5
  * You can use this method to "attach" front-end geocoding to any forms in the
@@ -1,4 +1,4 @@
1
- import * as i18n from "./i18n";
1
+ import * as i18n from "src/decidim/i18n";
2
2
 
3
3
  const config = {
4
4
  messages: {
@@ -9,13 +9,16 @@ import "core-js/stable";
9
9
  import "regenerator-runtime/runtime";
10
10
  import "jquery"
11
11
 
12
+ // REDESIGN_PENDING: deprecated
13
+ import "foundation-sites";
14
+
12
15
  // external deps that require initialization
13
16
  import Rails from "@rails/ujs"
14
17
  import svg4everybody from "svg4everybody"
15
18
  import morphdom from "morphdom"
16
19
 
17
20
  // vendor customizated scripts (bad practice: these ones should be removed eventually)
18
- import "./vendor/modernizr"
21
+ import "src/decidim/vendor/modernizr"
19
22
 
20
23
  /**
21
24
  * Local dependencies
@@ -18,7 +18,7 @@ $(() => {
18
18
 
19
19
  /* eslint no-use-before-define: ["error", { "variables": false }]*/
20
20
  let remoteSearch = function(text, cb) {
21
- $.post("/api", {query: `{hashtags(name:"${text}") {name}}`}).
21
+ $.post(window.Decidim.config.get("api_path"), {query: `{hashtags(name:"${text}") {name}}`}).
22
22
 
23
23
  then((response) => {
24
24
  let data = response.data.hashtags || {};
@@ -34,7 +34,7 @@ const mentionsInitializer = () => {
34
34
  /* eslint no-use-before-define: ["error", { "variables": false }]*/
35
35
  let remoteSearch = function(text, cb) {
36
36
  let query = `{users(filter:{wildcard:"${text}"}){nickname,name,avatarUrl,__typename,...on UserGroup{membersCount}}}`;
37
- $.post("/api", {query: query}).
37
+ $.post(window.Decidim.config.get("api_path"), {query: query}).
38
38
  then((response) => {
39
39
  let data = response.data.users || {};
40
40
  cb(data)
@@ -42,7 +42,7 @@ $(() => {
42
42
  const autoComplete = new AutoComplete($searchInput[0], {
43
43
  dataMatchKeys: ["name", "nickname"],
44
44
  dataSource: (query, callback) => {
45
- $.post("/api", {
45
+ $.post(window.Decidim.config.get("api_path"), {
46
46
  "query": `
47
47
  {
48
48
  users(filter:{wildcard:"${query}",excludeIds:[]})
@@ -1,3 +1,3 @@
1
- import "./loader"
2
- import "./a2hs"
3
- import "./push-permissions"
1
+ import "src/decidim/sw/loader"
2
+ import "src/decidim/sw/a2hs"
3
+ import "src/decidim/sw/push-permissions"
@@ -1,4 +1,4 @@
1
- import PasswordToggler from "./password_toggler";
1
+ import PasswordToggler from "src/decidim/password_toggler";
2
2
 
3
3
  $(() => {
4
4
  const $userRegistrationForm = $("#register-form");
@@ -19,7 +19,7 @@ $(() => {
19
19
  metricsParams.spaceId = $("#metrics #metrics-space_id").val() || null;
20
20
  }
21
21
 
22
- const fetch = (metrics) => $.post("/api", query(metrics));
22
+ const fetch = (metrics) => $.post(window.Decidim.config.get("api_path"), query(metrics));
23
23
 
24
24
  const downloadMetricData = (event) => {
25
25
  event.preventDefault();
@@ -127,13 +127,13 @@
127
127
  @apply text-black text-2xl font-bold;
128
128
  }
129
129
 
130
- &-time {
130
+ &-year {
131
131
  @apply text-black text-xs;
132
132
  }
133
133
 
134
134
  &-month,
135
135
  &-day,
136
- &-time {
136
+ &-year {
137
137
  @apply inline-flex items-center justify-evenly empty:[&>span]:hidden;
138
138
  }
139
139
  }
@@ -1,5 +1,5 @@
1
1
  [id*="dropdown-menu"] {
2
- @apply flex flex-col py-3.5 md:py-0 mx-3.5 md:mx-0 border-t md:border-t-0 border-gray-3 cursor-pointer;
2
+ @apply flex flex-col py-0 mx-3.5 md:mx-0 border-t-0 border-gray-3 cursor-pointer;
3
3
 
4
4
  &[aria-hidden="true"] {
5
5
  @apply hidden md:flex;
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  .dropdown {
37
- @apply absolute bg-white border-2 border-gray-3 rounded min-w-max p-4 drop-shadow-md text-left z-10;
37
+ @apply absolute border-2 border-gray-3 rounded min-w-max p-4 drop-shadow-md text-left z-10;
38
38
 
39
39
  & > * {
40
40
  @apply relative z-10 p-3.5 first:pt-1.5 last:pb-1.5;
@@ -51,18 +51,18 @@
51
51
  }
52
52
 
53
53
  .layout-item {
54
- @apply container grid grid-cols-1 md:grid-cols-12 py-4 md:py-24 gap-12 md:gap-x-0;
54
+ @apply container grid grid-cols-1 lg:grid-cols-12 py-4 lg:py-24 gap-12 lg:gap-x-0;
55
55
 
56
56
  &__main {
57
- @apply lg:col-start-2 md:col-span-8 lg:col-span-7 relative;
57
+ @apply xl:col-start-2 lg:col-span-8 xl:col-span-7 relative;
58
58
  }
59
59
 
60
60
  &__aside {
61
- @apply md:col-start-10 lg:col-start-10 md:col-span-3 lg:col-span-2;
61
+ @apply lg:col-start-10 xl:col-start-10 lg:col-span-3 xl:col-span-2;
62
62
  }
63
63
 
64
64
  &__back {
65
- @apply mb-4 md:mb-0 md:absolute md:-left-[1em] md:-top-8 md:-translate-y-full;
65
+ @apply mb-4 lg:mb-0 lg:absolute lg:-left-[1em] lg:-top-8 lg:-translate-y-full;
66
66
  }
67
67
 
68
68
  &__arrow {
@@ -78,6 +78,3 @@
78
78
  // This imports all the Decidim module stylesheet imports registered at
79
79
  // `config/assets.rb` of the module for the "app" group.
80
80
  @import "!decidim-style-imports[app]";
81
-
82
- // Application specific styles: https://docs.decidim.org/en/customize/styles/#_webpacker
83
- @import "stylesheets/decidim/decidim_application";
@@ -2,4 +2,8 @@
2
2
  // Notice that this file is included at the very end of the stylesheets packs to have
3
3
  // more priority
4
4
  //
5
+ // Please note this file is only targeting the end user interface and not the admin interface.
6
+ // To change the Tailwind CSS configuration, or to override the admin, system or design interface
7
+ // styles follow the instructions in https://docs.decidim.org/en/customize/styles/
8
+ //
5
9
  // By default this is empty.