decidim-core 0.28.0 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/activity_cell.rb +2 -2
  3. data/app/cells/decidim/address/online.erb +27 -9
  4. data/app/cells/decidim/address/show.erb +27 -12
  5. data/app/cells/decidim/address_cell.rb +29 -0
  6. data/app/cells/decidim/authorization_modal/show.erb +8 -4
  7. data/app/cells/decidim/authorization_modal_cell.rb +1 -0
  8. data/app/cells/decidim/card_metadata_cell.rb +3 -3
  9. data/app/cells/decidim/coauthorships_cell.rb +1 -1
  10. data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +6 -0
  11. data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +20 -4
  12. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +8 -0
  13. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb +13 -0
  14. data/app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb +1 -1
  15. data/app/cells/decidim/footer_pages_cell.rb +3 -3
  16. data/app/cells/decidim/profile/tabs.erb +3 -2
  17. data/app/cells/decidim/tags_cell.rb +3 -1
  18. data/app/cells/decidim/upload_modal/modal.erb +2 -2
  19. data/app/commands/decidim/create_omniauth_registration.rb +1 -3
  20. data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
  21. data/app/commands/decidim/messaging/start_conversation.rb +3 -0
  22. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
  23. data/app/controllers/concerns/decidim/paginable.rb +1 -1
  24. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
  25. data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
  26. data/app/events/decidim/welcome_notification_event.rb +6 -9
  27. data/app/helpers/decidim/application_helper.rb +0 -18
  28. data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
  29. data/app/helpers/decidim/check_boxes_tree_helper.rb +6 -6
  30. data/app/helpers/decidim/layout_helper.rb +1 -1
  31. data/app/helpers/decidim/map_helper.rb +1 -1
  32. data/app/helpers/decidim/menu_helper.rb +2 -0
  33. data/app/helpers/decidim/newsletters_helper.rb +83 -16
  34. data/app/helpers/decidim/paginate_helper.rb +1 -1
  35. data/app/helpers/decidim/sanitize_helper.rb +9 -0
  36. data/app/helpers/decidim/social_share_button_helper.rb +1 -1
  37. data/app/helpers/decidim/user_profile_helper.rb +7 -2
  38. data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
  39. data/app/models/decidim/push_notification_message.rb +38 -0
  40. data/app/packs/entrypoints/decidim_overrides.scss +2 -0
  41. data/app/packs/images/decidim/.keep +0 -0
  42. data/app/packs/src/decidim/a11y.js +1 -1
  43. data/app/packs/src/decidim/account_form.js +1 -1
  44. data/app/packs/src/decidim/data_consent/consent_manager.test.js +1 -1
  45. data/app/packs/src/decidim/data_consent/index.js +1 -1
  46. data/app/packs/src/decidim/direct_uploads/upload_field.js +1 -1
  47. data/app/packs/src/decidim/direct_uploads/upload_modal.js +10 -6
  48. data/app/packs/src/decidim/editor/extensions/hashtag/index.js +1 -1
  49. data/app/packs/src/decidim/editor/extensions/mention/index.js +1 -1
  50. data/app/packs/src/decidim/editor/extensions/video_embed/index.js +3 -0
  51. data/app/packs/src/decidim/editor/test/editor/create.test.js +1 -1
  52. data/app/packs/src/decidim/editor/test/extensions/bold.test.js +2 -3
  53. data/app/packs/src/decidim/editor/test/extensions/character_count.test.js +2 -2
  54. data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +2 -3
  55. data/app/packs/src/decidim/editor/test/extensions/dialog.test.js +2 -2
  56. data/app/packs/src/decidim/editor/test/extensions/emoji.test.js +2 -2
  57. data/app/packs/src/decidim/editor/test/extensions/hashtag.test.js +2 -2
  58. data/app/packs/src/decidim/editor/test/extensions/heading.test.js +2 -2
  59. data/app/packs/src/decidim/editor/test/extensions/image.test.js +4 -4
  60. data/app/packs/src/decidim/editor/test/extensions/indent.test.js +2 -2
  61. data/app/packs/src/decidim/editor/test/extensions/link.test.js +3 -3
  62. data/app/packs/src/decidim/editor/test/extensions/mention.test.js +2 -2
  63. data/app/packs/src/decidim/editor/test/extensions/ordered_list.test.js +2 -2
  64. data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +3 -3
  65. data/app/packs/src/decidim/editor/test/helpers.js +5 -4
  66. data/app/packs/src/decidim/editor/test/toolbar/basic.test.js +2 -2
  67. data/app/packs/src/decidim/editor/test/toolbar/content.test.js +2 -2
  68. data/app/packs/src/decidim/editor/test/toolbar/full.test.js +3 -3
  69. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic.js +6 -6
  70. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +2 -2
  71. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +1 -1
  72. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +2 -2
  73. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +2 -2
  74. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +2 -2
  75. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +2 -2
  76. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content.js +7 -7
  77. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +2 -2
  78. data/app/packs/src/decidim/editor/test/toolbar/shared/context.js +1 -1
  79. data/app/packs/src/decidim/editor/test/utilities/paste_transform.test.js +2 -2
  80. data/app/packs/src/decidim/external_domain_warning.js +13 -0
  81. data/app/packs/src/decidim/external_domain_warning.test.js +1 -1
  82. data/app/packs/src/decidim/external_link.js +48 -9
  83. data/app/packs/src/decidim/external_link.test.js +1 -1
  84. data/app/packs/src/decidim/focus_guard.js +8 -20
  85. data/app/packs/src/decidim/form_filter.component_for_testing.js +1 -1
  86. data/app/packs/src/decidim/form_filter.js +3 -3
  87. data/app/packs/src/decidim/geocoding/attach_input.js +1 -1
  88. data/app/packs/src/decidim/i18n.test.js +1 -1
  89. data/app/packs/src/decidim/index.js +4 -1
  90. data/app/packs/src/decidim/input_hashtags.js +1 -1
  91. data/app/packs/src/decidim/input_mentions.js +1 -1
  92. data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
  93. data/app/packs/src/decidim/sw/index.js +3 -3
  94. data/app/packs/src/decidim/user_registrations.js +1 -1
  95. data/app/packs/src/decidim/vizzs/index.js +1 -1
  96. data/app/packs/stylesheets/decidim/_cards.scss +2 -2
  97. data/app/packs/stylesheets/decidim/_dropdown.scss +2 -2
  98. data/app/packs/stylesheets/decidim/_layout.scss +4 -4
  99. data/app/packs/stylesheets/decidim/application.scss +0 -3
  100. data/app/packs/stylesheets/decidim/decidim_application.scss +4 -0
  101. data/app/packs/stylesheets/decidim/legacy/leaflet.scss +88 -107
  102. data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
  103. data/app/presenters/decidim/log/diff_presenter.rb +1 -1
  104. data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
  105. data/app/services/decidim/events_manager.rb +6 -0
  106. data/app/services/decidim/iframe_disabler.rb +4 -0
  107. data/app/services/decidim/push_notification_message_sender.rb +40 -0
  108. data/app/services/decidim/send_push_notification.rb +22 -8
  109. data/app/uploaders/decidim/background_image_uploader.rb +11 -0
  110. data/app/views/decidim/application/_collection.html.erb +2 -2
  111. data/app/views/decidim/application/_document.html.erb +1 -1
  112. data/app/views/decidim/devise/registrations/new.html.erb +2 -2
  113. data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
  114. data/app/views/decidim/offline/show.html.erb +15 -9
  115. data/app/views/layouts/decidim/_head.html.erb +1 -0
  116. data/app/views/layouts/decidim/_js_configuration.html.erb +3 -1
  117. data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +5 -5
  118. data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
  119. data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
  120. data/config/assets.rb +1 -0
  121. data/config/locales/ar.yml +63 -7
  122. data/config/locales/bg.yml +32 -2
  123. data/config/locales/ca.yml +29 -24
  124. data/config/locales/cs.yml +6 -2
  125. data/config/locales/de.yml +34 -29
  126. data/config/locales/el.yml +3 -6
  127. data/config/locales/en.yml +7 -2
  128. data/config/locales/es-MX.yml +9 -4
  129. data/config/locales/es-PY.yml +9 -4
  130. data/config/locales/es.yml +27 -22
  131. data/config/locales/eu.yml +22 -8
  132. data/config/locales/fi-plain.yml +8 -3
  133. data/config/locales/fi.yml +10 -5
  134. data/config/locales/fr-CA.yml +12 -7
  135. data/config/locales/fr.yml +12 -7
  136. data/config/locales/ga-IE.yml +1 -0
  137. data/config/locales/gl.yml +4 -2
  138. data/config/locales/he-IL.yml +1 -0
  139. data/config/locales/hu.yml +264 -7
  140. data/config/locales/id-ID.yml +0 -2
  141. data/config/locales/it.yml +2 -5
  142. data/config/locales/ja.yml +11 -6
  143. data/config/locales/lb.yml +2 -5
  144. data/config/locales/lt.yml +0 -10
  145. data/config/locales/lv.yml +0 -2
  146. data/config/locales/nl.yml +1 -2
  147. data/config/locales/no.yml +2 -5
  148. data/config/locales/pl.yml +581 -2
  149. data/config/locales/pt-BR.yml +202 -18
  150. data/config/locales/pt.yml +2 -5
  151. data/config/locales/ro-RO.yml +2 -5
  152. data/config/locales/ru.yml +7 -2
  153. data/config/locales/sk.yml +0 -2
  154. data/config/locales/sv.yml +24 -5
  155. data/config/locales/tr-TR.yml +3 -5
  156. data/config/locales/uk.yml +12 -2
  157. data/config/locales/zh-CN.yml +0 -5
  158. data/config/locales/zh-TW.yml +2 -10
  159. data/decidim-core.gemspec +90 -0
  160. data/lib/decidim/asset_router/storage.rb +2 -0
  161. data/lib/decidim/attribute_encryptor.rb +6 -4
  162. data/lib/decidim/attributes/time_with_zone.rb +1 -1
  163. data/lib/decidim/core/engine.rb +7 -6
  164. data/lib/decidim/core/seeds.rb +36 -32
  165. data/lib/decidim/core/test/factories.rb +296 -89
  166. data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
  167. data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
  168. data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
  169. data/lib/decidim/core/test/shared_examples/has_attachments.rb +8 -8
  170. data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
  171. data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
  172. data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -1
  173. data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -0
  174. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +5 -2
  175. data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
  176. data/lib/decidim/core/test/shared_examples/simple_event.rb +18 -2
  177. data/lib/decidim/core/test.rb +1 -0
  178. data/lib/decidim/core/version.rb +1 -1
  179. data/lib/decidim/core.rb +1 -0
  180. data/lib/decidim/engine_router.rb +17 -4
  181. data/lib/decidim/events/base_event.rb +3 -3
  182. data/lib/decidim/events/simple_event.rb +3 -17
  183. data/lib/decidim/form_builder.rb +8 -2
  184. data/lib/decidim/has_category.rb +1 -1
  185. data/lib/decidim/has_conversations.rb +91 -0
  186. data/lib/decidim/participable.rb +17 -0
  187. data/lib/decidim/upgrade/wysiwyg_migrator.rb +7 -0
  188. data/lib/decidim/view_model.rb +1 -0
  189. data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
  190. data/lib/premailer/adapter/decidim.rb +5 -4
  191. data/lib/tasks/decidim_reminders_tasks.rake +1 -0
  192. data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
  193. metadata +27 -30
  194. data/app/views/decidim/searches/index.js.erb +0 -7
  195. data/config/brakeman.ignore +0 -37
  196. data/config/environment.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5b30446f8e883cb4610be652a64155471870ba9271583ce5b7061105f8d0c68
