decidim-core 0.32.0.rc3 → 0.32.0
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/author_cell.rb +0 -4
- data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_participatory_spaces_cell.rb +1 -1
- data/app/commands/decidim/destroy_account.rb +12 -1
- data/app/commands/decidim/multiple_attachments_methods.rb +28 -27
- data/app/jobs/decidim/process_inactive_participant_job.rb +0 -7
- data/app/mailers/decidim/delete_user_mailer.rb +14 -0
- data/app/mailers/decidim/participants_account_mailer.rb +0 -16
- data/app/packs/src/decidim/controllers/main_menu/controller.js +33 -0
- data/app/packs/src/decidim/controllers/main_menu/main_menu.test.js +77 -0
- data/app/packs/src/decidim/controllers/mention/controller.js +296 -140
- data/app/packs/src/decidim/controllers/mention/input_mentions.test.js +120 -457
- data/app/packs/src/decidim/controllers/multiple_mentions/controller.js +68 -32
- data/app/packs/src/decidim/controllers/multiple_mentions/input_multiple_mentions.test.js +30 -23
- data/app/packs/src/decidim/editor/common/suggestion.js +3 -1
- data/app/packs/src/decidim/editor/extensions/indent/index.js +9 -0
- data/app/packs/src/decidim/geocoding/reverse_geocoding.js +15 -5
- data/app/packs/src/decidim/geocoding/reverse_geocoding.test.js +197 -0
- data/app/packs/src/decidim/index.js +2 -2
- data/app/packs/stylesheets/decidim/_conversations.scss +14 -0
- data/app/packs/stylesheets/decidim/_dropdown.scss +1 -1
- data/app/packs/stylesheets/decidim/_editor_suggestions.scss +49 -0
- data/app/packs/stylesheets/decidim/_header.scss +12 -8
- data/app/packs/stylesheets/decidim/_tom_select.scss +23 -0
- data/app/packs/stylesheets/decidim/application.scss +2 -0
- data/app/packs/stylesheets/decidim/editor.scss +2 -33
- data/app/packs/stylesheets/decidim/geocoding_addons.scss +10 -2
- data/app/uploaders/decidim/image_uploader.rb +1 -1
- data/app/views/decidim/delete_user_mailer/delete.html.erb +6 -0
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +11 -19
- data/app/views/decidim/messaging/conversations/error.js.erb +12 -7
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile.html.erb +2 -1
- data/config/locales/ar.yml +0 -2
- data/config/locales/bg.yml +0 -2
- data/config/locales/ca-IT.yml +21 -10
- data/config/locales/ca.yml +21 -10
- data/config/locales/cs.yml +10 -9
- data/config/locales/de.yml +4 -13
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +20 -9
- data/config/locales/es-MX.yml +20 -9
- data/config/locales/es-PY.yml +20 -9
- data/config/locales/es.yml +20 -9
- data/config/locales/eu.yml +36 -9
- data/config/locales/fi-plain.yml +19 -8
- data/config/locales/fi.yml +19 -8
- data/config/locales/fr-CA.yml +23 -9
- data/config/locales/fr.yml +23 -9
- data/config/locales/hu.yml +0 -2
- data/config/locales/it.yml +0 -2
- data/config/locales/ja.yml +59 -19
- data/config/locales/lb.yml +0 -2
- data/config/locales/lt.yml +0 -2
- data/config/locales/nl.yml +0 -2
- data/config/locales/no.yml +0 -2
- data/config/locales/pl.yml +2 -4
- data/config/locales/pt-BR.yml +2 -11
- data/config/locales/pt.yml +0 -2
- data/config/locales/ro-RO.yml +1 -10
- data/config/locales/sk.yml +1 -10
- data/config/locales/sv.yml +0 -9
- data/config/locales/tr-TR.yml +0 -2
- data/config/locales/zh-CN.yml +0 -2
- data/config/locales/zh-TW.yml +0 -2
- data/decidim-core.gemspec +1 -1
- data/lib/decidim/attachment_attributes.rb +58 -9
- data/lib/decidim/command.rb +1 -1
- data/lib/decidim/core/content_blocks/registry_manager.rb +4 -4
- data/lib/decidim/core/engine.rb +8 -0
- data/lib/decidim/core/test/factories.rb +3 -0
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +10 -10
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +6 -6
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/map/autocomplete.rb +4 -3
- data/lib/decidim/searchable.rb +5 -0
- data/lib/decidim/view_model.rb +1 -1
- data/lib/tasks/decidim_mailers_tasks.rake +31 -9
- metadata +10 -9
- data/app/commands/decidim/gallery_methods.rb +0 -107
- data/app/packs/src/decidim/vendor/tribute.js +0 -1890
- data/app/packs/stylesheets/decidim/_tribute.scss +0 -36
- data/app/views/decidim/participants_account_mailer/removal_notification.html.erb +0 -11
data/lib/decidim/command.rb
CHANGED
|
@@ -45,11 +45,11 @@ module Decidim
|
|
|
45
45
|
]
|
|
46
46
|
|
|
47
47
|
content_block.settings do |settings|
|
|
48
|
-
settings.attribute :title, type: :text, translated: true
|
|
48
|
+
settings.attribute :title, type: :text, translated: true, required: true
|
|
49
49
|
settings.attribute :short_description, type: :text, translated: true
|
|
50
|
-
settings.attribute :action_button_title, type: :text, translated: true
|
|
51
|
-
settings.attribute :action_button_subtitle, type: :text, translated: true
|
|
52
|
-
settings.attribute :action_button_url, type: :text
|
|
50
|
+
settings.attribute :action_button_title, type: :text, translated: true, required: true
|
|
51
|
+
settings.attribute :action_button_subtitle, type: :text, translated: true, required: true
|
|
52
|
+
settings.attribute :action_button_url, type: :text, required: true
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
content_block.default!
|
data/lib/decidim/core/engine.rb
CHANGED
|
@@ -463,6 +463,14 @@ module Decidim
|
|
|
463
463
|
end
|
|
464
464
|
end
|
|
465
465
|
|
|
466
|
+
initializer "decidim_core.delete_account" do
|
|
467
|
+
config.to_prepare do
|
|
468
|
+
ActiveSupport::Notifications.subscribe("decidim.destroy_account:after") do |_event_name, data|
|
|
469
|
+
Decidim::DeleteUserMailer.delete(user_email: data[:user_email], user_name: data[:user_name], locale: data[:locale], organization: data[:organization]).deliver_later
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
end
|
|
473
|
+
|
|
466
474
|
initializer "decidim_core.add_cells_view_paths" do
|
|
467
475
|
Cell::ViewModel.view_paths << Rails.root.join("app/views") # for partials
|
|
468
476
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells")
|
|
@@ -85,6 +85,8 @@ FactoryBot.define do
|
|
|
85
85
|
"#{Faker::Lorem.sentence(word_count: 1, supplemental: true, random_words_to_add: 3)} #{n}"
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
sequence(:component_position)
|
|
89
|
+
|
|
88
90
|
factory :category, class: "Decidim::Category" do
|
|
89
91
|
transient do
|
|
90
92
|
skip_injection { false }
|
|
@@ -469,6 +471,7 @@ FactoryBot.define do
|
|
|
469
471
|
manifest_name { "dummy" }
|
|
470
472
|
published_at { Time.current }
|
|
471
473
|
deleted_at { nil }
|
|
474
|
+
weight { generate(:component_position) }
|
|
472
475
|
settings do
|
|
473
476
|
{
|
|
474
477
|
dummy_global_translatable_text: generate_localized_title(:dummy_global_translatable_text, skip_injection:),
|
|
@@ -87,7 +87,7 @@ end
|
|
|
87
87
|
|
|
88
88
|
shared_examples "admin creates resource gallery" do
|
|
89
89
|
context "when uploading images" do
|
|
90
|
-
let(:
|
|
90
|
+
let(:uploaded_attachments) do
|
|
91
91
|
[
|
|
92
92
|
{
|
|
93
93
|
title: "Picture of the city",
|
|
@@ -99,10 +99,10 @@ shared_examples "admin creates resource gallery" do
|
|
|
99
99
|
}
|
|
100
100
|
]
|
|
101
101
|
end
|
|
102
|
-
let(:
|
|
102
|
+
let(:current_attachments) { [] }
|
|
103
103
|
|
|
104
104
|
it "creates a gallery for the resource" do
|
|
105
|
-
expect { command.call }.to change(Decidim::Attachment, :count).by(
|
|
105
|
+
expect { command.call }.to change(Decidim::Attachment, :count).by(uploaded_attachments.count)
|
|
106
106
|
|
|
107
107
|
resource = resource_class.last
|
|
108
108
|
expect(resource.photos.count).to eq(2)
|
|
@@ -111,7 +111,7 @@ shared_examples "admin creates resource gallery" do
|
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
context "when gallery is left blank" do
|
|
114
|
-
let(:
|
|
114
|
+
let(:uploaded_attachments) { [] }
|
|
115
115
|
|
|
116
116
|
it "broadcasts ok" do
|
|
117
117
|
expect { command.call }.to broadcast(:ok)
|
|
@@ -122,7 +122,7 @@ end
|
|
|
122
122
|
|
|
123
123
|
shared_examples "admin manages resource gallery" do
|
|
124
124
|
context "when managing images" do
|
|
125
|
-
let(:
|
|
125
|
+
let(:uploaded_attachments) do
|
|
126
126
|
[
|
|
127
127
|
{
|
|
128
128
|
title: "Picture of the city",
|
|
@@ -134,10 +134,10 @@ shared_examples "admin manages resource gallery" do
|
|
|
134
134
|
}
|
|
135
135
|
]
|
|
136
136
|
end
|
|
137
|
-
let(:
|
|
137
|
+
let(:current_attachments) { [] }
|
|
138
138
|
|
|
139
139
|
it "creates a gallery for the resource" do
|
|
140
|
-
expect { command.call }.to change(Decidim::Attachment, :count).by(
|
|
140
|
+
expect { command.call }.to change(Decidim::Attachment, :count).by(uploaded_attachments.count)
|
|
141
141
|
resource = resource_class.last
|
|
142
142
|
expect(resource.photos.count).to eq(2)
|
|
143
143
|
last_attachment = Decidim::Attachment.last
|
|
@@ -145,7 +145,7 @@ shared_examples "admin manages resource gallery" do
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
context "when gallery is left blank" do
|
|
148
|
-
let(:
|
|
148
|
+
let(:uploaded_attachments) { [] }
|
|
149
149
|
|
|
150
150
|
it "broadcasts ok" do
|
|
151
151
|
expect { command.call }.to broadcast(:ok)
|
|
@@ -155,8 +155,8 @@ shared_examples "admin manages resource gallery" do
|
|
|
155
155
|
context "when images are removed" do
|
|
156
156
|
let!(:image1) { create(:attachment, :with_image, attached_to: resource) }
|
|
157
157
|
let!(:image2) { create(:attachment, :with_image, attached_to: resource) }
|
|
158
|
-
let(:
|
|
159
|
-
let(:
|
|
158
|
+
let(:uploaded_attachments) { [] }
|
|
159
|
+
let(:current_attachments) { [image1.id] }
|
|
160
160
|
|
|
161
161
|
it "to decrease the number of photos in the gallery" do
|
|
162
162
|
expect(resource.attachments.count).to eq(2)
|
|
@@ -990,16 +990,16 @@ shared_examples "comments" do
|
|
|
990
990
|
let(:content) { "A valid user mention: @#{mentioned_user.nickname}" }
|
|
991
991
|
|
|
992
992
|
context "when text finish with a mention" do
|
|
993
|
-
it "shows the
|
|
994
|
-
expect(page).to have_css(".
|
|
993
|
+
it "shows the suggestions menu" do
|
|
994
|
+
expect(page).to have_css(".editor-suggestions-item", text: "@#{mentioned_user.nickname} (#{mentioned_user.name})", wait: 10)
|
|
995
995
|
end
|
|
996
996
|
end
|
|
997
997
|
|
|
998
998
|
context "when text contains a mention" do
|
|
999
999
|
let(:content) { "A valid user mention: @#{mentioned_user.nickname}." }
|
|
1000
1000
|
|
|
1001
|
-
it "
|
|
1002
|
-
expect(page).to have_no_css(".
|
|
1001
|
+
it "hides the suggestions menu" do
|
|
1002
|
+
expect(page).to have_no_css(".editor-suggestions-item", text: "@#{mentioned_user.nickname} (#{mentioned_user.name})")
|
|
1003
1003
|
end
|
|
1004
1004
|
end
|
|
1005
1005
|
end
|
|
@@ -1008,8 +1008,8 @@ shared_examples "comments" do
|
|
|
1008
1008
|
let!(:mentioned_user) { create(:user, organization:) }
|
|
1009
1009
|
let(:content) { "A unconfirmed user mention: @#{mentioned_user.nickname}" }
|
|
1010
1010
|
|
|
1011
|
-
it "
|
|
1012
|
-
expect(page).to have_no_css(".
|
|
1011
|
+
it "does not show the suggestions menu" do
|
|
1012
|
+
expect(page).to have_no_css(".editor-suggestions-item", text: "@#{mentioned_user.nickname} (#{mentioned_user.name})")
|
|
1013
1013
|
end
|
|
1014
1014
|
end
|
|
1015
1015
|
end
|
data/lib/decidim/core/version.rb
CHANGED
|
@@ -37,19 +37,20 @@ module Decidim
|
|
|
37
37
|
template.snippets.add(:decidim_geocoding_scripts, template.append_javascript_pack_tag("decidim_geocoding"))
|
|
38
38
|
template.snippets.add(:decidim_geocoding_styles, template.append_stylesheet_pack_tag("decidim_geocoding"))
|
|
39
39
|
|
|
40
|
-
template.content_tag(:div, class: "geocoding
|
|
40
|
+
template.content_tag(:div, class: "geocoding") do
|
|
41
41
|
template.text_field(
|
|
42
42
|
object_name,
|
|
43
43
|
method,
|
|
44
44
|
options.merge("data-decidim-geocoding" => view_options.to_json)
|
|
45
45
|
) +
|
|
46
|
-
template.content_tag(:div, class: "input-group-button
|
|
47
|
-
template.content_tag(:button, class: "button button__sm md:button__sm button__text-secondary", type: "button", data: {
|
|
46
|
+
template.content_tag(:div, class: "input-group-button geocoding__locate") do
|
|
47
|
+
template.content_tag(:button, class: "button button__sm md:button__sm button__text-secondary geocoding__button", type: "button", data: {
|
|
48
48
|
input: "#{object_name}_#{method}",
|
|
49
49
|
latitude: "#{object_name}_latitude",
|
|
50
50
|
longitude: "#{object_name}_longitude",
|
|
51
51
|
error_no_location: I18n.t("errors.no_device_location", scope: "decidim.proposals.forms"),
|
|
52
52
|
error_unsupported: I18n.t("errors.device_not_supported", scope: "decidim.proposals.forms"),
|
|
53
|
+
locating_text: I18n.t("locating", scope: "decidim.proposals.forms"),
|
|
53
54
|
url: Decidim::Core::Engine.routes.url_helpers.locate_path
|
|
54
55
|
}) do
|
|
55
56
|
icon("map-pin-line", role: "img", "aria-hidden": true) + " #{I18n.t("use_my_location", scope: "decidim.proposals.forms")}"
|
data/lib/decidim/searchable.rb
CHANGED
|
@@ -117,6 +117,11 @@ module Decidim
|
|
|
117
117
|
searchables_in_org.find_each do |sr|
|
|
118
118
|
next if sr.blank?
|
|
119
119
|
|
|
120
|
+
unless sr.locale.in?(org.available_locales)
|
|
121
|
+
sr.destroy
|
|
122
|
+
next
|
|
123
|
+
end
|
|
124
|
+
|
|
120
125
|
sr.update(contents_to_searchable_resource_attributes(fields, sr.locale))
|
|
121
126
|
end
|
|
122
127
|
end
|
data/lib/decidim/view_model.rb
CHANGED
|
@@ -4,20 +4,42 @@ namespace :decidim do
|
|
|
4
4
|
namespace :mailers do
|
|
5
5
|
desc "Sends the notification digest email with the daily report"
|
|
6
6
|
task notifications_digest_daily: :environment do
|
|
7
|
-
|
|
7
|
+
time = Time.now.utc
|
|
8
|
+
target_users = Decidim::User.where(notifications_sending_frequency: :daily)
|
|
9
|
+
|
|
10
|
+
target_users.find_in_batches do |batch|
|
|
11
|
+
notification_users =
|
|
12
|
+
Decidim::Notification
|
|
13
|
+
.daily(time)
|
|
14
|
+
.where(decidim_user_id: batch.pluck(:id))
|
|
15
|
+
.select(:decidim_user_id)
|
|
16
|
+
.distinct
|
|
17
|
+
.pluck(:decidim_user_id)
|
|
18
|
+
|
|
19
|
+
notification_users.each do |user_id|
|
|
20
|
+
Decidim::EmailNotificationsDigestGeneratorJob.perform_later(user_id, :daily, time:)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
8
23
|
end
|
|
9
24
|
|
|
10
25
|
desc "Sends the notification digest email with the weekly report"
|
|
11
26
|
task notifications_digest_weekly: :environment do
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
time = Time.now.utc
|
|
28
|
+
target_users = Decidim::User.where(notifications_sending_frequency: :weekly)
|
|
29
|
+
|
|
30
|
+
target_users.find_in_batches do |batch|
|
|
31
|
+
notification_users =
|
|
32
|
+
Decidim::Notification
|
|
33
|
+
.weekly(time)
|
|
34
|
+
.where(decidim_user_id: batch.pluck(:id))
|
|
35
|
+
.select(:decidim_user_id)
|
|
36
|
+
.distinct
|
|
37
|
+
.pluck(:decidim_user_id)
|
|
15
38
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Decidim::EmailNotificationsDigestGeneratorJob.perform_later(user.id, frequency, time:)
|
|
39
|
+
notification_users.each do |user_id|
|
|
40
|
+
Decidim::EmailNotificationsDigestGeneratorJob.perform_later(user_id, :weekly, time:)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
21
43
|
end
|
|
22
44
|
end
|
|
23
45
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.32.0
|
|
4
|
+
version: 0.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -893,28 +893,28 @@ dependencies:
|
|
|
893
893
|
requirements:
|
|
894
894
|
- - '='
|
|
895
895
|
- !ruby/object:Gem::Version
|
|
896
|
-
version: 0.32.0
|
|
896
|
+
version: 0.32.0
|
|
897
897
|
type: :development
|
|
898
898
|
prerelease: false
|
|
899
899
|
version_requirements: !ruby/object:Gem::Requirement
|
|
900
900
|
requirements:
|
|
901
901
|
- - '='
|
|
902
902
|
- !ruby/object:Gem::Version
|
|
903
|
-
version: 0.32.0
|
|
903
|
+
version: 0.32.0
|
|
904
904
|
- !ruby/object:Gem::Dependency
|
|
905
905
|
name: decidim-dev
|
|
906
906
|
requirement: !ruby/object:Gem::Requirement
|
|
907
907
|
requirements:
|
|
908
908
|
- - '='
|
|
909
909
|
- !ruby/object:Gem::Version
|
|
910
|
-
version: 0.32.0
|
|
910
|
+
version: 0.32.0
|
|
911
911
|
type: :development
|
|
912
912
|
prerelease: false
|
|
913
913
|
version_requirements: !ruby/object:Gem::Requirement
|
|
914
914
|
requirements:
|
|
915
915
|
- - '='
|
|
916
916
|
- !ruby/object:Gem::Version
|
|
917
|
-
version: 0.32.0
|
|
917
|
+
version: 0.32.0
|
|
918
918
|
description: Adds core features so other engines can hook into the framework.
|
|
919
919
|
email:
|
|
920
920
|
- josepjaume@gmail.com
|
|
@@ -1256,7 +1256,6 @@ files:
|
|
|
1256
1256
|
- app/commands/decidim/delete_follow.rb
|
|
1257
1257
|
- app/commands/decidim/destroy_account.rb
|
|
1258
1258
|
- app/commands/decidim/destroy_ephemeral_user.rb
|
|
1259
|
-
- app/commands/decidim/gallery_methods.rb
|
|
1260
1259
|
- app/commands/decidim/invite_user.rb
|
|
1261
1260
|
- app/commands/decidim/invite_user_again.rb
|
|
1262
1261
|
- app/commands/decidim/like_resource.rb
|
|
@@ -1489,6 +1488,7 @@ files:
|
|
|
1489
1488
|
- app/mailers/decidim/application_mailer.rb
|
|
1490
1489
|
- app/mailers/decidim/block_user_mailer.rb
|
|
1491
1490
|
- app/mailers/decidim/decidim_devise_mailer.rb
|
|
1491
|
+
- app/mailers/decidim/delete_user_mailer.rb
|
|
1492
1492
|
- app/mailers/decidim/export_mailer.rb
|
|
1493
1493
|
- app/mailers/decidim/messaging/conversation_mailer.rb
|
|
1494
1494
|
- app/mailers/decidim/newsletter_mailer.rb
|
|
@@ -1774,6 +1774,7 @@ files:
|
|
|
1774
1774
|
- app/packs/src/decidim/geocoding/provider/here.js
|
|
1775
1775
|
- app/packs/src/decidim/geocoding/provider/photon.js
|
|
1776
1776
|
- app/packs/src/decidim/geocoding/reverse_geocoding.js
|
|
1777
|
+
- app/packs/src/decidim/geocoding/reverse_geocoding.test.js
|
|
1777
1778
|
- app/packs/src/decidim/index.js
|
|
1778
1779
|
- app/packs/src/decidim/map.js
|
|
1779
1780
|
- app/packs/src/decidim/map/controller.js
|
|
@@ -1815,7 +1816,6 @@ files:
|
|
|
1815
1816
|
- app/packs/src/decidim/utilities/dom.js
|
|
1816
1817
|
- app/packs/src/decidim/utilities/text.js
|
|
1817
1818
|
- app/packs/src/decidim/vendor/jquery-tmpl.js
|
|
1818
|
-
- app/packs/src/decidim/vendor/tribute.js
|
|
1819
1819
|
- app/packs/stylesheets/decidim/_accordion.scss
|
|
1820
1820
|
- app/packs/stylesheets/decidim/_actions.scss
|
|
1821
1821
|
- app/packs/stylesheets/decidim/_activity.scss
|
|
@@ -1830,6 +1830,7 @@ files:
|
|
|
1830
1830
|
- app/packs/stylesheets/decidim/_datepicker.scss
|
|
1831
1831
|
- app/packs/stylesheets/decidim/_documents.scss
|
|
1832
1832
|
- app/packs/stylesheets/decidim/_dropdown.scss
|
|
1833
|
+
- app/packs/stylesheets/decidim/_editor_suggestions.scss
|
|
1833
1834
|
- app/packs/stylesheets/decidim/_emoji.scss
|
|
1834
1835
|
- app/packs/stylesheets/decidim/_filters.scss
|
|
1835
1836
|
- app/packs/stylesheets/decidim/_flash.scss
|
|
@@ -1871,9 +1872,9 @@ files:
|
|
|
1871
1872
|
- app/packs/stylesheets/decidim/_tabs_x.scss
|
|
1872
1873
|
- app/packs/stylesheets/decidim/_tags.scss
|
|
1873
1874
|
- app/packs/stylesheets/decidim/_toggle_switch.scss
|
|
1875
|
+
- app/packs/stylesheets/decidim/_tom_select.scss
|
|
1874
1876
|
- app/packs/stylesheets/decidim/_tooltip.scss
|
|
1875
1877
|
- app/packs/stylesheets/decidim/_tos.scss
|
|
1876
|
-
- app/packs/stylesheets/decidim/_tribute.scss
|
|
1877
1878
|
- app/packs/stylesheets/decidim/_typography.scss
|
|
1878
1879
|
- app/packs/stylesheets/decidim/_versions.scss
|
|
1879
1880
|
- app/packs/stylesheets/decidim/_vertical_tabs.scss
|
|
@@ -2064,6 +2065,7 @@ files:
|
|
|
2064
2065
|
- app/views/decidim/application/_radio_accordion.html.erb
|
|
2065
2066
|
- app/views/decidim/authorization_modals/show.html.erb
|
|
2066
2067
|
- app/views/decidim/block_user_mailer/notify.html.erb
|
|
2068
|
+
- app/views/decidim/delete_user_mailer/delete.html.erb
|
|
2067
2069
|
- app/views/decidim/devise/confirmations/new.html.erb
|
|
2068
2070
|
- app/views/decidim/devise/invitations/edit.html.erb
|
|
2069
2071
|
- app/views/decidim/devise/omniauth_registrations/new.html.erb
|
|
@@ -2131,7 +2133,6 @@ files:
|
|
|
2131
2133
|
- app/views/decidim/pages/index.html.erb
|
|
2132
2134
|
- app/views/decidim/pages/show.html.erb
|
|
2133
2135
|
- app/views/decidim/participants_account_mailer/inactivity_notification.html.erb
|
|
2134
|
-
- app/views/decidim/participants_account_mailer/removal_notification.html.erb
|
|
2135
2136
|
- app/views/decidim/participatory_space/members/_member.html.erb
|
|
2136
2137
|
- app/views/decidim/profiles/show.html.erb
|
|
2137
2138
|
- app/views/decidim/qr/show.html.erb
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
# A module with all the gallery common methods
|
|
5
|
-
# Allows to create several image attachments at once
|
|
6
|
-
module GalleryMethods
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
def build_gallery(attached_to = nil)
|
|
10
|
-
@gallery = []
|
|
11
|
-
@form.add_photos.compact_blank.each do |photo|
|
|
12
|
-
if photo.is_a?(Hash) && photo.has_key?(:id)
|
|
13
|
-
update_attachment_title_for(photo)
|
|
14
|
-
next
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
@gallery << Attachment.new(
|
|
18
|
-
title: photos_title(photo),
|
|
19
|
-
attached_to: attached_to || gallery_attached_to,
|
|
20
|
-
file: photos_signed_id(photo), # Define attached_to before this
|
|
21
|
-
content_type: photos_content_type(photo)
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def update_attachment_title_for(photo)
|
|
27
|
-
Decidim::Attachment.find(photo[:id]).update(title: photos_title(photo))
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def image?(signed_id)
|
|
31
|
-
blob(signed_id).content_type.start_with? "image"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def gallery_invalid?
|
|
35
|
-
@gallery.each do |photo|
|
|
36
|
-
if photo.invalid? && photo.errors.has_key?(:file)
|
|
37
|
-
@form.errors.add(:add_photos, photo.errors[:file])
|
|
38
|
-
return true
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
false
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def create_gallery(first_weight: 0)
|
|
45
|
-
weight = first_weight
|
|
46
|
-
# Add the weights first to the old photos
|
|
47
|
-
@form.photos.each do |photo|
|
|
48
|
-
photo.update!(weight:)
|
|
49
|
-
weight += 1
|
|
50
|
-
end
|
|
51
|
-
@gallery.map! do |photo|
|
|
52
|
-
photo.weight = weight
|
|
53
|
-
photo.attached_to = gallery_attached_to
|
|
54
|
-
photo.save!
|
|
55
|
-
weight += 1
|
|
56
|
-
@form.photos << photo
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def photo_cleanup!
|
|
61
|
-
gallery_attached_to.photos.each do |photo|
|
|
62
|
-
next unless @form.photos.map(&:id).exclude?(photo.id)
|
|
63
|
-
|
|
64
|
-
photo.destroy! if (@form.respond_to?(:documents) && @form.documents.map(&:id).exclude?(photo.id)) || !@form.respond_to?(:documents)
|
|
65
|
-
end
|
|
66
|
-
# manually reset cached photos
|
|
67
|
-
gallery_attached_to.reload
|
|
68
|
-
gallery_attached_to.instance_variable_set(:@photos, nil)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# maybe a custom settings options would be nice
|
|
72
|
-
def gallery_allowed?
|
|
73
|
-
true
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def process_gallery?
|
|
77
|
-
gallery_allowed? && @form.add_photos.any?
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def gallery_attached_to
|
|
81
|
-
return @attached_to if @attached_to.present?
|
|
82
|
-
return form.current_organization if form.respond_to?(:current_organization)
|
|
83
|
-
|
|
84
|
-
form.current_component.organization if form.respond_to?(:current_component)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def photos_signed_id(photo)
|
|
88
|
-
return photo[:file] if photo.is_a?(Hash)
|
|
89
|
-
|
|
90
|
-
photo
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def photos_title(photo)
|
|
94
|
-
return { I18n.locale => photo[:title] } if photo.is_a?(Hash) && photo.has_key?(:title)
|
|
95
|
-
|
|
96
|
-
{ I18n.locale => "" }
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def photos_content_type(photo)
|
|
100
|
-
blob(photos_signed_id(photo)).content_type
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def blob(signed_id)
|
|
104
|
-
ActiveStorage::Blob.find_signed(signed_id)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|