decidim-core 0.29.4 → 0.30.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (562) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/address/show.erb +3 -3
  3. data/app/cells/decidim/amendable/amend_button_card/show.erb +6 -4
  4. data/app/cells/decidim/amendable/amend_button_card_cell.rb +8 -0
  5. data/app/cells/decidim/amendable/amendments/show.erb +1 -1
  6. data/app/cells/decidim/amendable/promote_button_card/show.erb +2 -0
  7. data/app/cells/decidim/author/flag.erb +6 -0
  8. data/app/cells/decidim/author/flag_user.erb +14 -0
  9. data/app/cells/decidim/author/show.erb +4 -2
  10. data/app/cells/decidim/author_cell.rb +1 -1
  11. data/app/cells/decidim/card_l/extra_data.erb +1 -0
  12. data/app/cells/decidim/card_metadata_cell.rb +9 -16
  13. data/app/cells/decidim/comments_button_cell.rb +14 -2
  14. data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +2 -0
  15. data/app/cells/decidim/content_blocks/highlighted_elements_with_cell_for_list_cell.rb +1 -1
  16. data/app/cells/decidim/content_blocks/participatory_space_extra_data/extra_data.erb +2 -2
  17. data/app/cells/decidim/endorsement_block/show.erb +0 -1
  18. data/app/cells/decidim/endorsement_block_cell.rb +6 -0
  19. data/app/cells/decidim/endorsement_buttons/button_content.erb +1 -1
  20. data/app/cells/decidim/endorsement_buttons/select_identity_button.erb +1 -1
  21. data/app/cells/decidim/endorsement_buttons/show.erb +7 -7
  22. data/app/cells/decidim/endorsement_buttons/verification_modal.erb +4 -2
  23. data/app/cells/decidim/endorsers_list/empty.erb +3 -0
  24. data/app/cells/decidim/endorsers_list/full.erb +17 -5
  25. data/app/cells/decidim/endorsers_list/show.erb +19 -10
  26. data/app/cells/decidim/endorsers_list_cell.rb +19 -6
  27. data/app/cells/decidim/flag_modal/flag_user.erb +34 -0
  28. data/app/cells/decidim/flag_modal/show.erb +52 -0
  29. data/app/cells/decidim/flag_modal_cell.rb +56 -0
  30. data/app/cells/decidim/follow_button/show.erb +1 -2
  31. data/app/cells/decidim/follow_button_cell.rb +5 -0
  32. data/app/cells/decidim/map/show.erb +3 -0
  33. data/app/cells/decidim/map/template.erb +14 -0
  34. data/app/cells/decidim/map_cell.rb +39 -0
  35. data/app/cells/decidim/notification_actions/buttons_cell.rb +1 -1
  36. data/app/cells/decidim/onboarding_action_message/show.erb +15 -0
  37. data/app/cells/decidim/onboarding_action_message_cell.rb +81 -0
  38. data/app/cells/decidim/participatory_space_dropdown_metadata/metadata.erb +4 -4
  39. data/app/cells/decidim/participatory_space_dropdown_metadata/show.erb +3 -5
  40. data/app/cells/decidim/participatory_space_private_user/show.erb +23 -0
  41. data/app/cells/decidim/participatory_space_private_user_cell.rb +21 -0
  42. data/app/cells/decidim/profile_actions/show.erb +1 -1
  43. data/app/cells/decidim/profile_sidebar/show.erb +167 -0
  44. data/app/cells/decidim/profile_sidebar_cell.rb +68 -0
  45. data/app/cells/decidim/progress_bar/show.erb +2 -2
  46. data/app/cells/decidim/report_button/already_reported_modal.erb +2 -2
  47. data/app/cells/decidim/report_button/flag_modal.erb +27 -13
  48. data/app/cells/decidim/report_button_cell.rb +9 -2
  49. data/app/cells/decidim/resource_history/show.erb +20 -0
  50. data/app/cells/decidim/resource_history_cell.rb +66 -0
  51. data/app/cells/decidim/resource_types_filter/show.erb +1 -1
  52. data/app/cells/decidim/resource_types_filter_cell.rb +6 -6
  53. data/app/cells/decidim/share_button_cell.rb +0 -4
  54. data/app/cells/decidim/share_widget/modal.erb +26 -0
  55. data/app/cells/decidim/share_widget/show.erb +2 -0
  56. data/app/cells/decidim/share_widget_cell.rb +20 -0
  57. data/app/cells/decidim/tags/show.erb +7 -4
  58. data/app/cells/decidim/tags_cell.rb +11 -72
  59. data/app/cells/decidim/user_activity/show.erb +1 -1
  60. data/app/commands/decidim/amendable/create_draft.rb +2 -2
  61. data/app/commands/decidim/create_ephemeral_user.rb +52 -0
  62. data/app/commands/decidim/create_omniauth_registration.rb +21 -17
  63. data/app/commands/decidim/create_report.rb +8 -11
  64. data/app/commands/decidim/create_user_group.rb +6 -2
  65. data/app/commands/decidim/destroy_ephemeral_user.rb +47 -0
  66. data/app/commands/decidim/invite_user.rb +1 -1
  67. data/app/commands/decidim/search.rb +0 -14
  68. data/app/commands/decidim/update_account.rb +11 -3
  69. data/app/commands/decidim/update_notifications_settings.rb +1 -0
  70. data/app/commands/decidim/update_resources_taxonomies.rb +67 -0
  71. data/app/commands/decidim/update_user_group.rb +7 -1
  72. data/app/constraints/decidim/current_component.rb +1 -1
  73. data/app/controllers/concerns/decidim/ajax_permission_handler.rb +21 -0
  74. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +3 -6
  75. data/app/controllers/concerns/decidim/devise_controllers.rb +2 -0
  76. data/app/controllers/concerns/decidim/disable_redirection_to_external_host.rb +1 -1
  77. data/app/controllers/concerns/decidim/ephemeral_session_checker.rb +87 -0
  78. data/app/controllers/concerns/decidim/filter_resource.rb +4 -2
  79. data/app/controllers/concerns/decidim/has_members_page.rb +25 -0
  80. data/app/controllers/concerns/decidim/headers/browser_feature_permissions.rb +50 -0
  81. data/app/controllers/concerns/decidim/locale_switcher.rb +2 -2
  82. data/app/controllers/concerns/decidim/needs_password_change.rb +0 -1
  83. data/app/controllers/concerns/decidim/needs_permission.rb +2 -1
  84. data/app/controllers/concerns/decidim/needs_tos_accepted.rb +4 -5
  85. data/app/controllers/concerns/decidim/onboarding_action_methods.rb +52 -0
  86. data/app/controllers/concerns/decidim/participatory_space_context.rb +1 -4
  87. data/app/controllers/decidim/application_controller.rb +10 -0
  88. data/app/controllers/decidim/authorization_modals_controller.rb +8 -2
  89. data/app/controllers/decidim/components/base_controller.rb +3 -7
  90. data/app/controllers/decidim/devise/confirmations_controller.rb +4 -0
  91. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +8 -1
  92. data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
  93. data/app/controllers/decidim/devise/sessions_controller.rb +2 -0
  94. data/app/controllers/decidim/download_your_data_controller.rb +33 -2
  95. data/app/controllers/decidim/editor_images_controller.rb +1 -11
  96. data/app/controllers/decidim/follows_controller.rb +1 -1
  97. data/app/controllers/decidim/geolocation_controller.rb +19 -0
  98. data/app/controllers/decidim/homepage_controller.rb +0 -1
  99. data/app/controllers/decidim/open_data_controller.rb +33 -8
  100. data/app/controllers/decidim/profiles_controller.rb +2 -2
  101. data/app/controllers/decidim/reports_controller.rb +2 -7
  102. data/app/controllers/decidim/user_activities_controller.rb +1 -1
  103. data/app/controllers/decidim/user_conversations_controller.rb +1 -11
  104. data/app/events/decidim/soft_delete_resource_event.rb +15 -0
  105. data/app/forms/decidim/account_form.rb +2 -5
  106. data/app/forms/decidim/amendable/form.rb +4 -2
  107. data/app/forms/decidim/ephemeral_user_form.rb +22 -0
  108. data/app/forms/decidim/notifications_settings_form.rb +1 -0
  109. data/app/forms/decidim/omniauth_registration_form.rb +15 -2
  110. data/app/forms/decidim/registration_form.rb +1 -1
  111. data/app/helpers/concerns/decidim/flash_helper_extensions.rb +17 -2
  112. data/app/helpers/decidim/action_authorization_helper.rb +75 -14
  113. data/app/helpers/decidim/amendments_helper.rb +0 -9
  114. data/app/helpers/decidim/application_helper.rb +6 -2
  115. data/app/helpers/decidim/breadcrumb_helper.rb +6 -0
  116. data/app/helpers/decidim/cache_helper.rb +1 -1
  117. data/app/helpers/decidim/check_boxes_tree_helper.rb +25 -53
  118. data/app/helpers/decidim/decidim_form_helper.rb +0 -44
  119. data/app/helpers/decidim/endorsable_helper.rb +0 -10
  120. data/app/helpers/decidim/layout_helper.rb +6 -0
  121. data/app/helpers/decidim/menu_helper.rb +2 -2
  122. data/app/helpers/decidim/messaging/conversation_helper.rb +2 -3
  123. data/app/helpers/decidim/meta_tags_helper.rb +32 -23
  124. data/app/helpers/decidim/modal_helper.rb +23 -0
  125. data/app/helpers/decidim/omniauth_helper.rb +5 -5
  126. data/app/helpers/decidim/onboarding_action_helper.rb +13 -0
  127. data/app/helpers/decidim/orders_helper.rb +1 -2
  128. data/app/helpers/decidim/paginate_helper.rb +1 -1
  129. data/app/helpers/decidim/participatory_space_helpers.rb +1 -1
  130. data/app/helpers/decidim/passwords_helper.rb +2 -2
  131. data/app/helpers/decidim/taxonomies_helper.rb +40 -0
  132. data/app/helpers/decidim/tooltip_helper.rb +1 -4
  133. data/app/jobs/decidim/download_your_data_export_job.rb +2 -19
  134. data/app/jobs/decidim/event_publisher_job.rb +18 -9
  135. data/app/jobs/decidim/export_job.rb +5 -1
  136. data/app/jobs/decidim/export_participatory_space_job.rb +4 -1
  137. data/app/jobs/decidim/open_data_job.rb +4 -4
  138. data/app/mailers/decidim/export_mailer.rb +7 -12
  139. data/app/mailers/decidim/notifications_digest_mailer.rb +1 -7
  140. data/app/mailers/decidim/reported_mailer.rb +2 -18
  141. data/app/models/decidim/action_log.rb +20 -1
  142. data/app/models/decidim/category.rb +4 -0
  143. data/app/models/decidim/component.rb +25 -3
  144. data/app/models/decidim/metric.rb +2 -1
  145. data/app/models/decidim/moderation.rb +16 -0
  146. data/app/models/decidim/newsletter.rb +12 -8
  147. data/app/models/decidim/organization.rb +7 -3
  148. data/app/models/decidim/participatory_space_private_user.rb +20 -0
  149. data/app/models/decidim/private_export.rb +24 -0
  150. data/app/models/decidim/push_notification_message.rb +1 -1
  151. data/app/models/decidim/report.rb +1 -1
  152. data/app/models/decidim/scope.rb +4 -0
  153. data/app/models/decidim/share_token.rb +36 -10
  154. data/app/models/decidim/taxonomization.rb +23 -0
  155. data/app/models/decidim/taxonomy.rb +139 -0
  156. data/app/models/decidim/taxonomy_filter.rb +130 -0
  157. data/app/models/decidim/taxonomy_filter_item.rb +33 -0
  158. data/app/models/decidim/user.rb +13 -23
  159. data/app/models/decidim/user_base_entity.rb +12 -4
  160. data/app/models/decidim/user_moderation.rb +9 -0
  161. data/app/models/decidim/user_report.rb +4 -0
  162. data/app/packs/entrypoints/decidim_core.js +1 -0
  163. data/app/packs/entrypoints/decidim_geocoding.js +2 -0
  164. data/app/packs/images/decidim/brands/facebook.svg +10 -0
  165. data/app/packs/images/decidim/brands/google.svg +7 -1
  166. data/app/packs/images/decidim/brands/twitter-x.svg +3 -0
  167. data/app/packs/src/decidim/check_boxes_tree.js +0 -1
  168. data/app/packs/src/decidim/clipboard.js +18 -9
  169. data/app/packs/src/decidim/confirm.js +79 -59
  170. data/app/packs/src/decidim/datepicker/datepicker_functions.js +3 -3
  171. data/app/packs/src/decidim/decidim_application.js +1 -0
  172. data/app/packs/src/decidim/form_remote.js +1 -1
  173. data/app/packs/src/decidim/geocoding/reverse_geocoding.js +60 -0
  174. data/app/packs/src/decidim/impersonation.js +1 -1
  175. data/app/packs/src/decidim/index.js +13 -5
  176. data/app/packs/src/decidim/input_character_counter.js +1 -1
  177. data/app/packs/src/decidim/map/provider/here.js +1 -1
  178. data/app/packs/src/decidim/onboarding_pending_action.js +24 -0
  179. data/app/packs/src/decidim/session_timeouter.js +1 -1
  180. data/app/packs/src/decidim/sticky_footer.js +29 -0
  181. data/app/packs/src/decidim/sticky_header.js +6 -31
  182. data/app/packs/src/decidim/user_registrations.js +13 -0
  183. data/app/packs/src/decidim/utilities/dom.js +148 -0
  184. data/app/packs/src/decidim/vendor/leaflet-tilelayer-here.js +212 -0
  185. data/app/packs/stylesheets/decidim/_accordion.scss +30 -0
  186. data/app/packs/stylesheets/decidim/_buttons.scss +19 -0
  187. data/app/packs/stylesheets/decidim/_cards.scss +1 -1
  188. data/app/packs/stylesheets/decidim/_content_blocks.scss +0 -4
  189. data/app/packs/stylesheets/decidim/_dropdown.scss +1 -1
  190. data/app/packs/stylesheets/decidim/_endorsers_list.scss +26 -20
  191. data/app/packs/stylesheets/decidim/_forms.scss +2 -2
  192. data/app/packs/stylesheets/decidim/_header.scss +37 -60
  193. data/app/packs/stylesheets/decidim/_layout.scss +32 -2
  194. data/app/packs/stylesheets/decidim/_login.scss +53 -6
  195. data/app/packs/stylesheets/decidim/_modal.scss +42 -0
  196. data/app/packs/stylesheets/decidim/_modal_tos_refuse.scss +4 -0
  197. data/app/packs/stylesheets/decidim/_participatory_spaces.scss +46 -0
  198. data/app/packs/stylesheets/decidim/_profile.scss +1 -1
  199. data/app/packs/stylesheets/decidim/_success_image.scss +64 -0
  200. data/app/packs/stylesheets/decidim/_tribute.scss +36 -0
  201. data/app/packs/stylesheets/decidim/application.scss +1 -1
  202. data/app/packs/stylesheets/decidim/geocoding_addons.scss +5 -0
  203. data/app/packs/stylesheets/decidim/map.scss +7 -10
  204. data/app/packs/stylesheets/decidim/resource_history.scss +31 -0
  205. data/app/permissions/decidim/default_permissions.rb +0 -2
  206. data/app/permissions/decidim/permissions.rb +8 -2
  207. data/app/presenters/decidim/admin_log/base_user_presenter.rb +67 -0
  208. data/app/presenters/decidim/admin_log/component_presenter.rb +32 -3
  209. data/app/presenters/decidim/admin_log/moderation_presenter.rb +30 -3
  210. data/app/presenters/decidim/admin_log/share_token_presenter.rb +39 -0
  211. data/app/presenters/decidim/admin_log/taxonomy_filter_presenter.rb +57 -0
  212. data/app/presenters/decidim/admin_log/taxonomy_presenter.rb +48 -0
  213. data/app/presenters/decidim/admin_log/user_group_presenter.rb +6 -6
  214. data/app/presenters/decidim/admin_log/user_presenter.rb +4 -18
  215. data/app/presenters/decidim/log/user_presenter.rb +0 -1
  216. data/app/presenters/decidim/log/value_types/date_presenter.rb +1 -0
  217. data/app/presenters/decidim/log/value_types/taxonomy_presenter.rb +29 -0
  218. data/app/presenters/decidim/notification_to_mailer_presenter.rb +3 -7
  219. data/app/presenters/decidim/participatory_space_private_user_presenter.rb +50 -0
  220. data/app/presenters/decidim/taxonomy_filter_presenter.rb +19 -0
  221. data/app/presenters/decidim/taxonomy_presenter.rb +14 -0
  222. data/app/presenters/decidim/user_presenter.rb +1 -1
  223. data/app/queries/decidim/last_activity.rb +0 -25
  224. data/app/queries/decidim/metrics/blocked_users_metric_manage.rb +2 -2
  225. data/app/queries/decidim/metrics/users_metric_manage.rb +2 -2
  226. data/app/queries/decidim/public_activities.rb +1 -12
  227. data/app/queries/decidim/stats_users_count.rb +2 -2
  228. data/app/resolvers/decidim/meta_image_url_resolver.rb +128 -0
  229. data/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb +25 -0
  230. data/app/serializers/decidim/exporters/open_data_metric_serializer.rb +22 -0
  231. data/app/serializers/decidim/exporters/open_data_moderation_serializer.rb +30 -0
  232. data/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb +30 -0
  233. data/app/serializers/decidim/exporters/open_data_user_group_serializer.rb +38 -0
  234. data/app/serializers/decidim/exporters/open_data_user_serializer.rb +39 -0
  235. data/app/serializers/decidim/exporters/participatory_space_serializer.rb +104 -0
  236. data/app/serializers/decidim/exporters/serializer.rb +25 -0
  237. data/app/serializers/decidim/schema_org_breadcrumb_list_serializer.rb +52 -0
  238. data/app/services/decidim/action_authorizer.rb +32 -3
  239. data/app/services/decidim/base_diff_renderer.rb +1 -3
  240. data/app/services/decidim/download_your_data_exporter.rb +58 -24
  241. data/app/services/decidim/onboarding_manager.rb +272 -0
  242. data/app/services/decidim/open_data_exporter.rb +139 -13
  243. data/app/services/decidim/static_map_generator.rb +1 -1
  244. data/app/services/decidim/traceability.rb +13 -0
  245. data/app/uploaders/decidim/application_uploader.rb +1 -1
  246. data/app/validators/etiquette_validator.rb +9 -2
  247. data/app/validators/passthru_validator.rb +1 -1
  248. data/app/validators/translated_etiquette_validator.rb +32 -0
  249. data/app/views/decidim/account/_password_fields.html.erb +2 -2
  250. data/app/views/decidim/application/_accordion_section.html.erb +14 -0
  251. data/app/views/decidim/application/_collection.html.erb +30 -18
  252. data/app/views/decidim/devise/omniauth_registrations/new.html.erb +5 -1
  253. data/app/views/decidim/devise/omniauth_registrations/new_tos_fields.html.erb +29 -0
  254. data/app/views/decidim/devise/registrations/new.html.erb +10 -22
  255. data/app/views/decidim/devise/sessions/new.html.erb +24 -29
  256. data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +2 -4
  257. data/app/views/decidim/devise/shared/_tos_fields.html.erb +16 -0
  258. data/app/views/decidim/download_your_data/_export.html.erb +15 -0
  259. data/app/views/decidim/download_your_data/show.html.erb +51 -5
  260. data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +16 -19
  261. data/app/views/decidim/export_mailer/download_your_data_export.html.erb +2 -2
  262. data/app/views/decidim/export_mailer/export.html.erb +5 -1
  263. data/app/views/decidim/last_activities/index.html.erb +1 -1
  264. data/app/views/decidim/messaging/conversations/_reply_form.html.erb +2 -1
  265. data/app/views/decidim/messaging/conversations/_start.html.erb +1 -1
  266. data/app/views/decidim/notifications_settings/show.html.erb +22 -0
  267. data/app/views/decidim/open_data/_how_to_open_accordion_section.html.erb +15 -0
  268. data/app/views/decidim/open_data/index.html.erb +108 -0
  269. data/app/views/decidim/pages/show.html.erb +2 -1
  270. data/app/views/decidim/participatory_space_private_users/_participatory_space_private_user.html.erb +1 -0
  271. data/app/views/decidim/reported_mailer/hide.html.erb +9 -0
  272. data/app/views/decidim/reported_mailer/report.html.erb +1 -1
  273. data/app/views/decidim/searches/_count.html.erb +1 -1
  274. data/app/views/decidim/searches/_filters.html.erb +38 -40
  275. data/app/views/decidim/shared/_login_modal.html.erb +26 -20
  276. data/app/views/decidim/shared/_orders.html.erb +2 -2
  277. data/app/views/decidim/shared/_resource_actions.html.erb +21 -0
  278. data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
  279. data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -2
  280. data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
  281. data/app/views/decidim/shared/filters/_dropdown_label.html.erb +7 -4
  282. data/app/views/kaminari/decidim/_page.html.erb +1 -1
  283. data/app/views/kaminari/decidim/_paginator.html.erb +1 -1
  284. data/app/views/layouts/decidim/_application.html.erb +0 -1
  285. data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
  286. data/app/views/layouts/decidim/_logo.html.erb +2 -2
  287. data/app/views/layouts/decidim/_logo_mobile.html.erb +1 -1
  288. data/app/views/layouts/decidim/_meta_tags_config.html.erb +6 -11
  289. data/app/views/layouts/decidim/_schema_org_breadcrumb_list.html.erb +3 -0
  290. data/app/views/layouts/decidim/_wrapper.html.erb +15 -9
  291. data/app/views/layouts/decidim/footer/_main_legal.html.erb +1 -1
  292. data/app/views/layouts/decidim/footer/_main_links.html.erb +1 -1
  293. data/app/views/layouts/decidim/header/_close_ephemeral_session.html.erb +25 -0
  294. data/app/views/layouts/decidim/header/_main.html.erb +14 -10
  295. data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
  296. data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_desktop.html.erb +11 -5
  297. data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +5 -5
  298. data/app/views/layouts/decidim/shared/_layout_item.html.erb +1 -1
  299. data/config/assets.rb +2 -1
  300. data/config/locales/ar.yml +35 -74
  301. data/config/locales/bg.yml +33 -74
  302. data/config/locales/bs-BA.yml +0 -2
  303. data/config/locales/ca.yml +370 -102
  304. data/config/locales/cs.yml +374 -102
  305. data/config/locales/de.yml +350 -88
  306. data/config/locales/el.yml +22 -58
  307. data/config/locales/en.yml +350 -82
  308. data/config/locales/eo.yml +0 -4
  309. data/config/locales/es-MX.yml +364 -99
  310. data/config/locales/es-PY.yml +369 -104
  311. data/config/locales/es.yml +370 -102
  312. data/config/locales/eu.yml +426 -156
  313. data/config/locales/fi-plain.yml +366 -76
  314. data/config/locales/fi.yml +370 -77
  315. data/config/locales/fr-CA.yml +176 -97
  316. data/config/locales/fr.yml +176 -94
  317. data/config/locales/ga-IE.yml +4 -25
  318. data/config/locales/gl.yml +20 -58
  319. data/config/locales/hu.yml +30 -62
  320. data/config/locales/id-ID.yml +21 -57
  321. data/config/locales/is-IS.yml +5 -25
  322. data/config/locales/it.yml +36 -94
  323. data/config/locales/ja.yml +231 -112
  324. data/config/locales/lb.yml +28 -76
  325. data/config/locales/lt.yml +24 -64
  326. data/config/locales/lv.yml +21 -58
  327. data/config/locales/nl.yml +23 -75
  328. data/config/locales/no.yml +23 -70
  329. data/config/locales/pl.yml +30 -72
  330. data/config/locales/pt-BR.yml +41 -63
  331. data/config/locales/pt.yml +23 -70
  332. data/config/locales/ro-RO.yml +115 -184
  333. data/config/locales/ru.yml +13 -43
  334. data/config/locales/sk.yml +24 -70
  335. data/config/locales/sl.yml +0 -4
  336. data/config/locales/sr-CS.yml +0 -2
  337. data/config/locales/sv.yml +138 -106
  338. data/config/locales/tr-TR.yml +29 -75
  339. data/config/locales/uk.yml +6 -29
  340. data/config/locales/zh-CN.yml +21 -68
  341. data/config/locales/zh-TW.yml +23 -62
  342. data/config/routes.rb +4 -10
  343. data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
  344. data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
  345. data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +1 -1
  346. data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +1 -1
  347. data/db/migrate/20181025082245_add_timestamps_to_components.rb +2 -0
  348. data/db/migrate/20190412131728_fix_user_names.rb +1 -1
  349. data/db/migrate/20240628111905_add_visible_to_components.rb +7 -0
  350. data/db/migrate/20240704115429_create_decidim_taxonomies.rb +23 -0
  351. data/db/migrate/20240717093514_add_registered_only_to_decidim_share_tokens.rb +7 -0
  352. data/db/migrate/20240722215500_change_object_changes_on_versions.rb +39 -0
  353. data/db/migrate/20240806065417_create_decidim_taxonomy_filters.rb +23 -0
  354. data/db/migrate/20240822161348_add_deleted_at_to_decidim_components.rb +8 -0
  355. data/db/migrate/20240906162524_add_part_of_to_taxonomies.rb +26 -0
  356. data/db/migrate/20241001135825_add_role_to_participatory_space_private_users.rb +7 -0
  357. data/db/migrate/20241001140408_add_published_to_participatory_space_private_users.rb +7 -0
  358. data/db/migrate/20241022002600_create_private_exports.rb +18 -0
  359. data/db/migrate/20241028114430_add_component_counter_to_taxonomy_filters.rb +7 -0
  360. data/db/migrate/20241111104357_add_names_and_space_boolean_to_taxonomy_filters.rb +9 -0
  361. data/db/migrate/20241127093708_add_taxonomy_to_metrics.rb +7 -0
  362. data/db/migrate/20241204121445_add_participatory_space_manifests_from_taxonomy_filters.rb +9 -0
  363. data/decidim-core.gemspec +14 -17
  364. data/lib/decidim/action_authorization.rb +3 -2
  365. data/lib/decidim/amendable.rb +1 -1
  366. data/lib/decidim/api/input_filters/category_input_filter.rb +5 -3
  367. data/lib/decidim/api/input_filters/component_input_filter.rb +33 -20
  368. data/lib/decidim/api/input_filters/user_entity_input_filter.rb +53 -44
  369. data/lib/decidim/api/input_sorts/component_input_sort.rb +15 -13
  370. data/lib/decidim/api/input_sorts/user_entity_input_sort.rb +4 -4
  371. data/lib/decidim/api/interfaces/author_interface.rb +3 -2
  372. data/lib/decidim/api/interfaces/coauthorable_interface.rb +5 -5
  373. data/lib/decidim/api/interfaces/endorsable_interface.rb +2 -2
  374. data/lib/decidim/api/interfaces/participatory_space_interface.rb +5 -10
  375. data/lib/decidim/api/interfaces/taxonomizable_interface.rb +13 -0
  376. data/lib/decidim/api/types/amendment_type.rb +5 -7
  377. data/lib/decidim/api/types/area_api_type.rb +3 -3
  378. data/lib/decidim/api/types/attachment_type.rb +3 -3
  379. data/lib/decidim/api/types/category_type.rb +2 -2
  380. data/lib/decidim/api/types/decidim_type.rb +5 -1
  381. data/lib/decidim/api/types/fingerprint_type.rb +1 -1
  382. data/lib/decidim/api/types/localized_string_type.rb +1 -1
  383. data/lib/decidim/api/types/metric_history_type.rb +2 -0
  384. data/lib/decidim/api/types/metric_type.rb +1 -1
  385. data/lib/decidim/api/types/organization_type.rb +5 -0
  386. data/lib/decidim/api/types/participatory_space_link_type.rb +2 -2
  387. data/lib/decidim/api/types/participatory_space_manifest_type.rb +1 -1
  388. data/lib/decidim/api/types/quantifiable_translated_field_type.rb +1 -1
  389. data/lib/decidim/api/types/scope_api_type.rb +2 -3
  390. data/lib/decidim/api/types/session_type.rb +1 -2
  391. data/lib/decidim/api/types/taxonomy_type.rb +15 -0
  392. data/lib/decidim/api/types/trace_version_type.rb +2 -2
  393. data/lib/decidim/api/types/translated_field_type.rb +3 -5
  394. data/lib/decidim/api/types/user_group_type.rb +7 -20
  395. data/lib/decidim/api/types/user_type.rb +7 -20
  396. data/lib/decidim/asset_router/storage.rb +6 -11
  397. data/lib/decidim/assets/tailwind/tailwind.config.js.erb +2 -1
  398. data/lib/decidim/attachment_attributes.rb +1 -1
  399. data/lib/decidim/attribute_encryptor.rb +1 -1
  400. data/lib/decidim/attribute_object/nested_validator.rb +1 -1
  401. data/lib/decidim/attributes/integer_with_units.rb +27 -0
  402. data/lib/decidim/attributes/time_with_zone.rb +1 -5
  403. data/lib/decidim/attributes.rb +2 -0
  404. data/lib/decidim/authorization_form_builder.rb +0 -7
  405. data/lib/decidim/coauthorable.rb +1 -1
  406. data/lib/decidim/command.rb +3 -3
  407. data/lib/decidim/commands/destroy_resource.rb +5 -1
  408. data/lib/decidim/commands/resource_handler.rb +2 -2
  409. data/lib/decidim/commands/restore_resource.rb +45 -0
  410. data/lib/decidim/commands/soft_delete_resource.rb +63 -0
  411. data/lib/decidim/component_manifest.rb +7 -0
  412. data/lib/decidim/content_parsers/blob_parser.rb +8 -10
  413. data/lib/decidim/content_parsers/user_parser.rb +1 -1
  414. data/lib/decidim/core/api.rb +2 -0
  415. data/lib/decidim/core/engine.rb +21 -7
  416. data/lib/decidim/core/menu.rb +0 -5
  417. data/lib/decidim/core/seeds.rb +42 -2
  418. data/lib/decidim/core/test/factories.rb +105 -2
  419. data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +85 -0
  420. data/lib/decidim/core/test/shared_examples/comments_examples.rb +393 -38
  421. data/lib/decidim/core/test/shared_examples/components_controller_hide_shared_examples.rb +11 -0
  422. data/lib/decidim/core/test/shared_examples/components_controller_reorder_shared_examples.rb +21 -0
  423. data/lib/decidim/core/test/shared_examples/download_open_data_shared_context.rb +36 -0
  424. data/lib/decidim/core/test/shared_examples/download_open_data_shared_examples.rb +45 -0
  425. data/lib/decidim/core/test/shared_examples/download_your_data_shared_examples.rb +17 -0
  426. data/lib/decidim/core/test/shared_examples/etiquette_validator_examples.rb +25 -0
  427. data/lib/decidim/core/test/shared_examples/follows_examples.rb +43 -0
  428. data/lib/decidim/core/test/shared_examples/has_taxonomies.rb +94 -0
  429. data/lib/decidim/core/test/shared_examples/manage_share_tokens_examples.rb +237 -0
  430. data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -0
  431. data/lib/decidim/core/test/shared_examples/open_data_exporter_examples.rb +102 -0
  432. data/lib/decidim/core/test/shared_examples/participatory_space_members_page_examples.rb +46 -0
  433. data/lib/decidim/core/test/shared_examples/participatory_space_search_examples.rb +98 -0
  434. data/lib/decidim/core/test/shared_examples/permissions.rb +7 -7
  435. data/lib/decidim/core/test/shared_examples/preview_with_share_token_examples.rb +94 -0
  436. data/lib/decidim/core/test/shared_examples/reports_examples.rb +15 -53
  437. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +2 -2
  438. data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +75 -69
  439. data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +1 -1
  440. data/lib/decidim/core/test/shared_examples/simple_event.rb +33 -19
  441. data/lib/decidim/core/test/shared_examples/social_share_examples.rb +7 -14
  442. data/lib/decidim/core/test/shared_examples/softdeleteable_components_examples.rb +173 -0
  443. data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +54 -8
  444. data/lib/decidim/core/test/shared_examples/taxonomizable_interface_examples.rb +20 -0
  445. data/lib/decidim/core/test/shared_examples/taxonomizable_resource_examples.rb +37 -0
  446. data/lib/decidim/core/test/shared_examples/taxonomy_settings.rb +49 -0
  447. data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +1 -1
  448. data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +0 -26
  449. data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +2 -28
  450. data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
  451. data/lib/decidim/core/test.rb +9 -5
  452. data/lib/decidim/core/version.rb +1 -1
  453. data/lib/decidim/core.rb +58 -0
  454. data/lib/decidim/download_your_data_serializers/download_your_data_identity_serializer.rb +0 -4
  455. data/lib/decidim/download_your_data_serializers/download_your_data_participatory_space_private_user_serializer.rb +3 -1
  456. data/lib/decidim/download_your_data_serializers/download_your_data_report_serializer.rb +2 -1
  457. data/lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb +6 -7
  458. data/lib/decidim/download_your_data_serializers.rb +19 -0
  459. data/lib/decidim/exporters/csv.rb +6 -0
  460. data/lib/decidim/exporters/export_manifest.rb +14 -0
  461. data/lib/decidim/exporters/pdf.rb +26 -22
  462. data/lib/decidim/filter_form_builder.rb +12 -15
  463. data/lib/decidim/form_builder.rb +6 -129
  464. data/lib/decidim/has_category.rb +5 -1
  465. data/lib/decidim/has_private_users.rb +4 -0
  466. data/lib/decidim/has_taxonomy_settings.rb +47 -0
  467. data/lib/decidim/has_upload_validations.rb +1 -1
  468. data/lib/decidim/legacy_form_builder.rb +118 -0
  469. data/lib/decidim/maintenance/import_models/application_record.rb +93 -0
  470. data/lib/decidim/maintenance/import_models/area.rb +82 -0
  471. data/lib/decidim/maintenance/import_models/area_type.rb +12 -0
  472. data/lib/decidim/maintenance/import_models/assembly_type.rb +49 -0
  473. data/lib/decidim/maintenance/import_models/categorization.rb +14 -0
  474. data/lib/decidim/maintenance/import_models/category.rb +107 -0
  475. data/lib/decidim/maintenance/import_models/participatory_process_type.rb +21 -0
  476. data/lib/decidim/maintenance/import_models/scope.rb +163 -0
  477. data/lib/decidim/maintenance/import_models.rb +19 -0
  478. data/lib/decidim/maintenance/taxonomy_importer.rb +132 -0
  479. data/lib/decidim/maintenance/taxonomy_plan.rb +78 -0
  480. data/lib/decidim/maintenance.rb +12 -0
  481. data/lib/decidim/map/autocomplete.rb +52 -8
  482. data/lib/decidim/map/dynamic_map.rb +1 -1
  483. data/lib/decidim/map/provider/dynamic_map/here.rb +40 -1
  484. data/lib/decidim/map/provider/geocoding/here.rb +9 -3
  485. data/lib/decidim/map/provider/static_map/here.rb +0 -34
  486. data/lib/decidim/map.rb +3 -6
  487. data/lib/decidim/moderation_tools.rb +16 -19
  488. data/lib/decidim/newsletter_encryptor.rb +1 -1
  489. data/lib/decidim/nicknamizable.rb +9 -6
  490. data/lib/decidim/paddable.rb +1 -1
  491. data/lib/decidim/participable.rb +10 -10
  492. data/lib/decidim/participatory_space_user.rb +10 -0
  493. data/lib/decidim/private_download_helper.rb +15 -0
  494. data/lib/decidim/record_encryptor.rb +51 -46
  495. data/lib/decidim/reportable.rb +2 -6
  496. data/lib/decidim/resourceable.rb +16 -0
  497. data/lib/decidim/seeds.rb +18 -20
  498. data/lib/decidim/settings_manifest.rb +34 -1
  499. data/lib/decidim/soft_deletable.rb +17 -0
  500. data/lib/decidim/taxonomizable.rb +72 -0
  501. data/lib/decidim/translatable_attributes.rb +1 -5
  502. data/lib/decidim/view_model.rb +0 -1
  503. data/lib/tasks/decidim_download_your_data_tasks.rake +2 -4
  504. data/lib/tasks/decidim_procfile.rake +6 -0
  505. data/lib/tasks/decidim_tasks.rake +1 -0
  506. data/lib/tasks/decidim_taxonomies.rake +155 -0
  507. data/lib/tasks/upgrade/{decidim_fix_categorization.rake → clean.rake} +25 -18
  508. data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +1 -1
  509. data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +20 -23
  510. data/lib/tasks/upgrade/migrations.rake +91 -0
  511. metadata +203 -112
  512. data/app/cells/decidim/amendable/amenders_list/show.erb +0 -0
  513. data/app/cells/decidim/content_blocks/base/content.erb +0 -0
  514. data/app/cells/decidim/endorsers_list/full_endorsers_list.erb +0 -3
  515. data/app/cells/decidim/endorsers_list_button/content.erb +0 -1
  516. data/app/cells/decidim/endorsers_list_button_cell.rb +0 -15
  517. data/app/cells/decidim/report_user_button/already_reported_modal.erb +0 -11
  518. data/app/cells/decidim/report_user_button/flag_modal.erb +0 -46
  519. data/app/cells/decidim/report_user_button/show.erb +0 -2
  520. data/app/cells/decidim/report_user_button_cell.rb +0 -59
  521. data/app/cells/decidim/scopes_picker/scope_picker_prompt.erb +0 -3
  522. data/app/cells/decidim/scopes_picker/scope_picker_values.erb +0 -5
  523. data/app/cells/decidim/scopes_picker/show.erb +0 -14
  524. data/app/cells/decidim/scopes_picker_cell.rb +0 -92
  525. data/app/commands/decidim/update_user_interests.rb +0 -41
  526. data/app/controllers/decidim/scopes_controller.rb +0 -84
  527. data/app/controllers/decidim/user_interests_controller.rb +0 -30
  528. data/app/forms/decidim/user_interest_scope_form.rb +0 -25
  529. data/app/forms/decidim/user_interests_form.rb +0 -17
  530. data/app/helpers/decidim/categories_helper.rb +0 -26
  531. data/app/helpers/decidim/scopes_helper.rb +0 -105
  532. data/app/jobs/decidim/hide_child_resources_job.rb +0 -24
  533. data/app/packs/images/decidim/vendor/leaflet/layers-2x.png +0 -0
  534. data/app/packs/images/decidim/vendor/leaflet/layers.png +0 -0
  535. data/app/packs/images/decidim/vendor/leaflet/marker-icon-2x.png +0 -0
  536. data/app/packs/images/decidim/vendor/leaflet/marker-icon.png +0 -0
  537. data/app/packs/images/decidim/vendor/leaflet/marker-shadow.png +0 -0
  538. data/app/packs/stylesheets/decidim/_hashtags.scss +0 -5
  539. data/app/packs/stylesheets/decidim/legacy/MarkerCluster.Default.scss +0 -67
  540. data/app/packs/stylesheets/decidim/legacy/MarkerCluster.scss +0 -18
  541. data/app/packs/stylesheets/decidim/legacy/leaflet.scss +0 -705
  542. data/app/validators/scope_belongs_to_component_validator.rb +0 -16
  543. data/app/views/decidim/account/_user_groups.html.erb +0 -0
  544. data/app/views/decidim/reported_mailer/hidden_automatically.html.erb +0 -25
  545. data/app/views/decidim/reported_mailer/hidden_manually.html.erb +0 -25
  546. data/app/views/decidim/scopes/_scopes_picker_input.html.erb +0 -19
  547. data/app/views/decidim/scopes/picker.html.erb +0 -53
  548. data/app/views/decidim/shared/_comments.html.erb +0 -0
  549. data/app/views/decidim/shared/_share_modal.html.erb +0 -26
  550. data/app/views/decidim/shared/_tags.html.erb +0 -1
  551. data/app/views/decidim/user_interests/_areas.html.erb +0 -14
  552. data/app/views/decidim/user_interests/_scopes.html.erb +0 -22
  553. data/app/views/decidim/user_interests/show.html.erb +0 -22
  554. data/config/initializers/foundation_rails_helper.rb +0 -4
  555. data/config/locales/ca-IT.yml +0 -2122
  556. data/lib/decidim/core/test/shared_examples/has_category.rb +0 -38
  557. data/lib/decidim/core/test/shared_examples/has_scope.rb +0 -11
  558. data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +0 -83
  559. data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +0 -49
  560. data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +0 -93
  561. data/lib/decidim/seven_zip_wrapper.rb +0 -29
  562. data/lib/tasks/upgrade/clean_hidden_resources.rake +0 -33