4
- data.tar.gz: 300643e7aaf06cde799abae047625d5e73217f9669addea64be65b81ca56a194
3
+ metadata.gz: 800e096eb86537caa7de18236fe0becf73b1c30ee38e4631888025b52e831f3a
4
+ data.tar.gz: 9f05dfffcd55fcc9d4e76163a4b98c5b7e851bbdbcfe317f9a9566cb73a142d9
5
5
  SHA512:
6
- metadata.gz: 9bf0e3704aecce6bbf26a5603990f07a2d05b44f1d06cec5f8804b563a71e322cd225ebdaf5b487f001eaa485173b09c07643495e3d58b374ad03e59b0505f8c
7
- data.tar.gz: f24a8579f4ce4916b9786c4775cb3e865de4da331860a9105768163d868b0b8fc7191d738c23d9c0e8942a924d2c8c681c2f6db8b09aae6942d233e711d38f3e
6
+ metadata.gz: 97568f03aab3b39a4b75e98421a5b9e43f30f8f1c71b548478f0ee2f73c6303981643948289f9483d9cfbe71af47b872bf3e3c49d39009270e9e3ef72e55bf70
7
+ data.tar.gz: 8fa7ecb28d0d2e8097124330aced622ac52fc96d6cc8d6039e629c897d29af8f79366e8992107a9d8b89c88280c723b667b345ccbc643d2326303f376abd243a
@@ -39,9 +39,9 @@ module Decidim
39
39
 
