decidim-core 0.28.1 → 0.28.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/address/online.erb +2 -2
  3. data/app/cells/decidim/address_cell.rb +4 -0
  4. data/app/cells/decidim/announcement/show.erb +2 -2
  5. data/app/cells/decidim/author/show.erb +5 -5
  6. data/app/cells/decidim/card/show.erb +1 -1
  7. data/app/cells/decidim/card_g/show.erb +1 -1
  8. data/app/cells/decidim/card_g_cell.rb +5 -2
  9. data/app/cells/decidim/card_l/image.erb +2 -2
  10. data/app/cells/decidim/card_l_cell.rb +5 -2
  11. data/app/cells/decidim/card_metadata/show.erb +2 -2
  12. data/app/cells/decidim/content_blocks/hero_cell.rb +1 -1
  13. data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +1 -1
  14. data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +2 -2
  15. data/app/cells/decidim/data_consent/category.erb +1 -1
  16. data/app/cells/decidim/nav_links/show.erb +2 -2
  17. data/app/cells/decidim/notification/moderated.erb +12 -0
  18. data/app/cells/decidim/notification_cell.rb +5 -1
  19. data/app/cells/decidim/profile/details.erb +1 -1
  20. data/app/cells/decidim/progress_bar/show.erb +1 -1
  21. data/app/cells/decidim/progress_bar_cell.rb +2 -0
  22. data/app/cells/decidim/report_button/flag_modal.erb +5 -1
  23. data/app/cells/decidim/resource_types_filter/show.erb +3 -3
  24. data/app/cells/decidim/statistic/show.erb +2 -2
  25. data/app/cells/decidim/upload_modal/modal.erb +3 -4
  26. data/app/commands/decidim/create_omniauth_registration.rb +10 -4
  27. data/app/controllers/concerns/decidim/devise_controllers.rb +1 -0
  28. data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
  29. data/app/controllers/concerns/decidim/paginable.rb +1 -1
  30. data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
  31. data/app/controllers/decidim/application_controller.rb +1 -0
  32. data/app/controllers/decidim/gamification/badges_controller.rb +2 -0
  33. data/app/controllers/decidim/links_controller.rb +15 -2
  34. data/app/helpers/concerns/decidim/flash_helper_extensions.rb +2 -2
  35. data/app/helpers/decidim/check_boxes_tree_helper.rb +1 -2
  36. data/app/helpers/decidim/paginate_helper.rb +3 -5
  37. data/app/mailers/decidim/application_mailer.rb +40 -6
  38. data/app/models/decidim/attachment.rb +3 -3
  39. data/app/models/decidim/component.rb +4 -1
  40. data/app/models/decidim/content_block.rb +2 -2
  41. data/app/models/decidim/user.rb +12 -12
  42. data/app/packs/src/decidim/a11y.js +14 -0
  43. data/app/packs/src/decidim/abide_form_validator_fixer.js +44 -0
  44. data/app/packs/src/decidim/direct_uploads/upload_modal.js +2 -6
  45. data/app/packs/src/decidim/index.js +29 -1
  46. data/app/packs/src/decidim/input_character_counter.js +1 -1
  47. data/app/packs/stylesheets/decidim/_accordion.scss +2 -2
  48. data/app/packs/stylesheets/decidim/_cards.scss +2 -2
  49. data/app/packs/stylesheets/decidim/_dropdown.scss +9 -9
  50. data/app/packs/stylesheets/decidim/_forms.scss +4 -4
  51. data/app/packs/stylesheets/decidim/_layout.scss +3 -3
  52. data/app/packs/stylesheets/decidim/_modal_update.scss +1 -3
  53. data/app/packs/stylesheets/decidim/_tooltip.scss +10 -10
  54. data/app/packs/stylesheets/decidim/editor.scss +1 -1
  55. data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
  56. data/app/presenters/decidim/log/resource_presenter.rb +7 -1
  57. data/app/services/decidim/download_your_data_exporter.rb +36 -25
  58. data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
  59. data/app/services/decidim/open_data_exporter.rb +8 -7
  60. data/app/views/decidim/account/show.html.erb +2 -2
  61. data/app/views/decidim/application/_document.html.erb +2 -2
  62. data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +2 -1
  63. data/app/views/decidim/gamification/badges/index.html.erb +34 -33
  64. data/app/views/decidim/links/_modal.html.erb +1 -1
  65. data/app/views/decidim/links/new.html.erb +3 -1
  66. data/app/views/decidim/manifests/show.json.erb +5 -5
  67. data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
  68. data/app/views/decidim/notifications_settings/show.html.erb +6 -6
  69. data/app/views/decidim/pages/_tabbed.html.erb +2 -2
  70. data/app/views/decidim/searches/_filters.html.erb +2 -2
  71. data/app/views/decidim/shared/_filters.html.erb +2 -2
  72. data/app/views/decidim/shared/_orders.html.erb +2 -2
  73. data/app/views/decidim/shared/filters/_collection.html.erb +5 -3
  74. data/app/views/decidim/shared/filters/_dropdown_label.html.erb +21 -19
  75. data/app/views/layouts/decidim/_logo.html.erb +1 -1
  76. data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
  77. data/app/views/layouts/decidim/footer/_main_intro.html.erb +1 -1
  78. data/app/views/layouts/decidim/footer/_main_links.html.erb +3 -1
  79. data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +5 -3
  80. data/app/views/layouts/decidim/header/_main_links_mobile_account.html.erb +1 -1
  81. data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
  82. data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
  83. data/config/locales/ar.yml +1 -5
  84. data/config/locales/bg.yml +878 -1
  85. data/config/locales/ca.yml +5 -3
  86. data/config/locales/cs.yml +3 -1
  87. data/config/locales/de.yml +3 -1
  88. data/config/locales/el.yml +8 -1
  89. data/config/locales/en.yml +3 -1
  90. data/config/locales/es-MX.yml +8 -6
  91. data/config/locales/es-PY.yml +8 -6
  92. data/config/locales/es.yml +32 -30
  93. data/config/locales/eu.yml +4 -2
  94. data/config/locales/fi-plain.yml +6 -4
  95. data/config/locales/fi.yml +32 -30
  96. data/config/locales/fr-CA.yml +2 -0
  97. data/config/locales/fr.yml +2 -0
  98. data/config/locales/ga-IE.yml +8 -0
  99. data/config/locales/gl.yml +1 -0
  100. data/config/locales/hu.yml +1 -2
  101. data/config/locales/is-IS.yml +3 -0
  102. data/config/locales/it.yml +7 -1
  103. data/config/locales/ja.yml +3 -1
  104. data/config/locales/kaa.yml +5 -0
  105. data/config/locales/lb.yml +7 -1
  106. data/config/locales/lt.yml +8 -2
  107. data/config/locales/lv.yml +8 -1
  108. data/config/locales/nl.yml +7 -1
  109. data/config/locales/no.yml +7 -1
  110. data/config/locales/pl.yml +35 -0
  111. data/config/locales/pt-BR.yml +0 -1
  112. data/config/locales/pt.yml +7 -1
  113. data/config/locales/ro-RO.yml +8 -0
  114. data/config/locales/ru.yml +8 -0
  115. data/config/locales/sk.yml +8 -1
  116. data/config/locales/sl.yml +8 -0
  117. data/config/locales/sv.yml +132 -88
  118. data/config/locales/tr-TR.yml +21 -4
  119. data/config/locales/uk.yml +10 -0
  120. data/config/locales/zh-CN.yml +0 -1
  121. data/config/locales/zh-TW.yml +8 -1
  122. data/db/migrate/20181025082245_add_timestamps_to_components.rb +5 -1
  123. data/decidim-core.gemspec +0 -1
  124. data/lib/decidim/asset_router/storage.rb +214 -11
  125. data/lib/decidim/core/engine.rb +8 -0
  126. data/lib/decidim/core/seeds.rb +1 -1
  127. data/lib/decidim/core/test/shared_examples/attachable_interface_examples.rb +1 -1
  128. data/lib/decidim/core/test/shared_examples/comments_examples.rb +76 -6
  129. data/lib/decidim/core/test/shared_examples/follows_examples.rb +8 -3
  130. data/lib/decidim/core/test/shared_examples/logo_email.rb +2 -2
  131. data/lib/decidim/core/test/shared_examples/paginated_resource_examples.rb +5 -5
  132. data/lib/decidim/core/version.rb +1 -1
  133. data/lib/decidim/core.rb +6 -1
  134. data/lib/decidim/events/base_event.rb +4 -0
  135. data/lib/decidim/organization_settings.rb +10 -2
  136. data/lib/decidim/seven_zip_wrapper.rb +29 -0
  137. data/lib/tasks/upgrade/decidim_fix_categorization.rake +101 -1
  138. metadata +13 -25
  139. data/app/services/decidim/zip_stream/writer.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 800e096eb86537caa7de18236fe0becf73b1c30ee38e4631888025b52e831f3a
