decidim-conferences 0.15.1 → 0.16.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/assets/config/admin/decidim_conferences_manifest.js +1 -0
- data/app/assets/images/decidim/conferences/conference.svg +2 -5
- data/app/cells/decidim/conferences/linked_participatory_spaces_cell.rb +3 -0
- data/app/cells/decidim/conferences/{join_conference_button/show.erb → registration_type/join_conference.erb} +6 -7
- data/app/cells/decidim/conferences/{join_conference_button → registration_type}/registration_confirm.erb +2 -2
- data/app/cells/decidim/conferences/registration_type/show.erb +16 -0
- data/app/cells/decidim/conferences/registration_type_cell.rb +51 -0
- data/app/commands/decidim/conferences/admin/confirm_conference_registration.rb +75 -0
- data/app/commands/decidim/conferences/admin/create_conference.rb +1 -1
- data/app/commands/decidim/conferences/admin/create_registration_type.rb +77 -0
- data/app/commands/decidim/conferences/admin/destroy_registration_type.rb +56 -0
- data/app/commands/decidim/conferences/admin/invite_user_to_join_conference.rb +3 -2
- data/app/commands/decidim/conferences/admin/publish_registration_type.rb +36 -0
- data/app/commands/decidim/conferences/admin/send_conference_diplomas.rb +48 -0
- data/app/commands/decidim/conferences/admin/unpublish_registration_type.rb +36 -0
- data/app/commands/decidim/conferences/admin/update_conference.rb +2 -2
- data/app/commands/decidim/conferences/admin/update_diploma.rb +47 -0
- data/app/commands/decidim/conferences/admin/update_partner.rb +1 -1
- data/app/commands/decidim/conferences/admin/update_registration_type.rb +74 -0
- data/app/commands/decidim/conferences/join_conference.rb +21 -9
- data/app/commands/decidim/conferences/leave_conference.rb +5 -3
- data/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb +21 -0
- data/app/controllers/decidim/conferences/admin/conferences_controller.rb +0 -9
- data/app/controllers/decidim/conferences/admin/diplomas_controller.rb +62 -0
- data/app/controllers/decidim/conferences/admin/registration_type_publications_controller.rb +53 -0
- data/app/controllers/decidim/conferences/admin/registration_types_controller.rb +84 -0
- data/app/controllers/decidim/conferences/application_controller.rb +2 -0
- data/app/controllers/decidim/conferences/conference_registrations_controller.rb +6 -2
- data/app/controllers/decidim/conferences/conferences_controller.rb +4 -0
- data/app/controllers/decidim/conferences/registration_types_controller.rb +39 -0
- data/app/events/decidim/conferences/conference_registration_notification_event.rb +21 -0
- data/app/forms/decidim/conferences/admin/conference_form.rb +5 -2
- data/app/forms/decidim/conferences/admin/conference_registration_invite_form.rb +15 -0
- data/app/forms/decidim/conferences/admin/diploma_form.rb +24 -0
- data/app/forms/decidim/conferences/admin/registration_type_form.rb +44 -0
- data/app/helpers/decidim/conferences/conference_helper.rb +15 -0
- data/app/jobs/decidim/conferences/admin/send_conference_diploma_job.rb +20 -0
- data/app/jobs/decidim/conferences/upcoming_conference_notification_job.rb +1 -1
- data/app/mailers/decidim/conferences/admin/invite_join_conference_mailer.rb +2 -1
- data/app/mailers/decidim/conferences/admin/send_conference_diploma_mailer.rb +48 -0
- data/app/mailers/decidim/conferences/conference_registration_mailer.rb +16 -1
- data/app/models/decidim/conference.rb +12 -0
- data/app/models/decidim/conference_meeting.rb +2 -0
- data/app/models/decidim/conferences/conference_invite.rb +1 -0
- data/app/models/decidim/conferences/conference_meeting_registration_type.rb +10 -0
- data/app/models/decidim/conferences/conference_registration.rb +11 -0
- data/app/models/decidim/conferences/registration_type.rb +25 -0
- data/app/permissions/decidim/conferences/permissions.rb +19 -12
- data/app/presenters/decidim/conference_speaker_presenter.rb +4 -0
- data/app/presenters/decidim/conferences/admin_log/conference_registration_presenter.rb +43 -0
- data/app/presenters/decidim/conferences/admin_log/conferences_presenter.rb +4 -2
- data/app/presenters/decidim/conferences/admin_log/partner_presenter.rb +1 -1
- data/app/presenters/decidim/conferences/admin_log/registration_type_presenter.rb +45 -0
- data/app/serializers/decidim/conferences/conference_registration_serializer.rb +4 -0
- data/app/serializers/decidim/conferences/data_portability_conference_invite_serializer.rb +4 -0
- data/app/serializers/decidim/conferences/data_portability_conference_registration_serializer.rb +4 -0
- data/app/uploaders/decidim/conferences/diploma_uploader.rb +12 -0
- data/app/views/decidim/conferences/admin/conference_invites/_form.html.erb +8 -0
- data/app/views/decidim/conferences/admin/conference_invites/index.html.erb +4 -0
- data/app/views/decidim/conferences/admin/conference_registrations/index.html.erb +16 -0
- data/app/views/decidim/conferences/admin/conferences/edit.html.erb +0 -4
- data/app/views/decidim/conferences/admin/diplomas/_form.html.erb +31 -0
- data/app/views/decidim/conferences/admin/diplomas/edit.html.erb +7 -0
- data/app/views/decidim/conferences/admin/invite_join_conference_mailer/invite.html.erb +2 -2
- data/app/views/decidim/conferences/admin/registration_types/_form.html.erb +30 -0
- data/app/views/decidim/conferences/admin/registration_types/edit.html.erb +7 -0
- data/app/views/decidim/conferences/admin/registration_types/index.html.erb +65 -0
- data/app/views/decidim/conferences/admin/registration_types/new.html.erb +7 -0
- data/app/views/decidim/conferences/admin/send_conference_diploma_mailer/diploma.html.erb +1 -0
- data/app/views/decidim/conferences/admin/send_conference_diploma_mailer/diploma_user.html.erb +24 -0
- data/app/views/decidim/conferences/conference_program/_program_meeting.html.erb +1 -2
- data/app/views/decidim/conferences/conference_registration_mailer/confirmation.html.erb +9 -1
- data/app/views/decidim/conferences/conference_registration_mailer/pending_validation.html.erb +11 -0
- data/app/views/decidim/conferences/conferences/index.html.erb +2 -2
- data/app/views/decidim/conferences/conferences/show.html.erb +10 -24
- data/app/views/decidim/conferences/registration_types/index.html.erb +30 -0
- data/app/views/decidim/conferences/shared/_conference_user_login.html.erb +14 -0
- data/app/views/layouts/decidim/_conference_hero.html.erb +5 -3
- data/app/views/layouts/decidim/_conferences_nav.html.erb +45 -89
- data/app/views/layouts/decidim/admin/conference.html.erb +26 -8
- data/app/views/layouts/decidim/diploma.html.erb +11 -0
- data/config/initializers/wicked_pdf.rb +23 -0
- data/config/locales/ca.yml +125 -19
- data/config/locales/de.yml +127 -21
- data/config/locales/en.yml +126 -23
- data/config/locales/es-PY.yml +125 -19
- data/config/locales/es.yml +125 -19
- data/config/locales/eu.yml +127 -21
- data/config/locales/fi-pl.yml +570 -0
- data/config/locales/fi.yml +145 -39
- data/config/locales/fr.yml +127 -21
- data/config/locales/gl.yml +126 -20
- data/config/locales/hu.yml +127 -21
- data/config/locales/id-ID.yml +563 -0
- data/config/locales/it.yml +127 -21
- data/config/locales/nl.yml +126 -20
- data/config/locales/pl.yml +127 -24
- data/config/locales/pt-BR.yml +125 -19
- data/config/locales/pt.yml +126 -20
- data/config/locales/sv.yml +164 -58
- data/config/locales/tr-TR.yml +567 -0
- data/db/migrate/20181023142325_add_conference_registration_types.rb +21 -0
- data/db/migrate/20181030090202_add_reference_registration_type_to_conference_registration.rb +9 -0
- data/db/migrate/20181030153614_add_registration_type_to_conference_invite.rb +8 -0
- data/db/migrate/20181106092826_add_diploma_fields_to_conference.rb +11 -0
- data/db/migrate/20181123124424_make_price_optional_conference_registration_type.rb +7 -0
- data/lib/decidim/conferences/admin_engine.rb +16 -2
- data/lib/decidim/conferences/engine.rb +8 -4
- data/lib/decidim/conferences/participatory_space.rb +11 -0
- data/lib/decidim/conferences/test/factories.rb +36 -0
- data/lib/decidim/conferences/version.rb +1 -1
- metadata +94 -22
- data/app/cells/decidim/conferences/join_conference_button_cell.rb +0 -42
- data/app/views/decidim/conferences/conferences/_conferences_sidebar.html.erb +0 -11
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# This command gets called when a registration type is unpublished from the admin panel.
|
7
|
+
class UnpublishRegistrationType < Rectify::Command
|
8
|
+
# Public: Initializes the command.
|
9
|
+
#
|
10
|
+
# registration_type - The registration_type to unpublish.
|
11
|
+
# current_user - the user performing the action
|
12
|
+
def initialize(registration_type, current_user)
|
13
|
+
@registration_type = registration_type
|
14
|
+
@current_user = current_user
|
15
|
+
end
|
16
|
+
|
17
|
+
# Public: Unpublishes the RegistrationType.
|
18
|
+
#
|
19
|
+
# Broadcasts :ok if unpublished, :invalid otherwise.
|
20
|
+
def call
|
21
|
+
return broadcast(:invalid) if registration_type.nil? || !registration_type.published?
|
22
|
+
|
23
|
+
Decidim.traceability.perform_action!(:unpublish, registration_type, current_user) do
|
24
|
+
registration_type.unpublish!
|
25
|
+
end
|
26
|
+
|
27
|
+
broadcast(:ok)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :registration_type, :current_user
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -94,7 +94,7 @@ module Decidim
|
|
94
94
|
event: "decidim.events.conferences.registrations_enabled",
|
95
95
|
event_class: Decidim::Conferences::ConferenceRegistrationsEnabledEvent,
|
96
96
|
resource: @conference,
|
97
|
-
|
97
|
+
followers: @conference.followers
|
98
98
|
)
|
99
99
|
end
|
100
100
|
|
@@ -107,7 +107,7 @@ module Decidim
|
|
107
107
|
event: "decidim.events.conferences.conference_updated",
|
108
108
|
event_class: Decidim::Conferences::UpdateConferenceEvent,
|
109
109
|
resource: @conference,
|
110
|
-
|
110
|
+
followers: @conference.followers
|
111
111
|
)
|
112
112
|
end
|
113
113
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# This command is executed when the user updates the conference diploma configuration.
|
7
|
+
class UpdateDiploma < Rectify::Command
|
8
|
+
# Initializes a UpdateDiploma Command.
|
9
|
+
#
|
10
|
+
# form - The form from which to get the data.
|
11
|
+
# conference - The current instance of the conference to be updated.
|
12
|
+
def initialize(form, conference)
|
13
|
+
@form = form
|
14
|
+
@conference = conference
|
15
|
+
end
|
16
|
+
|
17
|
+
# Updates the conference if valid.
|
18
|
+
#
|
19
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
20
|
+
def call
|
21
|
+
@conference.with_lock do
|
22
|
+
return broadcast(:invalid) if form.invalid?
|
23
|
+
update_conference_diploma
|
24
|
+
Decidim.traceability.perform_action!(:update_diploma, @conference, form.current_user) do
|
25
|
+
@conference
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
broadcast(:ok)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :form, :conference
|
35
|
+
|
36
|
+
def update_conference_diploma
|
37
|
+
@conference.main_logo = @form.main_logo
|
38
|
+
@conference.signature = @form.signature
|
39
|
+
@conference.signature_name = @form.signature_name
|
40
|
+
@conference.sign_date = @form.sign_date
|
41
|
+
|
42
|
+
@conference.save!
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic when updating a conference
|
7
|
+
# registration type in the system.
|
8
|
+
class UpdateRegistrationType < Rectify::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# form - A form object with the params.
|
12
|
+
# registration_type - The RegistrationType to update
|
13
|
+
def initialize(form, registration_type)
|
14
|
+
@form = form
|
15
|
+
@registration_type = registration_type
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if form.invalid?
|
26
|
+
return broadcast(:invalid) unless registration_type
|
27
|
+
|
28
|
+
transaction do
|
29
|
+
update_registration_type!
|
30
|
+
link_meetings(@registration_type)
|
31
|
+
end
|
32
|
+
|
33
|
+
broadcast(:ok)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :form, :registration_type
|
39
|
+
|
40
|
+
def update_registration_type!
|
41
|
+
log_info = {
|
42
|
+
resource: {
|
43
|
+
title: registration_type.title
|
44
|
+
},
|
45
|
+
participatory_space: {
|
46
|
+
title: registration_type.conference.title
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
Decidim.traceability.update!(
|
51
|
+
registration_type,
|
52
|
+
form.current_user,
|
53
|
+
form.attributes.slice(
|
54
|
+
:title,
|
55
|
+
:description,
|
56
|
+
:price,
|
57
|
+
:weight
|
58
|
+
),
|
59
|
+
log_info
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def conference_meetings(registration_type)
|
64
|
+
meeting_components = registration_type.conference.components.where(manifest_name: "meetings")
|
65
|
+
Decidim::ConferenceMeeting.where(component: meeting_components).where(id: @form.attributes[:conference_meeting_ids])
|
66
|
+
end
|
67
|
+
|
68
|
+
def link_meetings(registration_type)
|
69
|
+
registration_type.conference_meetings = conference_meetings(registration_type)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -7,9 +7,11 @@ module Decidim
|
|
7
7
|
# Initializes a JoinConference Command.
|
8
8
|
#
|
9
9
|
# conference - The current instance of the conference to be joined.
|
10
|
+
# registration_type - The registration type selected to attend the conference
|
10
11
|
# user - The user joining the conference.
|
11
|
-
def initialize(conference, user)
|
12
|
+
def initialize(conference, registration_type, user)
|
12
13
|
@conference = conference
|
14
|
+
@registration_type = registration_type
|
13
15
|
@user = user
|
14
16
|
end
|
15
17
|
|
@@ -23,8 +25,9 @@ module Decidim
|
|
23
25
|
create_registration
|
24
26
|
create_meetings_registrations
|
25
27
|
accept_invitation
|
26
|
-
|
27
|
-
|
28
|
+
send_email_pending_validation
|
29
|
+
send_notification_pending_validation
|
30
|
+
notify_admin_over_percentage
|
28
31
|
end
|
29
32
|
broadcast(:ok)
|
30
33
|
end
|
@@ -38,12 +41,12 @@ module Decidim
|
|
38
41
|
end
|
39
42
|
|
40
43
|
def create_registration
|
41
|
-
Decidim::Conferences::ConferenceRegistration.create!(conference: conference, user: user)
|
44
|
+
Decidim::Conferences::ConferenceRegistration.create!(conference: conference, user: user, registration_type: @registration_type)
|
42
45
|
end
|
43
46
|
|
44
47
|
def create_meetings_registrations
|
45
48
|
published_meeting_components = Decidim::Component.where(participatory_space: conference).where(manifest_name: "meetings").published
|
46
|
-
meetings = Decidim::Meetings::Meeting.where(component: published_meeting_components)
|
49
|
+
meetings = Decidim::Meetings::Meeting.where(component: published_meeting_components).where(id: @registration_type.conference_meetings.pluck(:id))
|
47
50
|
|
48
51
|
meetings.each do |meeting|
|
49
52
|
Decidim::Meetings::Registration.create!(meeting: meeting, user: user)
|
@@ -54,15 +57,24 @@ module Decidim
|
|
54
57
|
conference.registrations_enabled? && conference.has_available_slots?
|
55
58
|
end
|
56
59
|
|
57
|
-
def
|
58
|
-
Decidim::Conferences::ConferenceRegistrationMailer.
|
60
|
+
def send_email_pending_validation
|
61
|
+
Decidim::Conferences::ConferenceRegistrationMailer.pending_validation(user, conference, @registration_type).deliver_later
|
62
|
+
end
|
63
|
+
|
64
|
+
def send_notification_pending_validation
|
65
|
+
Decidim::EventsManager.publish(
|
66
|
+
event: "decidim.events.conferences.conference_registration_validation_pending",
|
67
|
+
event_class: Decidim::Conferences::ConferenceRegistrationNotificationEvent,
|
68
|
+
resource: @conference,
|
69
|
+
affected_users: [@user]
|
70
|
+
)
|
59
71
|
end
|
60
72
|
|
61
73
|
def participatory_space_admins
|
62
74
|
@conference.admins
|
63
75
|
end
|
64
76
|
|
65
|
-
def
|
77
|
+
def notify_admin_over_percentage
|
66
78
|
return send_notification_over(0.5) if occupied_slots_over?(0.5)
|
67
79
|
return send_notification_over(0.8) if occupied_slots_over?(0.8)
|
68
80
|
send_notification_over(1.0) if occupied_slots_over?(1.0)
|
@@ -73,7 +85,7 @@ module Decidim
|
|
73
85
|
event: "decidim.events.conferences.conference_registrations_over_percentage",
|
74
86
|
event_class: Decidim::Conferences::ConferenceRegistrationsOverPercentageEvent,
|
75
87
|
resource: @conference,
|
76
|
-
|
88
|
+
followers: participatory_space_admins,
|
77
89
|
extra: {
|
78
90
|
percentage: percentage
|
79
91
|
}
|
@@ -7,9 +7,11 @@ module Decidim
|
|
7
7
|
# Initializes a LeaveConference Command.
|
8
8
|
#
|
9
9
|
# conference - The current instance of the conference to be left.
|
10
|
+
# registration_type - The registration type selected to attend the conference
|
10
11
|
# user - The user leaving the conference.
|
11
|
-
def initialize(conference, user)
|
12
|
+
def initialize(conference, registration_type, user)
|
12
13
|
@conference = conference
|
14
|
+
@registration_type = registration_type
|
13
15
|
@user = user
|
14
16
|
end
|
15
17
|
|
@@ -30,7 +32,7 @@ module Decidim
|
|
30
32
|
private
|
31
33
|
|
32
34
|
def registration
|
33
|
-
@registration ||= Decidim::Conferences::ConferenceRegistration.find_by(conference: @conference, user: @user)
|
35
|
+
@registration ||= Decidim::Conferences::ConferenceRegistration.find_by(conference: @conference, user: @user, registration_type: @registration_type)
|
34
36
|
end
|
35
37
|
|
36
38
|
def destroy_registration
|
@@ -39,7 +41,7 @@ module Decidim
|
|
39
41
|
|
40
42
|
def meetings_registrations
|
41
43
|
published_meeting_components = Decidim::Component.where(participatory_space: @conference).where(manifest_name: "meetings").published
|
42
|
-
meetings = Decidim::Meetings::Meeting.where(component: published_meeting_components)
|
44
|
+
meetings = Decidim::Meetings::Meeting.where(component: published_meeting_components).where(id: @registration_type.conference_meetings.pluck(:id))
|
43
45
|
|
44
46
|
@meetings_registrations ||= Decidim::Meetings::Registration.where(meeting: meetings, user: @user)
|
45
47
|
end
|
@@ -28,11 +28,32 @@ module Decidim
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def confirm
|
32
|
+
enforce_permission_to :confirm, :conference_registration, conference_registration: conference_registration
|
33
|
+
|
34
|
+
ConfirmConferenceRegistration.call(conference_registration, current_user) do
|
35
|
+
on(:ok) do
|
36
|
+
flash[:notice] = I18n.t("conference_registration.confirm.success", scope: "decidim.admin")
|
37
|
+
end
|
38
|
+
|
39
|
+
on(:invalid) do
|
40
|
+
flash[:alert] = I18n.t("conference_registration.confirm.error", scope: "decidim.admin")
|
41
|
+
end
|
42
|
+
|
43
|
+
redirect_back(fallback_location: conference_conference_registrations_path)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
private
|
32
48
|
|
33
49
|
def conference
|
34
50
|
@conference ||= Decidim::Conference.find_by(slug: params[:conference_slug])
|
35
51
|
end
|
52
|
+
|
53
|
+
def conference_registration
|
54
|
+
return if params[:id].blank?
|
55
|
+
@conference_registration ||= conference.conference_registrations.find_by(id: params[:id])
|
56
|
+
end
|
36
57
|
end
|
37
58
|
end
|
38
59
|
end
|
@@ -62,15 +62,6 @@ module Decidim
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def destroy
|
66
|
-
enforce_permission_to :destroy, :conference, conference: current_conference
|
67
|
-
current_conference.destroy!
|
68
|
-
|
69
|
-
flash[:notice] = I18n.t("conferences.destroy.success", scope: "decidim.admin")
|
70
|
-
|
71
|
-
redirect_to conferences_path
|
72
|
-
end
|
73
|
-
|
74
65
|
def copy
|
75
66
|
enforce_permission_to :create, :conference
|
76
67
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# This controller allows an admin to manage Conference Diploma configuration
|
7
|
+
class DiplomasController < Decidim::Conferences::Admin::ApplicationController
|
8
|
+
include Concerns::ConferenceAdmin
|
9
|
+
|
10
|
+
def edit
|
11
|
+
enforce_permission_to :update, :conference, conference: current_conference
|
12
|
+
|
13
|
+
@form = form(DiplomaForm).from_model(current_conference)
|
14
|
+
end
|
15
|
+
|
16
|
+
def update
|
17
|
+
enforce_permission_to :update, :conference, conference: current_conference
|
18
|
+
|
19
|
+
@form = form(DiplomaForm).from_params(diploma_params).with_context(conference: current_conference)
|
20
|
+
|
21
|
+
UpdateDiploma.call(@form, current_conference) do
|
22
|
+
on(:ok) do
|
23
|
+
flash[:notice] = I18n.t("conferences.update.success", scope: "decidim.admin")
|
24
|
+
redirect_to edit_conference_diploma_path(current_conference)
|
25
|
+
end
|
26
|
+
|
27
|
+
on(:invalid) do
|
28
|
+
flash.now[:alert] = I18n.t("conferences.update.error", scope: "decidim.admin")
|
29
|
+
render :edit
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def send_diplomas
|
35
|
+
enforce_permission_to :send_diplomas, :conference, conference: current_conference
|
36
|
+
|
37
|
+
SendConferenceDiplomas.call(current_conference, current_user) do
|
38
|
+
on(:ok) do
|
39
|
+
flash[:notice] = I18n.t("send_diploma.success", scope: "decidim.conferences.admin")
|
40
|
+
redirect_to edit_conference_diploma_path(current_conference)
|
41
|
+
end
|
42
|
+
|
43
|
+
on(:invalid) do
|
44
|
+
flash[:alert] = I18n.t("send_diploma.error", scope: "decidim.conferences.admin")
|
45
|
+
redirect_to edit_conference_diploma_path(current_conference)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def diploma_params
|
53
|
+
{
|
54
|
+
id: params[:slug],
|
55
|
+
signature: current_conference.signature,
|
56
|
+
main_logo: current_conference.main_logo
|
57
|
+
}.merge(params[:conference].to_unsafe_h)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing registration type publications.
|
7
|
+
#
|
8
|
+
class RegistrationTypePublicationsController < Decidim::Conferences::Admin::ApplicationController
|
9
|
+
include Concerns::ConferenceAdmin
|
10
|
+
|
11
|
+
def create
|
12
|
+
@registration_type = collection.find(params[:registration_type_id])
|
13
|
+
enforce_permission_to :publish, :registration_type, registration_type: @registration_type
|
14
|
+
|
15
|
+
PublishRegistrationType.call(@registration_type, current_user) do
|
16
|
+
on(:ok) do
|
17
|
+
flash[:notice] = I18n.t("registration_type_publications.create.success", scope: "decidim.admin")
|
18
|
+
end
|
19
|
+
|
20
|
+
on(:invalid) do
|
21
|
+
flash[:alert] = I18n.t("registration_type_publications.create.error", scope: "decidim.admin")
|
22
|
+
end
|
23
|
+
|
24
|
+
redirect_back(fallback_location: conference_registration_types_path(current_conference))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def destroy
|
29
|
+
@registration_type = collection.find(params[:registration_type_id])
|
30
|
+
enforce_permission_to :unpublish, :registration_type, registration_type: @registration_type
|
31
|
+
|
32
|
+
UnpublishRegistrationType.call(@registration_type, current_user) do
|
33
|
+
on(:ok) do
|
34
|
+
flash[:notice] = I18n.t("registration_type_publications.destroy.success", scope: "decidim.admin")
|
35
|
+
end
|
36
|
+
|
37
|
+
on(:invalid) do
|
38
|
+
flash[:alert] = I18n.t("registration_type_publications.destroy.error", scope: "decidim.admin")
|
39
|
+
end
|
40
|
+
|
41
|
+
redirect_back(fallback_location: conference_registration_types_path(current_conference))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def collection
|
48
|
+
@collection ||= Decidim::Conferences::RegistrationType.where(conference: current_conference)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|