40
40
  case resource_title
41
41
  when String
42
- resource_title
42
+ decidim_html_escape(resource_title)
43
43
  when Hash
44
- translated_attribute(resource_title)
44
+ decidim_escape_translated(resource_title)
45
45
  end
46
46
  end
47
47
 
@@ -1,9 +1,27 @@
1
- <div class="address__container">
2
- <%= icon "map-pin-line" %>
3
- <div class="address">
4
- <div class="address__location"><%= t(model.type_of_meeting, scope: "decidim.meetings.meetings.filters.type_values") %></div>
5
- <a href="<%= model.online_meeting_url %>" target="_blank" rel="noopener noreferrer" class="address__hints underline break-all">
6
- <%= model.online_meeting_url %>
7
- </a>
8
- </div>
9
- </div>
1
+ <ul>
2
+ <li class="mb-4">
3
+ <div class="address__container">
4
+ <%= icon "map-pin-line" %>
5
+ <div class="address">
6
+ <div class="address__location"><%= t(model.type_of_meeting, scope: "decidim.meetings.meetings.filters.type_values") %></div>
7
+ <% if display_online_meeting_url? %>
8
+ <a href="<%= model.online_meeting_url %>" target="_blank" rel="noopener noreferrer" class="address__hints underline break-all">
9
+ <%= model.online_meeting_url %>
10
+ <% end %>
11
+ </a>
12
+ </div>
13
+ </div>
14
+ </li>
15
+ <% if display_start_and_end_time? %>
16
+ <li>
17
+ <div class="address__container">
18
+ <%= icon "time-line" %>
19
+ <div class="address">
20
+ <div class="address__location">
21
+ <%= start_and_end_time %>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </li>
26
+ <% end %>
27
+ </ul>
@@ -1,14 +1,29 @@
1
- <div class="address__container">
2
- <%= icon "map-pin-line" %>
3
- <div class="address">
4
- <% if has_location? %>
5
- <div class="address__location"><%= location %></div>
6
- <% end %>
1
+ <ul>
2
+ <li class="mb-4">
3
+ <div class="address__container">
4
+ <%= icon "map-pin-line" %>
5
+ <div class="address">
6
+ <% if has_location? %>
7
+ <div class="address__location"><%= location %></div>
8
+ <% end %>
7
9
 