4
- data.tar.gz: 9f05dfffcd55fcc9d4e76163a4b98c5b7e851bbdbcfe317f9a9566cb73a142d9
3
+ metadata.gz: 7ed7b2e2e440e7ab68c508dc8242f6adbee52c292cfa8fd3fd43e42fc75e8f8f
4
+ data.tar.gz: ee75d95c1002bc872483de673a2e21e23c100d387d2bd50d86bb05ed5a91d1fa
5
5
  SHA512:
6
- metadata.gz: 97568f03aab3b39a4b75e98421a5b9e43f30f8f1c71b548478f0ee2f73c6303981643948289f9483d9cfbe71af47b872bf3e3c49d39009270e9e3ef72e55bf70
7
- data.tar.gz: 8fa7ecb28d0d2e8097124330aced622ac52fc96d6cc8d6039e629c897d29af8f79366e8992107a9d8b89c88280c723b667b345ccbc643d2326303f376abd243a
6
+ metadata.gz: d82a46910165f8510bec81d79677b26057d49e88ddc9ddd3fda2443b0d8529804faebb2eb8949313b4cf4c25fc8fd406da049dc2e33d172430d7614dc043b9cd
7
+ data.tar.gz: e86a808c22abc5db470d2bcf7d9427a2d8ea13588a73fcbde936fbd22c381d606f30b45353e3638f39150e16966cf75edcf6d81698164b3bdef9055b1881a02f
@@ -5,8 +5,8 @@
5
5
  <div class="address">