@@ -5,12 +5,14 @@
5
5
  * it to gain control over the confirm events BEFORE rails-ujs is loaded.
6
6
  */
7
7
 
8
- import Rails from "@rails/ujs"
8
+ const { Rails } = window;
9
9
 
10
10
  class ConfirmDialog {
11
11
  constructor(sourceElement) {
12
12
  this.$modal = $("#confirm-modal");
13
- this.$source = sourceElement;
13
+ if (sourceElement) {
14
+ this.$source = $(sourceElement);
15
+ }
14
16
  this.$content = $("[data-confirm-modal-content]", this.$modal);
15
17
  this.$buttonConfirm = $("[data-confirm-ok]", this.$modal);
16
18
  this.$buttonCancel = $("[data-confirm-cancel]", this.$modal);
@@ -29,22 +31,37 @@ class ConfirmDialog {
29
31
  this.$buttonConfirm.on("click", (ev) => {
30
32
  ev.preventDefault();
31
33
 
32
- window.Decidim.currentDialogs["confirm-modal"].close()
33
- resolve(true);
34
- this.$source.focus();
34
+ this.close(() => resolve(true));
35
35
  });
36
36
 
37
37
  this.$buttonCancel.on("click", (ev) => {
38
38
  ev.preventDefault();
39
39
 
40
- window.Decidim.currentDialogs["confirm-modal"].close()
41
- resolve(false);
42
- this.$source.focus();
40
+ this.close(() => resolve(false));
43
41
  });
44
42
  });
45
43
  }
