decidim-conferences 0.15.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +127 -21
- 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 +128 -22
- data/config/locales/fi.yml +128 -22
- 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 +125 -20
- 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 +126 -20
- data/config/locales/tr-TR.yml +125 -22
- 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 +92 -23
- 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,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
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing conference speakers.
|
7
|
+
#
|
8
|
+
class RegistrationTypesController < Decidim::Conferences::Admin::ApplicationController
|
9
|
+
include Concerns::ConferenceAdmin
|
10
|
+
include Decidim::ApplicationHelper
|
11
|
+
|
12
|
+
def index
|
13
|
+
enforce_permission_to :index, :registration_type
|
14
|
+
|
15
|
+
@registration_types = collection.page(params[:page]).per(15)
|
16
|
+
end
|
17
|
+
|
18
|
+
def new
|
19
|
+
enforce_permission_to :create, :registration_type
|
20
|
+
@form = form(Decidim::Conferences::Admin::RegistrationTypeForm).instance
|
21
|
+
end
|
22
|
+
|
23
|
+
def create
|
24
|
+
enforce_permission_to :create, :registration_type
|
25
|
+
@form = form(Decidim::Conferences::Admin::RegistrationTypeForm).from_params(params)
|
26
|
+
|
27
|
+
CreateRegistrationType.call(@form, current_user, current_conference) do
|
28
|
+
on(:ok) do
|
29
|
+
flash[:notice] = I18n.t("registration_types.create.success", scope: "decidim.admin")
|
30
|
+
redirect_to conference_registration_types_path(current_conference)
|
31
|
+
end
|
32
|
+
|
33
|
+
on(:invalid) do
|
34
|
+
flash.now[:alert] = I18n.t("registration_types.create.error", scope: "decidim.admin")
|
35
|
+
render :new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def edit
|
41
|
+
@registration_type = collection.find(params[:id])
|
42
|
+
enforce_permission_to :update, :registration_type, registration_type: @registration_type
|
43
|
+
@form = form(Decidim::Conferences::Admin::RegistrationTypeForm).from_model(@registration_type)
|
44
|
+
end
|
45
|
+
|
46
|
+
def update
|
47
|
+
@registration_type = collection.find(params[:id])
|
48
|
+
enforce_permission_to :update, :registration_type, registration_type: @registration_type
|
49
|
+
@form = form(Decidim::Conferences::Admin::RegistrationTypeForm).from_params(params)
|
50
|
+
|
51
|
+
UpdateRegistrationType.call(@form, @registration_type) do
|
52
|
+
on(:ok) do
|
53
|
+
flash[:notice] = I18n.t("registration_types.update.success", scope: "decidim.admin")
|
54
|
+
redirect_to conference_registration_types_path(current_conference)
|
55
|
+
end
|
56
|
+
|
57
|
+
on(:invalid) do
|
58
|
+
flash.now[:alert] = I18n.t("registration_types.update.error", scope: "decidim.admin")
|
59
|
+
render :edit
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def destroy
|
65
|
+
@registration_type = collection.find(params[:id])
|
66
|
+
enforce_permission_to :destroy, :registration_type, registration_type: @registration_type
|
67
|
+
|
68
|
+
DestroyRegistrationType.call(@registration_type, current_user) do
|
69
|
+
on(:ok) do
|
70
|
+
flash[:notice] = I18n.t("registration_types.destroy.success", scope: "decidim.admin")
|
71
|
+
redirect_to conference_registration_types_path(current_conference)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def collection
|
79
|
+
@collection ||= Decidim::Conferences::RegistrationType.where(conference: current_conference)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
def create
|
8
8
|
enforce_permission_to :join, :conference, conference: conference
|
9
9
|
|
10
|
-
JoinConference.call(conference, current_user) do
|
10
|
+
JoinConference.call(conference, registration_type, current_user) do
|
11
11
|
on(:ok) do
|
12
12
|
flash[:notice] = I18n.t("conference_registrations.create.success", scope: "decidim.conferences")
|
13
13
|
redirect_after_path
|
@@ -23,7 +23,7 @@ module Decidim
|
|
23
23
|
def destroy
|
24
24
|
enforce_permission_to :leave, :conference, conference: conference
|
25
25
|
|
26
|
-
LeaveConference.call(conference, current_user) do
|
26
|
+
LeaveConference.call(conference, registration_type, current_user) do
|
27
27
|
on(:ok) do
|
28
28
|
flash[:notice] = I18n.t("conference_registrations.destroy.success", scope: "decidim.conferences")
|
29
29
|
redirect_after_path
|
@@ -58,6 +58,10 @@ module Decidim
|
|
58
58
|
@conference ||= Conference.find_by(slug: params[:conference_slug])
|
59
59
|
end
|
60
60
|
|
61
|
+
def registration_type
|
62
|
+
conference.registration_types.find_by(id: params[:registration_type_id])
|
63
|
+
end
|
64
|
+
|
61
65
|
def redirect_after_path
|
62
66
|
referer = request.headers["Referer"]
|
63
67
|
return redirect_to(conference_path(conference)) if referer =~ /invitation_token/
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
class RegistrationTypesController < Decidim::Conferences::ApplicationController
|
6
|
+
include ParticipatorySpaceContext
|
7
|
+
|
8
|
+
participatory_space_layout only: :index
|
9
|
+
|
10
|
+
helper_method :collection, :conference
|
11
|
+
|
12
|
+
def index
|
13
|
+
raise ActionController::RoutingError, "No registration types for this conference " if registration_types.empty? && current_participatory_space.registrations_enabled.empty?
|
14
|
+
enforce_permission_to :list, :registration_types
|
15
|
+
redirect_to decidim_conferences.conference_path(current_participatory_space) unless current_user_can_visit_space?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def registration_types
|
21
|
+
@registration_types ||= current_participatory_space.registration_types.published
|
22
|
+
end
|
23
|
+
|
24
|
+
alias collection registration_types
|
25
|
+
|
26
|
+
def current_participatory_space
|
27
|
+
return unless params[:conference_slug]
|
28
|
+
|
29
|
+
@current_participatory_space ||= OrganizationConferences.new(current_organization).query.where(slug: params[:conference_slug]).or(
|
30
|
+
OrganizationConferences.new(current_organization).query.where(id: params[:conference_slug])
|
31
|
+
).first!
|
32
|
+
end
|
33
|
+
|
34
|
+
def conference
|
35
|
+
current_participatory_space
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen-string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
class ConferenceRegistrationNotificationEvent < Decidim::Events::BaseEvent
|
6
|
+
include Decidim::Events::NotificationEvent
|
7
|
+
|
8
|
+
def notification_title
|
9
|
+
I18n.t("notification_title", i18n_options).html_safe
|
10
|
+
end
|
11
|
+
|
12
|
+
def i18n_options
|
13
|
+
{
|
14
|
+
resource_title: resource_title,
|
15
|
+
resource_url: resource_url,
|
16
|
+
scope: event_name
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -49,8 +49,8 @@ module Decidim
|
|
49
49
|
validates :banner_image, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
|
50
50
|
validate :available_slots_greater_than_or_equal_to_registrations_count, if: ->(form) { form.registrations_enabled? && form.available_slots.positive? }
|
51
51
|
|
52
|
-
validates :start_date, presence: true, date: {
|
53
|
-
validates :end_date, presence: true, date: {
|
52
|
+
validates :start_date, presence: true, date: { before_or_equal_to: :end_date }
|
53
|
+
validates :end_date, presence: true, date: { after_or_equal_to: :start_date }
|
54
54
|
|
55
55
|
def map_model(model)
|
56
56
|
self.scope_id = model.decidim_scope_id
|
@@ -61,6 +61,7 @@ module Decidim
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def processes_for_select
|
64
|
+
return unless Decidim.participatory_space_manifests.map(&:name).include?(:participatory_processes)
|
64
65
|
@processes_for_select ||= Decidim.find_participatory_space_manifest(:participatory_processes)
|
65
66
|
.participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |process|
|
66
67
|
[
|
@@ -71,6 +72,7 @@ module Decidim
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def assemblies_for_select
|
75
|
+
return unless Decidim.participatory_space_manifests.map(&:name).include?(:assemblies)
|
74
76
|
@assemblies_for_select ||= Decidim.find_participatory_space_manifest(:assemblies)
|
75
77
|
.participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |assembly|
|
76
78
|
[
|
@@ -81,6 +83,7 @@ module Decidim
|
|
81
83
|
end
|
82
84
|
|
83
85
|
def consultations_for_select
|
86
|
+
return unless Decidim.participatory_space_manifests.map(&:name).include?(:consultations)
|
84
87
|
@consultations_for_select ||= Decidim.find_participatory_space_manifest(:consultations)
|
85
88
|
.participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |consultation|
|
86
89
|
[
|
@@ -6,9 +6,11 @@ module Decidim
|
|
6
6
|
# A form object used to invite users to join a conference.
|
7
7
|
#
|
8
8
|
class ConferenceRegistrationInviteForm < Form
|
9
|
+
include TranslatableAttributes
|
9
10
|
attribute :name, String
|
10
11
|
attribute :email, String
|
11
12
|
attribute :user_id, Integer
|
13
|
+
attribute :registration_type_id, Integer
|
12
14
|
attribute :existing_user, Boolean, default: false
|
13
15
|
|
14
16
|
validates :name, presence: true, unless: proc { |object| object.existing_user }
|
@@ -18,6 +20,19 @@ module Decidim
|
|
18
20
|
def user
|
19
21
|
@user ||= current_organization.users.find_by(id: user_id)
|
20
22
|
end
|
23
|
+
|
24
|
+
def registration_type
|
25
|
+
@registration_type ||= current_participatory_space.registration_types.find_by(id: registration_type_id)
|
26
|
+
end
|
27
|
+
|
28
|
+
def registration_types_for_select
|
29
|
+
@registration_types_for_select ||= current_participatory_space.registration_types&.map do |registration_type|
|
30
|
+
[
|
31
|
+
translated_attribute(registration_type.title),
|
32
|
+
registration_type.id
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
21
36
|
end
|
22
37
|
end
|
23
38
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A form object used to update conference diploma configuration
|
7
|
+
# from the admin dashboard
|
8
|
+
#
|
9
|
+
class DiplomaForm < Form
|
10
|
+
mimic :conference
|
11
|
+
|
12
|
+
attribute :main_logo
|
13
|
+
attribute :signature
|
14
|
+
attribute :signature_name, String
|
15
|
+
attribute :sign_date, Decidim::Attributes::LocalizedDate
|
16
|
+
|
17
|
+
validates :signature_name, :sign_date, :main_logo, :signature, presence: true
|
18
|
+
|
19
|
+
validates :main_logo, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
|
20
|
+
validates :signature, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A form object used to create conference registration types from the admin dashboard.
|
7
|
+
class RegistrationTypeForm < Form
|
8
|
+
include TranslatableAttributes
|
9
|
+
include Decidim::ApplicationHelper
|
10
|
+
|
11
|
+
mimic :conference_registration_type
|
12
|
+
|
13
|
+
translatable_attribute :title, String
|
14
|
+
translatable_attribute :description, String
|
15
|
+
|
16
|
+
attribute :weight, Integer
|
17
|
+
attribute :price, Decimal
|
18
|
+
attribute :conference_meeting_ids, Array[Integer]
|
19
|
+
|
20
|
+
validates :title, :description, :weight, presence: true
|
21
|
+
validates :weight, numericality: { greater_than_or_equal_to: 0 }
|
22
|
+
validates :price, numericality: { greater_than_or_equal_to: 0 }, if: ->(form) { form.price.present? }
|
23
|
+
|
24
|
+
def meetings
|
25
|
+
meeting_components = current_participatory_space.components.where(manifest_name: "meetings")
|
26
|
+
@meetings ||= Decidim::ConferenceMeeting.where(component: meeting_components)
|
27
|
+
&.order(title: :asc)
|
28
|
+
&.map do |meeting|
|
29
|
+
OpenStruct.new(
|
30
|
+
title: present(meeting).title,
|
31
|
+
value: meeting.id
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def conference_meetings
|
37
|
+
meeting_components = current_participatory_space.components.where(manifest_name: "meetings")
|
38
|
+
return unless meeting_components || conference_meeting_ids.delete("").present?
|
39
|
+
@conference_meetings ||= Decidim::ConferenceMeeting.where(component: meeting_components).where(id: conference_meeting_ids)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A Helper to render conferences.
|
5
|
+
module Conferences
|
6
|
+
module ConferenceHelper
|
7
|
+
# Renders the dates of a conference
|
8
|
+
#
|
9
|
+
def render_date(conference)
|
10
|
+
return l(conference.start_date, format: :decidim_with_month_name_short) if conference.start_date == conference.end_date
|
11
|
+
"#{l(conference.start_date, format: :decidim_with_month_name_short)} - #{l(conference.end_date, format: :decidim_with_month_name_short)}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
class SendConferenceDiplomaJob < ApplicationJob
|
7
|
+
queue_as :conference_diplomas
|
8
|
+
|
9
|
+
def perform(conference)
|
10
|
+
confirmed_registrations = conference.conference_registrations.confirmed
|
11
|
+
return unless confirmed_registrations.any?
|
12
|
+
|
13
|
+
confirmed_registrations.each do |registration_confirmed|
|
14
|
+
SendConferenceDiplomaMailer.diploma(conference, registration_confirmed.user).deliver_now
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
event: "decidim.events.conferences.upcoming_conference",
|
22
22
|
event_class: Decidim::Conferences::UpcomingConferenceEvent,
|
23
23
|
resource: conference,
|
24
|
-
|
24
|
+
followers: conference.followers
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
@@ -19,13 +19,14 @@ module Decidim
|
|
19
19
|
# user - The user being invited
|
20
20
|
# conference - The conference being joined.
|
21
21
|
# invited_by - The user performing the invitation.
|
22
|
-
def invite(user, conference, invited_by)
|
22
|
+
def invite(user, conference, registration_type, invited_by)
|
23
23
|
with_user(user) do
|
24
24
|
@user = user
|
25
25
|
@conference = conference
|
26
26
|
@invited_by = invited_by
|
27
27
|
@organization = @conference.organization
|
28
28
|
@locator = Decidim::ResourceLocatorPresenter.new(@conference)
|
29
|
+
@registration_type = registration_type
|
29
30
|
|
30
31
|
subject = I18n.t("invite.subject", scope: "decidim.conferences.mailer.invite_join_conference_mailer")
|
31
32
|
mail(to: user.email, subject: subject)
|