8
- <div class="address__address"><%= address %></div>
10
+ <div class="address__address"><%= address %></div>
9
11
 
10
- <% if has_location_hints? %>
11
- <div class="address__hints"><%= location_hints %></div>
12
- <% end %>
13
- </div>
14
- </div>
12
+ <% if has_location_hints? %>
13
+ <div class="address__hints"><%= location_hints %></div>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ </li>
18
+ <% if display_start_and_end_time? %>
19
+ <li>
20
+ <div class="address__container">
21
+ <%= icon "time-line" %>
22
+ <div class="address">
23
+ <div class="address__location">
24
+ <%= start_and_end_time %>
25
+ </div>
26
+ </div>
27
+ </li>
28
+ <% end %>
29
+ </ul>
@@ -32,5 +32,34 @@ module Decidim
32
32
  def address
33
33
  decidim_sanitize(translated_attribute(model.address))
34
34
  end
35
+
36
+ def display_start_and_end_time?
37
+ model.respond_to?(:start_time) && model.respond_to?(:end_time)
38
+ end
39
+
40
+ def start_and_end_time
41
+ <<~HTML
42
+ #{with_tooltip(l(model.start_time, format: :tooltip)) { start_time }}
43
+ -
44
+ #{with_tooltip(l(model.end_time, format: :tooltip)) { end_time }}
45
+ HTML
46
+ end
47
+
48
+ def display_online_meeting_url?
49
+ return true unless model.respond_to?(:online?)
50
+ return true unless model.respond_to?(:iframe_access_level_allowed_for_user?)
51
+
52
+ model.online? && model.iframe_access_level_allowed_for_user?(current_user)
53
+ end
54
+
55
+ private
56
+
57
+ def start_time
58
+ l model.start_time, format: "%H:%M %p"
59
+ end
60
+
61
+ def end_time
62
+ l model.end_time, format: "%H:%M %p %Z"
63
+ end
35
64
  end
36
65
  end
@@ -1,6 +1,10 @@
1
- <div data-dialog-container>
2
- <%= icon "lock-line" %>
3
- <h2 id="dialog-title-authorizationModal" tabindex="-1" data-dialog-title><%= title %></h2>
1
+ <% add_decidim_page_title(title) %>
2
+
3
+ <main data-dialog-container class="text-center mt-8">
4
+ <div class="flex justify-center">
5
+ <%= icon "lock-line", class: "w-20 h-20" %>
6
+ </div>
7
+ <h1 tabindex="-1" class="h1" data-dialog-title><%= title %></h1>
4
8
  <div>
5
9
  <div class="authorization-modal__verification-container">
6
10
  <% verifications.each do |verification| %>
@@ -25,4 +29,4 @@
25
29
  <% end %>
26
30
  </div>
27
31
  </div>
28
- </div>
32
+ </main>
@@ -3,6 +3,7 @@
3
3
  module Decidim
4
4
  class AuthorizationModalCell < Decidim::ViewModel
5
5
  include LayoutHelper
6
+ include Decidim::MetaTagsHelper
6
7
 
7
8
  delegate :authorize_action_path, to: :controller
8
9
 
@@ -75,7 +75,7 @@ module Decidim
75
75
 