6
6
  <div class="address__location"><%= t(model.type_of_meeting, scope: "decidim.meetings.meetings.filters.type_values") %></div>
7
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 %>
8
+ <a href="<%= online_meeting_url %>" target="_blank" rel="noopener noreferrer" class="address__hints underline break-all">
9
+ <%= online_meeting_url %>
10
10
  <% end %>
11
11
  </a>
12
12
  </div>
@@ -45,6 +45,10 @@ module Decidim
45
45
  HTML
46
46
  end
47
47
 
48
+ def online_meeting_url
49
+ URI::Parser.new.escape(model.online_meeting_url)
50
+ end
51
+
48
52
  def display_online_meeting_url?
49
53
  return true unless model.respond_to?(:online?)
50
54
  return true unless model.respond_to?(:iframe_access_level_allowed_for_user?)
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
  <% end %>
7
7
 
8
- <span class="flash__message">
8
+ <div class="flash__message">
9
9
  <%= text %>
10
- </span>
10
+ </div>
11
11
  <% end %>
@@ -1,16 +1,16 @@
1
1
  <% data = has_tooltip? ? { tooltip: render(:profile_minicard).html_safe } : nil %>
2
- <div class="author" data-author>
3
- <%= content_tag :div, class: "author__container#{" is-compact" if layout == :compact}", data: do %>
2
+ <span class="author" data-author>
3
+ <%= content_tag :span, class: "author__container#{" is-compact" if layout == :compact}", data: do %>
4
4
  <% if layout == :compact %>
5
5
  <%= render :avatar %>
6
6
 
7
- <div>
7
+ <span>
8
8
  <%= render :name %>
9
9
 
10
10
  <% context_actions.each do |action| %>
11
11
  <%= render action %>
12
12
  <% end %>
13
- </div>
13
+ </span>
14
14
  <% elsif layout == :avatar %>
15
15
  <%= render :avatar %>
16
16
  <% else %>
@@ -24,4 +24,4 @@
24
24
  <%= render action %>
25
25
  <% end %>
26
26
  <% end %>
27
- </div>
27
+ </span>
@@ -1,5 +1,5 @@
1
1
  <div class="py-4 space-y-2">
2
- <a href="" class="text-lg text-secondary font-semibold hover:underline"><%= title %></a>
2
+ <a href="" class="text-lg text-secondary font-semibold hover:underline"><%= decidim_html_escape(title) %></a>
3
3
  <div class="flex items-center divide-x divide-gray-3">
4
4
  <% metadata.first(4).each do |item| %>
5
5
  <div class="flex items-center gap-1 px-4 lg:px-6 first:pl-0 last:pr-0 max-w-xs">
@@ -1,7 +1,7 @@
1
1
  <%= link_to resource_path, class: classes[:default], id: resource_id do %>
2
2
  <div class="<%= classes[:img] %>">
3
3
  <% if has_image? %>
4
- <%= image_tag resource_image_path, alt: alt_title %>
4
+ <%= image_tag resource_image_url, alt: alt_title %>
5
5
  <% else %>
6
6
  <%= external_icon "media/images/placeholder-card-g.svg", class: "card__placeholder-g" %>
7
7
  <% end %>
@@ -52,12 +52,15 @@ module Decidim
52
52
  @id_base_name ||= resource.class.name.gsub(/\ADecidim::/, "").underscore.split("/").join("__")
53
53
  end
54
54
 
55
- def resource_image_path
55
+ def resource_image_url
56
+ # Backwards compatibility.
57
+ return resource_image_path if respond_to?(:resource_image_path)
58
+
56
59
  nil
