decidim-core 0.20.0 → 0.23.1.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-core might be problematic. Click here for more details.

Files changed (836) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_core_manifest.js +8 -0
  3. data/app/assets/fonts/decidim/Roboto-Regular.eot +0 -0
  4. data/app/assets/fonts/decidim/Roboto-Regular.svg +1 -0
  5. data/app/assets/fonts/decidim/Roboto-Regular.ttf +0 -0
  6. data/app/assets/fonts/decidim/Roboto-Regular.woff +0 -0
  7. data/app/assets/fonts/decidim/Roboto-Regular.woff2 +0 -0
  8. data/app/assets/fonts/decidim/Source_Sans_Pro_400.svg +1 -345
  9. data/app/assets/fonts/decidim/Source_Sans_Pro_600.svg +1 -339
  10. data/app/assets/fonts/decidim/Source_Sans_Pro_900.svg +1 -342
  11. data/app/assets/images/decidim/avatar-multiuser.png +0 -0
  12. data/app/assets/images/decidim/brands/google.svg +1 -0
  13. data/app/assets/images/decidim/decidim-logo.svg +1 -71
  14. data/app/assets/images/decidim/default-avatar.svg +1 -14
  15. data/app/assets/images/decidim/gamification/badges/followers.svg +1 -115
  16. data/app/assets/images/decidim/gamification/badges/invitations.svg +1 -117
  17. data/app/assets/images/decidim/icons.svg +1 -259
  18. data/app/assets/images/decidim/placeholder.jpg +0 -0
  19. data/app/assets/javascripts/decidim.js.es6 +30 -1
  20. data/app/assets/javascripts/decidim/ajax_modals.js.es6 +6 -3
  21. data/app/assets/javascripts/decidim/assets.js.erb +5 -0
  22. data/app/assets/javascripts/decidim/callout.js.es6 +18 -0
  23. data/app/assets/javascripts/decidim/check_boxes_tree.js.es6 +190 -0
  24. data/app/assets/javascripts/decidim/configuration.js.es6 +23 -0
  25. data/app/assets/javascripts/decidim/confirm.js.es6 +179 -0
  26. data/app/assets/javascripts/decidim/conversations.js.es6 +17 -0
  27. data/app/assets/javascripts/decidim/core/bundle.js +1 -1
  28. data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
  29. data/app/assets/javascripts/decidim/core/extrapoly.js +6 -0
  30. data/app/assets/javascripts/decidim/data_picker.js.es6 +128 -50
  31. data/app/assets/javascripts/decidim/delayed.js.es6 +26 -0
  32. data/app/assets/javascripts/decidim/diff_mode_dropdown.js.es6 +39 -6
  33. data/app/assets/javascripts/decidim/dropdowns_menus.js.es6 +32 -0
  34. data/app/assets/javascripts/decidim/editor.js.es6 +3 -3
  35. data/app/assets/javascripts/decidim/external_link.js.es6 +69 -0
  36. data/app/assets/javascripts/decidim/floating_help.js.es6 +7 -0
  37. data/app/assets/javascripts/decidim/form_filter.component.js.es6 +87 -39
  38. data/app/assets/javascripts/decidim/form_filter.component.test.js +43 -9
  39. data/app/assets/javascripts/decidim/form_validator.es6 +61 -0
  40. data/app/assets/javascripts/decidim/foundation.js.es6 +28 -28
  41. data/app/assets/javascripts/decidim/geocoding.js.es6 +60 -0
  42. data/app/assets/javascripts/decidim/geocoding/attach_input.js.es6 +106 -0
  43. data/app/assets/javascripts/decidim/geocoding/format_address.js.es6 +29 -0
  44. data/app/assets/javascripts/decidim/geocoding/provider/here.js.es6 +107 -0
  45. data/app/assets/javascripts/decidim/geocoding/provider/photon.js.es6 +77 -0
  46. data/app/assets/javascripts/decidim/history.js.es6 +16 -1
  47. data/app/assets/javascripts/decidim/icon.js.es6 +42 -0
  48. data/app/assets/javascripts/decidim/identity_selector_dialog.js.es6 +61 -0
  49. data/app/assets/javascripts/decidim/input_character_counter.js.es6 +115 -0
  50. data/app/assets/javascripts/decidim/input_mentions.js.es6 +34 -9
  51. data/app/assets/javascripts/decidim/input_multiple_mentions.js.es6 +195 -0
  52. data/app/assets/javascripts/decidim/map.js.es6 +35 -84
  53. data/app/assets/javascripts/decidim/map/controller.js.es6 +92 -0
  54. data/app/assets/javascripts/decidim/map/controller/markers.js.es6 +65 -0
  55. data/app/assets/javascripts/decidim/map/controller/static.es6 +48 -0
  56. data/app/assets/javascripts/decidim/map/factory.js.es6 +51 -0
  57. data/app/assets/javascripts/decidim/map/icon.js.es6 +31 -0
  58. data/app/assets/javascripts/decidim/map/legacy.js.es6 +87 -0
  59. data/app/assets/javascripts/decidim/map/provider/default.js.es6 +22 -0
  60. data/app/assets/javascripts/decidim/map/provider/here.js.es6 +22 -0
  61. data/app/assets/javascripts/decidim/orders.js.es6 +9 -28
  62. data/app/assets/javascripts/decidim/responsive_horizontal_tabs.js.es6 +12 -0
  63. data/app/assets/javascripts/decidim/results_listing.js.es6 +44 -0
  64. data/app/assets/javascripts/decidim/security/selfxss_warning.js.es6 +19 -0
  65. data/app/assets/javascripts/decidim/start_conversation_dialog.js +13 -0
  66. data/app/assets/javascripts/decidim/vizzs.js.es6 +1 -0
  67. data/app/assets/stylesheets/decidim/_decidim-settings.scss +5 -0
  68. data/app/assets/stylesheets/decidim/_decidim.scss +15 -11
  69. data/app/assets/stylesheets/decidim/_properties.scss +25 -0
  70. data/app/assets/stylesheets/decidim/_variables.scss +7 -25
  71. data/app/assets/stylesheets/decidim/application.scss.erb +2 -2
  72. data/app/assets/stylesheets/decidim/editor.scss +2 -2
  73. data/app/assets/stylesheets/decidim/email.scss +1771 -0
  74. data/app/assets/stylesheets/decidim/extras/_external-links.scss +29 -0
  75. data/app/assets/stylesheets/decidim/extras/_extras.scss +17 -0
  76. data/app/assets/stylesheets/decidim/extras/_label-required.scss +9 -0
  77. data/app/assets/stylesheets/decidim/extras/_process_stats.scss +1 -1
  78. data/app/assets/stylesheets/decidim/extras/_quill.scss +5 -0
  79. data/app/assets/stylesheets/decidim/extras/_results-per-page.scss +8 -1
  80. data/app/assets/stylesheets/decidim/layouts/_home.scss +31 -7
  81. data/app/assets/stylesheets/decidim/layouts/_layouts.scss +5 -0
  82. data/app/assets/stylesheets/decidim/layouts/_logo.scss +26 -0
  83. data/app/assets/stylesheets/decidim/layouts/_user.scss +4 -0
  84. data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +9 -13
  85. data/app/assets/stylesheets/decidim/modules/_buttons.scss +273 -28
  86. data/app/assets/stylesheets/decidim/modules/_cards.scss +189 -23
  87. data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +21 -0
  88. data/app/assets/stylesheets/decidim/modules/_comments.scss +102 -2
  89. data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +0 -1
  90. data/app/assets/stylesheets/decidim/modules/_confirm.scss +5 -0
  91. data/app/assets/stylesheets/decidim/modules/_conversation.scss +50 -0
  92. data/app/assets/stylesheets/decidim/modules/_data-picker.scss +9 -11
  93. data/app/assets/stylesheets/decidim/modules/_definition-data.scss +6 -1
  94. data/app/assets/stylesheets/decidim/modules/_docs-manager.scss +0 -1
  95. data/app/assets/stylesheets/decidim/modules/_extra.scss +0 -2
  96. data/app/assets/stylesheets/decidim/modules/_filters.scss +61 -3
  97. data/app/assets/stylesheets/decidim/modules/_floating-helper.scss +20 -8
  98. data/app/assets/stylesheets/decidim/modules/_footer.scss +8 -4
  99. data/app/assets/stylesheets/decidim/modules/_forms.scss +77 -4
  100. data/app/assets/stylesheets/decidim/modules/_horizontal-tabs.scss +64 -1
  101. data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +6 -3
  102. data/app/assets/stylesheets/decidim/modules/_input-gallery.scss +10 -0
  103. data/app/assets/stylesheets/decidim/modules/_input-mentions.scss +25 -7
  104. data/app/assets/stylesheets/decidim/modules/_input-multiple-mentions.scss +5 -0
  105. data/app/assets/stylesheets/decidim/modules/_layout.scss +21 -0
  106. data/app/assets/stylesheets/decidim/modules/_map.scss +46 -0
  107. data/app/assets/stylesheets/decidim/modules/_margins.scss +8 -7
  108. data/app/assets/stylesheets/decidim/modules/_messages.scss +18 -18
  109. data/app/assets/stylesheets/decidim/modules/_modules.scss +75 -71
  110. data/app/assets/stylesheets/decidim/modules/_navbar.scss +187 -31
  111. data/app/assets/stylesheets/decidim/modules/_notification.scss +5 -0
  112. data/app/assets/stylesheets/decidim/modules/_order-by.scss +5 -0
  113. data/app/assets/stylesheets/decidim/modules/_process-nav.scss +5 -2
  114. data/app/assets/stylesheets/decidim/modules/_process-phase.scss +2 -4
  115. data/app/assets/stylesheets/decidim/modules/_process-stats.scss +53 -0
  116. data/app/assets/stylesheets/decidim/modules/_progress-bar.scss +5 -1
  117. data/app/assets/stylesheets/decidim/modules/_reveal.scss +11 -0
  118. data/app/assets/stylesheets/decidim/modules/_signup.scss +6 -5
  119. data/app/assets/stylesheets/decidim/modules/_static-pages.scss +0 -1
  120. data/app/assets/stylesheets/decidim/modules/_status-labels.scss +7 -1
  121. data/app/assets/stylesheets/decidim/modules/_sticky.scss +5 -0
  122. data/app/assets/stylesheets/decidim/modules/_tags.scss +11 -1
  123. data/app/assets/stylesheets/decidim/modules/_timeline.scss +1 -2
  124. data/app/assets/stylesheets/decidim/modules/_typography.scss +94 -10
  125. data/app/assets/stylesheets/decidim/modules/_versions.scss +0 -1
  126. data/app/assets/stylesheets/decidim/utils/_fontface.scss +10 -0
  127. data/app/assets/stylesheets/decidim/utils/_helpers.scss +8 -0
  128. data/app/assets/stylesheets/decidim/utils/_mixins.scss +86 -7
  129. data/app/assets/stylesheets/decidim/utils/_settings.scss +81 -69
  130. data/app/assets/stylesheets/decidim/utils/_toggle-expand.scss +14 -0
  131. data/app/assets/stylesheets/decidim/vizzs.scss +8 -0
  132. data/app/assets/stylesheets/decidim/vizzs/_areachart.scss +0 -1
  133. data/app/assets/stylesheets/decidim/vizzs/_linechart.scss +0 -1
  134. data/app/assets/stylesheets/decidim/vizzs/_rowchart.scss +0 -1
  135. data/app/assets/stylesheets/decidim/vizzs/_vizzs.scss +5 -0
  136. data/app/assets/stylesheets/foundation-overrides/components/_button-group.scss +319 -0
  137. data/app/cells/decidim/activity/show.erb +24 -21
  138. data/app/cells/decidim/activity_cell.rb +2 -0
  139. data/app/cells/decidim/address_cell.rb +1 -1
  140. data/app/cells/decidim/amendable/amend_button_card_cell.rb +1 -5
  141. data/app/cells/decidim/amendable/promote_button_card_cell.rb +1 -1
  142. data/app/cells/decidim/announcement/show.erb +1 -1
  143. data/app/cells/decidim/author/comments.erb +1 -1
  144. data/app/cells/decidim/author/endorsements.erb +6 -0
  145. data/app/cells/decidim/author/flag.erb +6 -3
  146. data/app/cells/decidim/author/profile_inline.erb +3 -4
  147. data/app/cells/decidim/author/show.erb +2 -0
  148. data/app/cells/decidim/author/withdraw.erb +2 -2
  149. data/app/cells/decidim/author_cell.rb +12 -13
  150. data/app/cells/decidim/badge/show.erb +6 -6
  151. data/app/cells/decidim/badge/small.erb +2 -1
  152. data/app/cells/decidim/card/show.erb +4 -4
  153. data/app/cells/decidim/card_cell.rb +21 -7
  154. data/app/cells/decidim/card_m/comments_counter.erb +1 -1
  155. data/app/cells/decidim/card_m/header.erb +4 -4
  156. data/app/cells/decidim/card_m/image.erb +1 -1
  157. data/app/cells/decidim/card_m/show.erb +3 -3
  158. data/app/cells/decidim/card_m_cell.rb +9 -6
  159. data/app/cells/decidim/collapsible_authors_cell.rb +1 -1
  160. data/app/cells/decidim/collapsible_list/show.erb +3 -3
  161. data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +4 -4
  162. data/app/cells/decidim/content_blocks/hero_settings_form/show.erb +2 -2
  163. data/app/cells/decidim/content_blocks/how_to_participate/show.erb +8 -8
  164. data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -1
  165. data/app/cells/decidim/content_blocks/stats/show.erb +1 -1
  166. data/app/cells/decidim/content_blocks/sub_hero/show.erb +3 -3
  167. data/app/cells/decidim/diff/attribute.erb +15 -5
  168. data/app/cells/decidim/diff/diff_mode_html.erb +31 -0
  169. data/app/cells/decidim/diff/diff_split.erb +1 -1
  170. data/app/cells/decidim/diff/diff_unified.erb +1 -1
  171. data/app/cells/decidim/diff/show.erb +1 -0
  172. data/app/cells/decidim/diff_cell.rb +32 -9
  173. data/app/cells/decidim/endorsement_buttons/select_identity_button.erb +10 -0
  174. data/app/cells/decidim/endorsement_buttons/show.erb +4 -0
  175. data/app/cells/decidim/endorsement_buttons_cell.rb +208 -0
  176. data/app/cells/decidim/endorsers_list/show.erb +16 -0
  177. data/app/cells/decidim/endorsers_list_cell.rb +29 -0
  178. data/app/cells/decidim/fingerprint_cell.rb +1 -0
  179. data/app/cells/decidim/follow_button/show.erb +29 -8
  180. data/app/cells/decidim/follow_button_cell.rb +37 -5
  181. data/app/cells/decidim/navbar_admin_link/show.erb +6 -0
  182. data/app/cells/decidim/navbar_admin_link_cell.rb +49 -0
  183. data/app/cells/decidim/newsletter_templates/base_cell.rb +30 -0
  184. data/app/cells/decidim/newsletter_templates/base_settings_form_cell.rb +13 -0
  185. data/app/cells/decidim/newsletter_templates/basic_only_text/show.erb +86 -0
  186. data/app/cells/decidim/newsletter_templates/basic_only_text_cell.rb +21 -0
  187. data/app/cells/decidim/newsletter_templates/basic_only_text_settings_form/show.erb +7 -0
  188. data/app/cells/decidim/newsletter_templates/basic_only_text_settings_form_cell.rb +8 -0
  189. data/app/cells/decidim/newsletter_templates/image_text_cta/show.erb +125 -0
  190. data/app/cells/decidim/newsletter_templates/image_text_cta_cell.rb +61 -0
  191. data/app/cells/decidim/newsletter_templates/image_text_cta_settings_form/show.erb +17 -0
  192. data/app/cells/decidim/newsletter_templates/image_text_cta_settings_form_cell.rb +8 -0
  193. data/app/cells/decidim/notifications/show.erb +1 -1
  194. data/app/cells/decidim/profile/show.erb +2 -2
  195. data/app/cells/decidim/profile/user_group_tabs.erb +10 -5
  196. data/app/cells/decidim/profile/user_tabs.erb +16 -14
  197. data/app/cells/decidim/profile_cell.rb +18 -0
  198. data/app/cells/decidim/profile_sidebar/show.erb +16 -16
  199. data/app/cells/decidim/profile_sidebar_cell.rb +1 -0
  200. data/app/cells/decidim/progress_bar/show.erb +11 -4
  201. data/app/cells/decidim/progress_bar_cell.rb +20 -1
  202. data/app/cells/decidim/search_results_section/show.erb +1 -1
  203. data/app/cells/decidim/tags_cell.rb +34 -4
  204. data/app/cells/decidim/translation_bar/show.erb +6 -0
  205. data/app/cells/decidim/translation_bar_cell.rb +52 -0
  206. data/app/cells/decidim/user_activity/show.erb +19 -1
  207. data/app/cells/decidim/user_activity_cell.rb +6 -0
  208. data/app/cells/decidim/user_conversation/conversation_header.erb +14 -0
  209. data/app/cells/decidim/user_conversation/messages.erb +15 -0
  210. data/app/cells/decidim/user_conversation/new.erb +15 -0
  211. data/app/cells/decidim/user_conversation/reply.erb +17 -0
  212. data/app/cells/decidim/user_conversation/show.erb +20 -0
  213. data/app/cells/decidim/user_conversation_cell.rb +75 -0
  214. data/app/cells/decidim/user_conversations/add_conversation_users.erb +25 -0
  215. data/app/cells/decidim/user_conversations/conversation_item.erb +38 -0
  216. data/app/cells/decidim/user_conversations/show.erb +58 -0
  217. data/app/cells/decidim/user_conversations_cell.rb +40 -0
  218. data/app/cells/decidim/user_group_admin_membership_profile/footer.erb +3 -3
  219. data/app/cells/decidim/user_profile/footer.erb +1 -1
  220. data/app/cells/decidim/user_profile/unlinked_user_data.erb +16 -0
  221. data/app/cells/decidim/user_profile/user_data.erb +1 -1
  222. data/app/cells/decidim/user_profile_cell.rb +7 -1
  223. data/app/cells/decidim/user_timeline_cell.rb +4 -0
  224. data/app/cells/decidim/version/show.erb +31 -0
  225. data/app/{views/decidim/shared/_version_author.html.erb → cells/decidim/version_author/show.erb} +1 -1
  226. data/app/cells/decidim/version_author_cell.rb +9 -0
  227. data/app/cells/decidim/version_cell.rb +83 -0
  228. data/app/cells/decidim/versions_list/show.erb +32 -0
  229. data/app/cells/decidim/versions_list_cell.rb +64 -0
  230. data/app/cells/decidim/versions_list_item/show.erb +20 -0
  231. data/app/cells/decidim/versions_list_item_cell.rb +51 -0
  232. data/app/cells/decidim/wizard_step_form/wizard_aside.erb +1 -1
  233. data/app/cells/decidim/wizard_step_form/wizard_header.erb +2 -2
  234. data/app/cells/decidim/wizard_step_form_cell.rb +4 -1
  235. data/app/commands/decidim/amendable/accept.rb +18 -7
  236. data/app/commands/decidim/amendable/create_draft.rb +2 -0
  237. data/app/commands/decidim/amendable/publish_draft.rb +5 -0
  238. data/app/commands/decidim/amendable/reject.rb +5 -0
  239. data/app/commands/decidim/amendable/update_draft.rb +2 -0
  240. data/app/commands/decidim/amendable/withdraw.rb +3 -12
  241. data/app/commands/decidim/attachment_methods.rb +47 -0
  242. data/app/commands/decidim/create_registration.rb +7 -7
  243. data/app/commands/decidim/create_user_group.rb +12 -0
  244. data/app/commands/decidim/destroy_account.rb +13 -0
  245. data/app/commands/decidim/endorse_resource.rb +64 -0
  246. data/app/commands/decidim/gallery_methods.rb +71 -0
  247. data/app/commands/decidim/invite_user_again.rb +2 -4
  248. data/app/commands/decidim/messaging/reply_to_conversation.rb +35 -4
  249. data/app/commands/decidim/messaging/start_conversation.rb +36 -5
  250. data/app/commands/decidim/multiple_attachments_methods.rb +56 -0
  251. data/app/commands/decidim/unendorse_resource.rb +38 -0
  252. data/app/commands/decidim/update_notifications_settings.rb +1 -0
  253. data/app/commands/decidim/update_user_group.rb +14 -1
  254. data/app/controllers/concerns/decidim/devise_controllers.rb +1 -0
  255. data/app/controllers/concerns/decidim/filter_resource.rb +24 -6
  256. data/app/controllers/concerns/decidim/flaggable.rb +20 -0
  257. data/app/controllers/concerns/decidim/force_authentication.rb +1 -0
  258. data/app/controllers/concerns/decidim/impersonate_users.rb +14 -1
  259. data/app/controllers/concerns/decidim/needs_snippets.rb +20 -0
  260. data/app/controllers/concerns/decidim/paginable.rb +5 -1
  261. data/app/controllers/concerns/decidim/resource_versions_concern.rb +28 -0
  262. data/app/controllers/concerns/decidim/use_organization_time_zone.rb +32 -0
  263. data/app/controllers/concerns/decidim/withdrawable.rb +20 -0
  264. data/app/controllers/decidim/application_controller.rb +19 -0
  265. data/app/controllers/decidim/components/base_controller.rb +7 -1
  266. data/app/controllers/decidim/cookie_policy_controller.rb +6 -3
  267. data/app/controllers/decidim/data_portability_controller.rb +12 -19
  268. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -1
  269. data/app/controllers/decidim/devise/registrations_controller.rb +3 -4
  270. data/app/controllers/decidim/devise/sessions_controller.rb +5 -0
  271. data/app/controllers/decidim/endorsements_controller.rb +71 -0
  272. data/app/controllers/decidim/messaging/conversations_controller.rb +57 -14
  273. data/app/controllers/decidim/newsletters_controller.rb +2 -2
  274. data/app/controllers/decidim/profiles_controller.rb +6 -0
  275. data/app/controllers/decidim/scopes_controller.rb +42 -7
  276. data/app/controllers/decidim/user_activities_controller.rb +19 -2
  277. data/app/controllers/decidim/user_conversations_controller.rb +142 -0
  278. data/app/controllers/decidim/user_timeline_controller.rb +19 -2
  279. data/app/events/decidim/resource_endorsed_event.rb +35 -0
  280. data/app/events/decidim/user_group_admin_event.rb +37 -0
  281. data/app/events/decidim/user_group_created_event.rb +6 -0
  282. data/app/events/decidim/user_group_updated_event.rb +6 -0
  283. data/app/forms/decidim/account_form.rb +5 -1
  284. data/app/forms/decidim/amendable/create_form.rb +1 -1
  285. data/app/forms/decidim/amendable/form.rb +44 -3
  286. data/app/forms/decidim/attachment_form.rb +5 -0
  287. data/app/forms/decidim/messaging/conversation_form.rb +10 -4
  288. data/app/forms/decidim/notifications_settings_form.rb +6 -0
  289. data/app/forms/decidim/registration_form.rb +6 -0
  290. data/app/forms/decidim/user_group_form.rb +5 -1
  291. data/app/functions/decidim/core/component_finder_base.rb +40 -0
  292. data/app/functions/decidim/core/component_list.rb +38 -0
  293. data/app/functions/decidim/core/component_list_base.rb +67 -0
  294. data/app/functions/decidim/core/needs_api_filter_and_order.rb +52 -0
  295. data/app/functions/decidim/core/participatory_space_finder.rb +11 -0
  296. data/app/functions/decidim/core/participatory_space_finder_base.rb +29 -0
  297. data/app/functions/decidim/core/participatory_space_list.rb +11 -0
  298. data/app/functions/decidim/core/participatory_space_list_base.rb +34 -0
  299. data/app/functions/decidim/core/user_entity_finder.rb +33 -0
  300. data/app/functions/decidim/core/user_entity_list.rb +31 -0
  301. data/app/helpers/concerns/decidim/flash_helper_extensions.rb +47 -0
  302. data/app/helpers/decidim/action_authorization_helper.rb +24 -2
  303. data/app/helpers/decidim/amendments_helper.rb +29 -1
  304. data/app/helpers/decidim/application_helper.rb +38 -4
  305. data/app/helpers/decidim/categories_helper.rb +26 -0
  306. data/app/helpers/decidim/cells_helper.rb +3 -15
  307. data/app/helpers/decidim/check_boxes_tree_helper.rb +123 -0
  308. data/app/helpers/decidim/cookies_helper.rb +1 -1
  309. data/app/helpers/decidim/cta_button_helper.rb +1 -1
  310. data/app/helpers/decidim/decidim_form_helper.rb +24 -1
  311. data/app/helpers/decidim/endorsable_helper.rb +93 -0
  312. data/app/helpers/decidim/filter_params_helper.rb +30 -0
  313. data/app/helpers/decidim/filters_helper.rb +15 -5
  314. data/app/helpers/decidim/followable_helper.rb +11 -0
  315. data/app/helpers/decidim/layout_helper.rb +23 -5
  316. data/app/helpers/decidim/map_helper.rb +100 -17
  317. data/app/helpers/decidim/markup_helper.rb +9 -0
  318. data/app/helpers/decidim/messaging/conversation_helper.rb +61 -7
  319. data/app/helpers/decidim/omniauth_helper.rb +6 -13
  320. data/app/helpers/decidim/orders_helper.rb +15 -1
  321. data/app/helpers/decidim/paginate_helper.rb +3 -1
  322. data/app/helpers/decidim/participatory_space_helpers.rb +1 -1
  323. data/app/helpers/decidim/resource_versions_helper.rb +46 -0
  324. data/app/helpers/decidim/rich_text_editor_helper.rb +23 -0
  325. data/app/helpers/decidim/sanitize_helper.rb +13 -3
  326. data/app/helpers/decidim/scopes_helper.rb +7 -6
  327. data/app/helpers/decidim/tooltip_helper.rb +1 -1
  328. data/app/helpers/decidim/traceability_helper.rb +2 -8
  329. data/app/helpers/decidim/translations_helper.rb +7 -1
  330. data/app/helpers/decidim/user_profile_helper.rb +1 -1
  331. data/app/helpers/decidim/widget_urls_helper.rb +4 -2
  332. data/app/jobs/decidim/data_portability_export_job.rb +18 -10
  333. data/app/jobs/decidim/event_publisher_job.rb +1 -1
  334. data/app/jobs/decidim/export_job.rb +1 -1
  335. data/app/jobs/decidim/machine_translation_fields_job.rb +30 -0
  336. data/app/jobs/decidim/machine_translation_resource_job.rb +113 -0
  337. data/app/jobs/decidim/machine_translation_save_job.rb +33 -0
  338. data/app/mailers/concerns/decidim/multitenant_asset_host.rb +33 -0
  339. data/app/mailers/decidim/application_mailer.rb +1 -0
  340. data/app/mailers/decidim/export_mailer.rb +9 -5
  341. data/app/mailers/decidim/messaging/conversation_mailer.rb +53 -4
  342. data/app/mailers/decidim/newsletter_mailer.rb +22 -4
  343. data/app/mailers/decidim/reported_mailer.rb +8 -1
  344. data/app/middleware/decidim/strip_x_forwarded_host.rb +14 -0
  345. data/app/models/decidim/action_log.rb +2 -2
  346. data/app/models/decidim/amendment.rb +0 -18
  347. data/app/models/decidim/area.rb +3 -0
  348. data/app/models/decidim/area_type.rb +4 -0
  349. data/app/models/decidim/attachment.rb +30 -2
  350. data/app/models/decidim/attachment_collection.rb +3 -0
  351. data/app/models/decidim/authorization.rb +27 -0
  352. data/app/models/decidim/category.rb +4 -0
  353. data/app/models/decidim/component.rb +14 -0
  354. data/app/models/decidim/content_block.rb +16 -4
  355. data/app/models/decidim/contextual_help_section.rb +4 -0
  356. data/app/models/decidim/endorsement.rb +30 -0
  357. data/app/models/decidim/follow.rb +3 -1
  358. data/app/models/decidim/messaging/conversation.rb +39 -11
  359. data/app/models/decidim/messaging/message.rb +32 -6
  360. data/app/models/decidim/messaging/participation.rb +1 -1
  361. data/app/models/decidim/messaging/receipt.rb +8 -0
  362. data/app/models/decidim/moderation.rb +1 -1
  363. data/app/models/decidim/newsletter.rb +10 -1
  364. data/app/models/decidim/oauth_application.rb +2 -0
  365. data/app/models/decidim/omniauth_provider.rb +28 -0
  366. data/app/models/decidim/organization.rb +94 -0
  367. data/app/models/decidim/participatory_space_role_config/admin.rb +8 -0
  368. data/app/models/decidim/participatory_space_role_config/base.rb +31 -0
  369. data/app/models/decidim/participatory_space_role_config/collaborator.rb +8 -0
  370. data/app/models/decidim/participatory_space_role_config/moderator.rb +11 -0
  371. data/app/models/decidim/participatory_space_role_config/null_object.rb +11 -0
  372. data/app/models/decidim/participatory_space_role_config/participatory_space_admin.rb +8 -0
  373. data/app/models/decidim/participatory_space_role_config/valuator.rb +11 -0
  374. data/app/models/decidim/scope.rb +8 -3
  375. data/app/models/decidim/scope_type.rb +3 -0
  376. data/app/models/decidim/share_token.rb +49 -0
  377. data/app/models/decidim/static_page.rb +4 -1
  378. data/app/models/decidim/static_page_topic.rb +3 -0
  379. data/app/models/decidim/user.rb +51 -3
  380. data/app/models/decidim/user_base_entity.rb +6 -2
  381. data/app/models/decidim/user_group.rb +23 -0
  382. data/app/permissions/decidim/permissions.rb +28 -6
  383. data/app/presenters/decidim/admin_log/user_presenter.rb +1 -1
  384. data/app/presenters/decidim/home_stats_presenter.rb +5 -2
  385. data/app/presenters/decidim/log/base_presenter.rb +1 -1
  386. data/app/presenters/decidim/log/value_types/default_presenter.rb +1 -1
  387. data/app/presenters/decidim/metric_charts_presenter.rb +33 -13
  388. data/app/presenters/decidim/nil_presenter.rb +29 -0
  389. data/app/presenters/decidim/official_author_presenter.rb +36 -0
  390. data/app/presenters/decidim/resource_locator_presenter.rb +71 -10
  391. data/app/presenters/decidim/user_group_presenter.rb +1 -1
  392. data/app/presenters/decidim/user_presenter.rb +6 -0
  393. data/app/queries/decidim/metric_manage.rb +5 -0
  394. data/app/queries/decidim/metrics/followers_metric_manage.rb +1 -6
  395. data/app/queries/decidim/similar_emendations.rb +4 -4
  396. data/app/queries/decidim/user_groups/admin_memberships.rb +3 -3
  397. data/app/scrubbers/decidim/user_input_scrubber.rb +1 -1
  398. data/app/serializers/decidim/exporters/participatory_space_components_serializer.rb +1 -1
  399. data/app/serializers/decidim/importers/participatory_space_components_importer.rb +14 -5
  400. data/app/services/decidim/activity_search.rb +1 -0
  401. data/app/services/decidim/base_diff_renderer.rb +42 -3
  402. data/app/services/decidim/data_portability_exporter.rb +72 -0
  403. data/app/services/decidim/events_manager.rb +4 -1
  404. data/app/services/decidim/open_data_exporter.rb +2 -0
  405. data/app/services/decidim/resource_search.rb +122 -17
  406. data/app/services/decidim/static_map_generator.rb +10 -21
  407. data/app/services/decidim/zip_stream/zip_stream_writer.rb +56 -0
  408. data/app/types/decidim/core/amendment_type.rb +26 -0
  409. data/app/types/decidim/core/area_api_type.rb +16 -0
  410. data/app/types/decidim/core/area_type_type.rb +14 -0
  411. data/app/types/decidim/core/base_input_filter.rb +8 -0
  412. data/app/types/decidim/core/base_input_sort.rb +22 -0
  413. data/app/types/decidim/core/component_input_filter.rb +50 -0
  414. data/app/types/decidim/core/component_input_sort.rb +32 -0
  415. data/app/types/decidim/core/decidim_type.rb +0 -4
  416. data/app/types/decidim/core/fingerprint_type.rb +15 -0
  417. data/app/types/decidim/core/has_endorsable_input_sort.rb +17 -0
  418. data/app/types/decidim/core/has_hastaggable_input_filter.rb +15 -0
  419. data/app/types/decidim/core/has_localized_input_filter.rb +21 -0
  420. data/app/types/decidim/core/has_localized_input_sort.rb +21 -0
  421. data/app/types/decidim/core/has_publishable_input_filter.rb +34 -0
  422. data/app/types/decidim/core/has_publishable_input_sort.rb +13 -0
  423. data/app/types/decidim/core/has_timestamp_input_filter.rb +52 -0
  424. data/app/types/decidim/core/has_timestamp_input_sort.rb +12 -0
  425. data/app/types/decidim/core/participatory_space_input_filter.rb +26 -0
  426. data/app/types/decidim/core/participatory_space_input_sort.rb +14 -0
  427. data/app/types/decidim/core/participatory_space_link_type.rb +24 -0
  428. data/app/types/decidim/core/trace_version_type.rb +29 -0
  429. data/app/types/decidim/core/user_entity_input_filter.rb +81 -0
  430. data/app/types/decidim/core/user_entity_input_sort.rb +24 -0
  431. data/app/types/decidim/core/user_group_type.rb +17 -5
  432. data/app/types/decidim/core/user_type.rb +17 -6
  433. data/app/uploaders/decidim/application_uploader.rb +15 -1
  434. data/app/uploaders/decidim/attachment_uploader.rb +23 -17
  435. data/app/uploaders/decidim/avatar_uploader.rb +4 -0
  436. data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
  437. data/app/uploaders/decidim/data_portability_uploader.rb +2 -7
  438. data/app/uploaders/decidim/hero_image_uploader.rb +1 -1
  439. data/app/uploaders/decidim/homepage_image_uploader.rb +1 -1
  440. data/app/uploaders/decidim/image_uploader.rb +34 -6
  441. data/app/uploaders/decidim/newsletter_template_image_uploader.rb +36 -0
  442. data/app/uploaders/decidim/oauth_application_logo_uploader.rb +1 -1
  443. data/app/uploaders/decidim/official_image_footer_uploader.rb +1 -1
  444. data/app/uploaders/decidim/official_image_header_uploader.rb +1 -1
  445. data/app/uploaders/decidim/organization_logo_uploader.rb +1 -1
  446. data/app/uploaders/decidim/record_image_uploader.rb +15 -0
  447. data/app/validators/etiquette_validator.rb +0 -7
  448. data/app/validators/geocoding_validator.rb +9 -4
  449. data/app/validators/passthru_validator.rb +111 -0
  450. data/app/validators/scope_belongs_to_component_validator.rb +16 -0
  451. data/app/validators/time_zone_validator.rb +10 -0
  452. data/app/validators/uploader_content_type_validator.rb +44 -0
  453. data/app/views/decidim/account/delete.html.erb +6 -3
  454. data/app/views/decidim/account/show.html.erb +17 -10
  455. data/app/views/decidim/amendments/_edit_form_fields.html.erb +7 -13
  456. data/app/views/decidim/amendments/_similar_emendation.html.erb +4 -4
  457. data/app/views/decidim/amendments/compare_draft.html.erb +2 -2
  458. data/app/views/decidim/amendments/edit_draft.html.erb +2 -2
  459. data/app/views/decidim/amendments/new.html.erb +2 -2
  460. data/app/views/decidim/amendments/preview_draft.html.erb +3 -3
  461. data/app/views/decidim/amendments/review.html.erb +3 -3
  462. data/app/views/decidim/application/_collection.html.erb +2 -2
  463. data/app/views/decidim/application/_document.html.erb +4 -4
  464. data/app/views/decidim/application/_documents.html.erb +1 -1
  465. data/app/views/decidim/application/_photos.html.erb +1 -1
  466. data/app/views/decidim/authorization_modals/_content.html.erb +2 -2
  467. data/app/views/decidim/authorization_modals/show.html.erb +1 -1
  468. data/app/views/decidim/data_portability/show.html.erb +3 -0
  469. data/app/views/decidim/devise/confirmations/new.html.erb +3 -3
  470. data/app/views/decidim/devise/invitations/edit.html.erb +13 -13
  471. data/app/views/decidim/devise/omniauth_registrations/new.html.erb +5 -3
  472. data/app/views/decidim/devise/passwords/edit.html.erb +5 -3
  473. data/app/views/decidim/devise/passwords/new.html.erb +3 -3
  474. data/app/views/decidim/devise/registrations/edit.html.erb +2 -1
  475. data/app/views/decidim/devise/registrations/new.html.erb +10 -9
  476. data/app/views/decidim/devise/sessions/new.html.erb +7 -7
  477. data/app/views/decidim/devise/shared/_newsletter_modal.html.erb +3 -3
  478. data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +11 -11
  479. data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +9 -8
  480. data/app/views/decidim/devise/unlocks/new.html.erb +3 -3
  481. data/app/views/decidim/doorkeeper/authorizations/new.html.erb +2 -2
  482. data/app/views/decidim/endorsements/_identity.html.erb +9 -0
  483. data/app/views/decidim/endorsements/identities.html.erb +12 -0
  484. data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +20 -0
  485. data/app/views/decidim/errors/internal_server_error.html.erb +2 -2
  486. data/app/views/decidim/errors/not_found.html.erb +2 -2
  487. data/app/views/decidim/export_mailer/data_portability_export.html.erb +2 -2
  488. data/app/views/decidim/gamification/badges/index.html.erb +4 -4
  489. data/app/views/decidim/group_admins/index.html.erb +6 -4
  490. data/app/views/decidim/group_invites/index.html.erb +5 -2
  491. data/app/views/decidim/group_members/index.html.erb +6 -4
  492. data/app/views/decidim/groups/_form.html.erb +2 -0
  493. data/app/views/decidim/groups/edit.html.erb +4 -2
  494. data/app/views/decidim/groups/new.html.erb +2 -2
  495. data/app/views/decidim/last_activities/index.html.erb +2 -0
  496. data/app/views/decidim/messaging/conversation_mailer/comanagers_new_conversation.html.erb +17 -0
  497. data/app/views/decidim/messaging/conversation_mailer/comanagers_new_message.html.erb +17 -0
  498. data/app/views/decidim/messaging/conversation_mailer/new_conversation.html.erb +2 -2
  499. data/app/views/decidim/messaging/conversation_mailer/new_group_conversation.html.erb +17 -0
  500. data/app/views/decidim/messaging/conversation_mailer/new_group_message.html.erb +17 -0
  501. data/app/views/decidim/messaging/conversation_mailer/new_message.html.erb +2 -2
  502. data/app/views/decidim/messaging/conversations/_add_conversation_users.html.erb +24 -0
  503. data/app/views/decidim/messaging/conversations/_conversation.html.erb +54 -0
  504. data/app/views/decidim/messaging/conversations/_error_modal.html.erb +21 -0
  505. data/app/views/decidim/messaging/conversations/_messages.html.erb +15 -0
  506. data/app/views/decidim/messaging/conversations/_new_conversation_button.html.erb +33 -0
  507. data/app/views/decidim/messaging/conversations/_reply.html.erb +3 -3
  508. data/app/views/decidim/messaging/conversations/_show.html.erb +34 -15
  509. data/app/views/decidim/messaging/conversations/_start.html.erb +7 -1
  510. data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
  511. data/app/views/decidim/messaging/conversations/error.js.erb +10 -0
  512. data/app/views/decidim/messaging/conversations/index.html.erb +34 -29
  513. data/app/views/decidim/messaging/conversations/new.html.erb +1 -1
  514. data/app/views/decidim/messaging/conversations/show.html.erb +8 -4
  515. data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
  516. data/app/views/decidim/newsletter_mailer/newsletter.html.erb +2 -2
  517. data/app/views/decidim/newsletters/show.html.erb +8 -1
  518. data/app/views/decidim/notification_mailer/event_received.html.erb +2 -2
  519. data/app/views/decidim/notifications/index.html.erb +4 -2
  520. data/app/views/decidim/notifications_settings/show.html.erb +14 -1
  521. data/app/views/decidim/own_user_groups/index.html.erb +4 -0
  522. data/app/views/decidim/pages/_standalone.html.erb +1 -1
  523. data/app/views/decidim/pages/_tabbed.html.erb +5 -5
  524. data/app/views/decidim/pages/index.html.erb +22 -13
  525. data/app/views/decidim/profiles/_user_follow.erb +3 -3
  526. data/app/views/decidim/profiles/show.html.erb +2 -0
  527. data/app/views/decidim/reported_mailer/report.html.erb +49 -3
  528. data/app/views/decidim/scopes/_scopes_picker_input.html.erb +15 -7
  529. data/app/views/decidim/scopes/picker.html.erb +31 -17
  530. data/app/views/decidim/searches/_count.html.erb +14 -11
  531. data/app/views/decidim/searches/_filters.html.erb +3 -2
  532. data/app/views/decidim/searches/index.html.erb +5 -3
  533. data/app/views/decidim/shared/_check_boxes_tree.html.erb +56 -0
  534. data/app/views/decidim/shared/_confirm_modal.html.erb +18 -0
  535. data/app/views/decidim/shared/_embed_modal.html.erb +4 -1
  536. data/app/views/decidim/shared/_extended_navigation_bar.html.erb +3 -3
  537. data/app/views/decidim/shared/_filter_form_help.erb +8 -0
  538. data/app/views/decidim/shared/_floating_help.html.erb +7 -7
  539. data/app/views/decidim/shared/_login_modal.html.erb +17 -6
  540. data/app/views/decidim/shared/_orders.html.erb +16 -5
  541. data/app/views/decidim/shared/_results_per_page.html.erb +16 -6
  542. data/app/views/decidim/shared/_share_modal.html.erb +8 -4
  543. data/app/views/decidim/shared/_static_map.html.erb +2 -2
  544. data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +1 -1
  545. data/app/views/decidim/user_activities/index.html.erb +4 -0
  546. data/app/views/decidim/user_activities/index.js.erb +14 -0
  547. data/app/views/decidim/user_conversations/index.html.erb +4 -0
  548. data/app/views/decidim/user_conversations/show.html.erb +4 -0
  549. data/app/views/decidim/user_conversations/update.js.erb +8 -0
  550. data/app/views/decidim/user_interests/_scopes.html.erb +12 -10
  551. data/app/views/decidim/user_interests/show.html.erb +4 -1
  552. data/app/views/decidim/user_timeline/index.html.erb +5 -1
  553. data/app/views/decidim/user_timeline/index.js.erb +14 -0
  554. data/app/views/decidim/widgets/show.html.erb +4 -0
  555. data/app/views/kaminari/decidim/_first_page.html.erb +5 -1
  556. data/app/views/kaminari/decidim/_last_page.html.erb +5 -1
  557. data/app/views/kaminari/decidim/_next_page.html.erb +6 -1
  558. data/app/views/kaminari/decidim/_page.html.erb +2 -2
  559. data/app/views/kaminari/decidim/_paginator.html.erb +16 -14
  560. data/app/views/kaminari/decidim/_prev_page.html.erb +6 -1
  561. data/app/views/layouts/decidim/_admin_links.html.erb +2 -0
  562. data/app/views/layouts/decidim/_application.html.erb +4 -2
  563. data/app/views/layouts/decidim/_cookie_warning.html.erb +1 -1
  564. data/app/views/layouts/decidim/_edit_link.html.erb +0 -8
  565. data/app/views/layouts/decidim/_head.html.erb +4 -0
  566. data/app/views/layouts/decidim/_js_configuration.html.erb +34 -0
  567. data/app/views/layouts/decidim/_language_chooser.html.erb +10 -5
  568. data/app/views/layouts/decidim/_logo.html.erb +2 -22
  569. data/app/views/layouts/decidim/_mailer_logo.html.erb +2 -22
  570. data/app/views/layouts/decidim/_main_footer.html.erb +3 -1
  571. data/app/views/layouts/decidim/_mini_footer.html.erb +7 -7
  572. data/app/views/layouts/decidim/_omnipresent_banner.html.erb +1 -1
  573. data/app/views/layouts/decidim/_organization_colors.html.erb +4 -3
  574. data/app/views/layouts/decidim/_social_media_links.html.erb +15 -10
  575. data/app/views/layouts/decidim/_topbar_search.html.erb +12 -2
  576. data/app/views/layouts/decidim/_user_menu.html.erb +6 -6
  577. data/app/views/layouts/decidim/_wrapper.html.erb +21 -15
  578. data/app/views/layouts/decidim/newsletter_base.html.erb +46 -0
  579. data/app/views/layouts/decidim/user_profile.html.erb +8 -3
  580. data/app/views/layouts/decidim/widget.html.erb +2 -43
  581. data/config/initializers/browser.rb +5 -0
  582. data/config/initializers/devise.rb +11 -25
  583. data/config/initializers/invisible_captcha.rb +1 -0
  584. data/config/initializers/omniauth.rb +56 -0
  585. data/config/initializers/rack_attack.rb +25 -16
  586. data/config/locales/am-ET.yml +1 -0
  587. data/config/locales/ar.yml +44 -22
  588. data/config/locales/bg-BG.yml +1512 -0
  589. data/config/locales/bg.yml +1508 -0
  590. data/config/locales/ca.yml +302 -24
  591. data/config/locales/cs.yml +346 -55
  592. data/config/locales/da-DK.yml +9 -0
  593. data/config/locales/da.yml +1 -0
  594. data/config/locales/de.yml +311 -26
  595. data/config/locales/el-GR.yml +151 -0
  596. data/config/locales/el.yml +1587 -0
  597. data/config/locales/en.yml +308 -20
  598. data/config/locales/eo-UY.yml +2 -6
  599. data/config/locales/eo.yml +92 -0
  600. data/config/locales/es-MX.yml +297 -19
  601. data/config/locales/es-PY.yml +297 -19
  602. data/config/locales/es.yml +301 -23
  603. data/config/locales/et-EE.yml +9 -0
  604. data/config/locales/et.yml +1 -0
  605. data/config/locales/eu.yml +14 -19
  606. data/config/locales/fi-plain.yml +297 -19
  607. data/config/locales/fi.yml +361 -83
  608. data/config/locales/fr-CA.yml +1613 -0
  609. data/config/locales/fr.yml +304 -26
  610. data/config/locales/ga-IE.yml +1 -0
  611. data/config/locales/gl.yml +14 -19
  612. data/config/locales/hr-HR.yml +9 -0
  613. data/config/locales/hr.yml +1 -0
  614. data/config/locales/hu.yml +123 -39
  615. data/config/locales/id-ID.yml +14 -19
  616. data/config/locales/is-IS.yml +457 -0
  617. data/config/locales/is.yml +463 -0
  618. data/config/locales/it.yml +332 -54
  619. data/config/locales/ja-JP.yml +1587 -0
  620. data/config/locales/ja.yml +1605 -0
  621. data/config/locales/ko-KR.yml +1 -0
  622. data/config/locales/ko.yml +1 -0
  623. data/config/locales/lt-LT.yml +9 -0
  624. data/config/locales/lt.yml +1 -0
  625. data/config/locales/lv.yml +1481 -0
  626. data/config/locales/mt-MT.yml +9 -0
  627. data/config/locales/mt.yml +1 -0
  628. data/config/locales/nl.yml +292 -20
  629. data/config/locales/no.yml +951 -41
  630. data/config/locales/om-ET.yml +1 -0
  631. data/config/locales/pl.yml +801 -444
  632. data/config/locales/pt-BR.yml +15 -21
  633. data/config/locales/pt.yml +887 -551
  634. data/config/locales/ro-RO.yml +1609 -0
  635. data/config/locales/ru.yml +14 -14
  636. data/config/locales/sk-SK.yml +1426 -0
  637. data/config/locales/sk.yml +1440 -0
  638. data/config/locales/sl.yml +72 -0
  639. data/config/locales/so-SO.yml +1 -0
  640. data/config/locales/sr-CS.yml +122 -0
  641. data/config/locales/sv.yml +342 -40
  642. data/config/locales/ti-ER.yml +1 -0
  643. data/config/locales/tr-TR.yml +14 -19
  644. data/config/locales/uk.yml +10 -15
  645. data/config/locales/vi-VN.yml +1 -0
  646. data/config/locales/vi.yml +1 -0
  647. data/config/locales/zh-CN.yml +1584 -0
  648. data/config/locales/zh-TW.yml +1 -0
  649. data/config/routes.rb +5 -0
  650. data/db/migrate/20180810092428_move_organization_fields_to_hero_content_block.rb +2 -2
  651. data/db/migrate/20191113092826_add_omniauth_settings_to_decidim_organization.rb +7 -0
  652. data/db/migrate/20191113144432_add_rich_text_editor_in_public_views_to_organizations.rb +10 -0
  653. data/db/migrate/20191118123154_add_admin_terms_of_use_body_field_to_organization.rb +9 -0
  654. data/db/migrate/20191130151925_create_decidim_endorsements.rb +13 -0
  655. data/db/migrate/20191204075509_add_session_token_to_users.rb +7 -0
  656. data/db/migrate/20200107142226_add_organization_timezone.rb +7 -0
  657. data/db/migrate/20200211173227_add_direct_message_types_to_users.rb +12 -0
  658. data/db/migrate/20200320105904_index_foreign_keys_in_decidim_action_logs.rb +9 -0
  659. data/db/migrate/20200320105905_index_foreign_keys_in_decidim_amendments.rb +7 -0
  660. data/db/migrate/20200320105909_index_foreign_keys_in_decidim_authorizations.rb +7 -0
  661. data/db/migrate/20200320105917_index_foreign_keys_in_decidim_contextual_help_sections.rb +7 -0
  662. data/db/migrate/20200320105919_index_foreign_keys_in_decidim_endorsements.rb +7 -0
  663. data/db/migrate/20200320105923_index_foreign_keys_in_decidim_notifications.rb +7 -0
  664. data/db/migrate/20200320105927_index_foreign_keys_in_oauth_access_grants.rb +7 -0
  665. data/db/migrate/20200323094443_add_id_to_content_blocks_scope.rb +7 -0
  666. data/db/migrate/20200326102407_rename_scope_column.rb +7 -0
  667. data/db/migrate/20200327082257_migrate_newsletters_to_templates.rb +33 -0
  668. data/db/migrate/20200327082954_remove_newsletter_body.rb +7 -0
  669. data/db/migrate/20200401073419_add_index_on_content_block_scope_id.rb +11 -0
  670. data/db/migrate/20200525184143_add_enable_machine_translation_to_decidim_organizations.rb +7 -0
  671. data/db/migrate/20200702073419_create_decidim_share_tokens.rb +16 -0
  672. data/db/migrate/20200707132401_add_comments_max_length_to_decidim_organization.rb +7 -0
  673. data/db/migrate/20200730142511_add_file_upload_settings_to_decidim_organizations.rb +36 -0
  674. data/db/migrate/20200806092109_add_machine_translation_display_priority_to_organizations.rb +17 -0
  675. data/db/migrate/20201004160335_remove_notifications_with_continuity_badge.rb +9 -0
  676. data/db/seeds.rb +8 -6
  677. data/{app/controllers/concerns → lib}/decidim/action_authorization.rb +0 -0
  678. data/lib/decidim/amendable.rb +7 -4
  679. data/lib/decidim/api/amendable_entity_interface.rb +18 -0
  680. data/lib/decidim/api/amendable_interface.rb +18 -0
  681. data/lib/decidim/api/attachable_interface.rb +1 -1
  682. data/lib/decidim/api/author_interface.rb +4 -0
  683. data/lib/decidim/api/categorizable_interface.rb +1 -1
  684. data/lib/decidim/api/coauthorable_interface.rb +29 -0
  685. data/lib/decidim/api/endorsable_interface.rb +22 -0
  686. data/lib/decidim/api/fingerprint_interface.rb +13 -0
  687. data/lib/decidim/api/participatory_space_interface.rb +11 -9
  688. data/lib/decidim/api/participatory_space_resourceable_interface.rb +21 -0
  689. data/lib/decidim/api/scopable_interface.rb +1 -1
  690. data/lib/decidim/api/timestamps_interface.rb +21 -0
  691. data/lib/decidim/api/traceable_interface.rb +14 -0
  692. data/lib/decidim/authorable.rb +22 -1
  693. data/lib/decidim/authorization_form_builder.rb +7 -0
  694. data/lib/decidim/coauthorable.rb +32 -3
  695. data/lib/decidim/component_manifest.rb +16 -2
  696. data/lib/decidim/content_parsers.rb +1 -0
  697. data/lib/decidim/content_parsers/user_group_parser.rb +61 -0
  698. data/lib/decidim/content_parsers/user_parser.rb +3 -5
  699. data/lib/decidim/content_processor.rb +54 -29
  700. data/lib/decidim/content_renderers.rb +1 -0
  701. data/lib/decidim/content_renderers/base_renderer.rb +1 -1
  702. data/lib/decidim/content_renderers/hashtag_renderer.rb +2 -0
  703. data/lib/decidim/content_renderers/link_renderer.rb +4 -1
  704. data/lib/decidim/content_renderers/user_group_renderer.rb +32 -0
  705. data/lib/decidim/content_renderers/user_renderer.rb +3 -1
  706. data/lib/decidim/core.rb +133 -34
  707. data/lib/decidim/core/api.rb +8 -0
  708. data/lib/decidim/core/engine.rb +149 -23
  709. data/lib/decidim/core/test.rb +15 -0
  710. data/lib/decidim/core/test/factories.rb +152 -10
  711. data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +79 -0
  712. data/lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb +4 -4
  713. data/lib/decidim/core/test/shared_examples/amendable_interface_examples.rb +14 -0
  714. data/lib/decidim/core/test/shared_examples/amendable_proposals_interface_examples.rb +50 -0
  715. data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +3 -0
  716. data/lib/decidim/core/test/shared_examples/back_to_list_button_examples.rb +17 -0
  717. data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +60 -0
  718. data/lib/decidim/core/test/shared_examples/comments_examples.rb +77 -11
  719. data/lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb +5 -1
  720. data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +49 -0
  721. data/lib/decidim/core/test/shared_examples/endorsable_interface_examples.rb +22 -0
  722. data/lib/decidim/core/test/shared_examples/endorsements_controller_shared_context.rb +22 -0
  723. data/lib/decidim/core/test/shared_examples/fingerprintable_interface_examples.rb +17 -0
  724. data/lib/decidim/core/test/shared_examples/follows_examples.rb +18 -2
  725. data/lib/decidim/core/test/shared_examples/input_filter_examples.rb +118 -0
  726. data/lib/decidim/core/test/shared_examples/input_sort_examples.rb +126 -0
  727. data/lib/decidim/core/test/shared_examples/logo_email.rb +20 -0
  728. data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +83 -0
  729. data/lib/decidim/core/test/shared_examples/map_examples.rb +186 -0
  730. data/lib/decidim/core/test/shared_examples/metric_manage_shared_context.rb +9 -0
  731. data/lib/decidim/core/test/shared_examples/participatory_space_resourcable_interface_examples.rb +43 -0
  732. data/lib/decidim/core/test/shared_examples/permissions.rb +143 -0
  733. data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +55 -0
  734. data/lib/decidim/core/test/shared_examples/reports_examples.rb +4 -4
  735. data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +200 -0
  736. data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +59 -0
  737. data/lib/decidim/core/test/shared_examples/scopable_resource_examples.rb +43 -0
  738. data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +12 -1
  739. data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +2 -3
  740. data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +15 -2
  741. data/lib/decidim/core/test/shared_examples/simple_event.rb +8 -0
  742. data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +166 -0
  743. data/lib/decidim/core/test/shared_examples/timestamps_interface_examples.rb +21 -0
  744. data/lib/decidim/core/test/shared_examples/traceable_interface_examples.rb +47 -0
  745. data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +1 -1
  746. data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +89 -0
  747. data/lib/decidim/core/version.rb +1 -1
  748. data/lib/decidim/deprecations.rb +19 -0
  749. data/lib/decidim/diffy_extension.rb +47 -0
  750. data/lib/decidim/endorsable.rb +25 -0
  751. data/lib/decidim/events.rb +1 -0
  752. data/lib/decidim/events/base_event.rb +11 -9
  753. data/lib/decidim/events/user_group_event.rb +45 -0
  754. data/lib/decidim/exporters.rb +7 -0
  755. data/lib/decidim/exporters/csv.rb +16 -2
  756. data/lib/decidim/exporters/excel.rb +1 -1
  757. data/lib/decidim/exporters/export_manifest.rb +35 -2
  758. data/lib/decidim/exporters/pdf.rb +56 -0
  759. data/lib/decidim/file_validator_humanizer.rb +98 -0
  760. data/lib/decidim/filter_form_builder.rb +38 -11
  761. data/lib/decidim/form_builder.rb +239 -42
  762. data/lib/decidim/geocodable.rb +79 -0
  763. data/lib/decidim/has_attachments.rb +11 -1
  764. data/lib/decidim/has_settings.rb +10 -4
  765. data/lib/decidim/has_upload_validations.rb +36 -0
  766. data/lib/decidim/map.rb +214 -0
  767. data/lib/decidim/map/autocomplete.rb +67 -0
  768. data/lib/decidim/map/dynamic_map.rb +89 -0
  769. data/lib/decidim/map/frontend.rb +97 -0
  770. data/lib/decidim/map/geocoding.rb +115 -0
  771. data/lib/decidim/map/provider.rb +12 -0
  772. data/lib/decidim/map/provider/autocomplete/here.rb +20 -0
  773. data/lib/decidim/map/provider/autocomplete/osm.rb +20 -0
  774. data/lib/decidim/map/provider/dynamic_map/here.rb +51 -0
  775. data/lib/decidim/map/provider/dynamic_map/osm.rb +13 -0
  776. data/lib/decidim/map/provider/geocoding/here.rb +58 -0
  777. data/lib/decidim/map/provider/geocoding/osm.rb +30 -0
  778. data/lib/decidim/map/provider/here.rb +21 -0
  779. data/lib/decidim/map/provider/osm.rb +22 -0
  780. data/lib/decidim/map/provider/static_map/here.rb +35 -0
  781. data/lib/decidim/map/provider/static_map/osm.rb +29 -0
  782. data/lib/decidim/map/static_map.rb +133 -0
  783. data/lib/decidim/map/utility.rb +38 -0
  784. data/lib/decidim/organization_settings.rb +267 -0
  785. data/lib/decidim/participable.rb +6 -0
  786. data/lib/decidim/participatory_space_manifest.rb +35 -0
  787. data/lib/decidim/participatory_space_resourceable.rb +35 -1
  788. data/lib/decidim/query_extensions.rb +17 -37
  789. data/lib/decidim/resource_manifest.rb +1 -1
  790. data/lib/decidim/scopable.rb +19 -6
  791. data/lib/decidim/scopable_component.rb +29 -1
  792. data/lib/decidim/scopable_participatory_space.rb +19 -0
  793. data/lib/decidim/scopable_resource.rb +21 -0
  794. data/lib/decidim/search_resource_fields_mapper.rb +15 -2
  795. data/lib/decidim/searchable.rb +4 -0
  796. data/lib/decidim/settings_manifest.rb +16 -1
  797. data/lib/decidim/shareable_with_token.rb +27 -0
  798. data/lib/decidim/snippets.rb +30 -0
  799. data/lib/decidim/translatable_attributes.rb +42 -4
  800. data/lib/decidim/translatable_resource.rb +78 -0
  801. data/lib/decidim/view_model.rb +5 -0
  802. data/lib/tasks/decidim_data_portability_tasks.rake +66 -5
  803. data/lib/tasks/decidim_locales_tasks.rake +35 -0
  804. data/lib/tasks/decidim_metrics_tasks.rake +18 -7
  805. data/lib/tasks/decidim_tasks.rake +2 -0
  806. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.bg.js +14 -0
  807. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.da.js +14 -0
  808. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.el.js +14 -0
  809. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.eo.js +17 -0
  810. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.et.js +18 -0
  811. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr-CA.js +16 -0
  812. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ga.js +15 -0
  813. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.hr.js +13 -0
  814. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.is.js +14 -0
  815. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ja.js +16 -0
  816. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.lt.js +16 -0
  817. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.lv.js +17 -0
  818. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.mt.js +15 -0
  819. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ro.js +15 -0
  820. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sk.js +14 -0
  821. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sl.js +14 -0
  822. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sr.js +16 -0
  823. data/vendor/assets/javascripts/leaflet-tilelayer-here.js +200 -155
  824. data/vendor/assets/javascripts/svg4everybody.min.js +1 -2
  825. data/vendor/assets/javascripts/tribute.js +11 -4
  826. metadata +438 -42
  827. data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +0 -699
  828. data/app/assets/stylesheets/decidim/email.css +0 -1403
  829. data/app/assets/stylesheets/decidim/modules/_input-hashtags.scss +0 -124
  830. data/app/helpers/decidim/multi_translation_helper.rb +0 -0
  831. data/app/models/decidim/participatory_process_user_role.rb +0 -32
  832. data/app/resolvers/decidim/core/user_resolver.rb +0 -61
  833. data/app/views/decidim/messaging/conversations/_message.html.erb +0 -14
  834. data/lib/decidim/data_portability_file_reader.rb +0 -56
  835. data/lib/decidim/data_portability_file_zipper.rb +0 -67
  836. data/lib/decidim/hashtaggable.rb +0 -24
