decidim-conferences 0.28.4 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +1 -1
- data/app/helpers/decidim/conferences/conference_helper.rb +2 -1
- data/app/models/decidim/conference.rb +1 -1
- 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/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 +6 -6
- 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/config/initializers/wicked_pdf.rb +5 -5
- data/config/locales/ar.yml +0 -4
- data/config/locales/bg.yml +6 -6
- data/config/locales/ca.yml +7 -9
- data/config/locales/cs.yml +5 -8
- data/config/locales/de.yml +7 -9
- data/config/locales/el.yml +0 -6
- data/config/locales/en.yml +6 -8
- data/config/locales/es-MX.yml +6 -8
- data/config/locales/es-PY.yml +6 -8
- data/config/locales/es.yml +6 -8
- data/config/locales/eu.yml +6 -8
- data/config/locales/fi-plain.yml +6 -8
- data/config/locales/fi.yml +6 -8
- data/config/locales/fr-CA.yml +6 -8
- data/config/locales/fr.yml +6 -8
- data/config/locales/ga-IE.yml +0 -6
- data/config/locales/gl.yml +0 -4
- data/config/locales/hu.yml +0 -6
- data/config/locales/id-ID.yml +0 -4
- data/config/locales/it.yml +0 -4
- data/config/locales/ja.yml +7 -9
- data/config/locales/lb.yml +0 -6
- data/config/locales/lt.yml +0 -6
- data/config/locales/lv.yml +0 -6
- data/config/locales/nl.yml +0 -4
- data/config/locales/no.yml +0 -6
- data/config/locales/pl.yml +6 -6
- data/config/locales/pt-BR.yml +0 -51
- data/config/locales/pt.yml +0 -6
- data/config/locales/ro-RO.yml +0 -6
- data/config/locales/sk.yml +0 -6
- data/config/locales/sv.yml +21 -27
- data/config/locales/tr-TR.yml +0 -4
- data/config/locales/zh-CN.yml +0 -4
- data/config/locales/zh-TW.yml +0 -6
- data/db/migrate/20240613095855_add_published_at_to_conference_speakers.rb +7 -0
- data/decidim-conferences.gemspec +1 -1
- 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 +18 -20
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1b968b73364e0893374bd0ed3f1703a40b61ab120290a16980ce8add800b884
|
4
|
+
data.tar.gz: 1159a29d1a0504aff4d859709e938081f52b026c2125dfadc7c4be0f02e2d9ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14d3bb61f2c51cb95870e83bdf9c0f7cf2b7860ede6393c81df860b022d4a390c476cc357e5c0457ef28c4850529b2c7e8ec5f8b10f331c1d165babc201094ec
|
7
|
+
data.tar.gz: 6fbd57e26675159b4ea3cfedcc366bf58cc44ab9053659723381db36041cca57d0bf7eea3c02d3b7efeb2adc3a47037051a98792b9435904eeea6ca81c8220a9
|
@@ -11,8 +11,8 @@ module Decidim
|
|
11
11
|
Decidim::Conferences::Engine.routes.url_helpers.conference_path(model)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
model.attached_uploader(:hero_image).
|
14
|
+
def resource_image_path
|
15
|
+
model.attached_uploader(:hero_image).path
|
16
16
|
end
|
17
17
|
|
18
18
|
def metadata_cell
|
@@ -4,8 +4,6 @@ module Decidim
|
|
4
4
|
module Conferences
|
5
5
|
module ContentBlocks
|
6
6
|
class HighlightedConferencesCell < Decidim::ContentBlocks::HighlightedParticipatorySpacesCell
|
7
|
-
delegate :current_user, to: :controller
|
8
|
-
|
9
7
|
def highlighted_spaces
|
10
8
|
@highlighted_spaces ||= OrganizationPrioritizedConferences
|
11
9
|
.new(current_organization, current_user)
|
@@ -5,7 +5,6 @@ module Decidim
|
|
5
5
|
# This cell renders a collection of linked Participatory Space of current conference.
|
6
6
|
# `model` is the current conference
|
7
7
|
class LinkedParticipatorySpacesCell < Decidim::ViewModel
|
8
|
-
include Decidim::ApplicationHelper
|
9
8
|
include Decidim::CardHelper
|
10
9
|
|
11
10
|
def show
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="card__list-content">
|
2
|
-
<%= link_to
|
2
|
+
<%= link_to decidim_escape_translated(model.title), model.link, rel: "noopener noreferrer", target: "_blank", class: "card__list-title" %>
|
3
3
|
<div class="card__list-metadata">
|
4
4
|
<span><%= icon "calendar-line" %><%= l(model.date, format: :decidim_short_with_month_name_short) %></span>
|
5
5
|
<span><%= icon "link-m" %><%= model.link %></span>
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
def logo
|
22
22
|
return unless model.logo.attached?
|
23
23
|
|
24
|
-
"<div class='card p-m'> #{image_tag model.attached_uploader(:logo).
|
24
|
+
"<div class='card p-m'> #{image_tag model.attached_uploader(:logo).path(variant: :medium), alt: "logo"} </div>"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -5,9 +5,7 @@ module Decidim
|
|
5
5
|
# This cell renders the media link card for an instance of a RegistrationType
|
6
6
|
class RegistrationTypeCell < Decidim::ViewModel
|
7
7
|
include ActionView::Helpers::NumberHelper
|
8
|
-
include Decidim::SanitizeHelper
|
9
8
|
include Decidim::Conferences::Engine.routes.url_helpers
|
10
|
-
include Decidim::LayoutHelper
|
11
9
|
|
12
10
|
def show
|
13
11
|
render
|
@@ -15,10 +13,8 @@ module Decidim
|
|
15
13
|
|
16
14
|
private
|
17
15
|
|
18
|
-
delegate :current_user, to: :controller, prefix: false
|
19
|
-
|
20
16
|
def title
|
21
|
-
|
17
|
+
decidim_sanitize_translated(model.title)
|
22
18
|
end
|
23
19
|
|
24
20
|
def description
|
@@ -5,95 +5,50 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new
|
7
7
|
# conference in the system.
|
8
|
-
class CreateConference < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - A form object with the params.
|
12
|
-
def initialize(form)
|
13
|
-
@form = form
|
14
|
-
end
|
15
|
-
|
16
|
-
# Executes the command. Broadcasts these events:
|
17
|
-
#
|
18
|
-
# - :ok when everything is valid.
|
19
|
-
# - :invalid if the form was not valid and we could not proceed.
|
20
|
-
#
|
21
|
-
# Returns nothing.
|
22
|
-
def call
|
23
|
-
return broadcast(:invalid) if form.invalid?
|
8
|
+
class CreateConference < Decidim::Commands::CreateResource
|
9
|
+
fetch_file_attributes :hero_image, :banner_image
|
24
10
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
link_assemblies
|
29
|
-
|
30
|
-
broadcast(:ok, conference)
|
31
|
-
else
|
32
|
-
form.errors.add(:hero_image, conference.errors[:hero_image]) if conference.errors.include? :hero_image
|
33
|
-
form.errors.add(:banner_image, conference.errors[:banner_image]) if conference.errors.include? :banner_image
|
34
|
-
broadcast(:invalid)
|
35
|
-
end
|
36
|
-
end
|
11
|
+
fetch_form_attributes :organization, :title, :slogan, :slug, :weight, :hashtag, :description,
|
12
|
+
:short_description, :objectives, :location, :scopes_enabled, :scope, :start_date, :end_date,
|
13
|
+
:promoted, :show_statistics, :registrations_enabled, :available_slots, :registration_terms
|
37
14
|
|
38
15
|
private
|
39
16
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Conference,
|
45
|
-
form.current_user,
|
46
|
-
organization: form.current_organization,
|
47
|
-
title: form.title,
|
48
|
-
slogan: form.slogan,
|
49
|
-
slug: form.slug,
|
50
|
-
weight: form.weight,
|
51
|
-
hashtag: form.hashtag,
|
52
|
-
description: form.description,
|
53
|
-
short_description: form.short_description,
|
54
|
-
objectives: form.objectives,
|
55
|
-
location: form.location,
|
56
|
-
scopes_enabled: form.scopes_enabled,
|
57
|
-
scope: form.scope,
|
58
|
-
start_date: form.start_date,
|
59
|
-
end_date: form.end_date,
|
60
|
-
hero_image: form.hero_image,
|
61
|
-
banner_image: form.banner_image,
|
62
|
-
promoted: form.promoted,
|
63
|
-
show_statistics: form.show_statistics,
|
64
|
-
registrations_enabled: form.registrations_enabled,
|
65
|
-
available_slots: form.available_slots || 0,
|
66
|
-
registration_terms: form.registration_terms
|
67
|
-
)
|
17
|
+
def run_after_hooks
|
18
|
+
add_admins_as_followers
|
19
|
+
link_participatory_processes
|
20
|
+
link_assemblies
|
68
21
|
end
|
69
22
|
|
70
|
-
def
|
71
|
-
|
23
|
+
def resource_class = Decidim::Conference
|
24
|
+
|
25
|
+
def add_admins_as_followers
|
26
|
+
resource.organization.admins.each do |admin|
|
72
27
|
form = Decidim::FollowForm
|
73
|
-
.from_params(followable_gid:
|
28
|
+
.from_params(followable_gid: resource.to_signed_global_id.to_s)
|
74
29
|
.with_context(
|
75
|
-
current_organization:
|
30
|
+
current_organization: resource.organization,
|
76
31
|
current_user: admin
|
77
32
|
)
|
78
33
|
|
79
|
-
Decidim::CreateFollow.new(form
|
34
|
+
Decidim::CreateFollow.new(form).call
|
80
35
|
end
|
81
36
|
end
|
82
37
|
|
83
38
|
def participatory_processes
|
84
|
-
@participatory_processes ||=
|
39
|
+
@participatory_processes ||= resource.participatory_space_sibling_scope(:participatory_processes).where(id: form.participatory_processes_ids)
|
85
40
|
end
|
86
41
|
|
87
42
|
def link_participatory_processes
|
88
|
-
|
43
|
+
resource.link_participatory_space_resources(participatory_processes, "included_participatory_processes")
|
89
44
|
end
|
90
45
|
|
91
46
|
def assemblies
|
92
|
-
@assemblies ||=
|
47
|
+
@assemblies ||= resource.participatory_space_sibling_scope(:assemblies).where(id: form.assemblies_ids)
|
93
48
|
end
|
94
49
|
|
95
50
|
def link_assemblies
|
96
|
-
|
51
|
+
resource.link_participatory_space_resources(assemblies, "included_assemblies")
|
97
52
|
end
|
98
53
|
end
|
99
54
|
end
|
@@ -5,102 +5,38 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new conference
|
7
7
|
# speaker in the system.
|
8
|
-
class CreateConferenceSpeaker < Decidim::
|
9
|
-
|
8
|
+
class CreateConferenceSpeaker < Decidim::Commands::CreateResource
|
9
|
+
fetch_file_attributes :avatar
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
# form - A form object with the params.
|
14
|
-
# conference - The Conference that will hold the speaker
|
15
|
-
def initialize(form, current_user, conference)
|
16
|
-
@form = form
|
17
|
-
@current_user = current_user
|
18
|
-
@conference = conference
|
19
|
-
end
|
20
|
-
|
21
|
-
# Executes the command. Broadcasts these events:
|
22
|
-
#
|
23
|
-
# - :ok when everything is valid.
|
24
|
-
# - :invalid if the form was not valid and we could not proceed.
|
25
|
-
#
|
26
|
-
# Returns nothing.
|
27
|
-
def call
|
28
|
-
return broadcast(:invalid) if form.invalid?
|
29
|
-
|
30
|
-
# We are going to assign the attributes only to handle the validation of the avatar before accessing
|
31
|
-
# `create_conference_speaker!` which uses `create!`, and this will render an ActiveRecord::RecordInvalid error
|
32
|
-
# After we assign and check if the object is valid, we will not save the model to let it be handled the old way
|
33
|
-
# If there is an error we add the error to the form
|
34
|
-
# We are using this method to assign the conference because if we are trying to assign all at once, there will be thrown a
|
35
|
-
# Delegation error
|
36
|
-
|
37
|
-
if conference_speaker_with_attributes.valid?
|
38
|
-
|
39
|
-
transaction do
|
40
|
-
create_conference_speaker!
|
41
|
-
link_meetings(@conference_speaker)
|
42
|
-
end
|
43
|
-
broadcast(:ok)
|
44
|
-
else
|
45
|
-
form.errors.add(:avatar, conference_speaker_with_attributes.errors[:avatar]) if conference_speaker_with_attributes.errors.include? :avatar
|
46
|
-
|
47
|
-
broadcast(:invalid)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
attr_reader :form, :conference, :current_user
|
11
|
+
fetch_form_attributes :full_name, :twitter_handle, :personal_url, :position, :affiliation, :short_bio,
|
12
|
+
:user
|
54
13
|
|
55
|
-
|
56
|
-
@conference_speaker_attributes ||= form.attributes.slice(
|
57
|
-
"full_name",
|
58
|
-
"twitter_handle",
|
59
|
-
"personal_url",
|
60
|
-
"position",
|
61
|
-
"affiliation",
|
62
|
-
"short_bio"
|
63
|
-
).symbolize_keys.merge(
|
64
|
-
decidim_conference_id: conference.id,
|
65
|
-
conference:,
|
66
|
-
user: form.user
|
67
|
-
).merge(
|
68
|
-
attachment_attributes(:avatar)
|
69
|
-
)
|
70
|
-
end
|
14
|
+
protected
|
71
15
|
|
72
|
-
def
|
73
|
-
conference_speaker = conference.speakers.build
|
74
|
-
conference_speaker.conference = conference
|
75
|
-
conference_speaker.assign_attributes(conference_speaker_attributes)
|
76
|
-
conference_speaker
|
77
|
-
end
|
16
|
+
def resource_class = Decidim::ConferenceSpeaker
|
78
17
|
|
79
|
-
def
|
80
|
-
|
18
|
+
def extra_params
|
19
|
+
{
|
81
20
|
resource: {
|
82
21
|
title: form.full_name
|
83
22
|
},
|
84
23
|
participatory_space: {
|
85
|
-
title:
|
24
|
+
title: form.participatory_space.title
|
86
25
|
}
|
87
26
|
}
|
27
|
+
end
|
88
28
|
|
89
|
-
|
90
|
-
|
91
|
-
current_user,
|
92
|
-
conference_speaker_attributes,
|
93
|
-
log_info
|
94
|
-
)
|
29
|
+
def attributes
|
30
|
+
super.merge(conference: form.participatory_space)
|
95
31
|
end
|
96
32
|
|
97
|
-
def conference_meetings
|
98
|
-
meeting_components =
|
99
|
-
Decidim::ConferenceMeeting.where(component: meeting_components).where(id:
|
33
|
+
def conference_meetings
|
34
|
+
meeting_components = resource.conference.components.where(manifest_name: "meetings")
|
35
|
+
Decidim::ConferenceMeeting.where(component: meeting_components).where(id: form.conference_meeting_ids)
|
100
36
|
end
|
101
37
|
|
102
|
-
def
|
103
|
-
|
38
|
+
def run_after_hooks
|
39
|
+
resource.conference_meetings = conference_meetings
|
104
40
|
end
|
105
41
|
end
|
106
42
|
end
|
@@ -5,60 +5,26 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new
|
7
7
|
# media link for conference in the system.
|
8
|
-
class CreateMediaLink < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - A form object with the params.
|
12
|
-
# conference - The Conference that will hold the speaker
|
13
|
-
def initialize(form, current_user, conference)
|
14
|
-
@form = form
|
15
|
-
@current_user = current_user
|
16
|
-
@conference = conference
|
17
|
-
end
|
18
|
-
|
19
|
-
# Executes the command. Broadcasts these events:
|
20
|
-
#
|
21
|
-
# - :ok when everything is valid.
|
22
|
-
# - :invalid if the form was not valid and we could not proceed.
|
23
|
-
#
|
24
|
-
# Returns nothing.
|
25
|
-
def call
|
26
|
-
return broadcast(:invalid) if form.invalid?
|
27
|
-
|
28
|
-
transaction do
|
29
|
-
create_media_link!
|
30
|
-
end
|
8
|
+
class CreateMediaLink < Decidim::Commands::CreateResource
|
9
|
+
fetch_form_attributes :title, :link, :weight, :date
|
31
10
|
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
11
|
+
protected
|
36
12
|
|
37
|
-
|
13
|
+
def resource_class = Decidim::Conferences::MediaLink
|
38
14
|
|
39
|
-
def
|
40
|
-
|
15
|
+
def extra_params
|
16
|
+
{
|
41
17
|
resource: {
|
42
18
|
title: form.title
|
43
19
|
},
|
44
20
|
participatory_space: {
|
45
|
-
title:
|
21
|
+
title: form.current_participatory_space.title
|
46
22
|
}
|
47
23
|
}
|
24
|
+
end
|
48
25
|
|
49
|
-
|
50
|
-
|
51
|
-
current_user,
|
52
|
-
form.attributes.slice(
|
53
|
-
"title",
|
54
|
-
"link",
|
55
|
-
"weight",
|
56
|
-
"date"
|
57
|
-
).symbolize_keys.merge(
|
58
|
-
conference:
|
59
|
-
),
|
60
|
-
log_info
|
61
|
-
)
|
26
|
+
def attributes
|
27
|
+
super.merge(conference: form.current_participatory_space)
|
62
28
|
end
|
63
29
|
end
|
64
30
|
end
|
@@ -5,81 +5,28 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new partner
|
7
7
|
# in the system.
|
8
|
-
class CreatePartner < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - A form object with the params.
|
12
|
-
# conference - The Conference that will hold the speaker
|
13
|
-
def initialize(form, current_user, conference)
|
14
|
-
@form = form
|
15
|
-
@current_user = current_user
|
16
|
-
@conference = conference
|
17
|
-
end
|
18
|
-
|
19
|
-
# Executes the command. Broadcasts these events:
|
20
|
-
#
|
21
|
-
# - :ok when everything is valid.
|
22
|
-
# - :invalid if the form was not valid and we could not proceed.
|
23
|
-
#
|
24
|
-
# Returns nothing.
|
25
|
-
def call
|
26
|
-
return broadcast(:invalid) if form.invalid?
|
27
|
-
|
28
|
-
if conference_partner.valid?
|
29
|
-
transaction do
|
30
|
-
create_partner!
|
31
|
-
end
|
8
|
+
class CreatePartner < Decidim::Commands::CreateResource
|
9
|
+
fetch_file_attributes :logo
|
32
10
|
|
33
|
-
|
34
|
-
else
|
35
|
-
form.errors.add(:logo, conference_partner.errors[:logo]) if conference_partner.errors.include? :logo
|
36
|
-
|
37
|
-
broadcast(:invalid)
|
38
|
-
end
|
39
|
-
end
|
11
|
+
fetch_form_attributes :name, :weight, :link, :partner_type
|
40
12
|
|
41
|
-
|
13
|
+
protected
|
42
14
|
|
43
|
-
|
15
|
+
def resource_class = Decidim::Conferences::Partner
|
44
16
|
|
45
|
-
def
|
46
|
-
|
17
|
+
def extra_params
|
18
|
+
{
|
47
19
|
resource: {
|
48
20
|
title: form.name
|
49
21
|
},
|
50
22
|
participatory_space: {
|
51
|
-
title:
|
23
|
+
title: form.current_participatory_space.title
|
52
24
|
}
|
53
25
|
}
|
54
|
-
|
55
|
-
@partner = Decidim.traceability.create!(
|
56
|
-
Decidim::Conferences::Partner,
|
57
|
-
form.current_user,
|
58
|
-
attributes,
|
59
|
-
log_info
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
def conference_partner
|
64
|
-
return @conference_partner if defined?(@conference_partner)
|
65
|
-
|
66
|
-
@conference_partner = conference.partners.build
|
67
|
-
@conference_partner.conference = conference
|
68
|
-
@conference_partner.assign_attributes(attributes)
|
69
|
-
@conference_partner
|
70
26
|
end
|
71
27
|
|
72
28
|
def attributes
|
73
|
-
|
74
|
-
form.attributes.slice(
|
75
|
-
"name",
|
76
|
-
"weight",
|
77
|
-
"link",
|
78
|
-
"partner_type",
|
79
|
-
"logo",
|
80
|
-
"remove_avatar"
|
81
|
-
).symbolize_keys
|
82
|
-
)
|
29
|
+
super.merge(conference: form.participatory_space)
|
83
30
|
end
|
84
31
|
end
|
85
32
|
end
|
@@ -5,71 +5,35 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# A command with all the business logic when creating a new registration type
|
7
7
|
# in the system.
|
8
|
-
class CreateRegistrationType < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - A form object with the params.
|
12
|
-
# current_user - The current user hwo do the action of create
|
13
|
-
# conference - The Conference that will hold the speaker
|
14
|
-
def initialize(form, current_user, conference)
|
15
|
-
@form = form
|
16
|
-
@current_user = current_user
|
17
|
-
@conference = conference
|
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
|
-
|
29
|
-
transaction do
|
30
|
-
create_registration_type!
|
31
|
-
link_meetings(@registration_type)
|
32
|
-
end
|
8
|
+
class CreateRegistrationType < Decidim::Commands::CreateResource
|
9
|
+
fetch_form_attributes :title, :description, :price, :weight
|
33
10
|
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
11
|
+
protected
|
38
12
|
|
39
|
-
|
13
|
+
def resource_class = Decidim::Conferences::RegistrationType
|
40
14
|
|
41
|
-
def
|
42
|
-
|
15
|
+
def extra_params
|
16
|
+
{
|
43
17
|
resource: {
|
44
18
|
title: form.title
|
45
19
|
},
|
46
20
|
participatory_space: {
|
47
|
-
title:
|
21
|
+
title: form.participatory_space.title
|
48
22
|
}
|
49
23
|
}
|
24
|
+
end
|
50
25
|
|
51
|
-
|
52
|
-
|
53
|
-
form.current_user,
|
54
|
-
form.attributes.slice(
|
55
|
-
"title",
|
56
|
-
"description",
|
57
|
-
"price",
|
58
|
-
"weight"
|
59
|
-
).symbolize_keys.merge(
|
60
|
-
conference:
|
61
|
-
),
|
62
|
-
log_info
|
63
|
-
)
|
26
|
+
def attributes
|
27
|
+
super.merge({ conference: form.participatory_space })
|
64
28
|
end
|
65
29
|
|
66
|
-
def conference_meetings
|
67
|
-
meeting_components =
|
68
|
-
Decidim::ConferenceMeeting.where(component: meeting_components).where(id:
|
30
|
+
def conference_meetings
|
31
|
+
meeting_components = resource.conference.components.where(manifest_name: "meetings")
|
32
|
+
Decidim::ConferenceMeeting.where(component: meeting_components).where(id: form.conference_meeting_ids)
|
69
33
|
end
|
70
34
|
|
71
|
-
def
|
72
|
-
|
35
|
+
def run_after_hooks
|
36
|
+
resource.conference_meetings = conference_meetings
|
73
37
|
end
|
74
38
|
end
|
75
39
|
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
|
# speaker in the system.
|
8
|
-
class DestroyConferenceSpeaker < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# conference_speaker - the ConferenceSpeaker to destroy
|
12
|
-
# current_user - the user performing this 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
|
-
destroy_speaker!
|
26
|
-
broadcast(:ok)
|
27
|
-
end
|
8
|
+
class DestroyConferenceSpeaker < Decidim::Commands::DestroyResource
|
9
|
+
protected
|
28
10
|
|
29
|
-
|
30
|
-
|
31
|
-
attr_reader :conference_speaker, :current_user
|
32
|
-
|
33
|
-
def destroy_speaker!
|
34
|
-
log_info = {
|
11
|
+
def extra_params
|
12
|
+
{
|
35
13
|
resource: {
|
36
|
-
title:
|
14
|
+
title: resource.full_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_speaker,
|
46
|
-
current_user,
|
47
|
-
log_info
|
48
|
-
) do
|
49
|
-
conference_speaker.destroy!
|
50
|
-
conference_speaker
|
51
|
-
end
|
52
20
|
end
|
53
21
|
end
|
54
22
|
end
|