76
76
  {
77
77
  cell: "decidim/coauthorships",
78
- args: [resource, { stack: true }]
78
+ args: [resource, { stack: true, context_actions: [] }]
79
79
  }
80
80
  end
81
81
 
@@ -105,11 +105,11 @@ module Decidim
105
105
  }
106
106
  end
107
107
 
108
- def duration_item
108
+ def start_date_item
109
109
  return if dates_blank?
110
110
 
111
111
  {
112
- text: distance_of_time_in_words(start_date, end_date, scope: "datetime.distance_in_words.short"),
112
+ text: I18n.l(start_date, format: "%H:%M %p %Z"),
113
113
  icon: "time-line"
114
114
  }
115
115
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
  cell(
17
17
  "decidim/collapsible_authors",
18
18
  presenters_for_identities(model),
19
- options
19
+ options.merge(from: model)
20
20
  )
21
21
  end
22
22
  end
@@ -5,6 +5,12 @@ module Decidim
5
5
  # A cell to be rendered as a content block with the latest activities performed
6
6
  # in a Decidim Organization.
7
7
  class MenuBreadcrumbLastActivityCell < LastActivityCell
8
+ def show
9
+ return if current_user.blank? && current_organization&.force_users_to_authenticate_before_access_organization
10
+
11
+ super
12
+ end
13
+
8
14
  private
9
15
 
10
16
  def activities
@@ -7,19 +7,35 @@ module Decidim
7
7
  include Decidim::TranslationsHelper
8
8
  include Decidim::TwitterSearchHelper
9
9
 
10
- attr_reader :cta_text, :cta_path
10
+ delegate :title, :hashtag, :attached_uploader, to: :resource
11
11
 
12
- delegate :title, :subtitle, :attached_uploader, :hashtag, to: :resource
12
+ def cta_text
13
+ return unless model
14
+
15
+ @cta_text ||= translated_attribute(model.settings.button_text).presence
16
+ end
17
+
18
+ def cta_path
19
+ return unless model
20
+
21
+ @cta_path ||= translated_attribute(model.settings.button_url).presence
22
+ end
13
23
 
14
24
  def title_text
15
- translated_attribute(title)
25
+ decidim_escape_translated(title)
16
26
  end
17
27
 
18
28
  def subtitle_text
19
- translated_attribute(subtitle)
29
+ return unless resource.respond_to?(:subtitle)
30
+
31
+ decidim_escape_translated(resource.subtitle)
20
32
  end
21
33
 
34
+ # If it is called from the landing page content block, use the background image defined there
35
+ # Else, use the banner image defined in the space (for assemblies)
22
36
  def image_path
37
+ return model.images_container.attached_uploader(:background_image).path if model.respond_to?(:images_container)
38
+
23
39
  attached_uploader(:banner_image).path
24
40
  end
25
41
 
@@ -0,0 +1,8 @@
1
+ <% form.fields_for :settings, form.object.settings do |settings_fields| %>
2
+ <%= settings_fields.translated :text_field, :button_text, label: t("decidim.content_blocks.cta_settings_form.button_text") %>
3
+ <%= settings_fields.translated :text_field, :button_url, label: t("decidim.content_blocks.cta_settings_form.button_url") %>
4
+ <% end %>
5
+
6
+ <% form.fields_for :images, form.object.images do |images_fields| %>
7
+ <%= images_fields.upload :background_image, label: t("decidim.content_blocks.cta_settings_form.background_image") %>
8
+ <% end %>
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class ParticipatorySpaceHeroSettingsFormCell < Decidim::ViewModel
6
+ alias form model
7
+
8
+ def content_block
9
+ options[:content_block]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -11,7 +11,7 @@ module Decidim
11
11
 
12
12
  def metadata_valued_items
13
13
  metadata_items.filter_map do |item|
14
- next if (value = translated_attribute(presented_space.send(item))).blank?
14
+ next if (value = decidim_escape_translated(presented_space.send(item))).blank?
15
15
 