57
60
  end
58
61
 
59
62
  def has_image?
60
- resource_image_path.present?
63
+ resource_image_url.present?
61
64
  end
62
65
 
63
66
  def show_description?
@@ -1,6 +1,6 @@
1
1
  <div class="card__list-image">
2
- <% if resource_image_path.present? %>
3
- <%= image_tag resource_image_path, class: "w-full h-full object-cover" %>
2
+ <% if has_image? %>
3
+ <%= image_tag resource_image_url, class: "w-full h-full object-cover" %>
4
4
  <% else %>
5
5
  <div class="w-full h-full relative">
6
6
  <div class="w-full h-full bg-primary opacity-10 absolute top-0 left-0 z-10">
@@ -68,12 +68,15 @@ module Decidim
68
68
  "#{class_base_name}__#{class_name}"
69
69
  end
70
70
 
71
- def resource_image_path
71
+ def resource_image_url
72
+ # Backwards compatibility.
73
+ return resource_image_path if respond_to?(:resource_image_path)
74
+
72
75
  nil
73
76
  end
74
77
 
75
78
  def has_image?
76
- resource_image_path.present?
79
+ resource_image_url.present?
77
80
  end
78
81
 
79
82
  def has_link_to_resource?
@@ -3,12 +3,12 @@
3
3
  <% hook_output = render_hook(item[:hook]) %>
4
4
  <% next if hook_output.blank? %>
5
5
 
6
- <%= content_tag :span, data: item[:data_attributes] do %>
6
+ <%= content_tag :div, data: item[:data_attributes] do %>
7
7
  <%= icon item[:icon] if item[:icon].present? %>
8
8
  <%= hook_output %>
9
9
  <% end %>
10
10
  <% else %>
11
- <%= content_tag :span, data: item[:data_attributes] do %>
11
+ <%= content_tag :div, data: item[:data_attributes] do %>
12
12
  <%= icon item[:icon] if item[:icon].present? %>
13
13
  <% if item[:text].present? %>
14
14
  <%= link_to_if enable_links? && item.has_key?(:url), item[:text], item[:url] %>
@@ -16,7 +16,7 @@ module Decidim
16
16
  end
17
17
 
18
18
  def background_image
19
- model.images_container.attached_uploader(:background_image).path(variant: :big)
19
+ model.images_container.attached_uploader(:background_image).variant_url(:big)
20
20
  end
21
21
 
22
22
  private
@@ -1,4 +1,4 @@
1
- <section id="highlighted_content_banner" class="home__section-image" style="--hero-image:url('<%= current_organization.attached_uploader(:highlighted_content_banner_image).path %>');">
1
+ <section id="highlighted_content_banner" class="home__section-image" style="--hero-image:url('<%= current_organization.attached_uploader(:highlighted_content_banner_image).url %>');">
2
2
  <div class="home__section-content-banner home__section">
3
3
  <div>
4
4
  <h2 class="home__section-content-banner__title">
@@ -34,9 +34,9 @@ module Decidim
34
34
  # If it is called from the landing page content block, use the background image defined there
35
35
  # Else, use the banner image defined in the space (for assemblies)
36
36
  def image_path
37
- return model.images_container.attached_uploader(:background_image).path if model.respond_to?(:images_container)
37
+ return model.images_container.attached_uploader(:background_image).url if model.respond_to?(:images_container)
38
38
 
39
- attached_uploader(:banner_image).path
39
+ attached_uploader(:banner_image).url
40
40
  end
41
41
 
42
42
  def has_hashtag?
@@ -2,7 +2,7 @@
2
2
  <div class="cookies__category-trigger">
3
3
  <label for="dc-<%= category[:slug] %>" class="cookies__category-toggle">
4
4
  <input
5
- <%= %(checked="checked") if category[:mandatory] %>
5
+ <%== %(checked="checked") if category[:mandatory] %>
6
6
  id="dc-<%= category[:slug] %>"
7
7
  type="checkbox"
8
8
  name="<%= category[:slug] %>"
@@ -1,10 +1,10 @@
1
1
  <div class="participatory-space__nav-container">
2
- <button id="dropdown-trigger-participatory-space" data-component="dropdown" data-target="dropdown-menu-participatory-space" data-auto-close="true" data-disabled-md="true" data-scroll-to-menu="true">
2
+ <button id="dropdown-trigger-participatory-space" data-component="dropdown" data-target="dropdown-menu-participatory-space" data-auto-close="true" data-scroll-to-menu="true">
3
3
  <span><%= t("decidim.searches.filters.jump_to") %></span>
4
4
  <%= icon "arrow-down-s-line" %>
5
5
  <%= icon "arrow-up-s-line" %>
