decidim-core 0.30.0 → 0.30.1
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/address/show.erb +3 -3
- data/app/cells/decidim/author/show.erb +1 -1
- data/app/cells/decidim/content_blocks/participatory_space_extra_data/extra_data.erb +2 -2
- data/app/cells/decidim/participatory_space_dropdown_metadata/metadata.erb +4 -4
- data/app/commands/decidim/create_report.rb +5 -1
- data/app/commands/decidim/invite_user.rb +1 -1
- data/app/controllers/concerns/decidim/participatory_space_context.rb +4 -1
- data/app/controllers/decidim/reports_controller.rb +6 -1
- data/app/forms/decidim/ephemeral_user_form.rb +1 -1
- data/app/forms/decidim/omniauth_registration_form.rb +1 -1
- data/app/forms/decidim/registration_form.rb +1 -1
- data/app/helpers/decidim/menu_helper.rb +2 -2
- data/app/helpers/decidim/paginate_helper.rb +1 -1
- data/app/helpers/decidim/tooltip_helper.rb +4 -1
- data/app/mailers/decidim/notifications_digest_mailer.rb +7 -1
- data/app/mailers/decidim/reported_mailer.rb +17 -2
- data/app/packs/src/decidim/input_character_counter.js +1 -1
- data/app/packs/stylesheets/decidim/_cards.scss +1 -1
- data/app/packs/stylesheets/decidim/_header.scss +54 -35
- data/app/packs/stylesheets/decidim/resource_history.scss +14 -4
- data/app/permissions/decidim/default_permissions.rb +2 -0
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +7 -3
- data/app/queries/decidim/last_activity.rb +25 -0
- data/app/views/decidim/messaging/conversations/_reply_form.html.erb +1 -2
- data/app/views/decidim/messaging/conversations/_start.html.erb +1 -1
- data/app/views/decidim/reported_mailer/hidden_manually.html.erb +25 -0
- data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
- data/app/views/kaminari/decidim/_page.html.erb +1 -1
- data/app/views/kaminari/decidim/_paginator.html.erb +1 -1
- data/app/views/layouts/decidim/_logo.html.erb +2 -2
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_desktop.html.erb +5 -11
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +5 -5
- data/config/locales/ar.yml +0 -7
- data/config/locales/bg.yml +0 -7
- data/config/locales/ca-IT.yml +12 -1
- data/config/locales/ca.yml +12 -1
- data/config/locales/cs.yml +23 -12
- data/config/locales/de.yml +26 -11
- data/config/locales/el.yml +0 -7
- data/config/locales/en.yml +12 -1
- data/config/locales/es-MX.yml +13 -2
- data/config/locales/es-PY.yml +13 -2
- data/config/locales/es.yml +12 -1
- data/config/locales/eu.yml +17 -5
- data/config/locales/fi-plain.yml +0 -15
- data/config/locales/fi.yml +0 -15
- data/config/locales/fr-CA.yml +14 -8
- data/config/locales/fr.yml +14 -8
- data/config/locales/gl.yml +0 -5
- data/config/locales/hu.yml +0 -7
- data/config/locales/id-ID.yml +0 -5
- data/config/locales/is-IS.yml +0 -5
- data/config/locales/it.yml +0 -5
- data/config/locales/ja.yml +16 -14
- data/config/locales/lb.yml +0 -5
- data/config/locales/lt.yml +0 -7
- data/config/locales/lv.yml +0 -5
- data/config/locales/nl.yml +0 -5
- data/config/locales/no.yml +0 -5
- data/config/locales/pl.yml +0 -7
- data/config/locales/pt-BR.yml +0 -7
- data/config/locales/pt.yml +0 -5
- data/config/locales/ro-RO.yml +0 -14
- data/config/locales/ru.yml +0 -5
- data/config/locales/sk.yml +0 -5
- data/config/locales/sv.yml +36 -12
- data/config/locales/tr-TR.yml +0 -5
- data/config/locales/uk.yml +0 -5
- data/config/locales/zh-CN.yml +0 -5
- data/config/locales/zh-TW.yml +0 -7
- data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
- data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
- data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +1 -1
- data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +1 -1
- data/db/migrate/20190412131728_fix_user_names.rb +1 -1
- data/lib/decidim/core/test/factories.rb +12 -0
- data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -2
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/nicknamizable.rb +6 -9
- data/lib/decidim/private_download_helper.rb +3 -3
- data/lib/tasks/upgrade/clean.rake +9 -1
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +1 -1
- data/lib/tasks/upgrade/migrations.rake +2 -0
- metadata +8 -7
- /data/app/views/decidim/reported_mailer/{hide.html.erb → hidden_automatically.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763791440d8acd9bfdb66f0afe4d1a738f362815fd237b20b703a6fdc89edfb8
|
4
|
+
data.tar.gz: e6ff16714f702a13b60bee8d4bce8fe03978be54bbeea60c779bb5aaf735661f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ca3eaa4281c6b5f676f1df20466d18f8cd1893a26645f5bdd1f00ed9efe413849250801ae49d3e8572a7ca66fe24c0fe09935fb972719b67083df9ff13b4143
|
7
|
+
data.tar.gz: '068568c77bcf227bb7ef783606a63e858d59992001cc2e36d88c97212bf89fac3acefde0568f3557b4af7aa518326db6f5f10e5188d2195211a1a2b356228789'
|
@@ -4,13 +4,13 @@
|
|
4
4
|
<%= icon "map-pin-line" %>
|
5
5
|
<div class="address">
|
6
6
|
<% if has_location? %>
|
7
|
-
<
|
7
|
+
<p class="address__location"><%= location %></p>
|
8
8
|
<% end %>
|
9
9
|
|
10
|
-
<
|
10
|
+
<p class="address__address"><%= address %></p>
|
11
11
|
|
12
12
|
<% if has_location_hints? %>
|
13
|
-
<
|
13
|
+
<p class="address__hints"><%= location_hints %></p>
|
14
14
|
<% end %>
|
15
15
|
</div>
|
16
16
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%# If the options hash has the demo key it means we are in the decidim-design engine, so it is not a real-world scenario with actual users %>
|
2
2
|
<% tooltip = options.has_key?(:demo) ? { tooltip: render(:profile_minicard).html_safe } : nil %>
|
3
|
-
<%= content_tag(:
|
3
|
+
<%= content_tag(:p, class: :author, data: ) do %>
|
4
4
|
<%= content_tag :span, class: "author__container#{" is-compact" if layout == :compact}", data: tooltip do %>
|
5
5
|
<% if layout == :compact %>
|
6
6
|
<%= render :avatar %>
|
@@ -2,10 +2,10 @@
|
|
2
2
|
<div class="participatory-space__metadata-item">
|
3
3
|
<div class="participatory-space__metadata-item-title">
|
4
4
|
<%= icon item[:icon] %>
|
5
|
-
<
|
5
|
+
<h2><%= item[:title] %></h2>
|
6
6
|
</div>
|
7
7
|
<% if item[:text].present? %>
|
8
|
-
<%= content_tag :
|
8
|
+
<%= content_tag :p, item[:text] %>
|
9
9
|
<% elsif item[:partial].present? %>
|
10
10
|
<%= render item[:partial] %>
|
11
11
|
<% end %>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<h4 class="menu-bar__secondary-dropdown__title"><%= title %></h4>
|
2
|
-
|
3
|
-
|
2
|
+
<% if hashtag.present? %>
|
3
|
+
<div class="menu-bar__secondary-dropdown__metadata">
|
4
4
|
<span>
|
5
5
|
<%= icon "twitter-x-line", class: "text-gray fill-current" %>
|
6
6
|
<%= link_to "##{hashtag}", twitter_hashtag_url(hashtag), target: "_blank", class: "text-secondary underline" %>
|
7
7
|
</span>
|
8
|
-
|
9
|
-
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -76,7 +76,11 @@ module Decidim
|
|
76
76
|
participatory_space_moderators.each do |moderator|
|
77
77
|
next unless moderator.email_on_moderations
|
78
78
|
|
79
|
-
|
79
|
+
if hidden_by_admin?
|
80
|
+
ReportedMailer.hidden_manually(moderator, @report, current_user).deliver_later
|
81
|
+
else
|
82
|
+
ReportedMailer.hidden_automatically(moderator, @report).deliver_later
|
83
|
+
end
|
80
84
|
end
|
81
85
|
end
|
82
86
|
end
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
@user = Decidim::User.new(
|
42
42
|
name: form.name,
|
43
43
|
email: form.email.downcase,
|
44
|
-
nickname: UserBaseEntity.nicknamize(form.name,
|
44
|
+
nickname: UserBaseEntity.nicknamize(form.name, form.organization.id),
|
45
45
|
organization: form.organization,
|
46
46
|
admin: form.role == "admin",
|
47
47
|
roles: form.role == "admin" ? [] : [form.role].compact
|
@@ -9,6 +9,7 @@ module Decidim
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
include Decidim::NeedsOrganization
|
12
|
+
include Decidim::UserRoleChecker
|
12
13
|
|
13
14
|
helper ParticipatorySpaceHelpers, IconHelper, ContextualHelpHelper
|
14
15
|
helper_method :current_participatory_space
|
@@ -81,8 +82,10 @@ module Decidim
|
|
81
82
|
return true unless current_participatory_space.try(:private_space?) &&
|
82
83
|
!current_participatory_space.try(:is_transparent?)
|
83
84
|
return false unless current_user
|
85
|
+
return true if current_user.admin?
|
86
|
+
return true if user_has_any_role?(current_user, current_participatory_space, broad_check: true)
|
84
87
|
|
85
|
-
|
88
|
+
current_participatory_space.users.include?(current_user)
|
86
89
|
end
|
87
90
|
|
88
91
|
def help_section
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
# Exposes the report resource so users can report a reportable.
|
5
|
+
# Unless the reportable is marked as hideable, the resource notice will change accordingly.
|
5
6
|
class ReportsController < Decidim::ApplicationController
|
6
7
|
include FormFactory
|
7
8
|
include NeedsPermission
|
@@ -15,7 +16,11 @@ module Decidim
|
|
15
16
|
|
16
17
|
CreateReport.call(@form, reportable) do
|
17
18
|
on(:ok) do
|
18
|
-
flash[:notice] =
|
19
|
+
flash[:notice] = if hideable?
|
20
|
+
I18n.t("decidim.reports.hide.success")
|
21
|
+
else
|
22
|
+
I18n.t("decidim.reports.create.success")
|
23
|
+
end
|
19
24
|
redirect_to reportable.reload.reported_content_url
|
20
25
|
end
|
21
26
|
|
@@ -39,7 +39,7 @@ module Decidim
|
|
39
39
|
@breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new(
|
40
40
|
:menu,
|
41
41
|
self,
|
42
|
-
container_options: { class: "menu-
|
42
|
+
container_options: { class: "menu-bar__dropdown-menu" }
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
@@ -47,7 +47,7 @@ module Decidim
|
|
47
47
|
@mobile_breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new(
|
48
48
|
:mobile_menu,
|
49
49
|
self,
|
50
|
-
container_options: { class: "menu-bar__main-
|
50
|
+
container_options: { class: "menu-bar__main-dropdown__top-menu" }
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
@@ -13,7 +13,7 @@ module Decidim
|
|
13
13
|
|
14
14
|
per_page = (params[:per_page] || paginate_params[:per_page] || Decidim::Paginable::OPTIONS.first).to_i
|
15
15
|
|
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
|
16
|
+
content_tag :div, class: "flex flex-col-reverse md:flex-row items-center justify-between gap-1 py-8 md:py-16 md:flex-wrap", data: { pagination: "" } do
|
17
17
|
template = ""
|
18
18
|
template += render(partial: "decidim/shared/results_per_page", locals: { per_page: }, formats: [:html]) if collection.total_pages.positive?
|
19
19
|
template += paginate collection, window: 2, outer_window: 1, theme: "decidim", params: paginate_params
|
@@ -5,7 +5,10 @@ module Decidim
|
|
5
5
|
# on the layout.
|
6
6
|
module TooltipHelper
|
7
7
|
def with_tooltip(title, opts = {}, &)
|
8
|
-
content_tag(:
|
8
|
+
content_tag(:p,
|
9
|
+
title:,
|
10
|
+
class: "inline-block",
|
11
|
+
data: { tooltip: content_tag(:p, title, id: opts[:id], class: opts[:class] || "bottom", role: "tooltip", "aria-hidden": "true") }) do
|
9
12
|
capture(&).html_safe
|
10
13
|
end
|
11
14
|
end
|
@@ -14,7 +14,13 @@ module Decidim
|
|
14
14
|
@organization = user.organization
|
15
15
|
@notifications_digest = Decidim::NotificationsDigestPresenter.new(user)
|
16
16
|
@display_see_more_message = notifications.size > SIZE_LIMIT
|
17
|
-
|
17
|
+
# Note that this could be improved by adding a "type" column to the notifications table
|
18
|
+
# This fix can generate lists of notifications that are below the SIZE_LIMIT
|
19
|
+
@notifications = notifications[0...SIZE_LIMIT].filter_map do |notification|
|
20
|
+
next unless notification.event_class_instance.respond_to?(:email_intro)
|
21
|
+
|
22
|
+
Decidim::NotificationToMailerPresenter.new(notification)
|
23
|
+
end
|
18
24
|
|
19
25
|
mail(to: user.email, subject: @notifications_digest.subject)
|
20
26
|
end
|
@@ -21,14 +21,29 @@ module Decidim
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
# This is used when a user with special rights (like an administrator, a space administrator or a moderator) hides a resource
|
25
|
+
def hidden_manually(user, report, current_user)
|
25
26
|
with_user(user) do
|
26
27
|
@report = report
|
27
28
|
@participatory_space = @report.moderation.participatory_space
|
28
29
|
@reportable = @report.moderation.reportable
|
29
30
|
@organization = user.organization
|
30
31
|
@user = user
|
31
|
-
|
32
|
+
@moderator = current_user
|
33
|
+
subject = I18n.t("hidden_manually.subject", scope: "decidim.reported_mailer", moderator: @moderator.name)
|
34
|
+
mail(to: user.email, subject:)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# This is meant to be used when a resource is hidden by an algorithm, such as the `decidim-ai` module, or the `Decidim.max_reports_before_hiding` feature.
|
39
|
+
def hidden_automatically(user, report)
|
40
|
+
with_user(user) do
|
41
|
+
@report = report
|
42
|
+
@participatory_space = @report.moderation.participatory_space
|
43
|
+
@reportable = @report.moderation.reportable
|
44
|
+
@organization = user.organization
|
45
|
+
@user = user
|
46
|
+
subject = I18n.t("hidden_automatically.subject", scope: "decidim.reported_mailer")
|
32
47
|
mail(to: user.email, subject:)
|
33
48
|
end
|
34
49
|
end
|
@@ -93,7 +93,7 @@ export default class InputCharacterCounter {
|
|
93
93
|
this.$srTarget = $(`#${screenReaderId}`);
|
94
94
|
if (!this.$srTarget.length) {
|
95
95
|
this.$srTarget = $(
|
96
|
-
`<span role="status" id="${screenReaderId}" class="sr-only remaining-character-count-sr" />`
|
96
|
+
`<span role="status" id="${screenReaderId}" class="sr-only remaining-character-count-sr" aria-hidden="true"/>`
|
97
97
|
);
|
98
98
|
this.$target.before(this.$srTarget);
|
99
99
|
}
|
@@ -163,7 +163,7 @@
|
|
163
163
|
/* shared styles */
|
164
164
|
&__highlight-metadata,
|
165
165
|
&__grid-metadata {
|
166
|
-
@apply mt-auto flex items-center justify-between flex-wrap text-sm text-gray-2 [&>*]:flex [&>*]:items-center [&>*]:gap-1 first:[&>*]:
|
166
|
+
@apply mt-auto flex items-center justify-between flex-wrap w-full text-sm text-gray-2 [&>*]:flex [&>*]:items-center [&>*]:gap-1 first:[&>*]:w-4/5;
|
167
167
|
|
168
168
|
svg {
|
169
169
|
@apply flex-none text-gray fill-current;
|
@@ -334,10 +334,6 @@ header {
|
|
334
334
|
&__dropdown-trigger {
|
335
335
|
@apply flex items-center justify-between text-white;
|
336
336
|
|
337
|
-
span {
|
338
|
-
@apply flex flex-wrap md:flex-nowrap gap-x-2.5 overflow-hidden text-white;
|
339
|
-
}
|
340
|
-
|
341
337
|
svg {
|
342
338
|
@apply w-6 h-6 fill-current;
|
343
339
|
}
|
@@ -373,54 +369,77 @@ header {
|
|
373
369
|
@apply absolute top-full left-0 bg-white rounded w-full bg-gray-5;
|
374
370
|
}
|
375
371
|
|
376
|
-
&
|
377
|
-
@apply
|
372
|
+
&__dropdown-menu {
|
373
|
+
@apply w-full md:w-1/4 bg-primary px-4 md:px-8 pt-0 pb-3 md:py-3 divide-y divide-gray-3 text-white;
|
378
374
|
|
379
|
-
|
380
|
-
|
381
|
-
|
375
|
+
> * {
|
376
|
+
@apply py-3 md:py-3.5;
|
377
|
+
}
|
382
378
|
|
383
|
-
|
384
|
-
|
379
|
+
a {
|
380
|
+
@apply flex items-center justify-start gap-1 font-semibold text-lg text-white;
|
381
|
+
|
382
|
+
span {
|
383
|
+
@apply min-w-0 truncate;
|
385
384
|
}
|
386
|
-
}
|
387
385
|
|
388
|
-
|
389
|
-
|
386
|
+
svg {
|
387
|
+
@apply flex-none fill-current;
|
388
|
+
}
|
390
389
|
}
|
390
|
+
}
|
391
391
|
|
392
|
-
|
393
|
-
|
394
|
-
}
|
392
|
+
&__main-dropdown {
|
393
|
+
@apply bg-white flex flex-row rounded-b shadow-lg text-black w-full lg:w-[1280px] h-screen md:h-auto;
|
395
394
|
|
396
|
-
&
|
397
|
-
@apply
|
395
|
+
&__left {
|
396
|
+
@apply flex flex-col justify-between p-4 md:p-8 space-y-5 hidden md:block md:w-3/4;
|
397
|
+
|
398
|
+
&-top {
|
399
|
+
@apply border-b-4 border-gray-3 pb-3;
|
400
|
+
}
|
398
401
|
}
|
399
402
|
|
400
|
-
&
|
401
|
-
@apply w-full
|
403
|
+
&__top {
|
404
|
+
@apply w-full px-4;
|
402
405
|
|
403
|
-
|
404
|
-
@apply
|
406
|
+
&-menu {
|
407
|
+
@apply w-full md:w-1/2 mt-0 grid md:grid-cols-2 gap-x-6 text-secondary;
|
405
408
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
+
> * {
|
410
|
+
@apply py-3 md:py-3.5 border-b last:border-0 border-gray-3;
|
411
|
+
|
412
|
+
/* since the grid has 2 columns, remove the border for these last 2 columns */
|
413
|
+
&:nth-last-child(-n + 2) {
|
414
|
+
@apply md:border-0;
|
415
|
+
}
|
409
416
|
}
|
410
|
-
}
|
411
417
|
|
412
|
-
|
413
|
-
|
418
|
+
a {
|
419
|
+
@apply flex items-center justify-start gap-1 font-semibold text-lg text-secondary;
|
414
420
|
|
415
|
-
|
416
|
-
|
417
|
-
|
421
|
+
span {
|
422
|
+
@apply min-w-0 truncate;
|
423
|
+
}
|
418
424
|
|
419
|
-
|
420
|
-
|
425
|
+
svg {
|
426
|
+
@apply flex-none fill-current;
|
427
|
+
}
|
421
428
|
}
|
422
429
|
}
|
423
430
|
}
|
431
|
+
|
432
|
+
&__bottom {
|
433
|
+
@apply hidden md:flex;
|
434
|
+
}
|
435
|
+
|
436
|
+
&__title {
|
437
|
+
@apply hidden h4 md:flex md:h3;
|
438
|
+
}
|
439
|
+
|
440
|
+
&__subtitle {
|
441
|
+
@apply hidden text-md md:flex md:text-lg text-gray-2 mt-5;
|
442
|
+
}
|
424
443
|
}
|
425
444
|
|
426
445
|
&__secondary-dropdown {
|
@@ -459,7 +478,7 @@ header {
|
|
459
478
|
}
|
460
479
|
|
461
480
|
&__metadata {
|
462
|
-
@apply flex items-center text-sm space-x-6
|
481
|
+
@apply flex items-center text-sm space-x-6 pb-6;
|
463
482
|
|
464
483
|
> span {
|
465
484
|
@apply flex items-center space-x-2;
|
@@ -13,19 +13,29 @@
|
|
13
13
|
}
|
14
14
|
|
15
15
|
&_content {
|
16
|
-
@apply flex flex-col lg:items-
|
16
|
+
@apply flex flex-col lg:items-start lg:flex-row lg:gap-2 lg:pt-[6px];
|
17
17
|
}
|
18
18
|
|
19
19
|
&_date {
|
20
|
-
@apply text-sm text-gray-2;
|
20
|
+
@apply text-sm text-gray-2 lg:pt-px;
|
21
21
|
}
|
22
22
|
}
|
23
23
|
|
24
24
|
&_text {
|
25
|
-
@apply flex flex-col
|
25
|
+
@apply flex flex-col relative max-w-[250px] md:max-w-[600px] lg:max-w-[400px];
|
26
|
+
}
|
27
|
+
|
28
|
+
&_text:has(.resource-link) {
|
29
|
+
.resource-link {
|
30
|
+
@apply md:ml-[-1px] lg:ml-[-106px];
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
&_text:not(:has(.resource-link)) a {
|
35
|
+
@apply md:ml-[-1px] lg:ml-[-106px];
|
26
36
|
}
|
27
37
|
|
28
38
|
&__line {
|
29
|
-
@apply absolute -left-[26px] lg:-left-[
|
39
|
+
@apply absolute -left-[26px] lg:-left-[134px] top-3.5 lg:top-[26px] w-px h-full lg:h-[90%] bg-secondary;
|
30
40
|
}
|
31
41
|
}
|
@@ -5,6 +5,8 @@ module Decidim
|
|
5
5
|
# actions by any kind of user. Also works as a default implementation so other
|
6
6
|
# components can inherit from it and get some convenience methods.
|
7
7
|
class DefaultPermissions
|
8
|
+
include Decidim::UserRoleChecker
|
9
|
+
|
8
10
|
def initialize(user, permission_action, context = {})
|
9
11
|
@user = user
|
10
12
|
@permission_action = permission_action
|
@@ -14,15 +14,19 @@ module Decidim
|
|
14
14
|
delegate :url_helpers, to: "Decidim::Core::Engine.routes"
|
15
15
|
delegate :resource_title, to: :event
|
16
16
|
delegate :resource_url, to: :event
|
17
|
-
delegate :email_intro, to: :event
|
18
17
|
delegate :resource_path, to: :event
|
19
18
|
delegate :safe_resource_text, to: :event
|
20
19
|
|
20
|
+
def email_intro
|
21
|
+
event.email_intro if event.respond_to?(:email_intro)
|
22
|
+
end
|
23
|
+
|
21
24
|
def date_time
|
25
|
+
created_at_in_time_zone = created_at.in_time_zone(resource.organization.time_zone)
|
22
26
|
if frequency == :daily
|
23
|
-
|
27
|
+
I18n.l(created_at_in_time_zone, format: :time_of_day)
|
24
28
|
else
|
25
|
-
I18n.l(
|
29
|
+
I18n.l(created_at_in_time_zone, format: :decidim_short)
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
@@ -18,6 +18,7 @@ module Decidim
|
|
18
18
|
query = filter_moderated(query)
|
19
19
|
query = filter_spaces(query)
|
20
20
|
query = filter_deleted(query)
|
21
|
+
query = filter_withdrawn(query)
|
21
22
|
query.with_new_resource_type("all")
|
22
23
|
end
|
23
24
|
end
|
@@ -48,6 +49,30 @@ module Decidim
|
|
48
49
|
).where(decidim_moderations: { id: nil })
|
49
50
|
end
|
50
51
|
|
52
|
+
def filter_withdrawn(query)
|
53
|
+
# Filter out the items that have been withdrawn.
|
54
|
+
conditions = []
|
55
|
+
|
56
|
+
ActionLog.public_resource_types.each do |resource_type|
|
57
|
+
klass = resource_type.constantize
|
58
|
+
|
59
|
+
condition = if klass.respond_to?(:not_withdrawn)
|
60
|
+
Arel.sql(
|
61
|
+
[
|
62
|
+
"decidim_action_logs.resource_type = '#{resource_type}'",
|
63
|
+
"decidim_action_logs.resource_id IN (#{Arel.sql(klass.not_withdrawn.select(:id).to_sql)})"
|
64
|
+
].join(" AND ")
|
65
|
+
).to_s
|
66
|
+
else
|
67
|
+
Arel.sql("decidim_action_logs.resource_type = '#{resource_type}'").to_s
|
68
|
+
end
|
69
|
+
|
70
|
+
conditions << "(#{condition})"
|
71
|
+
end
|
72
|
+
|
73
|
+
query.where(Arel.sql(conditions.join(" OR ")).to_s)
|
74
|
+
end
|
75
|
+
|
51
76
|
def filter_spaces(query)
|
52
77
|
conditions = []
|
53
78
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
<div data-conversation-reply>
|
2
2
|
<%= decidim_form_for form, url: decidim.conversation_path(conversation.id), method: :put, remote: true do |f| %>
|
3
3
|
<div class="conversation__reply">
|
4
|
-
<%= f.
|
5
|
-
<%= f.text_area :body, label: false, rows: 4, required: true, placeholder: t(".placeholder"), data: { "input-emoji": true } %>
|
4
|
+
<%= f.text_area :body, label: false, rows: 4, required: true, placeholder: t(".placeholder"), data: { "input-emoji": true }, aria: { label: t(".placeholder") } %>
|
6
5
|
<%= f.submit "#{t(".send")} #{icon "arrow-right-line", class: "fill-current"}".html_safe, class: "button button__sm button__secondary self-end mt-4" %>
|
7
6
|
</div>
|
8
7
|
<% end %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<%= f.hidden_field :recipient_id, id: nil, name: "conversation[recipient_id][]", value: recipient.id %>
|
6
6
|
<% end %>
|
7
7
|
<%= f.label :body, nil, class: "sr-only" %>
|
8
|
-
<%= f.text_area :body, label: false, rows: 4, required: true, placeholder: t(".placeholder"), data: { "input-emoji": true } %>
|
8
|
+
<%= f.text_area :body, label: false, rows: 4, required: true, placeholder: t(".placeholder"), data: { "input-emoji": true }, aria: { label: t(".placeholder") } %>
|
9
9
|
<%= f.submit "#{t(".send")} #{icon "arrow-right-line", class: "fill-current"}".html_safe, class: "button button__sm button__secondary self-end mt-4" %>
|
10
10
|
</div>
|
11
11
|
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<p class="email-greeting"><%= t(".hello", name: @user.name) %></p>
|
2
|
+
|
3
|
+
<p class="email-instructions">
|
4
|
+
<%= t(".report_html", url: reported_content_url, moderator: @moderator.name) %>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<p><b><%= t(".participatory_space") %></b></p>
|
8
|
+
<p><%= link_to translated_attribute(@participatory_space.title), resource_locator(@participatory_space).url %></p>
|
9
|
+
|
10
|
+
<p><b><%= t(".reason") %></b></p>
|
11
|
+
<p><%= t(@report.reason, organization_name: organization_name(@participatory_space.organization), scope: "decidim.shared.flag_modal") %></p>
|
12
|
+
|
13
|
+
<% if @report.details.present? %>
|
14
|
+
<p><b><%= t(".details") %></b></p>
|
15
|
+
<blockquote>
|
16
|
+
<%= @report.details %>
|
17
|
+
</blockquote>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<p><b><%= t(".content") %></b></p>
|
21
|
+
<%= reported_content_cell %>
|
22
|
+
|
23
|
+
<p class="email-button email-button__cta">
|
24
|
+
<%= link_to t(".manage_moderations"), manage_moderations_url %>
|
25
|
+
</p>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% menu_id = "#{SecureRandom.uuid}_results_per_page_menu" %>
|
2
2
|
<div class="flex items-center gap-1">
|
3
3
|
<%= icon "list-check-2", class: "w-4 h-4 text-gray fill-current" %>
|
4
|
-
<
|
4
|
+
<p class="text-gray-2"><%= t("decidim.shared.results_per_page.label") %></p>
|
5
5
|
|
6
6
|
<details class="relative">
|
7
7
|
<summary id="<%= menu_id %>-control" class="flex items-center cursor-pointer text-secondary font-semibold" aria-controls="<%= menu_id %>" aria-haspopup="menu" title="<%= t("decidim.shared.results_per_page.title") %>">
|
@@ -6,6 +6,6 @@
|
|
6
6
|
total_pages: total number of pages
|
7
7
|
per_page: number of items to fetch per page
|
8
8
|
remote: data-remote -%>
|
9
|
-
<li class="w-6 h-6 rounded-full hover:bg-background-3 transition<%= "
|
9
|
+
<li class="w-6 h-6 px-2 rounded-full hover:bg-background-3 transition min-w-fit <%= "bg-background-3 grid place-items-center" if page.current? %>" <%== 'aria-current="page"' if page.current? %> data-page>
|
10
10
|
<%= link_to_unless page.current?, page, url, { class: "w-full h-full grid place-items-center", remote:, rel: page.rel, title: t("views.pagination.title") << page.to_s } %>
|
11
11
|
</li>
|
@@ -8,7 +8,7 @@ paginator: the paginator that renders the pagination tags inside -%>
|
|
8
8
|
|
9
9
|
<% if total_pages > 1 %>
|
10
10
|
<nav aria-label="<%= t("views.pagination.pagination") %>">
|
11
|
-
<ul class="flex items-center text-sm text-secondary" data-pages>
|
11
|
+
<ul class="flex flex-wrap items-center text-sm text-secondary gap-x-1" data-pages>
|
12
12
|
<%= paginator.prev_page_tag unless current_page.first? %>
|
13
13
|
|
14
14
|
<% paginator.each_page do |page| -%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if organization %>
|
2
|
-
<%= link_to root_url
|
2
|
+
<%= link_to root_url do %>
|
3
3
|
<% if organization.logo.attached? %>
|
4
|
-
<%= image_tag organization.attached_uploader(:logo).variant_url(:medium), alt: t("
|
4
|
+
<%= image_tag organization.attached_uploader(:logo).variant_url(:medium), alt: "#{current_organization_name} (#{t("decidim.errors.not_found.back_home")})" %>
|
5
5
|
<% else %>
|
6
6
|
<span><%= current_organization_name %></span>
|
7
7
|
<% end %>
|
@@ -1,16 +1,10 @@
|
|
1
1
|
<div id="<%= id %>" class="menu-bar__main-dropdown">
|
2
|
-
<div class="menu-bar__main-
|
3
|
-
<div class="menu-bar__main-
|
2
|
+
<div class="menu-bar__main-dropdown__left">
|
3
|
+
<div class="menu-bar__main-dropdown__left-top">
|
4
4
|
<%= render partial: "layouts/decidim/header/menu_breadcrumb_main_dropdown_top_left" %>
|
5
5
|
</div>
|
6
|
-
<%=
|
7
|
-
|
8
|
-
<div class="menu-bar__main-dropdown__bottom">
|
9
|
-
<div class="menu-bar__main-dropdown__bottom-left">
|
10
|
-
<%= cell("decidim/highlighted_participatory_process", menu_highlighted_participatory_process) %>
|
11
|
-
</div>
|
12
|
-
<div class="menu-bar__main-dropdown__bottom-right">
|
13
|
-
<%= cell "decidim/content_blocks/menu_breadcrumb_last_activity", current_organization %>
|
14
|
-
</div>
|
6
|
+
<%= cell("decidim/highlighted_participatory_process", menu_highlighted_participatory_process) %>
|
7
|
+
<%= cell "decidim/content_blocks/menu_breadcrumb_last_activity", current_organization %>
|
15
8
|
</div>
|
9
|
+
<%= breadcrumb_root_menu.render %>
|
16
10
|
</div>
|