16
16
  {
17
17
  title: t(item, scope: translations_scope),
@@ -42,7 +42,7 @@ module Decidim
42
42
  .static_pages_accessible_for(current_user)
43
43
  .where(show_in_footer: true, topic_id: nil)
44
44
  .where.not(slug: "terms-and-conditions").map do |page|
45
- { title: translated_attribute(page.title), path: decidim.page_path(page) }
45
+ { title: decidim_escape_translated(page.title), path: decidim.page_path(page) }
46
46
  end
47
47
  end
48
48
 
@@ -51,9 +51,9 @@ module Decidim
51
51
  next if (topic_pages = topic.accessible_pages_for(current_user).where(show_in_footer: true)).blank?
52
52
 
53
53
  {
54
- title: translated_attribute(topic.title),
54
+ title: decidim_escape_translated(topic.title),
55
55
  pages: topic_pages.map do |page|
56
- { title: translated_attribute(page.title), path: decidim.page_path(page) }
56
+ { title: decidim_escape_translated(page.title), path: decidim.page_path(page) }
57
57
  end
58
58
  }
59
59
  end.compact
@@ -1,6 +1,7 @@
1
1
  <% tab_items.each do |tab_item| %>
2
- <li class="profile__tab<%= " is-active" if is_active_link?(tab_item[:path]) %>">
3
- <%= link_to tab_item[:path], title: tab_item[:text], class: "profile__tab-item" do %>
2
+ <% active_link = is_active_link?(tab_item[:path]) %>
3
+ <li class="profile__tab<%= " is-active" if active_link %>">
4
+ <%= link_to tab_item[:path], title: tab_item[:text], class: "profile__tab-item", aria: { current: active_link ? "page" : nil } do %>
4
5
  <%= icon tab_item[:icon] %>
5
6
  <span><%= tab_item[:text] %></span>
6
7
  <% if tab_item[:count].present? %>
@@ -9,6 +9,8 @@ module Decidim
9
9
  # <%= cell("decidim/category", model.category, context: {resource: model}) %>
10
10
  #
11
11
  class TagsCell < Decidim::ViewModel
12
+ include Decidim::SanitizeHelper
13
+
12
14
  def show
13
15
  render if category? || scope?
14
16
  end
@@ -69,7 +71,7 @@ module Decidim
69
71
  end
70
72
 
71
73
  def category_name
72
- model.category.translated_name
74
+ decidim_html_escape model.category.translated_name
73
75
  end
74
76
 
75
77
  def category_path
@@ -37,10 +37,10 @@
37
37
  <%= icon "upload-cloud-2-line", class: "w-8 h-8 text-gray fill-current" %>
38
38
  <%= t("decidim.forms.upload_help.dropzone") %>
39
39
  </span>
40
- <label class="button button__sm button__secondary" for="files-<%= modal_id %>">
40
+ <button class="button button__sm button__secondary" data-select-file-button>
41
41
  <span><%= t("decidim.forms.upload.select_file") %></span>
42
42
  <%= icon "arrow-right-line", class: "fill-current" %>
43
- </label>
43
+ </button>
44
44
  </div>
45
45
  </div>
46
46
  </div>
@@ -57,13 +57,11 @@ module Decidim
57
57
  # to be marked confirmed.
58
58
  @user.skip_confirmation! if !@user.confirmed? && @user.email == verified_email
59
59
  else
60
- generated_password = SecureRandom.hex
61
-
62
60
  @user.email = (verified_email || form.email)
63
61
  @user.name = form.name
64
62
  @user.nickname = form.normalized_nickname
65
63
  @user.newsletter_notifications_at = nil
66
- @user.password = generated_password
64
+ @user.password = SecureRandom.hex
67
65
  if form.avatar_url.present?
68
66
  url = URI.parse(form.avatar_url)
69
67
  filename = File.basename(url.path)
@@ -54,11 +54,13 @@ module Decidim
54
54
  notify(manager) do
55
55
  ConversationMailer.new_group_message(sender, manager, conversation, message, recipient).deliver_later
56
56
  end
57
+ Decidim::PushNotificationMessageSender.new.new_group_message(sender, manager, conversation, message, recipient).deliver
57
58
  end
58
59
  else
59
60
  notify(recipient) do
60
61
  ConversationMailer.new_message(sender, recipient, conversation, message).deliver_later
61
62
  end
63
+ Decidim::PushNotificationMessageSender.new.new_message(sender, recipient, conversation, message).deliver
62
64
  end
63
65
  end
64
66
  end
@@ -68,6 +70,7 @@ module Decidim
68
70
  notify(recipient) do
69
71
  ConversationMailer.comanagers_new_message(sender, recipient, conversation, message, form.context.current_user).deliver_later
70
72
  end
73
+ Decidim::PushNotificationMessageSender.new.comanagers_new_message(sender, recipient, conversation, message, form.context.current_user).deliver
71
74
  end
72
75
  end
73
76
 
@@ -54,11 +54,13 @@ module Decidim
54
54
  notify(manager) do
55
55
  ConversationMailer.new_group_conversation(originator, manager, conversation, recipient).deliver_later
56
56
  end
57
+ Decidim::PushNotificationMessageSender.new.new_group_conversation(originator, manager, conversation, recipient).deliver
57
58
  end
58
59
  else
59
60
  notify(recipient) do
60
61
  ConversationMailer.new_conversation(originator, recipient, conversation).deliver_later
61
62
  end
63
+ Decidim::PushNotificationMessageSender.new.new_conversation(originator, recipient, conversation).deliver
62
64
  end
63
65
  end
64
66
  end
@@ -68,6 +70,7 @@ module Decidim
68
70
  notify(recipient) do
69
71
  ConversationMailer.comanagers_new_conversation(originator, recipient, conversation, form.context.current_user).deliver_later
70
72
  end
73
+ Decidim::PushNotificationMessageSender.new.comanagers_new_conversation(originator, recipient, conversation, form.context.current_user).deliver
71
74
  end
72
75
  end
73
76
 
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ module Decidim
6
+ module DeviseAuthenticationMethods
7
+ extend ActiveSupport::Concern
8
+ include Decidim::UserBlockedChecker
9
+
10
+ included do
11
+ def after_sign_in_path_for(user)
12
+ if user.present? && user.blocked?
13
+ check_user_block_status(user)
14
+ elsif user.needs_password_update?
15
+ change_password_path
16
+ elsif first_login_and_not_authorized?(user) && !user.admin? && !pending_redirect?(user)
17
+ decidim_verifications.first_login_authorizations_path
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ # Calling the `stored_location_for` method removes the key, so in order
24
+ # to check if there is any pending redirect after login I need to call
25
+ # this method and use the value to set a pending redirect. This is the
26
+ # only way to do this without checking the session directly.
27
+ def pending_redirect?(user)
28
+ store_location_for(user, stored_location_for(user))
29
+ end
30
+
31
+ def first_login_and_not_authorized?(user)
32
+ user.is_a?(User) && user.sign_in_count == 1 && current_organization.available_authorizations.any? && user.verifiable?
33
+ end
34
+ end
35
+ end
36
+ end
@@ -19,7 +19,7 @@ module Decidim
19
19
 
20
20
  def per_page
21
21
  if OPTIONS.include?(params[:per_page])
22
- params[:per_page]
22
+ params[:per_page].to_i
23
23
  elsif params[:per_page]
24
24
  sorted = OPTIONS.sort
25
25
  params[:per_page].to_i.clamp(sorted.first, sorted.last)
@@ -6,6 +6,7 @@ module Decidim
6
6
  class OmniauthRegistrationsController < ::Devise::OmniauthCallbacksController
7
7
  include FormFactory
8
8
  include Decidim::DeviseControllers
9
+ include Decidim::DeviseAuthenticationMethods
9
10
 
10
11
  def new
11
12
  @form = form(OmniauthRegistrationForm).from_params(params[:user])
@@ -45,28 +46,6 @@ module Decidim
45
46
  end
46
47
  end
47
48
 
48
- def after_sign_in_path_for(user)
49
- if user.present? && user.blocked?
50
- check_user_block_status(user)
51
- elsif !pending_redirect?(user) && first_login_and_not_authorized?(user)
52
- decidim_verifications.authorizations_path
53
- else
54
- super
55
- end
56
- end
57
-
58
- # Calling the `stored_location_for` method removes the key, so in order
59
- # to check if there is any pending redirect after login I need to call
60
- # this method and use the value to set a pending redirect. This is the
61
- # only way to do this without checking the session directly.
62
- def pending_redirect?(user)
63
- store_location_for(user, stored_location_for(user))
64
- end
65
-
66
- def first_login_and_not_authorized?(user)
67
- user.is_a?(User) && user.sign_in_count == 1 && Decidim::Verifications.workflows.any? && user.verifiable?
68
- end
69
-
70
49
  def action_missing(action_name)
71
50
  return send(:create) if devise_mapping.omniauthable? && current_organization.enabled_omniauth_providers.keys.include?(action_name.to_sym)
72
51
 
@@ -5,6 +5,7 @@ module Decidim
5
5
  # Custom Devise SessionsController to avoid namespace problems.
6
6
  class SessionsController < ::Devise::SessionsController
7
7
  include Decidim::DeviseControllers
8
+ include Decidim::DeviseAuthenticationMethods
8
9
 
9
10
  before_action :check_sign_in_enabled, only: :create
10
11
 
@@ -35,30 +36,6 @@ module Decidim
35
36
  end
36
37
  end
37
38
 
38
- def after_sign_in_path_for(user)
39
- if user.present? && user.blocked?
40
- check_user_block_status(user)
41
- elsif user.needs_password_update?
42
- change_password_path
43
- elsif first_login_and_not_authorized?(user) && !user.admin? && !pending_redirect?(user)
44
- decidim_verifications.first_login_authorizations_path
45
- else
46
- super
47
- end
48
- end
49
-
50
- # Calling the `stored_location_for` method removes the key, so in order
51
- # to check if there is any pending redirect after login I need to call
52
- # this method and use the value to set a pending redirect. This is the
53
- # only way to do this without checking the session directly.
54
- def pending_redirect?(user)
55
- store_location_for(user, stored_location_for(user))
56
- end
57
-
58
- def first_login_and_not_authorized?(user)
59
- user.is_a?(User) && user.sign_in_count == 1 && current_organization.available_authorizations.any? && user.verifiable?
60
- end
61
-
62
39
  def after_sign_out_path_for(user)
63
40
  request.referer || super
64
41
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "mustache"
4
-
5
3
  module Decidim
6
4
  class WelcomeNotificationEvent < Decidim::Events::BaseEvent
7
5
  include Decidim::Events::EmailEvent
@@ -46,13 +44,12 @@ module Decidim
46
44
  private
47
45
 
48
46
  def interpolate(template)
49
- Mustache.render(
50
- template.to_s,
51
- organization: organization.name,
52
- name: user.name,
53
- help_url: url_helpers.pages_url(host: organization.host),
54
- badges_url: url_helpers.gamification_badges_url(host: organization.host)
55
- ).html_safe
47
+ template
48
+ .gsub("{{name}}", user.name)
49
+ .gsub("{{organization}}", organization.name)
50
+ .gsub("{{help_url}}", url_helpers.pages_url(host: organization.host))
51
+ .gsub("{{badges_url}}", url_helpers.gamification_badges_url(host: organization.host))
52
+ .html_safe
56
53
  end
57
54
  end
58
55
  end
@@ -102,24 +102,6 @@ module Decidim
102
102
  super(name, model, options, &)
103
103
  end
104
104
 
105
- # Public: Builds the URL for the step Call To Action. Takes URL params
106
- # into account.
107
- #
108
- # process - a ParticipatoryProcess
109
- #
110
- # Returns a String that can be used as a URL.
111
- def step_cta_url(process)
112
- return unless respond_to?(:decidim_participatory_processes)
113
-
114
- base_url, params = decidim_participatory_processes.participatory_process_path(process).split("?")
115
-
116
- if params.present?
117
- [base_url, "/", process.active_step.cta_path, "?", params].join
118
- else
119
- [base_url, "/", process.active_step.cta_path].join
120
- end
121
- end
122
-
123
105
  def prevent_timeout_seconds
124
106
  0
125
107
  end
@@ -14,7 +14,7 @@ module Decidim
14
14
  end
15
15
 
16
16
  def per_page
17
- params[:per_page] || Decidim::Paginable::OPTIONS.first
17
+ params[:per_page].to_i || Decidim::Paginable::OPTIONS.first
18
18
  end
19
19
  end
20
20
  end
@@ -3,6 +3,8 @@
3
3
  module Decidim
4
4
  # This helper include some methods for rendering a checkboxes tree input.
5
5
  module CheckBoxesTreeHelper
6
+ include SanitizeHelper
7
+
6
8
  # This method returns a hash with the options for the checkbox and its label
7
9
  # used in filters that uses checkboxes trees
8
10
  def check_boxes_tree_options(value, label, **options)
@@ -49,23 +51,21 @@ module Decidim
49
51
  end
50
52
 
51
53
  def filter_categories_values
52
- organization = current_participatory_space.organization
53
-
54
54
  sorted_main_categories = current_participatory_space.categories.first_class.includes(:subcategories).sort_by do |category|
55
- [category.weight, translated_attribute(category.name, organization)]
55
+ [category.weight, decidim_escape_translated(category.name)]
56
56
  end
57
57
 
58
58
  categories_values = sorted_main_categories.flat_map do |category|
59
59
  sorted_descendant_categories = category.descendants.includes(:subcategories).sort_by do |subcategory|
60
- [subcategory.weight, translated_attribute(subcategory.name, organization)]
60
+ [subcategory.weight, decidim_escape_translated(subcategory.name)]
61
61
  end
62
62
 
63
63
  subcategories = sorted_descendant_categories.flat_map do |subcategory|
64
- TreePoint.new(subcategory.id.to_s, translated_attribute(subcategory.name, organization))
64
+ TreePoint.new(subcategory.id.to_s, decidim_escape_translated(subcategory.name))
65
65
  end
66
66
 
67
67
  TreeNode.new(
68
- TreePoint.new(category.id.to_s, translated_attribute(category.name, organization)),
68
+ TreePoint.new(category.id.to_s, decidim_escape_translated(category.name)),
69
69
  subcategories
70
70
  )
71
71
  end
@@ -62,7 +62,7 @@ module Decidim
62
62
  href = Decidim.cors_enabled ? "" : asset_pack_path("media/images/remixicon.symbol.svg")
63
63
 
64
64
  content_tag :svg, html_properties do
65
- content_tag :use, nil, "href" => "#{href}#ri-#{name}", tabindex: -1
65
+ content_tag :use, nil, "href" => "#{href}#ri-#{name}"
66
66
  end
67
67
  end
68
68