6
6
  </button>
7
- <ul id="dropdown-menu-participatory-space" class="participatory-space__nav">
7
+ <ul id="dropdown-menu-participatory-space" class="participatory-space__nav" aria-hidden="true">
8
8
  <% model.each do |item| %>
9
9
  <li>
10
10
  <%= link_to item[:url], class: "participatory-space__nav-item" do %>
@@ -0,0 +1,12 @@
1
+ <div class="notification" data-notification>
2
+ <div class="notification__wrapper">
3
+ <div class="notification__time" title="<%= l(notification.created_at) %>"> <%= notification.created_at_in_words %></div>
4
+ <div class="notification__snippet">
5
+ <span class="notification__snippet-title text-gray"><%= t("decidim.notifications.show.moderated") %></span>
6
+ </div>
7
+ </div>
8
+ <%= link_to model, remote: true, method: :delete, class: "notification__button", data: { "notification-read": "" } do %>
9
+ <span class="sr-only md:not-sr-only"><%= t("mark_as_read", scope: "layouts.decidim.notifications_dashboard") %></span>
10
+ <%= icon "check-line", class: "fill-current" %>
11
+ <% end %>
12
+ </div>
@@ -9,7 +9,11 @@ module Decidim
9
9
  include Decidim::SanitizeHelper
10
10
 
11
11
  def show
12
- render :show
12
+ if notification.event_class_instance.try(:hidden_resource?)
13
+ render :moderated
14
+ else
15
+ render :show
16
+ end
13
17
  end
14
18
 
15
19
  def notification_title
@@ -9,7 +9,7 @@
9
9
  <%= icon detail[:icon] %>
10
10
  <span>
11
11
  <% if detail[:url].present? %>
12
- <%= link_to(detail[:url], detail[:text]) %>
12
+ <%= link_to(detail[:url], detail[:text], rel: "nofollow noopener noreferrer") %>
13
13
  <% else %>
14
14
  <%= detail[:text] %>
15
15
  <% end %>
@@ -7,7 +7,7 @@
7
7
  <%= content_tag :div, units_name_text, class: "progress-bar__units" if units_name %>
8
8
 
9
9
  <% if total != 0 %>
10
- <div class="progress-bar" role="progressbar" tabindex="0" aria-label="<%= units_name.present? ? units_name_text : t("decidim.shared.progress") %>" aria-valuenow="<%= percentage %>" aria-valuemin="0" aria-valuetext="<%= percentage %> %" aria-valuemax="<%= total %>">
10
+ <div class="progress-bar" role="progressbar" aria-label="<%= units_name.present? ? units_name_text : t("decidim.shared.progress") %>" aria-valuenow="<%= number_with_precision(percentage, separator: ".", precision: 2) %>" aria-valuemin="0" aria-valuemax="100" aria-valuetext="<%= number_to_percentage(percentage, precision: 2) %>">
11
11
  <div style="width: <%= percentage %>%"></div>
12
12
  </div>
13
13
  <% end %>
@@ -29,6 +29,8 @@ module Decidim
29
29
  # total: 10,
30
30
  # )
31
31
  class ProgressBarCell < Decidim::ViewModel
32
+ include ActionView::Helpers::NumberHelper
33
+
32
34
  private
33
35
 
34
36
  def element_id
@@ -34,11 +34,15 @@
34
34
  <%= f.check_box :hide,
35
35
  label: t("decidim.shared.flag_modal.hide_content"),
36
36
  include_hidden: false,
37
+ id: hide_checkbox_id,
37
38
  data: {
38
39
  label_action: t("decidim.shared.flag_modal.hide"),
39
40
  label_report: t("decidim.shared.flag_modal.report"),
40
41
  hide: "true"
41
- }, id: hide_checkbox_id %>
42
+ },
43
+ label_options: {
44
+ for: hide_checkbox_id
45
+ } %>
42
46
  <% end %>
43
47
  <% end %>
44
48
 
@@ -1,5 +1,5 @@
1
1
  <div id="<%= id %>" class="filter-container">
2
- <button id="dropdown-trigger-resource" data-component="dropdown" data-target="dropdown-menu-resource" data-auto-close="true" data-disabled-md="true">
2
+ <button id="dropdown-trigger-resource" data-component="dropdown" data-target="dropdown-menu-resource" data-auto-close="true">
3
3
  <% resource_types.each do |resource_type| %>
4
4
  <span data-value="<%= resource_type[0] %>" class="<%= "is-active" if filter_param == resource_type[0] %>">
5
5
  <%= text_with_resource_icon(*resource_type) %>
@@ -8,7 +8,7 @@
8
8
  <%= icon "arrow-down-s-line" %>
9
9
  <%= icon "arrow-up-s-line" %>
