decidim-conferences 0.28.5 → 0.29.0.rc1
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/conferences/conference_g_cell.rb +2 -2
- data/app/cells/decidim/conferences/conference_speaker_cell.rb +1 -1
- data/app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb +0 -2
- data/app/cells/decidim/conferences/linked_participatory_spaces_cell.rb +0 -1
- data/app/cells/decidim/conferences/media_link/show.erb +1 -1
- data/app/cells/decidim/conferences/media_link_cell.rb +0 -3
- data/app/cells/decidim/conferences/partner/image.erb +1 -1
- data/app/cells/decidim/conferences/partner_cell.rb +1 -1
- data/app/cells/decidim/conferences/registration_type_cell.rb +1 -5
- data/app/commands/decidim/conferences/admin/create_conference.rb +20 -65
- data/app/commands/decidim/conferences/admin/create_conference_speaker.rb +17 -81
- data/app/commands/decidim/conferences/admin/create_media_link.rb +10 -44
- data/app/commands/decidim/conferences/admin/create_partner.rb +9 -62
- data/app/commands/decidim/conferences/admin/create_registration_type.rb +15 -51
- data/app/commands/decidim/conferences/admin/destroy_conference_speaker.rb +6 -38
- data/app/commands/decidim/conferences/admin/destroy_media_link.rb +6 -38
- data/app/commands/decidim/conferences/admin/destroy_partner.rb +6 -38
- data/app/commands/decidim/conferences/admin/destroy_registration_type.rb +6 -38
- data/app/commands/decidim/conferences/admin/publish_conference_speaker.rb +51 -0
- data/app/commands/decidim/conferences/admin/unpublish_conference_speaker.rb +44 -0
- data/app/commands/decidim/conferences/admin/update_conference.rb +35 -93
- data/app/commands/decidim/conferences/admin/update_conference_speaker.rb +17 -74
- data/app/commands/decidim/conferences/admin/update_media_link.rb +8 -44
- data/app/commands/decidim/conferences/admin/update_partner.rb +10 -61
- data/app/commands/decidim/conferences/admin/update_registration_type.rb +12 -47
- data/app/controllers/concerns/decidim/conferences/admin/conferences_invites/filterable.rb +41 -0
- data/app/controllers/decidim/conferences/admin/conference_invites_controller.rb +8 -3
- data/app/controllers/decidim/conferences/admin/conference_speakers_controller.rb +33 -1
- data/app/controllers/decidim/conferences/admin/conferences_controller.rb +1 -1
- data/app/controllers/decidim/conferences/admin/media_links_controller.rb +1 -1
- data/app/controllers/decidim/conferences/admin/partners_controller.rb +1 -1
- data/app/controllers/decidim/conferences/admin/registration_types_controller.rb +1 -1
- data/app/controllers/decidim/conferences/application_controller.rb +4 -1
- data/app/controllers/decidim/conferences/conference_program_controller.rb +1 -2
- data/app/controllers/decidim/conferences/conference_speakers_controller.rb +1 -4
- data/app/controllers/decidim/conferences/conferences_controller.rb +1 -4
- data/app/controllers/decidim/conferences/media_controller.rb +1 -4
- data/app/controllers/decidim/conferences/registration_types_controller.rb +0 -3
- data/app/events/decidim/conferences/conference_role_assigned_event.rb +0 -5
- data/app/forms/decidim/conferences/admin/conference_form.rb +5 -5
- data/app/forms/decidim/conferences/admin/conference_speaker_form.rb +1 -1
- data/app/forms/decidim/conferences/admin/registration_type_form.rb +1 -1
- data/app/helpers/decidim/conferences/conference_helper.rb +2 -1
- data/app/mailers/decidim/conferences/admin/send_conference_diploma_mailer.rb +5 -9
- data/app/models/decidim/conference.rb +2 -2
- data/app/models/decidim/conference_speaker.rb +2 -0
- data/app/permissions/decidim/conferences/permissions.rb +2 -2
- data/app/presenters/decidim/conferences/admin_log/conference_speaker_presenter.rb +2 -1
- data/app/views/decidim/conferences/admin/conference_invites/_form.html.erb +5 -5
- data/app/views/decidim/conferences/admin/conference_invites/index.html.erb +1 -33
- data/app/views/decidim/conferences/admin/conference_registrations/index.html.erb +2 -4
- data/app/views/decidim/conferences/admin/conference_speakers/index.html.erb +11 -1
- data/app/views/decidim/conferences/admin/conference_user_roles/index.html.erb +1 -1
- data/app/views/decidim/conferences/admin/invite_join_conference_mailer/invite.html.erb +1 -1
- data/app/views/decidim/conferences/admin/media_links/index.html.erb +1 -1
- data/app/views/decidim/conferences/admin/media_links/new.html.erb +1 -1
- data/app/views/decidim/conferences/admin/partners/index.html.erb +3 -3
- data/app/views/decidim/conferences/admin/registration_types/index.html.erb +1 -1
- data/app/views/decidim/conferences/admin/send_conference_diploma_mailer/diploma_user.html.erb +7 -11
- data/app/views/decidim/conferences/conference_program/_program_item.html.erb +1 -1
- data/app/views/decidim/conferences/conference_speakers/index.html.erb +1 -0
- data/app/views/decidim/conferences/conferences/_conference_hero.html.erb +1 -1
- data/app/views/decidim/conferences/conferences/show.html.erb +5 -3
- data/app/views/decidim/conferences/media/index.html.erb +1 -0
- data/app/views/decidim/conferences/registration_types/index.html.erb +2 -1
- data/app/views/devise/mailer/join_conference.html.erb +1 -1
- data/app/views/devise/mailer/join_conference.text.erb +1 -1
- data/app/views/layouts/decidim/diploma.html.erb +1 -1
- data/config/initializers/wicked_pdf.rb +6 -4
- data/config/locales/ar.yml +21 -4
- data/config/locales/bg.yml +27 -6
- data/config/locales/ca.yml +18 -20
- data/config/locales/cs.yml +18 -21
- data/config/locales/de.yml +19 -21
- data/config/locales/el.yml +21 -6
- data/config/locales/en.yml +25 -27
- data/config/locales/es-MX.yml +18 -20
- data/config/locales/es-PY.yml +21 -23
- data/config/locales/es.yml +14 -16
- data/config/locales/eu.yml +169 -171
- data/config/locales/fi-plain.yml +17 -19
- data/config/locales/fi.yml +23 -25
- data/config/locales/fr-CA.yml +19 -21
- data/config/locales/fr.yml +19 -21
- data/config/locales/ga-IE.yml +0 -6
- data/config/locales/gl.yml +21 -4
- data/config/locales/hu.yml +21 -6
- data/config/locales/id-ID.yml +21 -4
- data/config/locales/it.yml +21 -4
- data/config/locales/ja.yml +17 -17
- data/config/locales/lb.yml +19 -6
- data/config/locales/lt.yml +21 -6
- data/config/locales/lv.yml +21 -6
- data/config/locales/nl.yml +21 -4
- data/config/locales/no.yml +21 -6
- data/config/locales/pl.yml +27 -6
- data/config/locales/pt-BR.yml +21 -51
- data/config/locales/pt.yml +21 -6
- data/config/locales/ro-RO.yml +12 -19
- data/config/locales/sk.yml +21 -6
- data/config/locales/sv.yml +52 -37
- data/config/locales/tr-TR.yml +21 -4
- data/config/locales/zh-CN.yml +21 -4
- data/config/locales/zh-TW.yml +21 -6
- data/db/migrate/20240613095855_add_published_at_to_conference_speakers.rb +7 -0
- data/decidim-conferences.gemspec +3 -2
- data/lib/decidim/api/conference_partner_type.rb +1 -1
- data/lib/decidim/api/conference_speaker_type.rb +1 -1
- data/lib/decidim/api/conference_type.rb +6 -2
- data/lib/decidim/conferences/admin_engine.rb +6 -1
- data/lib/decidim/conferences/engine.rb +1 -0
- data/lib/decidim/conferences/menu.rb +11 -0
- data/lib/decidim/conferences/seeds.rb +4 -22
- data/lib/decidim/conferences/test/factories.rb +5 -0
- data/lib/decidim/conferences/version.rb +1 -1
- metadata +33 -23
- data/app/cells/decidim/conference_activity_cell.rb +0 -10
- data/app/helpers/decidim/conferences/media_attachments_helper.rb +0 -19
- data/app/helpers/decidim/conferences/partners_helper.rb +0 -17
- data/app/uploaders/decidim/cw/conferences/diploma_uploader.rb +0 -14
- data/app/uploaders/decidim/cw/conferences/partner_logo_uploader.rb +0 -15
- data/app/views/layouts/decidim/conference.html.erb +0 -17
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -14
@@ -5,50 +5,18 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when destroying a media link
|
7
7
|
# in the system.
|
8
|
-
class DestroyMediaLink < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# media_link - the MediaLink to destroy
|
12
|
-
# current_user - the user performing this action
|
13
|
-
def initialize(media_link, current_user)
|
14
|
-
@media_link = media_link
|
15
|
-
@current_user = current_user
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form was not valid and we could not proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
destroy_speaker!
|
26
|
-
broadcast(:ok)
|
27
|
-
end
|
8
|
+
class DestroyMediaLink < Decidim::Commands::DestroyResource
|
9
|
+
protected
|
28
10
|
|
29
|
-
|
30
|
-
|
31
|
-
attr_reader :media_link, :current_user
|
32
|
-
|
33
|
-
def destroy_speaker!
|
34
|
-
log_info = {
|
11
|
+
def extra_params
|
12
|
+
{
|
35
13
|
resource: {
|
36
|
-
title:
|
14
|
+
title: resource.title
|
37
15
|
},
|
38
16
|
participatory_space: {
|
39
|
-
title:
|
17
|
+
title: resource.conference.title
|
40
18
|
}
|
41
19
|
}
|
42
|
-
|
43
|
-
Decidim.traceability.perform_action!(
|
44
|
-
"delete",
|
45
|
-
media_link,
|
46
|
-
current_user,
|
47
|
-
log_info
|
48
|
-
) do
|
49
|
-
media_link.destroy!
|
50
|
-
media_link
|
51
|
-
end
|
52
20
|
end
|
53
21
|
end
|
54
22
|
end
|
@@ -5,50 +5,18 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when destroying a conference
|
7
7
|
# Partner in the system.
|
8
|
-
class DestroyPartner < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# conference_partner - the Partner to destroy
|
12
|
-
# current_user - the user performing this action
|
13
|
-
def initialize(conference_partner, current_user)
|
14
|
-
@conference_partner = conference_partner
|
15
|
-
@current_user = current_user
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form was not valid and we could not proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
destroy_partner!
|
26
|
-
broadcast(:ok)
|
27
|
-
end
|
8
|
+
class DestroyPartner < Decidim::Commands::DestroyResource
|
9
|
+
protected
|
28
10
|
|
29
|
-
|
30
|
-
|
31
|
-
attr_reader :conference_partner, :current_user
|
32
|
-
|
33
|
-
def destroy_partner!
|
34
|
-
log_info = {
|
11
|
+
def extra_params
|
12
|
+
{
|
35
13
|
resource: {
|
36
|
-
title:
|
14
|
+
title: resource.name
|
37
15
|
},
|
38
16
|
participatory_space: {
|
39
|
-
title:
|
17
|
+
title: resource.conference.title
|
40
18
|
}
|
41
19
|
}
|
42
|
-
|
43
|
-
Decidim.traceability.perform_action!(
|
44
|
-
"delete",
|
45
|
-
conference_partner,
|
46
|
-
current_user,
|
47
|
-
log_info
|
48
|
-
) do
|
49
|
-
conference_partner.destroy!
|
50
|
-
conference_partner
|
51
|
-
end
|
52
20
|
end
|
53
21
|
end
|
54
22
|
end
|
@@ -5,50 +5,18 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when destroying a conference
|
7
7
|
# registration type in the system.
|
8
|
-
class DestroyRegistrationType < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# registration_type - the Partner to destroy
|
12
|
-
# current_user - the user performing this action
|
13
|
-
def initialize(registration_type, current_user)
|
14
|
-
@registration_type = registration_type
|
15
|
-
@current_user = current_user
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form was not valid and we could not proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
destroy_registration_type!
|
26
|
-
broadcast(:ok)
|
27
|
-
end
|
8
|
+
class DestroyRegistrationType < Decidim::Commands::DestroyResource
|
9
|
+
protected
|
28
10
|
|
29
|
-
|
30
|
-
|
31
|
-
attr_reader :registration_type, :current_user
|
32
|
-
|
33
|
-
def destroy_registration_type!
|
34
|
-
log_info = {
|
11
|
+
def extra_params
|
12
|
+
{
|
35
13
|
resource: {
|
36
|
-
title:
|
14
|
+
title: resource.title
|
37
15
|
},
|
38
16
|
participatory_space: {
|
39
|
-
title:
|
17
|
+
title: resource.conference.title
|
40
18
|
}
|
41
19
|
}
|
42
|
-
|
43
|
-
Decidim.traceability.perform_action!(
|
44
|
-
"delete",
|
45
|
-
registration_type,
|
46
|
-
current_user,
|
47
|
-
log_info
|
48
|
-
) do
|
49
|
-
registration_type.destroy!
|
50
|
-
registration_type
|
51
|
-
end
|
52
20
|
end
|
53
21
|
end
|
54
22
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic that publishes an
|
7
|
+
# existing conference speaker.
|
8
|
+
class PublishConferenceSpeaker < Decidim::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# conference_speaker - Decidim::Conferences::Admin::ConferenceSpeaker
|
12
|
+
# current_user - the user performing the action
|
13
|
+
def initialize(conference_speaker, current_user)
|
14
|
+
@conference_speaker = conference_speaker
|
15
|
+
@current_user = current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if conference_speaker.published?
|
26
|
+
|
27
|
+
transaction do
|
28
|
+
publish_conference_speaker
|
29
|
+
end
|
30
|
+
|
31
|
+
broadcast(:ok, conference_speaker)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :conference_speaker, :current_user
|
37
|
+
|
38
|
+
def publish_conference_speaker
|
39
|
+
@conference_speaker = Decidim.traceability.perform_action!(
|
40
|
+
:publish,
|
41
|
+
conference_speaker,
|
42
|
+
current_user
|
43
|
+
) do
|
44
|
+
conference_speaker.publish!
|
45
|
+
conference_speaker
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic that unpublishes an
|
7
|
+
# existing conference speaker.
|
8
|
+
class UnpublishConferenceSpeaker < Decidim::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# conference_speaker - Decidim::Conferences::Admin::ConferenceSpeaker
|
12
|
+
# current_user - the user performing the action
|
13
|
+
def initialize(conference_speaker, current_user)
|
14
|
+
@conference_speaker = conference_speaker
|
15
|
+
@current_user = current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) unless conference_speaker.published?
|
26
|
+
|
27
|
+
@conference_speaker = Decidim.traceability.perform_action!(
|
28
|
+
:unpublish,
|
29
|
+
conference_speaker,
|
30
|
+
current_user
|
31
|
+
) do
|
32
|
+
conference_speaker.unpublish!
|
33
|
+
conference_speaker
|
34
|
+
end
|
35
|
+
broadcast(:ok, conference_speaker)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_reader :conference_speaker, :current_user
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -5,120 +5,62 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new participatory
|
7
7
|
# conference in the system.
|
8
|
-
class UpdateConference < Decidim::
|
9
|
-
|
10
|
-
|
11
|
-
# Public: Initializes the command.
|
12
|
-
#
|
13
|
-
# conference - the Conference to update
|
14
|
-
# form - A form object with the params.
|
15
|
-
def initialize(conference, form)
|
16
|
-
@conference = conference
|
17
|
-
@form = form
|
18
|
-
end
|
19
|
-
|
20
|
-
# Executes the command. Broadcasts these events:
|
21
|
-
#
|
22
|
-
# - :ok when everything is valid.
|
23
|
-
# - :invalid if the form was not valid and we could not proceed.
|
24
|
-
#
|
25
|
-
# Returns nothing.
|
26
|
-
def call
|
27
|
-
return broadcast(:invalid) if form.invalid?
|
8
|
+
class UpdateConference < Decidim::Commands::UpdateResource
|
9
|
+
fetch_file_attributes :hero_image, :banner_image
|
28
10
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if @conference.valid?
|
34
|
-
broadcast(:ok, @conference)
|
35
|
-
else
|
36
|
-
form.errors.add(:hero_image, @conference.errors[:hero_image]) if @conference.errors.include? :hero_image
|
37
|
-
form.errors.add(:banner_image, @conference.errors[:banner_image]) if @conference.errors.include? :banner_image
|
38
|
-
broadcast(:invalid)
|
39
|
-
end
|
40
|
-
end
|
11
|
+
fetch_form_attributes :title, :slogan, :slug, :weight, :hashtag, :description, :short_description,
|
12
|
+
:objectives, :location, :start_date, :end_date, :promoted, :show_statistics,
|
13
|
+
:scopes_enabled, :scope, :registrations_enabled
|
41
14
|
|
42
15
|
private
|
43
16
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
save_conference if @conference.valid?
|
49
|
-
end
|
17
|
+
def run_after_hooks
|
18
|
+
send_notification_registrations_enabled if should_notify_followers_registrations_enabled?
|
19
|
+
send_notification_update_conference if should_notify_followers_update_conference?
|
20
|
+
schedule_upcoming_conference_notification if start_date_changed?
|
50
21
|
|
51
|
-
|
52
|
-
|
53
|
-
update_conference_registrations
|
54
|
-
@conference.save!
|
55
|
-
send_notification_registrations_enabled if should_notify_followers_registrations_enabled?
|
56
|
-
send_notification_update_conference if should_notify_followers_update_conference?
|
57
|
-
schedule_upcoming_conference_notification if start_date_changed?
|
58
|
-
Decidim.traceability.perform_action!(:update, @conference, form.current_user) do
|
59
|
-
@conference
|
60
|
-
end
|
61
|
-
end
|
22
|
+
link_participatory_processes
|
23
|
+
link_assemblies
|
62
24
|
end
|
63
25
|
|
64
|
-
def
|
65
|
-
|
26
|
+
def registration_attributes
|
27
|
+
return {} unless form.registrations_enabled
|
66
28
|
|
67
|
-
if form.registrations_enabled
|
68
|
-
@conference.available_slots = form.available_slots
|
69
|
-
@conference.registration_terms = form.registration_terms
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def attributes
|
74
29
|
{
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
weight: form.weight,
|
79
|
-
hashtag: form.hashtag,
|
80
|
-
description: form.description,
|
81
|
-
short_description: form.short_description,
|
82
|
-
objectives: form.objectives,
|
83
|
-
location: form.location,
|
84
|
-
start_date: form.start_date,
|
85
|
-
end_date: form.end_date,
|
86
|
-
promoted: form.promoted,
|
87
|
-
scopes_enabled: form.scopes_enabled,
|
88
|
-
scope: form.scope,
|
89
|
-
show_statistics: form.show_statistics
|
90
|
-
}.merge(
|
91
|
-
attachment_attributes(:hero_image, :banner_image)
|
92
|
-
)
|
30
|
+
available_slots: form.available_slots,
|
31
|
+
registration_terms: form.registration_terms
|
32
|
+
}
|
93
33
|
end
|
94
34
|
|
35
|
+
def attributes = super.merge(registration_attributes)
|
36
|
+
|
95
37
|
def send_notification_registrations_enabled
|
96
38
|
Decidim::EventsManager.publish(
|
97
39
|
event: "decidim.events.conferences.registrations_enabled",
|
98
40
|
event_class: Decidim::Conferences::ConferenceRegistrationsEnabledEvent,
|
99
|
-
resource
|
100
|
-
followers:
|
41
|
+
resource:,
|
42
|
+
followers: resource.followers
|
101
43
|
)
|
102
44
|
end
|
103
45
|
|
104
46
|
def should_notify_followers_registrations_enabled?
|
105
|
-
|
106
|
-
|
107
|
-
|
47
|
+
resource.previous_changes["registrations_enabled"].present? &&
|
48
|
+
resource.registrations_enabled? &&
|
49
|
+
resource.published?
|
108
50
|
end
|
109
51
|
|
110
52
|
def send_notification_update_conference
|
111
53
|
Decidim::EventsManager.publish(
|
112
54
|
event: "decidim.events.conferences.conference_updated",
|
113
55
|
event_class: Decidim::Conferences::UpdateConferenceEvent,
|
114
|
-
resource
|
115
|
-
followers:
|
56
|
+
resource:,
|
57
|
+
followers: resource.followers
|
116
58
|
)
|
117
59
|
end
|
118
60
|
|
119
61
|
def should_notify_followers_update_conference?
|
120
|
-
important_attributes.any? { |attr|
|
121
|
-
|
62
|
+
important_attributes.any? { |attr| resource.previous_changes[attr].present? } &&
|
63
|
+
resource.published?
|
122
64
|
end
|
123
65
|
|
124
66
|
def important_attributes
|
@@ -126,31 +68,31 @@ module Decidim
|
|
126
68
|
end
|
127
69
|
|
128
70
|
def start_date_changed?
|
129
|
-
|
71
|
+
resource.previous_changes["start_date"].present?
|
130
72
|
end
|
131
73
|
|
132
74
|
def schedule_upcoming_conference_notification
|
133
|
-
checksum = Decidim::Conferences::UpcomingConferenceNotificationJob.generate_checksum(
|
75
|
+
checksum = Decidim::Conferences::UpcomingConferenceNotificationJob.generate_checksum(resource)
|
134
76
|
|
135
77
|
Decidim::Conferences::UpcomingConferenceNotificationJob
|
136
|
-
.set(wait_until: (
|
137
|
-
.perform_later(
|
78
|
+
.set(wait_until: (resource.start_date - 2.days).to_s)
|
79
|
+
.perform_later(resource.id, checksum)
|
138
80
|
end
|
139
81
|
|
140
82
|
def participatory_processes
|
141
|
-
@participatory_processes ||=
|
83
|
+
@participatory_processes ||= resource.participatory_space_sibling_scope(:participatory_processes).where(id: form.participatory_processes_ids)
|
142
84
|
end
|
143
85
|
|
144
86
|
def link_participatory_processes
|
145
|
-
|
87
|
+
resource.link_participatory_space_resources(participatory_processes, "included_participatory_processes")
|
146
88
|
end
|
147
89
|
|
148
90
|
def assemblies
|
149
|
-
@assemblies ||=
|
91
|
+
@assemblies ||= resource.participatory_space_sibling_scope(:assemblies).where(id: form.assemblies_ids)
|
150
92
|
end
|
151
93
|
|
152
94
|
def link_assemblies
|
153
|
-
|
95
|
+
resource.link_participatory_space_resources(assemblies, "included_assemblies")
|
154
96
|
end
|
155
97
|
end
|
156
98
|
end
|
@@ -5,94 +5,37 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when updating a conference
|
7
7
|
# speaker in the system.
|
8
|
-
class UpdateConferenceSpeaker < Decidim::
|
9
|
-
|
8
|
+
class UpdateConferenceSpeaker < Decidim::Commands::UpdateResource
|
9
|
+
fetch_file_attributes :avatar
|
10
10
|
|
11
|
-
|
12
|
-
#
|
13
|
-
# form - A form object with the params.
|
14
|
-
# conference_speaker - The ConferenceSpeaker to update
|
15
|
-
def initialize(form, conference_speaker)
|
16
|
-
@form = form
|
17
|
-
@conference_speaker = conference_speaker
|
18
|
-
end
|
19
|
-
|
20
|
-
# Executes the command. Broadcasts these events:
|
21
|
-
#
|
22
|
-
# - :ok when everything is valid.
|
23
|
-
# - :invalid if the form was not valid and we could not proceed.
|
24
|
-
#
|
25
|
-
# Returns nothing.
|
26
|
-
def call
|
27
|
-
return broadcast(:invalid) if form.invalid?
|
28
|
-
return broadcast(:invalid) unless conference_speaker
|
29
|
-
|
30
|
-
# We are going to assign the attributes only to handle the validation of the avatar before accessing
|
31
|
-
# `update_conference_speaker!` which uses `update!`. Without this step, the image validation may render
|
32
|
-
# an ActiveRecord::RecordInvalid error
|
33
|
-
# After we assign and check if the object is valid, we reload the model to let it be handled the old way
|
34
|
-
# If there is an error we add the error to the form
|
35
|
-
conference_speaker.assign_attributes(attributes)
|
36
|
-
|
37
|
-
if conference_speaker.valid?
|
38
|
-
conference_speaker.reload
|
39
|
-
|
40
|
-
transaction do
|
41
|
-
update_conference_speaker!
|
42
|
-
link_meetings(@conference_speaker)
|
43
|
-
end
|
44
|
-
broadcast(:ok)
|
45
|
-
else
|
46
|
-
form.errors.add(:avatar, conference_speaker.errors[:avatar]) if conference_speaker.errors.include? :avatar
|
47
|
-
|
48
|
-
broadcast(:invalid)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
11
|
+
fetch_form_attributes :full_name, :twitter_handle, :personal_url, :position, :affiliation, :user, :short_bio
|
53
12
|
|
54
|
-
|
13
|
+
protected
|
55
14
|
|
56
|
-
def
|
57
|
-
form.
|
58
|
-
"full_name",
|
59
|
-
"twitter_handle",
|
60
|
-
"personal_url",
|
61
|
-
"position",
|
62
|
-
"affiliation",
|
63
|
-
"short_bio"
|
64
|
-
).symbolize_keys.merge(
|
65
|
-
user: form.user
|
66
|
-
).merge(
|
67
|
-
attachment_attributes(:avatar)
|
68
|
-
)
|
15
|
+
def invalid?
|
16
|
+
form.invalid? || !resource
|
69
17
|
end
|
70
18
|
|
71
|
-
def
|
72
|
-
|
19
|
+
def extra_params
|
20
|
+
{
|
73
21
|
resource: {
|
74
|
-
title:
|
22
|
+
title: resource.full_name
|
75
23
|
},
|
76
24
|
participatory_space: {
|
77
|
-
title:
|
25
|
+
title: resource.conference.title
|
78
26
|
}
|
79
27
|
}
|
80
|
-
|
81
|
-
Decidim.traceability.update!(
|
82
|
-
conference_speaker,
|
83
|
-
form.current_user,
|
84
|
-
attributes,
|
85
|
-
log_info
|
86
|
-
)
|
87
28
|
end
|
88
29
|
|
89
|
-
|
90
|
-
|
91
|
-
|
30
|
+
private
|
31
|
+
|
32
|
+
def conference_meetings
|
33
|
+
meeting_components = resource.conference.components.where(manifest_name: "meetings")
|
34
|
+
Decidim::ConferenceMeeting.where(component: meeting_components).where(id: form.conference_meeting_ids)
|
92
35
|
end
|
93
36
|
|
94
|
-
def
|
95
|
-
|
37
|
+
def run_after_hooks
|
38
|
+
resource.conference_meetings = conference_meetings
|
96
39
|
end
|
97
40
|
end
|
98
41
|
end
|
@@ -5,58 +5,22 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when updating a conference
|
7
7
|
# speaker in the system.
|
8
|
-
class UpdateMediaLink < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - A form object with the params.
|
12
|
-
# media_link - The ConferenceSpeaker to update
|
13
|
-
def initialize(form, media_link)
|
14
|
-
@form = form
|
15
|
-
@media_link = media_link
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form was not valid and we could not proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
return broadcast(:invalid) if form.invalid?
|
26
|
-
return broadcast(:invalid) unless media_link
|
27
|
-
|
28
|
-
transaction do
|
29
|
-
update_media_link!
|
30
|
-
end
|
8
|
+
class UpdateMediaLink < Decidim::Commands::UpdateResource
|
9
|
+
fetch_form_attributes :title, :link, :weight, :date
|
31
10
|
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
11
|
+
protected
|
36
12
|
|
37
|
-
|
13
|
+
def invalid? = form.invalid? || !resource
|
38
14
|
|
39
|
-
def
|
40
|
-
|
15
|
+
def extra_params
|
16
|
+
{
|
41
17
|
resource: {
|
42
|
-
title:
|
18
|
+
title: resource.title
|
43
19
|
},
|
44
20
|
participatory_space: {
|
45
|
-
title:
|
21
|
+
title: resource.conference.title
|
46
22
|
}
|
47
23
|
}
|
48
|
-
|
49
|
-
Decidim.traceability.update!(
|
50
|
-
media_link,
|
51
|
-
form.current_user,
|
52
|
-
form.attributes.slice(
|
53
|
-
"title",
|
54
|
-
"link",
|
55
|
-
"weight",
|
56
|
-
"date"
|
57
|
-
).symbolize_keys,
|
58
|
-
log_info
|
59
|
-
)
|
60
24
|
end
|
61
25
|
end
|
62
26
|
end
|