@@ -3,24 +3,26 @@
3
3
  */
4
4
  ((exports) => {
5
5
  class DataPicker {
6
- constructor(elements) {
6
+ constructor(pickers) {
7
7
  this.modal = this._createModalContainer();
8
8
  this.modal.appendTo($("body"));
9
9
  this.current = null;
10
10
 
11
- elements.each((_index, element) => {
12
- this.activate(element);
11
+ pickers.each((_index, picker) => {
12
+ this.activate(picker);
13
13
  });
14
14
  }
15
15
 
16
16
  activate(picker) {
17
- let $element = $(picker);
17
+ let $picker = $(picker);
18
+
19
+ this._setCurrentPicker($picker, null);
20
+
18
21
  let input = "hidden",
19
- name = $element.data("picker-name"),
20
- values = $(".picker-values", $element);
22
+ name = this.current.name,
23
+ values = this.current.values;
21
24
 
22
- if ($element.hasClass("picker-multiple")) {
23
- input = "checkbox";
25
+ if (this.current.multiple) {
24
26
  name += "[]";
25
27
  }
26
28
 
@@ -29,17 +31,27 @@
29
31
  $(div).prepend($(`<input type="${input}" checked name="${name}" value="${value}"/>`));
30
32
  });
31
33
 
32
- $element.on("click", "a", (event) => {
34
+ $picker.on("click", "a", (event) => {
33
35
  event.preventDefault();
34
- if ($element.hasClass("disabled")) {
36
+ if ($picker.hasClass("disabled")) {
35
37
  return;
36
38
  }
37
- this._openPicker($element, event.target.parentNode);
39
+ const isMultiPicker = $picker.hasClass("picker-multiple");
40
+
41
+ if ($(this._targetFromEvent(event)).hasClass("picker-prompt") || !isMultiPicker) {
42
+ this._openPicker($picker, this._targetFromEvent(event));
43
+ } else {
44
+ this._removeValue($picker, this._targetFromEvent(event));
45
+ }
38
46
  });
39
47
 
40
- $element.on("click", "input", (event) => {
41
- this._removeValue($element, event.target.parentNode);
48
+ $picker.on("click", "input", (event) => {
49
+ this._removeValue($picker, this._targetFromEvent(event));
42
50
  });
51
+
52
+ if (this.current.autosort) {
53
+ this._sort();
54
+ }
43
55
  }
44
56
 
45
57
  enabled(picker, value) {
@@ -65,34 +77,43 @@
65
77
  load(picker, savedData) {
66
78
  this._setCurrentPicker($(picker), null);
67
79
  $.each(savedData, (_index, data) => {
68
- this._choose(data, false);
80
+ this._choose(data, { interactive: false, modify: false });
69
81
  });
82
+ if (this.current.autosort) {
83
+ this._sort();
84
+ }
70
85
  }
71
86
 
72
87
  _createModalContainer() {
73
- return $(`<div class="small reveal" id="data_picker-modal" aria-hidden="true" role="dialog" aria-labelledby="data_picker-title" data-reveal data-multiple-opened="true">
74
- <div class="data_picker-modal-content"></div>
88
+ // Add a header because we are referencing the title element with
89
+ // `aria-labelledby`. If the title doesn't exist, the "labelled by"
90
+ // reference is incorrect.
91
+ const headerHtml = '<div class="scope-picker picker-header"><h6 id="data_picker-title" class="h2"></h6></div>';
92
+
93
+ return $(`<div class="small reveal" id="data_picker-modal" aria-hidden="true" aria-live="assertive" role="dialog" aria-labelledby="data_picker-title" data-reveal data-multiple-opened="true">
94
+ <div class="data_picker-modal-content">${headerHtml}</div>
75
95
  <button class="close-button" data-close type="button" data-reveal-id="data_picker-modal"><span aria-hidden="true">&times;</span></button>
76
96
  </div>`);
77
97
  }
78
98
 
79
- _openPicker($picker, div) {
80
- this._setCurrentPicker($picker, div);
81
- this._load($("a", div).attr("href"));
99
+ _openPicker($picker, target) {
100
+ this._setCurrentPicker($picker, target);
101
+ this._load($("a", target).attr("href"));
82
102
  }
83
103
 
84
- _setCurrentPicker($picker, div) {
85
- let currentDiv = false;
86
- if (div && !$(div).hasClass("picker-prompt")) {
87
- currentDiv = $(div);
104
+ _setCurrentPicker($picker, target) {
105
+ let $target = false;
106
+ if (target && !$(target).hasClass("picker-prompt")) {
107
+ $target = $(target);
88
108
  }
89
109
 
90
110
  this.current = {
91
- multiple: $picker.hasClass("picker-multiple"),
92
111
  picker: $picker,
93
112
  name: $picker.data("picker-name"),
94
113
  values: $picker.find(".picker-values"),
95
- div: currentDiv
114
+ multiple: $picker.hasClass("picker-multiple"),
115
+ autosort: $picker.hasClass("picker-multiple") && $picker.hasClass("picker-autosort"),
116
+ target: $target
96
117
  };
97
118
  }
98
119
 
@@ -101,6 +122,7 @@
101
122
  let modalContent = $(".data_picker-modal-content", this.modal);
102
123
  modalContent.html(resp);
103
124
  this._handleLinks(modalContent);
125
+ this._handleCheckboxes(modalContent);
104
126
  this.modal.foundation("open");
105
127
  });
106
128
  }
@@ -119,61 +141,109 @@
119
141
  if (typeof $link.data("picker-choose") === "undefined") {
120
142
  this._load(chooseUrl);
121
143
  } else {
122
- this._choose({ url: chooseUrl, value: $link.data("picker-value") || "", text: $link.data("picker-text") || "" });
144
+ this._choose(
145
+ { url: chooseUrl, value: $link.data("picker-value") || "", text: $link.data("picker-text") || "" }
146
+ );
123
147
  }
124
148
  }
125
149
  });
126
150
  });
127
151
  }
128
152
 
129
- _choose(data, user = true) {
130
- // Prevent choosing is nothing has been selected. This would otherwise
131
- // cause an empty checkbox to appear in the selected values list.
132
- if (!data.value || data.value.length < 1) {
133
- return;
134
- }
153
+ _handleCheckboxes(content) {
154
+ $("input[type=checkbox][data-picker-choose]", content).each((_index, checkbox) => {
155
+ const $checkbox = $(checkbox);
156
+ checkbox.checked = this._targetFromValue($checkbox.val()) !== null;
157
+ }).change((event) => {
158
+ const $checkbox = $(event.target);
159
+ if (event.target.checked) {
160
+ this._choose(
161
+ { url: $checkbox.data("picker-url"), value: $checkbox.val() || "", text: $checkbox.data("picker-text") || "" },
162
+ { modify: false, close: false }
163
+ );
164
+ }
165
+ else {
166
+ this._removeValue(this.current.picker, this._targetFromValue($checkbox.val()));
167
+ }
168
+ });
169
+ }
170
+
171
+ _choose(data, opts = {}) {
172
+ const options = Object.assign({ interactive: true, modify: true, close: true }, opts);
135
173
 
136
174
  let dataText = this._escape(data.text);
175
+ let choosenOption = null;
176
+
177
+ if (!this.current.target && options.modify) {
178
+ this.current.target = this._targetFromValue(data.value);
179
+ }
137
180
 
138
181
  // Add or update value appearance
139
- if (this.current.div) {
140
- let link = $("a", this.current.div);
182
+ if (this.current.target && options.modify) {
183
+ let link = $("a", this.current.target);
141
184
  link.data("picker-value", data.value);
142
185
  link.attr("href", data.url);
143
- link.text(dataText);
186
+ choosenOption = this.current.target;
187
+ if (this.current.multiple) {
188
+ link.html(`&times;&nbsp;${dataText}`);
189
+ } else {
190
+ link.text(dataText);
191
+ }
144
192
  } else {
145
193
  let input = "hidden",
146
194
  name = this.current.name;
147
195
 
148
196
  if (this.current.multiple) {
149
- input = "checkbox";
150
197
  name += "[]";
198
+ choosenOption = $(`<div><input type="${input}" checked name="${name}"/><a href="${data.url}" data-picker-value="${data.value}" class="label primary">&times;&nbsp;${dataText}</a></div>`);
199
+ } else {
200
+ choosenOption = $(`<div><input type="${input}" checked name="${name}"/><a href="${data.url}" data-picker-value="${data.value}">${dataText}</a></div>`);
201
+ }
202
+ choosenOption.appendTo(this.current.values);
203
+
204
+ if (!this.current.target) {
205
+ this.current.target = choosenOption;
151
206
  }
152
- this.current.div = $(`<div><input type="${input}" checked name="${name}"/><a href="${data.url}" data-picker-value="${data.value}">${dataText}</a></div>`);
153
- this.current.div.appendTo(this.current.values);
154
207
  }
155
208
 
156
209
  // Set input value
157
- let $input = $("input", this.current.div);
210
+ let $input = $("input", choosenOption);
158
211
  $input.attr("value", data.value);
159
212
 
160
- // Raise changed event
161
- if (user) {
213
+ if (this.current.autosort) {
214
+ this._sort();
215
+ }
216
+
217
+ if (options.interactive) {
218
+ // Raise changed event
162
219
  $input.trigger("change");
163
220
  this._removeErrors();
164
- this.modal.foundation("close");
221
+
222
+ if (options.close) {
223
+ this._close();
224
+ }
165
225
  }
226
+ }
166
227
 
167
- // Unselect updated value and close modal
168
- this.current.div = null;
228
+ _sort() {
229
+ const values = $(".picker-values", this.current.picker);
230
+ values.children().sort((item1, item2) => $("input", item1).val() - $("input", item2).val()).detach().appendTo(values);
169
231
  }
170
232
 
171
- _removeValue($picker, div) {
172
- this._setCurrentPicker($picker, div);
173
- this.current.div.fadeOut(500, () => {
174
- this.current.div.remove();
175
- this.current.div = null;
176
- });
233
+ _close() {
234
+ // Close modal and unset target element
235
+ this.modal.foundation("close");
236
+ this.current.target = null;
237
+ }
238
+
239
+ _removeValue($picker, target) {
240
+ if (target) {
241
+ this._setCurrentPicker($picker, target);
242
+ this.current.target.fadeOut(500, () => {
243
+ this.current.target.remove();
244
+ this.current.target = null;
245
+ });
246
+ }
177
247
  }
178
248
 
179
249
  _removeErrors() {
@@ -188,6 +258,14 @@
188
258
  return `&#${char.charCodeAt(0)};`;
189
259
  });
190
260
  }
261
+
262
+ _targetFromEvent(event) {
263
+ return event.target.parentNode;
264
+ }
265
+
266
+ _targetFromValue(value) {
267
+ return $(`[data-picker-value=${value}]`, this.current.picker).parent()[0] || null;
268
+ }
191
269
  }
192
270
 
193
271
  exports.Decidim = exports.Decidim || {};
@@ -0,0 +1,26 @@
1
+ ((exports) => {
2
+
3
+ /**
4
+ * Returns a function, that, as long as it continues to be invoked, will not
5
+ * be triggered. The function will be called after it stops being called for
6
+ * N milliseconds.
7
+ * @param {Object} context - the context for the called function.
8
+ * @param {Function} func - the function to be executed.
9
+ * @param {int} wait - number of milliseconds to wait before executing the function.
10
+ * @private
11
+ * @returns {Void} - Returns nothing.
12
+ */
13
+ exports.delayed = (context, func, wait) => {
14
+ let timeout = null;
15
+
16
+ return function(...args) {
17
+ if (timeout) {
18
+ clearTimeout(timeout);
19
+ }
20
+ timeout = setTimeout(() => {
21
+ timeout = null;
22
+ Reflect.apply(func, context, args);
23
+ }, wait);
24
+ }
25
+ }
26
+ })(window);
@@ -1,16 +1,49 @@
1
1
  $(() => {
2
+ const $allDiffViews = $(".row.diff_view");
3
+
2
4
  $(document).on("click", ".diff-view-by a.diff-view-mode", (event) => {
3
5
  event.preventDefault();
4
- const $target = $(event.target);
5
- $target.parents(".is-dropdown-submenu-parent").find("#diff-view-selected").text($target.text());
6
+ const $target = $(event.target)
7
+ let type = "escaped";
8
+ const $selected = $target.parents(".is-dropdown-submenu-parent").find("#diff-view-selected");
9
+ if ($selected.text().trim() === $target.text().trim()) {
10
+ return;
11
+ }
12
+
13
+ $selected.text($target.text());
6
14
 
7
15
  if ($target.attr("id") === "diff-view-unified") {
8
- $(".row#diff_split").addClass("hide");
9
- $(".row#diff_unified").removeClass("hide");
16
+ if ($(".row.diff_view_split_escaped").hasClass("hide")) {
17
+ type = "unescaped";
18
+ }
19
+
20
+ $allDiffViews.addClass("hide");
21
+ $(`.row.diff_view_unified_${type}`).removeClass("hide");
10
22
  }
11
23
  if ($target.attr("id") === "diff-view-split") {
12
- $(".row#diff_unified").addClass("hide");
13
- $(".row#diff_split").removeClass("hide");
24
+ if ($(".row.diff_view_unified_escaped").hasClass("hide")) {
25
+ type = "unescaped";
26
+ }
27
+
28
+ $allDiffViews.addClass("hide");
29
+ $(`.row.diff_view_split_${type}`).removeClass("hide");
30
+ }
31
+ })
32
+
33
+ $(document).on("click", ".diff-view-by a.diff-view-html", (event) => {
34
+ event.preventDefault();
35
+ const $target = $(event.target);
36
+ $target.parents(".is-dropdown-submenu-parent").find("#diff-view-selected").text($target.text());
37
+ const $visibleDiffViewsId = $allDiffViews.not(".hide").first().attr("id").split("_").slice(1, -1).join("_");
38
+ const $visibleDiffViews = $allDiffViews.filter(`[id*=${$visibleDiffViewsId}]`)
39
+
40
+ if ($target.attr("id") === "escaped-html") {
41
+ $visibleDiffViews.filter("[id$=_unescaped]").addClass("hide");
42
+ $visibleDiffViews.filter("[id$=_escaped]").removeClass("hide");
43
+ }
44
+ if ($target.attr("id") === "unescaped-html") {
45
+ $visibleDiffViews.filter("[id$=_escaped]").addClass("hide");
46
+ $visibleDiffViews.filter("[id$=_unescaped]").removeClass("hide");
14
47
  }
15
48
  })
16
49
  });
@@ -0,0 +1,32 @@
1
+ ((exports) => {
2
+ // This will apply some fixes for the Foundation dropdown menu element
3
+ // according to W3C instructions at:
4
+ // https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-links.html
5
+ //
6
+ // NOTE:
7
+ // This needs to run AFTER Foundation has been initialized because those
8
+ // initializers will affect the drop down menu elements.
9
+ const fixDropdownMenus = () => {
10
+ exports.$("[data-dropdown-menu]").each((_i, element) => {
11
+ // This will break navigation on macOS VoiceOver app since it will let the
12
+ // user to focus on the li element instead of the <a> element where we
13
+ // actually need the focus to be in.
14
+ $("li.is-dropdown-submenu-parent", element).removeAttr("aria-haspopup").removeAttr("aria-label");
15
+ // Foundation marks the wrong role for the submenu elements
16
+ $("ul.is-dropdown-submenu", element).attr("role", "menu");
17
+ })
18
+ }
19
+
20
+ // Ensure the first element is always focused when a dropdown is opened as
21
+ // this would not always happen when using a screen reader. If this is not
22
+ // done, the screen reader will stay quiet when the menu opens which can lead
23
+ // to the blind user not understanding the menu has opened.
24
+ exports.$(() => {
25
+ exports.$("[data-dropdown-menu]").on("show.zf.dropdownMenu", (_i, element) => {
26
+ exports.$("li:first > a", element).focus();
27
+ });
28
+ });
29
+
30
+ exports.Decidim = exports.Decidim || {};
31
+ exports.Decidim.fixDropdownMenus = fixDropdownMenus;
32
+ })(window);
@@ -28,6 +28,8 @@
28
28
  }
29
29
 
30
30
  const $input = $(container).siblings('input[type="hidden"]');
31
+ container.innerHTML = $input.val() || "";
32
+
31
33
  const quill = new Quill(container, {
32
34
  modules: {
33
35
  toolbar: quillToolbar
@@ -56,12 +58,10 @@
56
58
  $input.val(quill.root.innerHTML);
57
59
  }
58
60
  });
59
-
60
- quill.root.innerHTML = $input.val() || "";
61
61
  };
62
62
 
63
63
  const quillEditor = () => {
64
- $(".editor-container").each((idx, container) => {
64
+ $(".editor-container").each((_idx, container) => {
65
65
  createQuillEditor(container);
66
66
  });
67
67
  };
@@ -0,0 +1,69 @@
1
+ ((exports) => {
2
+ const { icon } = exports.Decidim;
3
+
4
+ const EXCLUDE_CLASSES = [
5
+ "card--list__data__icon",
6
+ "footer-social__icon",
7
+ "logo-cityhall"
8
+ ];
9
+ const EXCLUDE_REL = ["license", "decidim"];
10
+
11
+ const DEFAULT_MESSAGES = {
12
+ externalLink: "External link"
13
+ };
14
+ let MESSAGES = DEFAULT_MESSAGES;
15
+
16
+ class ExternalLink {
17
+ static configureMessages(messages) {
18
+ MESSAGES = exports.$.extend(DEFAULT_MESSAGES, messages);
19
+ }
20
+
21
+ constructor(link) {
22
+ this.$link = link;
23
+
24
+ this.setup();
25
+ }
26
+
27
+ setup() {
28
+ if (EXCLUDE_CLASSES.some((cls) => this.$link.hasClass(cls))) {
29
+ return;
30
+ }
31
+ if (
32
+ EXCLUDE_REL.some((rel) => {
33
+ const linkRels = `${this.$link.attr("rel")}`.split(" ");
34
+ return linkRels.indexOf(rel) > -1;
35
+ })
36
+ ) {
37
+ return;
38
+ }
39
+
40
+ this.$link.addClass("external-link-container");
41
+ this.$link.append(`&nbsp;${this.generateElement()}`);
42
+ }
43
+
44
+ generateElement() {
45
+ let content = `${this.generateIcon()}${this.generateScreenReaderLabel()}`;
46
+
47
+ return `<span class="external-link-indicator">${content}</span>`;
48
+ }
49
+
50
+ generateIcon() {
51
+ return icon("external-link");
52
+ }
53
+
54
+ generateScreenReaderLabel() {
55
+ return `<span class="show-for-sr">(${MESSAGES.externalLink})</span>`;
56
+ }
57
+ }
58
+
59
+ exports.Decidim = exports.Decidim || {};
60
+ exports.Decidim.ExternalLink = ExternalLink;
61
+
62
+ $(document).ready(function() {
63
+ $('a[target="_blank"]').each((_i, elem) => {
64
+ const $link = $(elem);
65
+
66
+ $link.data("external-link", new ExternalLink($link));
67
+ });
68
+ });
69
+ })(window);