decidim-core 0.27.0.rc1 → 0.27.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cells/decidim/announcement_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/cta/show.erb +1 -1
- data/app/cells/decidim/content_blocks/cta_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/hero/show.erb +2 -2
- data/app/cells/decidim/content_blocks/hero_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +2 -2
- data/app/cells/decidim/content_blocks/stats_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +1 -1
- data/app/cells/decidim/data_consent/category.erb +19 -19
- data/app/cells/decidim/data_consent/dialog.erb +12 -12
- data/app/cells/decidim/data_consent/modal.erb +13 -13
- data/app/cells/decidim/data_consent_cell.rb +3 -3
- data/app/commands/decidim/update_account.rb +3 -1
- data/app/controllers/concerns/decidim/resource_versions_concern.rb +4 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +5 -1
- data/app/controllers/decidim/last_activities_controller.rb +1 -0
- data/app/events/decidim/resource_endorsed_event.rb +2 -1
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/user_group_form.rb +1 -1
- data/app/helpers/decidim/filters_helper.rb +5 -1
- data/app/helpers/decidim/sanitize_helper.rb +12 -3
- data/app/models/decidim/action_log.rb +9 -9
- data/app/models/decidim/notification.rb +11 -2
- data/app/models/decidim/user_base_entity.rb +1 -0
- data/app/packs/entrypoints/decidim_core.js +1 -1
- data/app/packs/src/decidim/account_form.js +68 -18
- data/app/packs/src/decidim/{cookie_consent → data_consent}/consent_manager.js +27 -24
- data/app/packs/src/decidim/data_consent/consent_manager.test.js +280 -0
- data/app/packs/src/decidim/{cookie_consent/cookie_consent.js → data_consent/index.js} +12 -12
- data/app/packs/src/decidim/input_character_counter.js +57 -34
- data/app/packs/src/decidim/sw/a2hs.js +10 -1
- data/app/packs/stylesheets/decidim/modules/_cards.scss +2 -0
- data/app/packs/stylesheets/decidim/modules/_comments.scss +2 -0
- data/app/packs/stylesheets/decidim/modules/{_cookie-consent.scss → _data-consent.scss} +10 -10
- data/app/packs/stylesheets/decidim/modules/_forms.scss +5 -0
- data/app/packs/stylesheets/decidim/modules/_modules.scss +1 -1
- data/app/permissions/decidim/permissions.rb +4 -2
- data/app/presenters/decidim/push_notification_presenter.rb +2 -1
- data/app/presenters/decidim/user_presenter.rb +4 -1
- data/app/scrubbers/decidim/admin_input_scrubber.rb +25 -0
- data/app/scrubbers/decidim/user_input_scrubber.rb +3 -5
- data/app/services/decidim/iframe_disabler.rb +2 -3
- data/app/services/decidim/notifications_digest_sending_decider.rb +6 -2
- data/app/services/decidim/send_push_notification.rb +14 -12
- data/app/views/decidim/account/_password_fields.html.erb +2 -2
- data/app/views/decidim/download_your_data/show.html.erb +1 -1
- data/app/views/decidim/notifications_settings/show.html.erb +65 -67
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/user_interests/show.html.erb +11 -13
- data/app/views/layouts/decidim/_application.html.erb +1 -1
- data/app/views/layouts/decidim/_data_consent_warning.html.erb +8 -0
- data/app/views/layouts/decidim/_main_footer.html.erb +1 -1
- data/config/locales/am-ET.yml +0 -1
- data/config/locales/ar.yml +0 -9
- data/config/locales/bg.yml +0 -9
- data/config/locales/ca.yml +18 -23
- data/config/locales/cs.yml +19 -24
- data/config/locales/da.yml +0 -1
- data/config/locales/de.yml +204 -10
- data/config/locales/el.yml +0 -9
- data/config/locales/en.yml +17 -22
- data/config/locales/es-MX.yml +20 -25
- data/config/locales/es-PY.yml +19 -24
- data/config/locales/es.yml +20 -25
- data/config/locales/et.yml +0 -1
- data/config/locales/eu.yml +1 -10
- data/config/locales/fi-plain.yml +17 -22
- data/config/locales/fi.yml +17 -22
- data/config/locales/fr-CA.yml +29 -20
- data/config/locales/fr.yml +42 -33
- data/config/locales/ga-IE.yml +0 -2
- data/config/locales/gl.yml +0 -9
- data/config/locales/hr.yml +0 -1
- data/config/locales/hu.yml +250 -9
- data/config/locales/id-ID.yml +0 -9
- data/config/locales/it.yml +1 -10
- data/config/locales/ja.yml +30 -24
- data/config/locales/ko.yml +0 -1
- data/config/locales/lb.yml +0 -9
- data/config/locales/lt.yml +1949 -0
- data/config/locales/lv.yml +0 -9
- data/config/locales/mt.yml +0 -1
- data/config/locales/nl.yml +16 -10
- data/config/locales/no.yml +1 -10
- data/config/locales/om-ET.yml +0 -1
- data/config/locales/pl.yml +0 -9
- data/config/locales/pt-BR.yml +2 -11
- data/config/locales/pt.yml +0 -9
- data/config/locales/ro-RO.yml +0 -9
- data/config/locales/si-LK.yml +0 -1
- data/config/locales/sk.yml +0 -9
- data/config/locales/so-SO.yml +0 -1
- data/config/locales/sv.yml +9 -14
- data/config/locales/sw-KE.yml +0 -1
- data/config/locales/ti-ER.yml +0 -1
- data/config/locales/tr-TR.yml +0 -9
- data/config/locales/val-ES.yml +0 -1
- data/config/locales/vi.yml +0 -1
- data/config/locales/zh-CN.yml +2 -11
- data/config/locales/zh-TW.yml +0 -1
- data/config/routes.rb +20 -2
- data/lib/decidim/attributes/model.rb +9 -1
- data/lib/decidim/content_parsers/hashtag_parser.rb +1 -1
- data/lib/decidim/core/engine.rb +1 -1
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +60 -0
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +40 -0
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +52 -13
- data/lib/decidim/dependency_resolver.rb +272 -0
- data/lib/decidim/events/simple_event.rb +1 -0
- data/lib/decidim/has_resource_permission.rb +0 -2
- data/lib/decidim/map/provider/dynamic_map/here.rb +46 -1
- data/lib/decidim/nicknamizable.rb +1 -1
- data/lib/decidim/translatable_attributes.rb +8 -1
- data/lib/decidim/url_option_resolver.rb +1 -1
- metadata +15 -11
- data/app/views/decidim/devise/registrations/edit.html.erb +0 -41
- data/app/views/layouts/decidim/_cookie_warning.html.erb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 150f88886f1b4e3b5e3402c9f7fa34057d3c808a4de16cef92493aafb82597f9
|
|
4
|
+
data.tar.gz: b1fe1fa4fd31ed1038cb77395e7eee3bc0af36853f42c60d34bc96b388a3f7f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 559ef49a486a762a2928150e7511faf9f9946bf50d825f1060613c3c0fcac696cfb6be68222895eb2ea0570e9d1b2e8dfccde78f56afb1b8b31704e8a14b5d76
|
|
7
|
+
data.tar.gz: aa814eae2a1d8ac9d2baaab67b9547b6066ddb14537c38be2f5e2990f84e1fb5727e3608912ec768fbb6f62cf908fc73be46c4cf0708b42586bec79d387a4945
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<section class="section">
|
|
2
|
-
<div class="expanded hero" style="background-image:url(<%= background_image %>);">
|
|
2
|
+
<div class="expanded hero" style="background-image:url('<%= background_image %>');">
|
|
3
3
|
<div class="hero__container">
|
|
4
4
|
<div class="row">
|
|
5
5
|
<div class="columns small-centered medium-6 text-center">
|
|
@@ -16,7 +16,7 @@ module Decidim
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def translated_description
|
|
19
|
-
@translated_description ||=
|
|
19
|
+
@translated_description ||= decidim_sanitize_editor_admin(translated_attribute(model.settings.description))
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def button_url
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero" class="extended hero home-section" style="background-image:url(<%= background_image %>);">
|
|
1
|
+
<section id="hero" class="extended hero home-section" style="background-image:url('<%= background_image %>');">
|
|
2
2
|
<div class="hero__container">
|
|
3
3
|
<div class="row">
|
|
4
4
|
<div class="columns small-centered large-10">
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<% if translated_welcome_text.blank? %>
|
|
7
7
|
<%= t("decidim.pages.home.hero.welcome", organization: current_organization.name) %>
|
|
8
8
|
<% else %>
|
|
9
|
-
<%=
|
|
9
|
+
<%= decidim_sanitize_admin translated_welcome_text %>
|
|
10
10
|
<% end %>
|
|
11
11
|
</h1>
|
|
12
12
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<section id="highlighted_content_banner" class="extended highligted-content-banner home-section"
|
|
2
|
-
style="background-image:url(<%= current_organization.attached_uploader(:highlighted_content_banner_image).path %>);">
|
|
2
|
+
style="background-image:url('<%= current_organization.attached_uploader(:highlighted_content_banner_image).path %>');">
|
|
3
3
|
<div class="highligted-content-banner__container">
|
|
4
4
|
<div class="row">
|
|
5
5
|
<div class="columns large-10">
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<%= translated_attribute current_organization.highlighted_content_banner_title %>
|
|
8
8
|
</h1>
|
|
9
9
|
<div class="text-highlight">
|
|
10
|
-
<%=
|
|
10
|
+
<%= decidim_sanitize_editor_admin translated_attribute current_organization.highlighted_content_banner_short_description %>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
<div class="columns large-2">
|
|
@@ -15,7 +15,7 @@ module Decidim
|
|
|
15
15
|
private
|
|
16
16
|
|
|
17
17
|
def organization_description
|
|
18
|
-
desc =
|
|
18
|
+
desc = decidim_sanitize_admin(translated_attribute(current_organization.description))
|
|
19
19
|
|
|
20
20
|
# Strip the surrounding paragraph tag because it is not allowed within
|
|
21
21
|
# a <hN> element.
|
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
<div class="category-wrapper margin-vertical-1" data-id="<%= category[:slug] %>">
|
|
2
2
|
<div class="category-row flex-center">
|
|
3
|
-
<button class="
|
|
4
|
-
<span class="h5
|
|
3
|
+
<button class="dc-title padding-left-3">
|
|
4
|
+
<span class="h5 dc-category-title">
|
|
5
5
|
<strong><%= category[:title] %></strong>
|
|
6
6
|
</span>
|
|
7
7
|
</button>
|
|
8
8
|
|
|
9
|
-
<div class="
|
|
9
|
+
<div class="dc-switch">
|
|
10
10
|
<input
|
|
11
11
|
class="switch-input"
|
|
12
12
|
<%= %(checked="checked") if category[:mandatory] %>
|
|
13
|
-
id="
|
|
13
|
+
id="dc-<%= category[:slug] %>"
|
|
14
14
|
type="checkbox"
|
|
15
15
|
name="<%= category[:slug] %>"
|
|
16
16
|
<%= "disabled" if category[:mandatory] %>>
|
|
17
17
|
|
|
18
|
-
<label class="switch-paddle" for="
|
|
19
|
-
<span class="show-for-sr"><%= t("layouts.decidim.
|
|
18
|
+
<label class="switch-paddle" for="dc-<%= category[:slug] %>">
|
|
19
|
+
<span class="show-for-sr"><%= t("layouts.decidim.data_consent.modal.toggle", consent_category: category[:title]) %></span>
|
|
20
20
|
</label>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
|
-
<div class="
|
|
23
|
+
<div class="dc-description hide">
|
|
24
24
|
<div class="description-text">
|
|
25
25
|
<p><%= category[:description] %></p>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
|
-
<% if category[:
|
|
29
|
-
<div class="
|
|
28
|
+
<% if category[:items].present? %>
|
|
29
|
+
<div class="dataconsent-details-wrapper">
|
|
30
30
|
<div class="row detail-titles">
|
|
31
31
|
<div class="columns small-2">
|
|
32
|
-
<%= t("layouts.decidim.
|
|
32
|
+
<%= t("layouts.decidim.data_consent.details.columns.type") %>
|
|
33
33
|
</div>
|
|
34
34
|
<div class="columns small-2">
|
|
35
|
-
<%= t("layouts.decidim.
|
|
35
|
+
<%= t("layouts.decidim.data_consent.details.columns.name") %>
|
|
36
36
|
</div>
|
|
37
37
|
<div class="columns small-2">
|
|
38
|
-
<%= t("layouts.decidim.
|
|
38
|
+
<%= t("layouts.decidim.data_consent.details.columns.service") %>
|
|
39
39
|
</div>
|
|
40
40
|
<div class="columns small-6">
|
|
41
|
-
<%= t("layouts.decidim.
|
|
41
|
+
<%= t("layouts.decidim.data_consent.details.columns.description") %>
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
|
-
<% category[:
|
|
46
|
-
<div class="row
|
|
45
|
+
<% category[:items].each do |item| %>
|
|
46
|
+
<div class="row dataconsent-detail-row">
|
|
47
47
|
<div class="columns small-2">
|
|
48
|
-
<%= t("layouts.decidim.
|
|
48
|
+
<%= t("layouts.decidim.data_consent.details.types.#{item[:type]}") %>
|
|
49
49
|
</div>
|
|
50
50
|
<div class="columns small-2">
|
|
51
|
-
<%=
|
|
51
|
+
<%= item[:name] %>
|
|
52
52
|
</div>
|
|
53
53
|
<div class="columns small-2">
|
|
54
|
-
<%= t("layouts.decidim.
|
|
54
|
+
<%= t("layouts.decidim.data_consent.details.items.#{item[:name]}.service") %>
|
|
55
55
|
</div>
|
|
56
56
|
<div class="columns small-6">
|
|
57
|
-
<%= t("layouts.decidim.
|
|
57
|
+
<%= t("layouts.decidim.data_consent.details.items.#{item[:name]}.description") %>
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
60
60
|
<% end %>
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
<div id="
|
|
2
|
-
<div class="
|
|
1
|
+
<div id="dc-dialog-wrapper" class="flex-center hide robots-noindex robots-nocontent noindex" data-nosnippet role="region">
|
|
2
|
+
<div class="dc-dialog padding-vertical-1">
|
|
3
3
|
<div class="row expanded">
|
|
4
4
|
<div class="columns medium-12 large-8">
|
|
5
|
-
<div class="
|
|
5
|
+
<div class="dc-content">
|
|
6
6
|
<div class="h5">
|
|
7
|
-
<%= t("layouts.decidim.
|
|
7
|
+
<%= t("layouts.decidim.data_consent.dialog.title") %>
|
|
8
8
|
</div>
|
|
9
9
|
<div>
|
|
10
|
-
<%= t("layouts.decidim.
|
|
10
|
+
<%= t("layouts.decidim.data_consent.dialog.description") %>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
14
|
<div class="columns medium-12 large-4">
|
|
15
|
-
<div class="
|
|
16
|
-
<button id="
|
|
17
|
-
<%= t("layouts.decidim.
|
|
15
|
+
<div class="dc-button-wrapper flex-center">
|
|
16
|
+
<button id="dc-dialog-accept" class="button">
|
|
17
|
+
<%= t("layouts.decidim.data_consent.dialog.accept_all") %>
|
|
18
18
|
</button>
|
|
19
|
-
<button id="
|
|
20
|
-
<%= t("layouts.decidim.
|
|
19
|
+
<button id="dc-dialog-reject" class="button hollow">
|
|
20
|
+
<%= t("layouts.decidim.data_consent.dialog.accept_only_essential") %>
|
|
21
21
|
</button>
|
|
22
|
-
<button id="
|
|
23
|
-
<%= t("layouts.decidim.
|
|
22
|
+
<button id="dc-dialog-settings" class="button clear" data-open="dc-modal">
|
|
23
|
+
<%= t("layouts.decidim.data_consent.dialog.settings") %>
|
|
24
24
|
</button>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<div class="reveal
|
|
1
|
+
<div class="reveal dc-modal" id="dc-modal" role="dialog" data-close-on-click="false" data-close-on-esc="false" aria-modal="true" data-reveal>
|
|
2
2
|
<div class="reveal__header">
|
|
3
3
|
<h3 class="reveal__title">
|
|
4
|
-
<%= t("layouts.decidim.
|
|
4
|
+
<%= t("layouts.decidim.data_consent.modal.title") %>
|
|
5
5
|
</h3>
|
|
6
6
|
<p>
|
|
7
|
-
<%= t("layouts.decidim.
|
|
7
|
+
<%= t("layouts.decidim.data_consent.modal.description") %>
|
|
8
8
|
</p>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
<div class="
|
|
11
|
+
<div class="dc-categories">
|
|
12
12
|
<% categories.each do |category| %>
|
|
13
13
|
<%= render(
|
|
14
14
|
{
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
<% end %>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
<div class="
|
|
25
|
-
<div class="
|
|
26
|
-
<button id="
|
|
27
|
-
<%= t("layouts.decidim.
|
|
24
|
+
<div class="dc-buttons-wrapper flex-center">
|
|
25
|
+
<div class="dc-buttons-left">
|
|
26
|
+
<button id="dc-modal-accept" class="button" data-close>
|
|
27
|
+
<%= t("layouts.decidim.data_consent.modal.accept_all") %>
|
|
28
28
|
</button>
|
|
29
|
-
<button id="
|
|
30
|
-
<%= t("layouts.decidim.
|
|
29
|
+
<button id="dc-modal-reject" class="button hollow" data-close>
|
|
30
|
+
<%= t("layouts.decidim.data_consent.modal.accept_only_essential") %>
|
|
31
31
|
</button>
|
|
32
32
|
</div>
|
|
33
|
-
<div class="
|
|
34
|
-
<button id="
|
|
35
|
-
<%= t("layouts.decidim.
|
|
33
|
+
<div class="dc-buttons-right">
|
|
34
|
+
<button id="dc-modal-save" class="button clear" data-close>
|
|
35
|
+
<%= t("layouts.decidim.data_consent.modal.save_settings") %>
|
|
36
36
|
</button>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
@@ -10,10 +10,10 @@ module Decidim
|
|
|
10
10
|
@categories ||= Decidim.consent_categories.map do |category|
|
|
11
11
|
{
|
|
12
12
|
slug: category[:slug],
|
|
13
|
-
title: t("layouts.decidim.
|
|
14
|
-
description: t("layouts.decidim.
|
|
13
|
+
title: t("layouts.decidim.data_consent.modal.#{category[:slug]}.title"),
|
|
14
|
+
description: t("layouts.decidim.data_consent.modal.#{category[:slug]}.description"),
|
|
15
15
|
mandatory: category[:mandatory],
|
|
16
|
-
|
|
16
|
+
items: category.has_key?(:items) ? category[:items] : []
|
|
17
17
|
}
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -24,7 +24,9 @@ module Decidim
|
|
|
24
24
|
notify_followers
|
|
25
25
|
broadcast(:ok, @user.unconfirmed_email.present?)
|
|
26
26
|
else
|
|
27
|
-
|
|
27
|
+
[:avatar, :password, :password_confirmation].each do |key|
|
|
28
|
+
@form.errors.add key, @user.errors[key] if @user.errors.has_key? key
|
|
29
|
+
end
|
|
28
30
|
broadcast(:invalid)
|
|
29
31
|
end
|
|
30
32
|
end
|
|
@@ -10,6 +10,10 @@ module Decidim
|
|
|
10
10
|
helper Decidim::TraceabilityHelper
|
|
11
11
|
helper_method :current_version, :versioned_resource
|
|
12
12
|
|
|
13
|
+
def show
|
|
14
|
+
raise ActionController::RoutingError, "Not found" unless current_version
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
private
|
|
14
18
|
|
|
15
19
|
# Overwrite this method in your controller to define how to find the
|
|
@@ -39,7 +39,7 @@ module Decidim
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
on(:invalid) do
|
|
42
|
-
flash.now[:alert] = @form.errors
|
|
42
|
+
flash.now[:alert] = @form.errors.full_messages.join(", ") if @form.errors.full_messages.any?
|
|
43
43
|
render :new
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -60,6 +60,10 @@ module Decidim
|
|
|
60
60
|
super(hash)
|
|
61
61
|
resource.organization = current_organization
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
def devise_mapping
|
|
65
|
+
::Devise.mappings[:user]
|
|
66
|
+
end
|
|
63
67
|
end
|
|
64
68
|
end
|
|
65
69
|
end
|
|
@@ -14,7 +14,7 @@ module Decidim
|
|
|
14
14
|
attribute :email
|
|
15
15
|
attribute :password
|
|
16
16
|
attribute :password_confirmation
|
|
17
|
-
attribute :avatar
|
|
17
|
+
attribute :avatar, Decidim::Attributes::Blob
|
|
18
18
|
attribute :remove_avatar, Boolean, default: false
|
|
19
19
|
attribute :personal_url
|
|
20
20
|
attribute :about
|
|
@@ -24,7 +24,11 @@ module Decidim
|
|
|
24
24
|
remote: true,
|
|
25
25
|
html: { id: nil }.merge(html_options)
|
|
26
26
|
) do |form|
|
|
27
|
-
|
|
27
|
+
# Cannot use `concat()` here because it's not available in cells
|
|
28
|
+
inner = []
|
|
29
|
+
inner << hidden_field_tag("per_page", params[:per_page], id: nil) if params[:per_page]
|
|
30
|
+
inner << capture { yield form }
|
|
31
|
+
inner.join.html_safe
|
|
28
32
|
end
|
|
29
33
|
end
|
|
30
34
|
end
|
|
@@ -16,13 +16,18 @@ module Decidim
|
|
|
16
16
|
#
|
|
17
17
|
# Returns an HTML-safe String.
|
|
18
18
|
def decidim_sanitize(html, options = {})
|
|
19
|
+
scrubber = options[:scrubber] || Decidim::UserInputScrubber.new
|
|
19
20
|
if options[:strip_tags]
|
|
20
|
-
strip_tags sanitize(html, scrubber:
|
|
21
|
+
strip_tags sanitize(html, scrubber: scrubber)
|
|
21
22
|
else
|
|
22
|
-
sanitize(html, scrubber:
|
|
23
|
+
sanitize(html, scrubber: scrubber)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
|
27
|
+
def decidim_sanitize_admin(html, options = {})
|
|
28
|
+
decidim_sanitize(html, { scrubber: Decidim::AdminInputScrubber.new }.merge(options))
|
|
29
|
+
end
|
|
30
|
+
|
|
26
31
|
def decidim_sanitize_newsletter(html, options = {})
|
|
27
32
|
if options[:strip_tags]
|
|
28
33
|
strip_tags sanitize(html, scrubber: Decidim::NewsletterScrubber.new)
|
|
@@ -32,10 +37,14 @@ module Decidim
|
|
|
32
37
|
end
|
|
33
38
|
|
|
34
39
|
def decidim_sanitize_editor(html, options = {})
|
|
35
|
-
html = Decidim::IframeDisabler.new(html, options).perform
|
|
36
40
|
content_tag(:div, decidim_sanitize(html, options), class: %w(ql-editor ql-reset-decidim))
|
|
37
41
|
end
|
|
38
42
|
|
|
43
|
+
def decidim_sanitize_editor_admin(html, options = {})
|
|
44
|
+
html = Decidim::IframeDisabler.new(html, options).perform
|
|
45
|
+
decidim_sanitize_editor(html, { scrubber: Decidim::AdminInputScrubber.new }.merge(options))
|
|
46
|
+
end
|
|
47
|
+
|
|
39
48
|
def decidim_html_escape(text)
|
|
40
49
|
ERB::Util.unwrapped_html_escape(text.to_str)
|
|
41
50
|
end
|
|
@@ -214,16 +214,16 @@ module Decidim
|
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
# Whether this activity or log is visible for a given user (can also be nil)
|
|
217
|
-
#
|
|
218
|
-
# Returns a True/False.
|
|
219
217
|
def visible_for?(user)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
resource_lazy.present? &&
|
|
219
|
+
participatory_space_lazy.present? &&
|
|
220
|
+
!resource_lazy.try(:deleted?) &&
|
|
221
|
+
!resource_lazy.try(:hidden?) &&
|
|
222
|
+
(!resource_lazy.respond_to?(:can_participate?) || resource_lazy.try(:can_participate?, user))
|
|
223
|
+
rescue NameError => e
|
|
224
|
+
Rails.logger.warn "Failed resource for #{self.class.name}(id=#{id}): #{e.message}"
|
|
225
|
+
|
|
226
|
+
false
|
|
227
227
|
end
|
|
228
228
|
end
|
|
229
229
|
end
|
|
@@ -7,8 +7,17 @@ module Decidim
|
|
|
7
7
|
belongs_to :resource, foreign_key: "decidim_resource_id", foreign_type: "decidim_resource_type", polymorphic: true
|
|
8
8
|
belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
# Daily notifications should contain all notifications within the previous
|
|
11
|
+
# day from the given day.
|
|
12
|
+
scope :daily, ->(time: Time.now.utc) { where(created_at: (time - 1.day).all_day) }
|
|
13
|
+
|
|
14
|
+
# Weekly notifications should contain all notifications within the previous
|
|
15
|
+
# week counting from the end of the previous day until the start of the day
|
|
16
|
+
# 1 week ago from the previous day.
|
|
17
|
+
scope :weekly, lambda { |time: Time.now.utc|
|
|
18
|
+
end_of_previous_day = (time - 1.day).end_of_day
|
|
19
|
+
where(created_at: (end_of_previous_day - 7.days).beginning_of_day..end_of_previous_day)
|
|
20
|
+
}
|
|
12
21
|
|
|
13
22
|
def event_class_instance
|
|
14
23
|
@event_class_instance ||= event_class.constantize.new(
|
|
@@ -30,6 +30,7 @@ module Decidim
|
|
|
30
30
|
|
|
31
31
|
scope :blocked, -> { where(blocked: true) }
|
|
32
32
|
scope :not_blocked, -> { where(blocked: false) }
|
|
33
|
+
scope :available, -> { where(deleted_at: nil, blocked: false, managed: false) }
|
|
33
34
|
|
|
34
35
|
# Public: Returns a collection with all the public entities this user is following.
|
|
35
36
|
#
|
|
@@ -58,7 +58,7 @@ import "src/decidim/identity_selector_dialog"
|
|
|
58
58
|
import "src/decidim/gallery"
|
|
59
59
|
import "src/decidim/direct_uploads/upload_field"
|
|
60
60
|
import "src/decidim/back_to_list"
|
|
61
|
-
import "src/decidim/
|
|
61
|
+
import "src/decidim/data_consent"
|
|
62
62
|
|
|
63
63
|
// CSS
|
|
64
64
|
import "entrypoints/decidim_core.scss"
|
|
@@ -1,27 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initializes the edit account form to control the password field elements
|
|
3
|
+
* which should only be required when they are visible.
|
|
4
|
+
*
|
|
5
|
+
* @returns {void}
|
|
6
|
+
*/
|
|
7
|
+
const initializeAccountForm = () => {
|
|
8
|
+
const editUserForm = document.querySelector("form.edit_user");
|
|
9
|
+
if (!editUserForm) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const passwordChange = editUserForm.querySelector("#passwordChange");
|
|
14
|
+
if (!passwordChange) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const passwordFields = passwordChange.querySelectorAll("input[type='password']");
|
|
19
|
+
if (passwordFields.length < 1) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Foundation uses jQuery so these have to be bound using jQuery and the
|
|
24
|
+
// attribute value needs to be set through jQuery.
|
|
25
|
+
const togglePasswordFieldValidators = (enabled) => {
|
|
26
|
+
$(passwordFields).attr("required", enabled);
|
|
27
|
+
|
|
28
|
+
if (!enabled) {
|
|
29
|
+
passwordFields.forEach((field) => (field.value = ""));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$(passwordChange).on("on.zf.toggler", () => {
|
|
34
|
+
togglePasswordFieldValidators(true);
|
|
35
|
+
});
|
|
36
|
+
$(passwordChange).on("off.zf.toggler", () => {
|
|
37
|
+
togglePasswordFieldValidators(false);
|
|
38
|
+
});
|
|
39
|
+
togglePasswordFieldValidators(false);
|
|
40
|
+
};
|
|
41
|
+
|
|
1
42
|
/**
|
|
2
43
|
* Since the delete account has a modal to confirm it we need to copy the content of the
|
|
3
44
|
* reason field to the hidden field in the form inside the modal.
|
|
45
|
+
*
|
|
46
|
+
* @return {void}
|
|
4
47
|
*/
|
|
5
|
-
|
|
48
|
+
const initializeDeleteAccount = () => {
|
|
6
49
|
const $deleteAccountForm = $(".delete-account");
|
|
7
50
|
const $deleteAccountModalForm = $(".delete-account-modal");
|
|
8
51
|
|
|
9
|
-
if ($deleteAccountForm.length
|
|
10
|
-
|
|
11
|
-
const $modal = $("#deleteConfirm");
|
|
12
|
-
|
|
13
|
-
$openModalButton.on("click", (event) => {
|
|
14
|
-
try {
|
|
15
|
-
const reasonValue = $deleteAccountForm.find("textarea#delete_account_delete_reason").val();
|
|
16
|
-
$deleteAccountModalForm.find("input#delete_account_delete_reason").val(reasonValue);
|
|
17
|
-
$modal.foundation("open");
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.error(error); // eslint-disable-line no-console
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
event.preventDefault();
|
|
23
|
-
event.stopPropagation();
|
|
24
|
-
return false;
|
|
25
|
-
});
|
|
52
|
+
if ($deleteAccountForm.length < 1) {
|
|
53
|
+
return;
|
|
26
54
|
}
|
|
55
|
+
|
|
56
|
+
const $openModalButton = $(".open-modal-button");
|
|
57
|
+
const $modal = $("#deleteConfirm");
|
|
58
|
+
|
|
59
|
+
$openModalButton.on("click", (event) => {
|
|
60
|
+
try {
|
|
61
|
+
const reasonValue = $deleteAccountForm.find("textarea#delete_account_delete_reason").val();
|
|
62
|
+
$deleteAccountModalForm.find("input#delete_account_delete_reason").val(reasonValue);
|
|
63
|
+
$modal.foundation("open");
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error(error); // eslint-disable-line no-console
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
event.stopPropagation();
|
|
70
|
+
return false;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
$(() => {
|
|
75
|
+
initializeAccountForm();
|
|
76
|
+
initializeDeleteAccount();
|
|
27
77
|
});
|