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.
Files changed (246) 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/announcement/show.erb +2 -2
  7. data/app/cells/decidim/author/show.erb +5 -5
  8. data/app/cells/decidim/authorization_modal/show.erb +8 -4
  9. data/app/cells/decidim/authorization_modal_cell.rb +1 -0
  10. data/app/cells/decidim/card/show.erb +1 -1
  11. data/app/cells/decidim/card_metadata/show.erb +2 -2
  12. data/app/cells/decidim/card_metadata_cell.rb +3 -3
  13. data/app/cells/decidim/coauthorships_cell.rb +1 -1
  14. data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +6 -0
  15. data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +20 -4
  16. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +8 -0
  17. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb +13 -0
  18. data/app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb +1 -1
  19. data/app/cells/decidim/data_consent/category.erb +1 -1
  20. data/app/cells/decidim/footer_pages_cell.rb +3 -3
  21. data/app/cells/decidim/nav_links/show.erb +2 -2
  22. data/app/cells/decidim/notification/moderated.erb +12 -0
  23. data/app/cells/decidim/notification_cell.rb +5 -1
  24. data/app/cells/decidim/profile/details.erb +1 -1
  25. data/app/cells/decidim/profile/tabs.erb +3 -2
  26. data/app/cells/decidim/progress_bar/show.erb +1 -1
  27. data/app/cells/decidim/progress_bar_cell.rb +2 -0
  28. data/app/cells/decidim/report_button/flag_modal.erb +5 -1
  29. data/app/cells/decidim/resource_types_filter/show.erb +3 -3
  30. data/app/cells/decidim/statistic/show.erb +2 -2
  31. data/app/cells/decidim/tags_cell.rb +3 -1
  32. data/app/cells/decidim/upload_modal/modal.erb +1 -2
  33. data/app/commands/decidim/create_omniauth_registration.rb +1 -3
  34. data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
  35. data/app/commands/decidim/messaging/start_conversation.rb +3 -0
  36. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
  37. data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
  38. data/app/controllers/concerns/decidim/paginable.rb +1 -1
  39. data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
  40. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
  41. data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
  42. data/app/controllers/decidim/gamification/badges_controller.rb +2 -0
  43. data/app/controllers/decidim/links_controller.rb +15 -2
  44. data/app/events/decidim/welcome_notification_event.rb +6 -9
  45. data/app/helpers/concerns/decidim/flash_helper_extensions.rb +2 -2
  46. data/app/helpers/decidim/application_helper.rb +0 -18
  47. data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
  48. data/app/helpers/decidim/check_boxes_tree_helper.rb +7 -8
  49. data/app/helpers/decidim/layout_helper.rb +1 -1
  50. data/app/helpers/decidim/map_helper.rb +1 -1
  51. data/app/helpers/decidim/menu_helper.rb +2 -0
  52. data/app/helpers/decidim/newsletters_helper.rb +83 -16
  53. data/app/helpers/decidim/paginate_helper.rb +1 -1
  54. data/app/helpers/decidim/sanitize_helper.rb +9 -0
  55. data/app/helpers/decidim/social_share_button_helper.rb +1 -1
  56. data/app/helpers/decidim/user_profile_helper.rb +7 -2
  57. data/app/mailers/decidim/application_mailer.rb +40 -6
  58. data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
  59. data/app/models/decidim/push_notification_message.rb +38 -0
  60. data/app/packs/entrypoints/decidim_overrides.scss +2 -0
  61. data/app/packs/images/decidim/.keep +0 -0
  62. data/app/packs/src/decidim/a11y.js +15 -1
  63. data/app/packs/src/decidim/abide_form_validator_fixer.js +44 -0
  64. data/app/packs/src/decidim/account_form.js +1 -1
  65. data/app/packs/src/decidim/data_consent/consent_manager.test.js +1 -1
  66. data/app/packs/src/decidim/data_consent/index.js +1 -1
  67. data/app/packs/src/decidim/direct_uploads/upload_field.js +1 -1
  68. data/app/packs/src/decidim/direct_uploads/upload_modal.js +5 -5
  69. data/app/packs/src/decidim/editor/extensions/hashtag/index.js +1 -1
  70. data/app/packs/src/decidim/editor/extensions/mention/index.js +1 -1
  71. data/app/packs/src/decidim/editor/extensions/video_embed/index.js +3 -0
  72. data/app/packs/src/decidim/editor/test/editor/create.test.js +1 -1
  73. data/app/packs/src/decidim/editor/test/extensions/bold.test.js +2 -3
  74. data/app/packs/src/decidim/editor/test/extensions/character_count.test.js +2 -2
  75. data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +2 -3
  76. data/app/packs/src/decidim/editor/test/extensions/dialog.test.js +2 -2
  77. data/app/packs/src/decidim/editor/test/extensions/emoji.test.js +2 -2
  78. data/app/packs/src/decidim/editor/test/extensions/hashtag.test.js +2 -2
  79. data/app/packs/src/decidim/editor/test/extensions/heading.test.js +2 -2
  80. data/app/packs/src/decidim/editor/test/extensions/image.test.js +4 -4
  81. data/app/packs/src/decidim/editor/test/extensions/indent.test.js +2 -2
  82. data/app/packs/src/decidim/editor/test/extensions/link.test.js +3 -3
  83. data/app/packs/src/decidim/editor/test/extensions/mention.test.js +2 -2
  84. data/app/packs/src/decidim/editor/test/extensions/ordered_list.test.js +2 -2
  85. data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +3 -3
  86. data/app/packs/src/decidim/editor/test/helpers.js +5 -4
  87. data/app/packs/src/decidim/editor/test/toolbar/basic.test.js +2 -2
  88. data/app/packs/src/decidim/editor/test/toolbar/content.test.js +2 -2
  89. data/app/packs/src/decidim/editor/test/toolbar/full.test.js +3 -3
  90. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic.js +6 -6
  91. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +2 -2
  92. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +1 -1
  93. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +2 -2
  94. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +2 -2
  95. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +2 -2
  96. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +2 -2
  97. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content.js +7 -7
  98. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +2 -2
  99. data/app/packs/src/decidim/editor/test/toolbar/shared/context.js +1 -1
  100. data/app/packs/src/decidim/editor/test/utilities/paste_transform.test.js +2 -2
  101. data/app/packs/src/decidim/external_domain_warning.js +13 -0
  102. data/app/packs/src/decidim/external_domain_warning.test.js +1 -1
  103. data/app/packs/src/decidim/external_link.js +48 -9
  104. data/app/packs/src/decidim/external_link.test.js +1 -1
  105. data/app/packs/src/decidim/focus_guard.js +8 -20
  106. data/app/packs/src/decidim/form_filter.component_for_testing.js +1 -1
  107. data/app/packs/src/decidim/form_filter.js +3 -3
  108. data/app/packs/src/decidim/geocoding/attach_input.js +1 -1
  109. data/app/packs/src/decidim/i18n.test.js +1 -1
  110. data/app/packs/src/decidim/index.js +33 -2
  111. data/app/packs/src/decidim/input_hashtags.js +1 -1
  112. data/app/packs/src/decidim/input_mentions.js +1 -1
  113. data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
  114. data/app/packs/src/decidim/sw/index.js +3 -3
  115. data/app/packs/src/decidim/user_registrations.js +1 -1
  116. data/app/packs/src/decidim/vizzs/index.js +1 -1
  117. data/app/packs/stylesheets/decidim/_accordion.scss +2 -2
  118. data/app/packs/stylesheets/decidim/_cards.scss +4 -4
  119. data/app/packs/stylesheets/decidim/_dropdown.scss +2 -2
  120. data/app/packs/stylesheets/decidim/_layout.scss +7 -7
  121. data/app/packs/stylesheets/decidim/_modal_update.scss +1 -3
  122. data/app/packs/stylesheets/decidim/application.scss +0 -3
  123. data/app/packs/stylesheets/decidim/decidim_application.scss +4 -0
  124. data/app/packs/stylesheets/decidim/legacy/leaflet.scss +88 -107
  125. data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
  126. data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
  127. data/app/presenters/decidim/log/diff_presenter.rb +1 -1
  128. data/app/presenters/decidim/log/resource_presenter.rb +7 -1
  129. data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
  130. data/app/services/decidim/events_manager.rb +6 -0
  131. data/app/services/decidim/iframe_disabler.rb +4 -0
  132. data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
  133. data/app/services/decidim/push_notification_message_sender.rb +40 -0
  134. data/app/services/decidim/send_push_notification.rb +22 -8
  135. data/app/uploaders/decidim/background_image_uploader.rb +11 -0
  136. data/app/views/decidim/account/show.html.erb +2 -2
  137. data/app/views/decidim/application/_collection.html.erb +2 -2
  138. data/app/views/decidim/application/_document.html.erb +3 -3
  139. data/app/views/decidim/devise/registrations/new.html.erb +2 -2
  140. data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +2 -1
  141. data/app/views/decidim/gamification/badges/index.html.erb +34 -33
  142. data/app/views/decidim/links/_modal.html.erb +1 -1
  143. data/app/views/decidim/links/new.html.erb +3 -1
  144. data/app/views/decidim/manifests/show.json.erb +1 -1
  145. data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
  146. data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
  147. data/app/views/decidim/notifications_settings/show.html.erb +6 -6
  148. data/app/views/decidim/offline/show.html.erb +15 -9
  149. data/app/views/decidim/pages/_tabbed.html.erb +2 -2
  150. data/app/views/decidim/searches/_filters.html.erb +2 -2
  151. data/app/views/decidim/shared/_filters.html.erb +2 -2
  152. data/app/views/decidim/shared/_orders.html.erb +2 -2
  153. data/app/views/decidim/shared/filters/_collection.html.erb +5 -3
  154. data/app/views/decidim/shared/filters/_dropdown_label.html.erb +21 -19
  155. data/app/views/layouts/decidim/_head.html.erb +1 -0
  156. data/app/views/layouts/decidim/_js_configuration.html.erb +3 -1
  157. data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
  158. data/app/views/layouts/decidim/footer/_main_links.html.erb +3 -1
  159. data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +5 -5
  160. data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
  161. data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +4 -2
  162. data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
  163. data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
  164. data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
  165. data/config/assets.rb +1 -0
  166. data/config/locales/ar.yml +60 -8
  167. data/config/locales/bg.yml +909 -2
  168. data/config/locales/ca.yml +31 -24
  169. data/config/locales/cs.yml +7 -3
  170. data/config/locales/de.yml +37 -30
  171. data/config/locales/el.yml +11 -7
  172. data/config/locales/en.yml +10 -3
  173. data/config/locales/es-MX.yml +17 -10
  174. data/config/locales/es-PY.yml +17 -10
  175. data/config/locales/es.yml +59 -52
  176. data/config/locales/eu.yml +26 -10
  177. data/config/locales/fi-plain.yml +11 -4
  178. data/config/locales/fi.yml +14 -7
  179. data/config/locales/fr-CA.yml +14 -7
  180. data/config/locales/fr.yml +14 -7
  181. data/config/locales/ga-IE.yml +9 -0
  182. data/config/locales/gl.yml +5 -2
  183. data/config/locales/he-IL.yml +1 -0
  184. data/config/locales/hu.yml +264 -8
  185. data/config/locales/id-ID.yml +0 -2
  186. data/config/locales/it.yml +9 -6
  187. data/config/locales/ja.yml +14 -7
  188. data/config/locales/kaa.yml +5 -0
  189. data/config/locales/lb.yml +9 -6
  190. data/config/locales/lt.yml +8 -12
  191. data/config/locales/lv.yml +8 -3
  192. data/config/locales/nl.yml +8 -3
  193. data/config/locales/no.yml +9 -6
  194. data/config/locales/pl.yml +616 -2
  195. data/config/locales/pt-BR.yml +202 -19
  196. data/config/locales/pt.yml +9 -6
  197. data/config/locales/ro-RO.yml +10 -5
  198. data/config/locales/ru.yml +15 -2
  199. data/config/locales/sk.yml +8 -3
  200. data/config/locales/sl.yml +8 -0
  201. data/config/locales/sv.yml +32 -6
  202. data/config/locales/tr-TR.yml +24 -9
  203. data/config/locales/uk.yml +22 -2
  204. data/config/locales/zh-CN.yml +0 -6
  205. data/config/locales/zh-TW.yml +10 -11
  206. data/decidim-core.gemspec +90 -0
  207. data/lib/decidim/asset_router/storage.rb +2 -0
  208. data/lib/decidim/attribute_encryptor.rb +6 -4
  209. data/lib/decidim/attributes/time_with_zone.rb +1 -1
  210. data/lib/decidim/core/engine.rb +7 -6
  211. data/lib/decidim/core/seeds.rb +37 -33
  212. data/lib/decidim/core/test/factories.rb +296 -89
  213. data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
  214. data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
  215. data/lib/decidim/core/test/shared_examples/comments_examples.rb +76 -6
  216. data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
  217. data/lib/decidim/core/test/shared_examples/has_attachments.rb +8 -8
  218. data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
  219. data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
  220. data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -1
  221. data/lib/decidim/core/test/shared_examples/logo_email.rb +2 -2
  222. data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -0
  223. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +5 -2
  224. data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
  225. data/lib/decidim/core/test/shared_examples/simple_event.rb +18 -2
  226. data/lib/decidim/core/test.rb +1 -0
  227. data/lib/decidim/core/version.rb +1 -1
  228. data/lib/decidim/core.rb +7 -1
  229. data/lib/decidim/engine_router.rb +17 -4
  230. data/lib/decidim/events/base_event.rb +7 -3
  231. data/lib/decidim/events/simple_event.rb +3 -17
  232. data/lib/decidim/form_builder.rb +8 -2
  233. data/lib/decidim/has_category.rb +1 -1
  234. data/lib/decidim/has_conversations.rb +91 -0
  235. data/lib/decidim/organization_settings.rb +10 -2
  236. data/lib/decidim/participable.rb +17 -0
  237. data/lib/decidim/upgrade/wysiwyg_migrator.rb +7 -0
  238. data/lib/decidim/view_model.rb +1 -0
  239. data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
  240. data/lib/premailer/adapter/decidim.rb +5 -4
  241. data/lib/tasks/decidim_reminders_tasks.rake +1 -0
  242. data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
  243. metadata +26 -27
  244. data/app/views/decidim/searches/index.js.erb +0 -7
  245. data/config/brakeman.ignore +0 -37
  246. data/config/environment.rb +0 -3