10
10
  </button>
11
- <%= filter_form_for filter, form_path, class: "new_filter", id: "dropdown-menu-resource" do |form| %>
11
+ <%= filter_form_for filter, form_path, :class => "new_filter", :id => "dropdown-menu-resource", "aria-hidden" => true do |form| %>
12
12
  <%= form.collection_radio_buttons(
13
13
  filter_param_key,
14
14
  resource_types,
@@ -16,7 +16,7 @@
16
16
  :last,
17
17
  { checked: filter_param }
18
18
  ) do |builder|
19
- builder.label { builder.radio_button(class: "reset-defaults", hidden: true) + content_tag(:div, text_with_resource_icon(builder.value, builder.text), class: "filter") }
19
+ builder.label { builder.radio_button(class: "reset-defaults", hidden: true) + content_tag(:span, text_with_resource_icon(builder.value, builder.text), class: "filter") }
20
20
  end %>
21
21
  <% end %>
22
22
  </div>
@@ -1,7 +1,7 @@
1
1
  <div class="statistic <%= stat_dom_class %>" data-statistic>
2
- <h3 class="statistic__title" title="<%= stat_title %>">
2
+ <span class="statistic__title" title="<%= stat_title %>">
3
3
  <%= stat_title %>
4
- </h3>
4
+ </span>
5
5
  <span class="statistic__number">
6
6
  <%= stat_number %>
7
7
  </span>
@@ -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
- <button class="button button__sm button__secondary" data-select-file-button>
40
+ <label class="button button__sm button__secondary" for="files-<%= modal_id %>">
41
41
  <span><%= t("decidim.forms.upload.select_file") %></span>
42
42
  <%= icon "arrow-right-line", class: "fill-current" %>
43
- </button>
43
+ </label>
44
44
  </div>
45
45
  </div>
46
46
  </div>
@@ -60,8 +60,7 @@
60
60
  <%= t("decidim.shared.confirm_modal.cancel") %>
61
61
  </button>
62
62
  <button type="button" class="button button__sm md:button__lg button__secondary" data-dropzone-save data-dialog-close="<%= modal_id %>" disabled>
63
- <%= t("next", scope: "decidim.messaging.conversations.index") %>
64
- <%= icon "arrow-right-line", class: "fill-current" %>
63
+ <%= t("save", scope: "decidim.forms.upload.labels") %>
65
64
  </button>
66
65
  </div>
67
66
  <% end %>
@@ -55,7 +55,12 @@ module Decidim
55
55
  # If user has left the account unconfirmed and later on decides to sign
56
56
  # in with omniauth with an already verified account, the account needs
57
57
  # to be marked confirmed.
58
- @user.skip_confirmation! if !@user.confirmed? && @user.email == verified_email
58
+ if !@user.confirmed? && @user.email == verified_email
59
+ @user.skip_confirmation!
60
+ @user.after_confirmation
61
+ end
62
+ @user.tos_agreement = "1"
63
+ @user.save!
59
64
  else
60
65
  @user.email = (verified_email || form.email)
61
66
  @user.name = form.name
@@ -69,10 +74,11 @@ module Decidim
69
74
  @user.avatar.attach(io: file, filename:)
70
75
  end
71
76
  @user.skip_confirmation! if verified_email
72
- end
77
+ @user.tos_agreement = "1"
78
+ @user.save!
73
79
 
74
- @user.tos_agreement = "1"
75
- @user.save!
80
+ @user.after_confirmation if verified_email
81
+ end
76
82
  end
77
83
 
78
84
  def create_identity
@@ -20,6 +20,7 @@ module Decidim
20
20
  include Decidim::SafeRedirect
21
21
  include NeedsSnippets
22
22
  include UserBlockedChecker
23
+ include ActiveStorage::SetCurrent
23
24
 
24
25
  helper Decidim::TranslationsHelper
25
26
  helper Decidim::MetaTagsHelper
@@ -17,7 +17,7 @@ module Decidim
17
17
  # Breaks the request lifecycle, if user is not authenticated.
18
18
  # Otherwise returns.
19
19
  def ensure_authenticated!
20
- return true unless current_organization.force_users_to_authenticate_before_access_organization
20
+ return true unless current_organization&.force_users_to_authenticate_before_access_organization
21
21
 
22
22
  # Next stop: Check whether auth is ok
23
23
  unless user_signed_in?
@@ -7,7 +7,7 @@ module Decidim
7
7
  module Paginable
8
8
  extend ActiveSupport::Concern
9
9
 
10
- OPTIONS = [10, 20, 50, 100].freeze
10
+ OPTIONS = [25, 50, 100].freeze
11
11
 
12
12
  included do
13
13
  helper_method :per_page, :page_offset