44
+
45
+ close(afterClose) {
46
+ window.Decidim.currentDialogs["confirm-modal"].close()
47
+ afterClose();
48
+ if (this.$source) {
49
+ this.$source.focus();
50
+ }
51
+ }
46
52
  }
47
53
 
54
+ const runConfirm = (message, sourceElement = null) => new Promise((resolve) => {
55
+ const dialog = new ConfirmDialog(sourceElement);
56
+ dialog.confirm(message).then((answer) => {
57
+ let completed = true;
58
+ if (sourceElement) {
59
+ completed = Rails.fire(sourceElement, "confirm:complete", [answer]);
60
+ }
61
+ resolve(answer && completed);
62
+ });
63
+ });
64
+
48
65
  // Override the default confirm dialog by Rails
49
66
  // See:
50
67
  // https://github.com/rails/rails/blob/fba1064153d8e2f4654df7762a7d3664b93e9fc8/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee
@@ -64,37 +81,35 @@ const allowAction = (ev, element) => {
64
81
  return false;
65
82
  }
66
83
 
67
- const dialog = new ConfirmDialog(
68
- $(element)
69
- );
70
- dialog.confirm(message).then((answer) => {
71
- const completed = Rails.fire(element, "confirm:complete", [answer]);
72
- if (answer && completed) {
73
- // Allow the event to propagate normally and re-dispatch it without
74
- // the confirm data attribute which the Rails internal method is
75
- // checking.
76
- $(element).data("confirm", null);
77
- $(element).removeAttr("data-confirm");
78
-
79
- // The submit button click events will not do anything if they are
80
- // dispatched as is. In these cases, just submit the underlying form.
81
- if (ev.type === "click" &&
82
- (
83
- $(element).is('button[type="submit"]') ||
84
- $(element).is('input[type="submit"]')
85
- )
86
- ) {
87
- $(element).parents("form").submit();
88
- } else {
89
- let origEv = ev.originalEvent || ev;
90
- let newEv = origEv;
91
- if (typeof Event === "function") {
92
- // Clone the event because otherwise some click events may not
93
- // work properly when re-dispatched.
94
- newEv = new origEv.constructor(origEv.type, origEv);
95
- }
96
- ev.target.dispatchEvent(newEv);
84
+ runConfirm(message, element).then((answer) => {
85
+ if (!answer) {
86
+ return;
87
+ }
88
+
89
+ // Allow the event to propagate normally and re-dispatch it without
90
+ // the confirm data attribute which the Rails internal method is
91
+ // checking.
92
+ $(element).data("confirm", null);
93
+ $(element).removeAttr("data-confirm");
94
+
95
+ // The submit button click events will not do anything if they are
96
+ // dispatched as is. In these cases, just submit the underlying form.
97
+ if (ev.type === "click" &&
98
+ (
99
+ $(element).is('button[type="submit"]') ||
100
+ $(element).is('input[type="submit"]')
101
+ )
102
+ ) {
103
+ $(element).parents("form").submit();
104
+ } else {
105
+ let origEv = ev.originalEvent || ev;
106
+ let newEv = origEv;
107
+ if (typeof Event === "function") {
108
+ // Clone the event because otherwise some click events may not
109
+ // work properly when re-dispatched.
110
+ newEv = new origEv.constructor(origEv.type, origEv);
97
111
  }
112
+ ev.target.dispatchEvent(newEv);
98
113
  }
99
114
  });
100
115
 
@@ -129,26 +144,31 @@ const handleDocumentEvent = (ev, matchSelectors) => {
129
144
  });
130
145
  };
131
146
 
132
- document.addEventListener("click", (ev) => {
133
- return handleDocumentEvent(ev, [
134
- Rails.linkClickSelector,
135
- Rails.buttonClickSelector,
136
- Rails.formInputClickSelector
137
- ]);
138
- });
139
- document.addEventListener("change", (ev) => {
140
- return handleDocumentEvent(ev, [Rails.inputChangeSelector]);
141
- });
142
- document.addEventListener("submit", (ev) => {
143
- return handleDocumentEvent(ev, [Rails.formSubmitSelector]);
144
- });
147
+ // Note that this needs to be run **before** Rails.start()
148
+ export const initializeConfirm = () => {
149
+ document.addEventListener("click", (ev) => {
150
+ return handleDocumentEvent(ev, [
151
+ Rails.linkClickSelector,
152
+ Rails.buttonClickSelector,
153
+ Rails.formInputClickSelector
154
+ ]);
155
+ });
156
+ document.addEventListener("change", (ev) => {
157
+ return handleDocumentEvent(ev, [Rails.inputChangeSelector]);
158
+ });
159
+ document.addEventListener("submit", (ev) => {
160
+ return handleDocumentEvent(ev, [Rails.formSubmitSelector]);
161
+ });
145
162
 
146
- // This is needed for the confirm dialog to work with Foundation Abide.
147
- // Abide registers its own submit click listeners since Foundation 5.6.x
148
- // which will be handled before the document listeners above. This would
149
- // break the custom confirm functionality when used with Foundation Abide.
150
- document.addEventListener("DOMContentLoaded", function() {
151
- $(Rails.formInputClickSelector).on("click.confirm", (ev) => {
152
- handleConfirm(ev, getMatchingEventTarget(ev, Rails.formInputClickSelector));
163
+ // This is needed for the confirm dialog to work with Foundation Abide.
164
+ // Abide registers its own submit click listeners since Foundation 5.6.x
165
+ // which will be handled before the document listeners above. This would
166
+ // break the custom confirm functionality when used with Foundation Abide.
167
+ document.addEventListener("DOMContentLoaded", function() {
168
+ $(Rails.formInputClickSelector).on("click.confirm", (ev) => {
169
+ handleConfirm(ev, getMatchingEventTarget(ev, Rails.formInputClickSelector));
170
+ });
153
171
  });
154
- });
172
+ };
173
+
174
+ export default runConfirm;
@@ -29,12 +29,12 @@ export const formatInputDate = (date, formats) => {
29
29
  const month = dateList[1];
30
30
  const day = dateList[2];
31
31
 
32
- if (formats.order === "m-d-y") {
33
- return `${month}${formats.separator}${day}${formats.separator}${year}`;
32
+ if (formats.order === "d-m-y") {
33
+ return `${day}${formats.separator}${month}${formats.separator}${year}`;
34
34
  } else if (formats.order === "y-m-d") {
35
35
  return `${year}${formats.separator}${month}${formats.separator}${day}`;
36
36
  };
37
- return `${day}${formats.separator}${month}${formats.separator}${year}`;
37
+ return `${month}${formats.separator}${day}${formats.separator}${year}`;
38
38
  };
39
39
 
40
40
  export const formatInputTime = (time, format, input) => {
@@ -0,0 +1 @@
1
+ // This file is intentionally empty, because is the place for the defidim applications will add their JavaScript code.
@@ -1,4 +1,4 @@
1
- import Rails from "@rails/ujs";
1
+ const { Rails } = window;
2
2
 
3
3
  // Make the remote form submit buttons disabled when the form is being
4
4
  // submitted to avoid multiple submits.
@@ -0,0 +1,60 @@
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ const info = (target, msg) => {
3
+ const label = target.closest("label");
4
+ label.querySelectorAll(".form-error").forEach((el) => el.remove());
5
+ if (msg) {
6
+ const error = document.createElement("span");
7
+ error.className = "form-error";
8
+ error.textContent = msg;
9
+ label.appendChild(error);
10
+ error.style.display = "block";
11
+ }
12
+ };
13
+
14
+ const setLocating = (button, enable) => {
15
+ if (enable) {
16
+ button.setAttribute("disabled", true);
17
+ } else {
18
+ button.removeAttribute("disabled");
19
+ }
20
+ };
21
+
22
+ document.querySelectorAll(".user-device-location button").forEach((button) => {
23
+ button.addEventListener("click", (event) => {
24
+ const target = event.target;
25
+ if (target.disabled) {
26
+ return;
27
+ }
28
+
29
+ const input = document.getElementById(target.dataset.input);
30
+ const errorNoLocation = target.dataset.errorNoLocation;
31
+ const errorUnsupported = target.dataset.errorUnsupported;
32
+ const url = target.dataset.url;
33
+
34
+ if (navigator.geolocation) {
35
+ setLocating(target, true);
36
+ navigator.geolocation.getCurrentPosition((position) => {
37
+ const coordinates = [position.coords.latitude, position.coords.longitude];
38
+
39
+ // reverse geolocation
40
+ $.post(url, { latitude: coordinates[0], longitude: coordinates[1] }, (data) => {
41
+ input.value = data.address;
42
+ $(input).trigger("geocoder-suggest-coordinates.decidim", [coordinates]);
43
+ }).fail((xhr, status, error) => {
44
+ info(input, `${errorNoLocation} ${error}`);
45
+ });
46
+
47
+ setLocating(target, false);
48
+
49
+ }, (evt) => {
50
+ info(input, `${errorNoLocation} ${evt.message}`);
51
+ target.removeAttribute("disabled");
52
+ }, {
53
+ enableHighAccuracy: true
54
+ });
55
+ } else {
56
+ info(input, errorUnsupported);
57
+ }
58
+ });
59
+ });
60
+ });
@@ -15,7 +15,7 @@ $(() => {
15
15
  }, 1000);
16
16
 
17
17
  // Prevent reload when page is already unloading, otherwise it may cause infinite reloads.
18
- window.addEventListener("beforeunload", () => {
18
+ window.addEventListener("pagehide", () => {
19
19
  clearInterval(exitInterval);
20
20
  return;
21
21
  });
@@ -8,6 +8,7 @@
8
8
  import "core-js/stable";
9
9
  import "regenerator-runtime/runtime";
10
10
  import "jquery"
11
+ import "chartkick/chart.js"
11
12
 
12
13
  // REDESIGN_PENDING: deprecated
13
14
  import "foundation-sites";
@@ -41,7 +42,6 @@ import "src/decidim/vizzs"
41
42
  import "src/decidim/responsive_horizontal_tabs"
42
43
  import "src/decidim/security/selfxss_warning"
43
44
  import "src/decidim/session_timeouter"
44
- import "src/decidim/confirm"
45
45
  import "src/decidim/results_listing"
46
46
  import "src/decidim/impersonation"
47
47
  import "src/decidim/gallery"
@@ -50,9 +50,11 @@ import "src/decidim/data_consent"
50
50
  import "src/decidim/abide_form_validator_fixer"
51
51
  import "src/decidim/sw"
52
52
  import "src/decidim/sticky_header"
53
+ import "src/decidim/sticky_footer"
53
54
  import "src/decidim/attachments"
54
55
 
55
56
  // local deps that require initialization
57
+ import ConfirmDialog, { initializeConfirm } from "src/decidim/confirm"
56
58
  import formDatePicker from "src/decidim/datepicker/form_datepicker"
57
59
  import Configuration from "src/decidim/configuration"
58
60
  import ExternalLink from "src/decidim/external_link"
@@ -69,8 +71,7 @@ import handleNotificationActions from "src/decidim/notifications_actions"
69
71
  import RemoteModal from "src/decidim/remote_modal"
70
72
  import selectActiveIdentity from "src/decidim/identity_selector_dialog"
71
73
  import createTooltip from "src/decidim/tooltips"
72
- // Temporary disabling this feature because we have a poor performance. See https://github.com/decidim/decidim/issues/14431
73
- // import fetchRemoteTooltip from "src/decidim/remote_tooltips"
74
+ import fetchRemoteTooltip from "src/decidim/remote_tooltips"
74
75
  import createToggle from "src/decidim/toggle"
75
76
  import {
76
77
  createAccordion,
@@ -80,6 +81,7 @@ import {
80
81
  Dialogs
81
82
  } from "src/decidim/a11y"
82
83
  import changeReportFormBehavior from "src/decidim/change_report_form_behavior"
84
+ import setOnboardingAction from "src/decidim/onboarding_pending_action"
83
85
 
84
86
  // bad practice: window namespace should avoid be populated as much as possible
85
87
  // rails-translations could be referenced through a single Decidim.I18n object
@@ -91,6 +93,7 @@ window.Decidim = window.Decidim || {
91
93
  addInputEmoji,
92
94
  EmojiButton,
93
95
  Dialogs,
96
+ ConfirmDialog,
94
97
  announceForScreenReader
95
98
  };
96
99
 
@@ -123,6 +126,8 @@ window.initFoundation = (element) => {
123
126
  });
124
127
  };
125
128
 
129
+ // Confirm initialization needs to happen before Rails.start()
130
+ initializeConfirm();
126
131
  Rails.start()
127
132
 
128
133
  /**
@@ -197,10 +202,13 @@ const initializer = (element = document) => {
197
202
  // Initialize data-toggles
198
203
  element.querySelectorAll("[data-toggle]").forEach((elem) => createToggle(elem))
199
204
 
200
- // Temporary disabling this feature because we have a poor performance. See https://github.com/decidim/decidim/issues/14431
201
- // element.querySelectorAll("[data-remote-tooltip]").forEach((elem) => fetchRemoteTooltip(elem))
205
+ element.querySelectorAll("[data-remote-tooltip]").forEach((elem) => fetchRemoteTooltip(elem))
202
206
 
203
207
  element.querySelectorAll(".new_report").forEach((elem) => changeReportFormBehavior(elem))
208
+
209
+ element.querySelectorAll("[data-onboarding-action]").forEach((elem) => setOnboardingAction(elem))
210
+
211
+ document.dispatchEvent(new CustomEvent("decidim:loaded", { detail: { element } }));
204
212
  }
205
213
 
206
214
  // If no jQuery is used the Tribute feature used in comments to autocomplete
@@ -93,7 +93,7 @@ export default class InputCharacterCounter {
93
93
  this.$srTarget = $(`#${screenReaderId}`);
94
94
  if (!this.$srTarget.length) {
95
95
  this.$srTarget = $(
96
- `<span role="status" id="${screenReaderId}" class="sr-only remaining-character-count-sr" aria-hidden="true"/>`
96
+ `<span role="status" id="${screenReaderId}" class="sr-only remaining-character-count-sr" />`
97
97
  );
98
98
  this.$target.before(this.$srTarget);
99
99
  }
@@ -1,5 +1,5 @@
1
1
  import "leaflet"
2
- import "leaflet-tilelayer-here"
2
+ import "src/decidim/vendor/leaflet-tilelayer-here"
3
3
 
4
4
  /**
5
5
  * NOTE:
@@ -0,0 +1,24 @@
1
+ import Cookies from "js-cookie";
2
+
3
+ const ONBOARDING_COOKIE_EXPIRY = 365;
4
+
5
+ // The same key is set in the Decidim::OnboardingManager class to retrieve the data from the cookie and store it in the extended data attribute
6
+ const DATA_KEY = "onboarding";
7
+
8
+ /**
9
+ * @param {DOMElement} element Element which provides the information for cookie about action to perform.
10
+ * @return {Void} Nothing
11
+ */
12
+ export default function setOnboardingAction(element) {
13
+ // the dialog-open data attribute is stealing the click event
14
+ element.addEventListener("mousedown", () => {
15
+ const action = element.dataset.onboardingAction;
16
+ const model = element.dataset.onboardingModel;
17
+ const permissionsHolder = element.dataset.onboardingPermissionsHolder;
18
+ const redirectPath = element.dataset.onboardingRedirectPath;
19
+
20
+ Cookies.set(DATA_KEY, JSON.stringify({ action, model, permissionsHolder, redirectPath }), {
21
+ expires: ONBOARDING_COOKIE_EXPIRY
22
+ });
23
+ });
24
+ }
@@ -127,7 +127,7 @@ $(() => {
127
127
  setTimer(timeoutInSeconds);
128
128
  });
129
129
 
130
- window.addEventListener("beforeunload", () => {
130
+ window.addEventListener("pagehide", () => {
131
131
  clearInterval(exitInterval);
132
132
  return;
133
133
  });
@@ -0,0 +1,29 @@
1
+ // This script add margin to the footer when the sticky CTA Buttons are shown on mobile devices,
2
+ // so the footer is always visible.
3
+ //
4
+ // The sticky buttons show some of the main Call to Actions (CTAs) so that they remain accessible on the
5
+ // screen as the participant scrolls through the detailed view of the Meetings, Proposals, Surveys, and Budgets
6
+ // components.
7
+ //
8
+
9
+ const footer = document.querySelector("footer");
10
+ const stickyButtons = document.querySelector("[data-sticky-buttons]");
11
+
12
+ const adjustCtasButtons = () => {
13
+ if (!stickyButtons) {
14
+ return;
15
+ }
16
+
17
+ const marginBottom = stickyButtons.offsetHeight;
18
+ footer.style.marginBottom = `${marginBottom}px`;
19
+ };
20
+
21
+ if (stickyButtons) {
22
+ document.addEventListener("scroll", () => {
23
+ adjustCtasButtons();
24
+ });
25
+
26
+ document.addEventListener("on:toggle", () => {
27
+ adjustCtasButtons();
28
+ });
29
+ }
@@ -1,33 +1,14 @@
1
- // This script implements the sticky header and the sticky buttons. The sticky header hides when participants scroll down and shows when they scroll up.
2
- // Sticky headers allow users to quickly access the navigation, search, and utility-navigation elements without scrolling up to the top of the page. They increase the discoverability of the elements in the header.
3
- // The sticky buttons in the other hand, those are some of the main Call to Actions (CTAs) that remain accessible on the screen as the user scrolls through the detailed view of the Meetings, Proposals, Surveys, and Budgets components.
1
+ // This script implements the sticky header on mobile devices.
2
+ //
3
+ // The sticky header hides when participants scroll down and shows when they scroll up.
4
+ // Sticky headers allow users to quickly access the navigation, search, and utility-navigation
5
+ // elements without scrolling up to the top of the page. They increase the discoverability of the elements in the header.
6
+ //
4
7
 
5
8
  import { screens } from "tailwindcss/defaultTheme"
6
9
 
7
10
  let prevScroll = window.scrollY;
8
11
  const stickyHeader = document.querySelector("[data-sticky-header]");
9
- const footer = document.querySelector("footer");
10
- const stickyButtons = document.querySelectorAll("[data-sticky-buttons]");
11
-
12
- const isElementInViewport = (element) => {
13
- const rect = element.getBoundingClientRect();
14
- return rect.top >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight);
15
- };
16
-
17
- const adjustCtasButtons = () => {
18
- if (!stickyButtons || !stickyButtons.length) {
19
- return;
20
- }
21
-
22
- let visibleButtons = Array.from(stickyButtons).filter(isElementInViewport);
23
-
24
- if (visibleButtons.length > 0) {
25
- const marginBottom = Math.max(...visibleButtons.map((ctasButton) => ctasButton.offsetHeight));
26
- footer.style.marginBottom = `${marginBottom}px`;
27
- } else {
28
- footer.style.marginBottom = 0;
29
- }
30
- };
31
12
 
32
13
  // Fix the menu bar container margin top when there are multiple elements in the sticky header
33
14
  // As there could be different heights and we cannot know beforehand, we need to adjust this in a dynamic way
@@ -76,12 +57,6 @@ if (stickyHeader) {
76
57
  }
77
58
  prevScroll = currentScroll;
78
59
  }
79
-
80
- adjustCtasButtons();
81
60
  }
82
61
  });
83
-
84
- document.addEventListener("on:toggle", () => {
85
- adjustCtasButtons();
86
- });
87
62
  };
@@ -2,6 +2,7 @@ import PasswordToggler from "src/decidim/password_toggler";
2
2
 
3
3
  $(() => {
4
4
  const $userRegistrationForm = $("#register-form");
5
+ const $userOmniauthRegistrationForm = $("#omniauth-register-form");
5
6
  const $userGroupFields = $userRegistrationForm.find(".user-group-fields");
6
7
  const userPassword = document.querySelector(".user-password");
7
8
  const inputSelector = 'input[name="user[sign_up_as]"]';
@@ -19,9 +20,11 @@ $(() => {
19
20
 
20
21
  const checkNewsletter = (check) => {
21
22
  $userRegistrationForm.find(newsletterSelector).prop("checked", check);
23
+ $userOmniauthRegistrationForm.find(newsletterSelector).prop("checked", check);
22
24
  $newsletterModal.data("continue", true);
23
25
  window.Decidim.currentDialogs["sign-up-newsletter-modal"].close()
24
26
  $userRegistrationForm.submit();
27
+ $userOmniauthRegistrationForm.submit();
25
28
  }
26
29
 
27
30
  setGroupFieldsVisibility($userRegistrationForm.find(`${inputSelector}:checked`).val());
@@ -42,6 +45,16 @@ $(() => {
42
45
  }
43
46
  });
44
47
 
48
+ $userOmniauthRegistrationForm.on("submit", (event) => {
49
+ const newsletterChecked = $userOmniauthRegistrationForm.find(newsletterSelector);
50
+ if (!$newsletterModal.data("continue")) {
51
+ if (!newsletterChecked.prop("checked")) {
52
+ event.preventDefault();
53
+ window.Decidim.currentDialogs["sign-up-newsletter-modal"].open()
54
+ }
55
+ }
56
+ });
57
+
45
58
  $newsletterModal.find("[data-check]").on("click", (event) => {
46
59
  checkNewsletter($(event.target).data("check"));
47
60
  });