@@ -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
@@ -47,6 +50,7 @@ import "src/decidim/impersonation"
47
50
  import "src/decidim/gallery"
48
51
  import "src/decidim/direct_uploads/upload_field"
49
52
  import "src/decidim/data_consent"
53
+ import "src/decidim/abide_form_validator_fixer"
50
54
  import "src/decidim/sw"
51
55
 
52
56
  // local deps that require initialization
@@ -87,6 +91,33 @@ window.Decidim = window.Decidim || {
87
91
 
88
92
  window.morphdom = morphdom
89
93
 
94
+ // REDESIGN_PENDING: deprecated
95
+ window.initFoundation = (element) => {
96
+ $(element).foundation();
97
+
98
+ // Fix compatibility issue with the `a11y-accordion-component` package that
99
+ // uses the `data-open` attribute to indicate the open state for the accordion
100
+ // trigger.
101
+ //
102
+ // In Foundation, these listeners are initiated on the document node always,
103
+ // regardless of the element for which foundation is initiated. Therefore, we
104
+ // need the document node here instead of the `element` passed to this
105
+ // function.
106
+ const $document = $(document);
107
+
108
+ $document.off("click.zf.trigger", window.Foundation.Triggers.Listeners.Basic.openListener);
109
+ $document.on("click.zf.trigger", "[data-open]", (ev, ...restArgs) => {
110
+ // Do not apply for the accordion triggers.
111
+ const accordion = ev.currentTarget?.closest("[data-component='accordion']");
112
+ if (accordion) {
113
+ return;
114
+ }
115
+
116
+ // Otherwise call the original implementation
117
+ Reflect.apply(window.Foundation.Triggers.Listeners.Basic.openListener, ev.currentTarget, [ev, ...restArgs]);
118
+ });
119
+ };
120
+
90
121
  Rails.start()
91
122
 
92
123
  /**
@@ -101,7 +132,7 @@ const initializer = (element = document) => {
101
132
  window.focusGuard = window.focusGuard || new FocusGuard(document.body);
102
133
 
103
134
  // REDESIGN_PENDING: deprecated
104
- $(element).foundation();
135
+ window.initFoundation(element);
105
136
 
106
137
  svg4everybody();
107
138
 
@@ -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();
@@ -4,10 +4,10 @@
4
4
 
5
5
  [data-component="accordion"]
6
6
  [id*="comment"][class="comment-reply"][aria-hidden="true"] {
7
- display: block;
7
+ display: none;
8
8
  }
9
9
 
10
10
  [data-component="accordion"]
11
11
  [id*="comment"][class="comment-reply"][aria-hidden="false"] {
12
- display: none;
12
+ display: block;
13
13
  }
@@ -127,14 +127,14 @@
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 {
137
- @apply inline-flex items-center justify-evenly empty:[&>span]:hidden;
136
+ &-year {
137
+ @apply inline-flex items-center justify-evenly empty:[&>div]:hidden;
138
138
  }
139
139
  }
140
140
 
@@ -143,7 +143,7 @@
143
143
  &__list-metadata {
144
144
  @apply mt-auto inline-flex flex-wrap gap-x-4 md:gap-0;
145
145
 
146
- & > span {
146
+ & > div {
147
147
  @apply inline-flex items-center gap-1 px-0 md:px-6 border-gray-3 border-0 md:border-r first:pl-0 last:pr-0 last:border-r-0 text-sm text-gray-2;
148
148
 
149
149
  & > svg {
@@ -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;
@@ -6,7 +6,7 @@
6
6
  }
7
7
 
8
8
  [data-content] {
9
- @apply min-h-[60vh] relative flex flex-col;
9
+ @apply relative flex flex-col;
10
10
  }
11
11
  }
12
12
 
@@ -31,14 +31,14 @@
31
31
  }
32
32
 
33
33
  .layout-2col {
34
- @apply md:grid grid-cols-12 container grow min-h-[60vh];
34
+ @apply md:grid grid-cols-12 container grow auto-rows-max;
35
35
 
36
36
  &__aside {
37
37
  @apply col-span-4 lg:col-span-3 md:pr-16 py-6 md:py-12 gap-6 md:gap-12 flex flex-col justify-between items-start md:justify-start before:content-[''] before:absolute before:top-0 before:left-0 before:h-full before:w-1/2 before:-z-10 md:before:bg-background;
38
38
  }
39
39
 
40
40
  &__main {
41
- @apply col-span-8 lg:col-span-9 bg-white md:pl-16 py-6 md:py-12;
41
+ @apply col-span-8 lg:col-span-9 bg-white md:pl-16 py-6 md:py-12 min-h-[60vh];
42
42
  }
43
43
 
44
44
  &__reverse &__aside {
@@ -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 {
@@ -28,9 +28,7 @@
28
28
  @apply w-24 flex-none flex justify-center;
29
29
  }
30
30
 
31
- img:not([src^="data:image"]):not(
32
- [src^="data:application/octet-stream"]
33
- ) {
31
+ img[src="data:,"] {
34
32
  @apply hidden;
35
33
  }
36
34
 
@@ -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.