decidim-meetings 0.5.1 → 0.6.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_meetings_manifest.js +1 -0
- data/app/assets/images/decidim/meetings/icon.svg +5 -1
- data/app/assets/javascripts/decidim/meetings/admin/registrations_form.js.es6 +21 -0
- data/app/commands/decidim/meetings/admin/close_meeting.rb +17 -9
- data/app/commands/decidim/meetings/admin/create_meeting.rb +13 -1
- data/app/commands/decidim/meetings/admin/update_meeting.rb +47 -21
- data/app/commands/decidim/meetings/admin/update_registrations.rb +60 -0
- data/app/commands/decidim/meetings/join_meeting.rb +73 -0
- data/app/commands/decidim/meetings/leave_meeting.rb +39 -0
- data/app/controllers/decidim/meetings/admin/registrations_controller.rb +43 -0
- data/app/controllers/decidim/meetings/registrations_controller.rb +46 -0
- data/app/events/decidim/meetings/close_meeting_event.rb +30 -0
- data/app/events/decidim/meetings/meeting_registrations_enabled_event.rb +39 -0
- data/app/events/decidim/meetings/meeting_registrations_over_percentage_event.rb +43 -0
- data/app/events/decidim/meetings/upcoming_meeting_event.rb +30 -0
- data/app/events/decidim/meetings/update_meeting_event.rb +30 -0
- data/app/forms/decidim/meetings/admin/meeting_form.rb +1 -1
- data/app/forms/decidim/meetings/admin/meeting_registrations_form.rb +32 -0
- data/app/helpers/decidim/meetings/application_helper.rb +1 -0
- data/app/jobs/decidim/meetings/upcoming_meeting_notification_job.rb +33 -0
- data/app/mailers/decidim/meetings/registration_mailer.rb +46 -0
- data/app/models/decidim/meetings/abilities/current_user_ability.rb +43 -0
- data/app/models/decidim/meetings/meeting.rb +42 -0
- data/app/models/decidim/meetings/registration.rb +13 -0
- data/app/serializers/decidim/meetings/registration_serializer.rb +18 -0
- data/app/views/decidim/meetings/admin/meetings/_form.html.erb +3 -3
- data/app/views/decidim/meetings/admin/meetings/index.html.erb +1 -0
- data/app/views/decidim/meetings/admin/registrations/_form.html.erb +33 -0
- data/app/views/decidim/meetings/admin/registrations/edit.html.erb +8 -0
- data/app/views/decidim/meetings/meetings/_filters.html.erb +2 -2
- data/app/views/decidim/meetings/meetings/_registration_confirm.html.erb +15 -0
- data/app/views/decidim/meetings/meetings/show.html.erb +15 -1
- data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +3 -0
- data/config/locales/ca.yml +74 -0
- data/config/locales/en.yml +72 -4
- data/config/locales/es.yml +75 -1
- data/config/locales/eu.yml +78 -3
- data/config/locales/fi.yml +84 -0
- data/config/locales/fr.yml +83 -8
- data/config/locales/it.yml +87 -0
- data/config/locales/nl.yml +169 -0
- data/config/locales/pl.yml +113 -0
- data/config/locales/uk.yml +178 -0
- data/db/migrate/20170810120836_add_registration_attributes_to_meetings.rb +9 -0
- data/db/migrate/20170810131100_create_registrations.rb +14 -0
- data/lib/decidim/meetings/admin_engine.rb +9 -0
- data/lib/decidim/meetings/engine.rb +8 -0
- data/lib/decidim/meetings/feature.rb +39 -9
- data/lib/decidim/meetings/test/factories.rb +11 -0
- metadata +65 -13
- data/config/i18n-tasks.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e7160d0be17585b556a03804913803d2ed3b9e7
|
4
|
+
data.tar.gz: 1f8c5494980d01e5d646f6a84730334939039713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 125da4f22f176a4bbe38ada17bb653f4547932942e489c3f62d0f3daaea9138f8190fb06a70ad9bd9d294b01d29479ee3d52652961e9a906fa5702b21d70f942
|
7
|
+
data.tar.gz: 7b607173e486d993930b11678f1515b2125d6d0a49c0079ac5ca9297f013fd52d4792dc944ad3411424e814836ad0a0cecb8b88ef847be5e3490af16043d37de
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link decidim/meetings/admin/registrations_form.js
|
@@ -1 +1,5 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.02 36.02"
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.02 36.02">
|
2
|
+
<path d="M693.07,543.84a18,18,0,1,1,18-18A18,18,0,0,1,693.07,543.84Zm0-34a16,16,0,1,0,16,16A16,16,0,0,0,693.07,509.83Z" transform="translate(-675.07 -507.83)"/>
|
3
|
+
<path d="M693.07,526.93a4.1,4.1,0,1,1,4.1-4.1A4.1,4.1,0,0,1,693.07,526.93Zm0-6.19a2.1,2.1,0,1,0,2.1,2.1A2.1,2.1,0,0,0,693.07,520.74Z" transform="translate(-675.07 -507.83)"/>
|
4
|
+
<path d="M693.07,536.65a1,1,0,0,1-.67-0.26c-0.29-.26-7.11-6.5-7.11-14a7.78,7.78,0,0,1,15.57,0c0,7.46-6.82,13.71-7.11,14A1,1,0,0,1,693.07,536.65Zm0-20a5.79,5.79,0,0,0-5.78,5.78c0,5.29,4.13,10.11,5.78,11.82,1.65-1.72,5.78-6.54,5.78-11.82A5.79,5.79,0,0,0,693.07,516.64Z" transform="translate(-675.07 -507.83)"/>
|
5
|
+
</svg>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $form = $('.edit_meeting_registrations');
|
3
|
+
|
4
|
+
if ($form.length > 0) {
|
5
|
+
const $registrationsEnabled = $form.find('#meeting_registrations_enabled');
|
6
|
+
const $availableSlots = $form.find('#meeting_available_slots');
|
7
|
+
|
8
|
+
const toggleDisabledFields = () => {
|
9
|
+
const enabled = $registrationsEnabled.prop('checked');
|
10
|
+
$availableSlots.attr('disabled', !enabled);
|
11
|
+
|
12
|
+
$form.find('.editor-container').each((idx, node) => {
|
13
|
+
const quill = Quill.find(node);
|
14
|
+
quill.enable(enabled);
|
15
|
+
})
|
16
|
+
};
|
17
|
+
|
18
|
+
$registrationsEnabled.on('change', toggleDisabledFields);
|
19
|
+
toggleDisabledFields();
|
20
|
+
}
|
21
|
+
});
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
#
|
20
20
|
# Broadcasts :ok if successful, :invalid otherwise.
|
21
21
|
def call
|
22
|
-
return broadcast(:invalid) if
|
22
|
+
return broadcast(:invalid) if form.invalid?
|
23
23
|
|
24
24
|
transaction do
|
25
25
|
close_meeting
|
@@ -31,22 +31,30 @@ module Decidim
|
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
+
attr_reader :form, :meeting
|
35
|
+
|
34
36
|
def close_meeting
|
35
|
-
|
36
|
-
closing_report:
|
37
|
-
attendees_count:
|
38
|
-
contributions_count:
|
39
|
-
attending_organizations:
|
40
|
-
closed_at:
|
37
|
+
meeting.update_attributes!(
|
38
|
+
closing_report: form.closing_report,
|
39
|
+
attendees_count: form.attendees_count,
|
40
|
+
contributions_count: form.contributions_count,
|
41
|
+
attending_organizations: form.attending_organizations,
|
42
|
+
closed_at: form.closed_at
|
43
|
+
)
|
44
|
+
Decidim::EventsManager.publish(
|
45
|
+
event: "decidim.events.meetings.meeting_closed",
|
46
|
+
event_class: Decidim::Meetings::CloseMeetingEvent,
|
47
|
+
resource: meeting,
|
48
|
+
recipient_ids: meeting.followers.pluck(:id)
|
41
49
|
)
|
42
50
|
end
|
43
51
|
|
44
52
|
def proposals
|
45
|
-
|
53
|
+
meeting.sibling_scope(:proposals).where(id: @form.proposal_ids)
|
46
54
|
end
|
47
55
|
|
48
56
|
def link_proposals
|
49
|
-
|
57
|
+
meeting.link_resources(proposals, "proposals_from_meeting")
|
50
58
|
end
|
51
59
|
end
|
52
60
|
end
|
@@ -16,7 +16,11 @@ module Decidim
|
|
16
16
|
def call
|
17
17
|
return broadcast(:invalid) if @form.invalid?
|
18
18
|
|
19
|
-
|
19
|
+
transaction do
|
20
|
+
create_meeting!
|
21
|
+
schedule_upcoming_meeting_notification
|
22
|
+
end
|
23
|
+
|
20
24
|
broadcast(:ok, @meeting)
|
21
25
|
end
|
22
26
|
|
@@ -38,6 +42,14 @@ module Decidim
|
|
38
42
|
feature: @form.current_feature
|
39
43
|
)
|
40
44
|
end
|
45
|
+
|
46
|
+
def schedule_upcoming_meeting_notification
|
47
|
+
checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(@meeting)
|
48
|
+
|
49
|
+
Decidim::Meetings::UpcomingMeetingNotificationJob
|
50
|
+
.set(wait_until: @meeting.start_time - 2.days)
|
51
|
+
.perform_later(@meeting.id, checksum)
|
52
|
+
end
|
41
53
|
end
|
42
54
|
end
|
43
55
|
end
|
@@ -19,38 +19,64 @@ module Decidim
|
|
19
19
|
#
|
20
20
|
# Broadcasts :ok if successful, :invalid otherwise.
|
21
21
|
def call
|
22
|
-
return broadcast(:invalid) if
|
22
|
+
return broadcast(:invalid) if form.invalid?
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
transaction do
|
25
|
+
update_meeting!
|
26
|
+
send_notification if should_notify_followers?
|
27
|
+
schedule_upcoming_meeting_notification if start_time_changed?
|
28
|
+
end
|
29
|
+
|
30
|
+
broadcast(:ok, meeting)
|
26
31
|
end
|
27
32
|
|
28
33
|
private
|
29
34
|
|
35
|
+
attr_reader :form, :meeting
|
36
|
+
|
30
37
|
def update_meeting!
|
31
|
-
|
32
|
-
scope:
|
33
|
-
category:
|
34
|
-
title:
|
35
|
-
description:
|
36
|
-
end_time:
|
37
|
-
start_time:
|
38
|
-
address:
|
39
|
-
latitude:
|
40
|
-
longitude:
|
41
|
-
location:
|
42
|
-
location_hints:
|
38
|
+
meeting.update_attributes!(
|
39
|
+
scope: form.scope,
|
40
|
+
category: form.category,
|
41
|
+
title: form.title,
|
42
|
+
description: form.description,
|
43
|
+
end_time: form.end_time,
|
44
|
+
start_time: form.start_time,
|
45
|
+
address: form.address,
|
46
|
+
latitude: form.latitude,
|
47
|
+
longitude: form.longitude,
|
48
|
+
location: form.location,
|
49
|
+
location_hints: form.location_hints
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def send_notification
|
54
|
+
Decidim::EventsManager.publish(
|
55
|
+
event: "decidim.events.meetings.meeting_updated",
|
56
|
+
event_class: Decidim::Meetings::UpdateMeetingEvent,
|
57
|
+
resource: meeting,
|
58
|
+
recipient_ids: meeting.followers.pluck(:id)
|
43
59
|
)
|
44
60
|
end
|
45
61
|
|
46
|
-
def
|
47
|
-
|
48
|
-
@form.errors.add :address, :invalid unless result
|
49
|
-
result
|
62
|
+
def should_notify_followers?
|
63
|
+
important_attributes.any? { |attr| meeting.previous_changes[attr].present? }
|
50
64
|
end
|
51
65
|
|
52
|
-
def
|
53
|
-
|
66
|
+
def important_attributes
|
67
|
+
%w(start_time end_time address)
|
68
|
+
end
|
69
|
+
|
70
|
+
def start_time_changed?
|
71
|
+
meeting.previous_changes["start_time"].present?
|
72
|
+
end
|
73
|
+
|
74
|
+
def schedule_upcoming_meeting_notification
|
75
|
+
checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(meeting)
|
76
|
+
|
77
|
+
Decidim::Meetings::UpcomingMeetingNotificationJob
|
78
|
+
.set(wait_until: meeting.start_time - 2.days)
|
79
|
+
.perform_later(meeting.id, checksum)
|
54
80
|
end
|
55
81
|
end
|
56
82
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
module Admin
|
6
|
+
# This command is executed when the user updates the meeting registrations.
|
7
|
+
class UpdateRegistrations < Rectify::Command
|
8
|
+
# Initializes a UpdateRegistrations Command.
|
9
|
+
#
|
10
|
+
# form - The form from which to get the data.
|
11
|
+
# meeting - The current instance of the meeting to be updated.
|
12
|
+
def initialize(form, meeting)
|
13
|
+
@form = form
|
14
|
+
@meeting = meeting
|
15
|
+
end
|
16
|
+
|
17
|
+
# Updates the meeting if valid.
|
18
|
+
#
|
19
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
20
|
+
def call
|
21
|
+
meeting.with_lock do
|
22
|
+
return broadcast(:invalid) if form.invalid?
|
23
|
+
update_meeting_registrations
|
24
|
+
send_notification if should_notify_followers?
|
25
|
+
end
|
26
|
+
|
27
|
+
broadcast(:ok)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :form, :meeting
|
33
|
+
|
34
|
+
def update_meeting_registrations
|
35
|
+
meeting.registrations_enabled = form.registrations_enabled
|
36
|
+
|
37
|
+
if form.registrations_enabled
|
38
|
+
meeting.available_slots = form.available_slots
|
39
|
+
meeting.registration_terms = form.registration_terms
|
40
|
+
end
|
41
|
+
|
42
|
+
meeting.save!
|
43
|
+
end
|
44
|
+
|
45
|
+
def send_notification
|
46
|
+
Decidim::EventsManager.publish(
|
47
|
+
event: "decidim.events.meetings.registrations_enabled",
|
48
|
+
event_class: Decidim::Meetings::MeetingRegistrationsEnabledEvent,
|
49
|
+
resource: meeting,
|
50
|
+
recipient_ids: meeting.followers.pluck(:id)
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def should_notify_followers?
|
55
|
+
meeting.previous_changes["registrations_enabled"].present? && meeting.registrations_enabled?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
# This command is executed when the user joins a meeting.
|
6
|
+
class JoinMeeting < Rectify::Command
|
7
|
+
# Initializes a JoinMeeting Command.
|
8
|
+
#
|
9
|
+
# meeting - The current instance of the meeting to be joined.
|
10
|
+
# user - The user joining the meeting.
|
11
|
+
def initialize(meeting, user)
|
12
|
+
@meeting = meeting
|
13
|
+
@user = user
|
14
|
+
end
|
15
|
+
|
16
|
+
# Creates a meeting registration if the meeting has registrations enabled
|
17
|
+
# and there are available slots.
|
18
|
+
#
|
19
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
20
|
+
def call
|
21
|
+
meeting.with_lock do
|
22
|
+
return broadcast(:invalid) unless can_join_meeting?
|
23
|
+
create_registration
|
24
|
+
send_email_confirmation
|
25
|
+
send_notification
|
26
|
+
end
|
27
|
+
broadcast(:ok)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :meeting, :user
|
33
|
+
|
34
|
+
def create_registration
|
35
|
+
Decidim::Meetings::Registration.create!(meeting: meeting, user: user)
|
36
|
+
end
|
37
|
+
|
38
|
+
def can_join_meeting?
|
39
|
+
meeting.registrations_enabled? && meeting.has_available_slots?
|
40
|
+
end
|
41
|
+
|
42
|
+
def send_email_confirmation
|
43
|
+
RegistrationMailer.confirmation(user, meeting).deliver_later
|
44
|
+
end
|
45
|
+
|
46
|
+
def participatory_space_admins
|
47
|
+
@meeting.feature.participatory_space.admins
|
48
|
+
end
|
49
|
+
|
50
|
+
def send_notification
|
51
|
+
return send_notification_over(0.5) if occupied_slots_over?(0.5)
|
52
|
+
return send_notification_over(0.8) if occupied_slots_over?(0.8)
|
53
|
+
send_notification_over(1.0) if occupied_slots_over?(1.0)
|
54
|
+
end
|
55
|
+
|
56
|
+
def send_notification_over(percentage)
|
57
|
+
Decidim::EventsManager.publish(
|
58
|
+
event: "decidim.events.meetings.meeting_registrations_over_percentage",
|
59
|
+
event_class: Decidim::Meetings::MeetingRegistrationsOverPercentageEvent,
|
60
|
+
resource: @meeting,
|
61
|
+
recipient_ids: participatory_space_admins.pluck(:id),
|
62
|
+
extra: {
|
63
|
+
percentage: percentage
|
64
|
+
}
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
def occupied_slots_over?(percentage)
|
69
|
+
@meeting.remaining_slots == (@meeting.available_slots * (1 - percentage)).round
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
# This command is executed when the user leaves a meeting.
|
6
|
+
class LeaveMeeting < Rectify::Command
|
7
|
+
# Initializes a LeaveMeeting Command.
|
8
|
+
#
|
9
|
+
# meeting - The current instance of the meeting to be left.
|
10
|
+
# user - The user leaving the meeting.
|
11
|
+
def initialize(meeting, user)
|
12
|
+
@meeting = meeting
|
13
|
+
@user = user
|
14
|
+
end
|
15
|
+
|
16
|
+
# Destroys a meeting registration if the meeting has registrations enabled
|
17
|
+
# and the registration exists.
|
18
|
+
#
|
19
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
20
|
+
def call
|
21
|
+
@meeting.with_lock do
|
22
|
+
return broadcast(:invalid) unless registration
|
23
|
+
destroy_registration
|
24
|
+
end
|
25
|
+
broadcast(:ok)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def registration
|
31
|
+
@registration ||= Decidim::Meetings::Registration.where(meeting: @meeting, user: @user).first
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy_registration
|
35
|
+
registration.destroy!
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
module Admin
|
6
|
+
# This controller allows an admin to manage meeting registrations from a Participatory Process
|
7
|
+
class RegistrationsController < Admin::ApplicationController
|
8
|
+
def edit
|
9
|
+
@form = MeetingRegistrationsForm.from_model(meeting)
|
10
|
+
end
|
11
|
+
|
12
|
+
def update
|
13
|
+
@form = MeetingRegistrationsForm.from_params(params).with_context(current_organization: meeting.organization, meeting: meeting)
|
14
|
+
|
15
|
+
UpdateRegistrations.call(@form, meeting) do
|
16
|
+
on(:ok) do
|
17
|
+
flash[:notice] = I18n.t("registrations.update.success", scope: "decidim.meetings.admin")
|
18
|
+
redirect_to meetings_path
|
19
|
+
end
|
20
|
+
|
21
|
+
on(:invalid) do
|
22
|
+
flash.now[:alert] = I18n.t("registrations.update.invalid", scope: "decidim.meetings.admin")
|
23
|
+
render action: "edit"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def export
|
29
|
+
format = params[:format]
|
30
|
+
export_data = Decidim::Exporters.find_exporter(format).new(meeting.registrations, Decidim::Meetings::RegistrationSerializer).export
|
31
|
+
|
32
|
+
send_data export_data.read, type: "text/#{format}", filename: export_data.filename("registrations")
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def meeting
|
38
|
+
@meeting ||= Meeting.where(feature: current_feature).find(params[:meeting_id])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
# Exposes the registration resource so users can join and leave meetings.
|
6
|
+
class RegistrationsController < Decidim::Meetings::ApplicationController
|
7
|
+
def create
|
8
|
+
authorize! :join, meeting
|
9
|
+
|
10
|
+
JoinMeeting.call(meeting, current_user) do
|
11
|
+
on(:ok) do
|
12
|
+
flash[:notice] = I18n.t("registrations.create.success", scope: "decidim.meetings")
|
13
|
+
redirect_to meeting_path(meeting)
|
14
|
+
end
|
15
|
+
|
16
|
+
on(:invalid) do
|
17
|
+
flash.now[:alert] = I18n.t("registrations.create.invalid", scope: "decidim.meetings")
|
18
|
+
redirect_to meeting_path(meeting)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def destroy
|
24
|
+
authorize! :leave, meeting
|
25
|
+
|
26
|
+
LeaveMeeting.call(meeting, current_user) do
|
27
|
+
on(:ok) do
|
28
|
+
flash[:notice] = I18n.t("registrations.destroy.success", scope: "decidim.meetings")
|
29
|
+
redirect_to meeting_path(meeting)
|
30
|
+
end
|
31
|
+
|
32
|
+
on(:invalid) do
|
33
|
+
flash.now[:alert] = I18n.t("registrations.destroy.invalid", scope: "decidim.meetings")
|
34
|
+
redirect_to meeting_path(meeting)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def meeting
|
42
|
+
@meeting ||= Meeting.where(feature: current_feature).find(params[:meeting_id])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen-string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
class CloseMeetingEvent < Decidim::Events::BaseEvent
|
6
|
+
include Decidim::Events::EmailEvent
|
7
|
+
include Decidim::Events::NotificationEvent
|
8
|
+
|
9
|
+
def email_subject
|
10
|
+
I18n.t("decidim.meetings.events.close_meeting_event.email_subject", resource_title: resource_title)
|
11
|
+
end
|
12
|
+
|
13
|
+
def email_intro
|
14
|
+
I18n.t("decidim.meetings.events.close_meeting_event.email_intro", resource_title: resource_title)
|
15
|
+
end
|
16
|
+
|
17
|
+
def email_outro
|
18
|
+
I18n.t("decidim.meetings.events.close_meeting_event.email_outro", resource_title: resource_title)
|
19
|
+
end
|
20
|
+
|
21
|
+
def notification_title
|
22
|
+
I18n.t(
|
23
|
+
"decidim.meetings.events.close_meeting_event.notification_title",
|
24
|
+
resource_title: resource_title,
|
25
|
+
resource_path: resource_path
|
26
|
+
).html_safe
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen-string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
class MeetingRegistrationsEnabledEvent < Decidim::Events::BaseEvent
|
6
|
+
include Decidim::Events::EmailEvent
|
7
|
+
include Decidim::Events::NotificationEvent
|
8
|
+
|
9
|
+
def email_subject
|
10
|
+
I18n.t(
|
11
|
+
"decidim.meetings.events.meeting_registrations_enabled.email_subject",
|
12
|
+
resource_title: resource_title
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def email_intro
|
17
|
+
I18n.t(
|
18
|
+
"decidim.meetings.events.meeting_registrations_enabled.email_intro",
|
19
|
+
resource_title: resource_title
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def email_outro
|
24
|
+
I18n.t(
|
25
|
+
"decidim.meetings.events.meeting_registrations_enabled.email_outro",
|
26
|
+
resource_title: resource_title
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def notification_title
|
31
|
+
I18n.t(
|
32
|
+
"decidim.meetings.events.meeting_registrations_enabled.notification_title",
|
33
|
+
resource_title: resource_title,
|
34
|
+
resource_path: resource_path
|
35
|
+
).html_safe
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen-string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
class MeetingRegistrationsOverPercentageEvent < Decidim::Events::BaseEvent
|
6
|
+
include Decidim::Events::EmailEvent
|
7
|
+
include Decidim::Events::NotificationEvent
|
8
|
+
|
9
|
+
def email_subject
|
10
|
+
I18n.t(
|
11
|
+
"decidim.meetings.events.meeting_registrations_over_percentage.email_subject",
|
12
|
+
resource_title: resource_title,
|
13
|
+
percentage: extra["percentage"] * 100
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def email_intro
|
18
|
+
I18n.t(
|
19
|
+
"decidim.meetings.events.meeting_registrations_over_percentage.email_intro",
|
20
|
+
resource_title: resource_title,
|
21
|
+
percentage: extra["percentage"] * 100
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def email_outro
|
26
|
+
I18n.t(
|
27
|
+
"decidim.meetings.events.meeting_registrations_over_percentage.email_outro",
|
28
|
+
resource_title: resource_title,
|
29
|
+
percentage: extra["percentage"] * 100
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def notification_title
|
34
|
+
I18n.t(
|
35
|
+
"decidim.meetings.events.meeting_registrations_over_percentage.notification_title",
|
36
|
+
resource_title: resource_title,
|
37
|
+
resource_path: resource_path,
|
38
|
+
percentage: extra["percentage"] * 100
|
39
|
+
).html_safe
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
class UpcomingMeetingEvent < Decidim::Events::BaseEvent
|
6
|
+
include Decidim::Events::EmailEvent
|
7
|
+
include Decidim::Events::NotificationEvent
|
8
|
+
|
9
|
+
def email_subject
|
10
|
+
I18n.t("decidim.meetings.events.upcoming_meeting_event.email_subject", resource_title: resource_title)
|
11
|
+
end
|
12
|
+
|
13
|
+
def email_intro
|
14
|
+
I18n.t("decidim.meetings.events.upcoming_meeting_event.email_intro", resource_title: resource_title)
|
15
|
+
end
|
16
|
+
|
17
|
+
def email_outro
|
18
|
+
I18n.t("decidim.meetings.events.upcoming_meeting_event.email_outro", resource_title: resource_title)
|
19
|
+
end
|
20
|
+
|
21
|
+
def notification_title
|
22
|
+
I18n.t(
|
23
|
+
"decidim.meetings.events.upcoming_meeting_event.notification_title",
|
24
|
+
resource_title: resource_title,
|
25
|
+
resource_path: resource_path
|
26
|
+
).html_safe
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Meetings
|
5
|
+
class UpdateMeetingEvent < Decidim::Events::BaseEvent
|
6
|
+
include Decidim::Events::EmailEvent
|
7
|
+
include Decidim::Events::NotificationEvent
|
8
|
+
|
9
|
+
def email_subject
|
10
|
+
I18n.t("decidim.meetings.events.update_meeting_event.email_subject", resource_title: resource_title)
|
11
|
+
end
|
12
|
+
|
13
|
+
def email_intro
|
14
|
+
I18n.t("decidim.meetings.events.update_meeting_event.email_intro", resource_title: resource_title)
|
15
|
+
end
|
16
|
+
|
17
|
+
def email_outro
|
18
|
+
I18n.t("decidim.meetings.events.update_meeting_event.email_outro", resource_title: resource_title)
|
19
|
+
end
|
20
|
+
|
21
|
+
def notification_title
|
22
|
+
I18n.t(
|
23
|
+
"decidim.meetings.events.update_meeting_event.notification_title",
|
24
|
+
resource_title: resource_title,
|
25
|
+
resource_path: resource_path
|
26
|
+
).html_safe
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|