@@ -25,7 +25,7 @@ module Decidim
25
25
  #
26
26
  # Returns a String.
27
27
  def organization_time_zone
28
- @organization_time_zone ||= current_organization.time_zone
28
+ @organization_time_zone ||= current_organization&.time_zone
29
29
  end
30
30
  end
31
31
  end
@@ -23,6 +23,7 @@ module Decidim
23
23
  include DisableRedirectionToExternalHost
24
24
  include NeedsPasswordChange
25
25
  include LinkedResourceReference
26
+ include ActiveStorage::SetCurrent
26
27
 
27
28
  helper Decidim::MetaTagsHelper
28
29
  helper Decidim::DecidimFormHelper
@@ -9,6 +9,8 @@ module Decidim
9
9
  @badges = Decidim::Gamification.badges.sort_by(&:name)
10
10
  end
11
11
 
12
+ private
13
+
12
14
  def breadcrumb_item
13
15
  {
14
16
  label: t("decidim.gamification.badges.index.title"),
@@ -14,7 +14,8 @@ module Decidim
14
14
  rescue_from URI::InvalidURIError, with: :modal
15
15
 
16
16
  def new
17
- headers["X-Robots-Tag"] = "noindex"
17
+ headers["X-Robots-Tag"] = "none"
18
+ headers["Link"] = %(<#{url_for}>; rel="canonical")
18
19
  end
19
20
 
20
21
  private
@@ -36,7 +37,19 @@ module Decidim
36
37
  end
37
38
 
38
39
  def external_url
39
- @external_url ||= URI.parse(URI::Parser.new.escape(params[:external_url]))
40
+ @external_url ||= URI.parse(escape_url(params[:external_url]))
41
+ end
42
+
43
+ def escape_url(external_url)
44
+ before_fragment, fragment = external_url.split("#", 2)
45
+ escaped_before_fragment = URI::Parser.new.escape(before_fragment)
46
+
47
+ if fragment
48
+ escaped_fragment = URI::Parser.new.escape(fragment)
49
+ "#{escaped_before_fragment}##{escaped_fragment}"
50
+ else
51
+ escaped_before_fragment
52
+ end
40
53
  end
41
54
  end
42
55
  end
@@ -106,9 +106,9 @@ module Decidim
106
106
  end
107
107
 
108
108
  def message(value)
109
- return content_tag(:span, value, class: "flash__message flex items-center") unless value.is_a?(Hash)
109
+ return content_tag(:div, value, class: "flash__message flex items-center") unless value.is_a?(Hash)
110
110
 
111
- content_tag(:span, class: "flash__message") do
111
+ content_tag(:div, class: "flash__message") do
112
112
  concat value[:title]
113
113
  concat content_tag(:span, value[:body], class: "flash__message-body")
114
114
  end
@@ -16,8 +16,7 @@ module Decidim
16
16
  include_hidden: false,
17
17
  label_options: {
18
18
  "data-children-checkbox": parent_id,
19
- value:,
20
- class: "filter"
19
+ value:
21
20
  }
22
21
  }
23
22
  options.merge!(checkbox_options)
@@ -11,16 +11,14 @@ module Decidim
11
11
  def decidim_paginate(collection, paginate_params = {})
12
12
  return if collection.total_pages <= 1
13
13
 
14
+ per_page = (params[:per_page] || paginate_params[:per_page] || Decidim::Paginable::OPTIONS.first).to_i
15
+
14
16
  content_tag :div, class: "flex flex-col-reverse md:flex-row items-center justify-between gap-1 py-8 md:py-16", data: { pagination: "" } do
15
17
  template = ""
16
- template += render partial: "decidim/shared/results_per_page", formats: ["html"] if collection.total_pages.positive?
18
+ template += render(partial: "decidim/shared/results_per_page", locals: { per_page: }, formats: [:html]) if collection.total_pages.positive?
17
19
  template += paginate collection, window: 2, outer_window: 1, theme: "decidim", params: paginate_params
18
20
  template.html_safe
19
21
  end
20
22
  end
21
-
22
- def per_page
23
- params[:per_page].to_i || Decidim::Paginable::OPTIONS.first
24
- end
25
23
  end
26
24
  end
@@ -7,23 +7,57 @@ module Decidim
7
7
  include LocalisedMailer
8
8
  include MultitenantAssetHost
9
9
  after_action :set_smtp
10
+ after_action :set_from
10
11
 
11
12
  default from: Decidim.config.mailer_sender
12
13
  layout "decidim/mailer"
13
14
 
14
15
  private
15
16
 
17
+ attr_reader :organization
18
+
16
19
  def set_smtp
17
- return if @organization.nil? || @organization.smtp_settings.blank?
20
+ return if organization.nil? || organization.smtp_settings.blank? || organization.smtp_settings.except("from", "from_label", "from_email").all?(&:blank?)
18
21
 
19
- mail.from = @organization.smtp_settings["from"].presence || mail.from
20
22
  mail.reply_to = mail.reply_to || Decidim.config.mailer_reply
21
23
  mail.delivery_method.settings.merge!(
22
- address: @organization.smtp_settings["address"],
23
- port: @organization.smtp_settings["port"],
24
- user_name: @organization.smtp_settings["user_name"],
25
- password: Decidim::AttributeEncryptor.decrypt(@organization.smtp_settings["encrypted_password"])
24
+ address: organization.smtp_settings["address"],
25
+ port: organization.smtp_settings["port"],
26
+ user_name: organization.smtp_settings["user_name"],
27
+ password: Decidim::AttributeEncryptor.decrypt(organization.smtp_settings["encrypted_password"])
26
28
  ) { |_k, o, v| v.presence || o }.compact_blank!
27
29
  end
30
+
31
+ def set_from
32
+ return if organization.nil?
33
+ return if already_defined_name_in_mail?(mail.from.first)
34
+
35
+ mail.from = sender
36
+ end
37
+
38
+ def sender
39
+ return Decidim.config.mailer_sender if return_mailer_sender?
40
+ return default_sender if organization.smtp_settings.blank?
41
+ return default_sender if organization.smtp_settings["from"].nil?
42
+ return default_sender if organization.smtp_settings["from"].empty?
43
+
44
+ smtp_settings_from = organization.smtp_settings["from"]
45
+ return smtp_settings_from if already_defined_name_in_mail?(smtp_settings_from)
46
+
47
+ email_address_with_name(smtp_settings_from, organization.name)
48
+ end
49
+
50
+ def default_sender
51
+ email_address_with_name(Decidim.config.mailer_sender, organization.name)
52
+ end
53
+
54
+ def already_defined_name_in_mail?(mail_address)
55
+ # if there is an space, there is already a name in the address
56
+ mail_address.match?(/ /)
57
+ end
58
+
59
+ def return_mailer_sender?
60
+ already_defined_name_in_mail?(Decidim.config.mailer_sender) && organization.smtp_settings.present?
61
+ end
28
62
  end
29
63
  end
@@ -69,7 +69,7 @@ module Decidim
69
69
  end
70
70
 
71
71
  def url
72
- attached_uploader(:file).path
72
+ attached_uploader(:file).url
73
73
  end
74
74
 
75
75
  # The URL to download the thumbnail of the file. Only works with images.
@@ -78,7 +78,7 @@ module Decidim
78
78
  def thumbnail_url
79
79
  return unless photo?
80
80
 
81
- attached_uploader(:file).path(variant: :thumbnail)
81
+ @thumbnail_url ||= attached_uploader(:file).variant_url(:thumbnail)
82
82
  end
83
83
 
84
84
  # The URL to download the a big version of the file. Only works with images.
@@ -87,7 +87,7 @@ module Decidim
87
87
  def big_url
88
88
  return unless photo?
89
89
 
90
- attached_uploader(:file).path(variant: :big)
90
+ @big_url ||= attached_uploader(:file).variant_url(:big)
91
91
  end
92
92
 
93
93
  def set_content_type_and_size
@@ -14,7 +14,10 @@ module Decidim
14
14
 
15
15
  belongs_to :participatory_space, polymorphic: true
16
16
 
17
- default_scope { order(arel_table[:weight].asc, arel_table[:manifest_name].asc) }
17
+ scope :registered_component_manifests, -> { where(manifest_name: Decidim.component_registry.manifests.collect(&:name)) }
18
+ scope :registered_space_manifests, -> { where(participatory_space_type: Decidim.participatory_space_registry.manifests.collect(&:model_class_name)) }
19
+
20
+ default_scope { registered_component_manifests.registered_space_manifests.order(arel_table[:weight].asc, arel_table[:manifest_name].asc) }
18
21
 
19
22
  delegate :organization, :categories, to: :participatory_space
20
23
 
@@ -60,8 +60,8 @@ module Decidim
60
60
  #
61
61
  # # This is how you can access the image data, just like with any other
62
62
  # # uploader field. You can use the uploader variants too.
63
- # content_block.images_container.attached_uploader(:my_image).path
64
- # content_block.images_container.attached_uploader(:my_image).path(variant: :big)
63
+ # content_block.images_container.attached_uploader(:my_image).url
64
+ # content_block.images_container.attached_uploader(:my_image).variant_url(:big)
65
65
  #
66
66
  # # This will delete the attached image
67
67
  # content_block.images_container.my_image = nil