decidim-conferences 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +38 -0
- data/Rakefile +3 -0
- data/app/assets/config/admin/decidim_conferences_manifest.js +2 -0
- data/app/assets/config/decidim_conferences_manifest.js +2 -0
- data/app/assets/images/decidim/conferences/conference.svg +6 -0
- data/app/assets/javascripts/decidim/conferences/admin/conference_invite_form.es6 +25 -0
- data/app/assets/javascripts/decidim/conferences/admin/conference_speakers.js.es6 +26 -0
- data/app/assets/javascripts/decidim/conferences/admin/conferences.js.es6 +30 -0
- data/app/assets/javascripts/decidim/conferences/conferences.js.es6 +0 -0
- data/app/cells/decidim/conferences/conference_address/show.erb +11 -0
- data/app/cells/decidim/conferences/conference_address_cell.rb +11 -0
- data/app/cells/decidim/conferences/conference_cell.rb +19 -0
- data/app/cells/decidim/conferences/conference_m/footer.erb +9 -0
- data/app/cells/decidim/conferences/conference_m/tags.erb +1 -0
- data/app/cells/decidim/conferences/conference_m_cell.rb +38 -0
- data/app/cells/decidim/conferences/conference_speaker/show.erb +84 -0
- data/app/cells/decidim/conferences/conference_speaker_cell.rb +86 -0
- data/app/cells/decidim/conferences/content_blocks/highlighted_conferences/show.erb +31 -0
- data/app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb +28 -0
- data/app/cells/decidim/conferences/join_conference_button/registration_confirm.erb +15 -0
- data/app/cells/decidim/conferences/join_conference_button/show.erb +25 -0
- data/app/cells/decidim/conferences/join_conference_button_cell.rb +42 -0
- data/app/cells/decidim/conferences/linked_participatory_spaces/show.erb +10 -0
- data/app/cells/decidim/conferences/linked_participatory_spaces_cell.rb +44 -0
- data/app/cells/decidim/conferences/media_link/show.erb +9 -0
- data/app/cells/decidim/conferences/media_link_cell.rb +14 -0
- data/app/cells/decidim/conferences/partner/show.erb +11 -0
- data/app/cells/decidim/conferences/partner_cell.rb +24 -0
- data/app/cells/decidim/conferences/photo/show.erb +28 -0
- data/app/cells/decidim/conferences/photo_cell.rb +41 -0
- data/app/cells/decidim/conferences/photos_list/show.erb +8 -0
- data/app/cells/decidim/conferences/photos_list_cell.rb +17 -0
- data/app/commands/decidim/conferences/admin/copy_conference.rb +80 -0
- data/app/commands/decidim/conferences/admin/create_conference.rb +120 -0
- data/app/commands/decidim/conferences/admin/create_conference_admin.rb +112 -0
- data/app/commands/decidim/conferences/admin/create_conference_speaker.rb +81 -0
- data/app/commands/decidim/conferences/admin/create_media_link.rb +66 -0
- data/app/commands/decidim/conferences/admin/create_partner.rb +68 -0
- data/app/commands/decidim/conferences/admin/destroy_conference_admin.rb +53 -0
- data/app/commands/decidim/conferences/admin/destroy_conference_speaker.rb +56 -0
- data/app/commands/decidim/conferences/admin/destroy_media_link.rb +56 -0
- data/app/commands/decidim/conferences/admin/destroy_partner.rb +56 -0
- data/app/commands/decidim/conferences/admin/export_conference_registrations.rb +44 -0
- data/app/commands/decidim/conferences/admin/invite_user_to_join_conference.rb +107 -0
- data/app/commands/decidim/conferences/admin/publish_conference.rb +39 -0
- data/app/commands/decidim/conferences/admin/unpublish_conference.rb +39 -0
- data/app/commands/decidim/conferences/admin/update_conference.rb +161 -0
- data/app/commands/decidim/conferences/admin/update_conference_admin.rb +52 -0
- data/app/commands/decidim/conferences/admin/update_conference_speaker.rb +80 -0
- data/app/commands/decidim/conferences/admin/update_media_link.rb +64 -0
- data/app/commands/decidim/conferences/admin/update_partner.rb +63 -0
- data/app/commands/decidim/conferences/decline_invitation.rb +45 -0
- data/app/commands/decidim/conferences/join_conference.rb +88 -0
- data/app/commands/decidim/conferences/leave_conference.rb +52 -0
- data/app/constraints/decidim/conferences/current_component.rb +28 -0
- data/app/constraints/decidim/conferences/current_conference.rb +43 -0
- data/app/controllers/concerns/decidim/conferences/admin/conference_context.rb +19 -0
- data/app/controllers/decidim/conferences/admin/application_controller.rb +25 -0
- data/app/controllers/decidim/conferences/admin/categories_controller.rb +13 -0
- data/app/controllers/decidim/conferences/admin/component_permissions_controller.rb +14 -0
- data/app/controllers/decidim/conferences/admin/components_controller.rb +14 -0
- data/app/controllers/decidim/conferences/admin/concerns/conference_admin.rb +48 -0
- data/app/controllers/decidim/conferences/admin/conference_attachment_collections_controller.rb +26 -0
- data/app/controllers/decidim/conferences/admin/conference_attachments_controller.rb +27 -0
- data/app/controllers/decidim/conferences/admin/conference_copies_controller.rb +35 -0
- data/app/controllers/decidim/conferences/admin/conference_invites_controller.rb +55 -0
- data/app/controllers/decidim/conferences/admin/conference_publications_controller.rb +45 -0
- data/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb +39 -0
- data/app/controllers/decidim/conferences/admin/conference_speakers_controller.rb +86 -0
- data/app/controllers/decidim/conferences/admin/conference_user_roles_controller.rb +101 -0
- data/app/controllers/decidim/conferences/admin/conferences_controller.rb +103 -0
- data/app/controllers/decidim/conferences/admin/exports_controller.rb +14 -0
- data/app/controllers/decidim/conferences/admin/media_links_controller.rb +82 -0
- data/app/controllers/decidim/conferences/admin/moderations_controller.rb +12 -0
- data/app/controllers/decidim/conferences/admin/partners_controller.rb +83 -0
- data/app/controllers/decidim/conferences/application_controller.rb +32 -0
- data/app/controllers/decidim/conferences/conference_program_controller.rb +50 -0
- data/app/controllers/decidim/conferences/conference_registrations_controller.rb +68 -0
- data/app/controllers/decidim/conferences/conference_speakers_controller.rb +39 -0
- data/app/controllers/decidim/conferences/conference_widgets_controller.rb +23 -0
- data/app/controllers/decidim/conferences/conferences_controller.rb +59 -0
- data/app/controllers/decidim/conferences/media_controller.rb +41 -0
- data/app/events/decidim/conferences/conference_registrations_enabled_event.rb +8 -0
- data/app/events/decidim/conferences/conference_registrations_over_percentage_event.rb +13 -0
- data/app/events/decidim/conferences/upcoming_conference_event.rb +8 -0
- data/app/events/decidim/conferences/update_conference_event.rb +8 -0
- data/app/forms/decidim/conferences/admin/conference_copy_form.rb +34 -0
- data/app/forms/decidim/conferences/admin/conference_form.rb +109 -0
- data/app/forms/decidim/conferences/admin/conference_registration_invite_form.rb +24 -0
- data/app/forms/decidim/conferences/admin/conference_speaker_form.rb +76 -0
- data/app/forms/decidim/conferences/admin/conference_user_role_form.rb +30 -0
- data/app/forms/decidim/conferences/admin/media_link_form.rb +42 -0
- data/app/forms/decidim/conferences/admin/partner_form.rb +53 -0
- data/app/helpers/decidim/conferences/admin/conference_speakers_helper.rb +14 -0
- data/app/helpers/decidim/conferences/admin/conferences_helper.rb +28 -0
- data/app/helpers/decidim/conferences/conference_program_helper.rb +21 -0
- data/app/helpers/decidim/conferences/media_attachments_helper.rb +29 -0
- data/app/helpers/decidim/conferences/partners_helper.rb +15 -0
- data/app/jobs/decidim/conferences/upcoming_conference_notification_job.rb +33 -0
- data/app/mailers/decidim/conferences/admin/invite_join_conference_mailer.rb +43 -0
- data/app/mailers/decidim/conferences/conference_registration_mailer.rb +44 -0
- data/app/models/decidim/conference.rb +90 -0
- data/app/models/decidim/conference_meeting.rb +9 -0
- data/app/models/decidim/conference_speaker.rb +34 -0
- data/app/models/decidim/conference_speaker_conference_meeting.rb +8 -0
- data/app/models/decidim/conference_user_role.rb +30 -0
- data/app/models/decidim/conferences/conference_invite.rb +38 -0
- data/app/models/decidim/conferences/conference_registration.rb +23 -0
- data/app/models/decidim/conferences/media_link.rb +17 -0
- data/app/models/decidim/conferences/partner.rb +25 -0
- data/app/permissions/decidim/conferences/permissions.rb +304 -0
- data/app/presenters/decidim/admin/conference_speaker_presenter.rb +18 -0
- data/app/presenters/decidim/conference_meeting_presenter.rb +7 -0
- data/app/presenters/decidim/conference_speaker_presenter.rb +42 -0
- data/app/presenters/decidim/conferences/admin_log/conference_invite_presenter.rb +35 -0
- data/app/presenters/decidim/conferences/admin_log/conference_speaker_presenter.rb +52 -0
- data/app/presenters/decidim/conferences/admin_log/conferences_presenter.rb +55 -0
- data/app/presenters/decidim/conferences/admin_log/conferences_user_role_presenter.rb +53 -0
- data/app/presenters/decidim/conferences/admin_log/media_link_presenter.rb +45 -0
- data/app/presenters/decidim/conferences/admin_log/partner_presenter.rb +47 -0
- data/app/presenters/decidim/conferences/admin_log/value_types/role_presenter.rb +22 -0
- data/app/presenters/decidim/conferences/conference_invite_presenter.rb +26 -0
- data/app/presenters/decidim/conferences/conference_stats_presenter.rb +52 -0
- data/app/presenters/decidim/log/value_types/conference_presenter.rb +28 -0
- data/app/queries/decidim/conferences/admin/admin_users.rb +39 -0
- data/app/queries/decidim/conferences/admin/conference_invites.rb +59 -0
- data/app/queries/decidim/conferences/admin/conference_speakers.rb +40 -0
- data/app/queries/decidim/conferences/conference_program_meetings.rb +17 -0
- data/app/queries/decidim/conferences/conference_program_meetings_by_day.rb +20 -0
- data/app/queries/decidim/conferences/conferences_with_user_role.rb +48 -0
- data/app/queries/decidim/conferences/organization_conferences.rb +16 -0
- data/app/queries/decidim/conferences/organization_prioritized_conferences.rb +21 -0
- data/app/queries/decidim/conferences/organization_published_conferences.rb +21 -0
- data/app/queries/decidim/conferences/prioritized_conferences.rb +13 -0
- data/app/queries/decidim/conferences/promoted_conferences.rb +12 -0
- data/app/queries/decidim/conferences/published_conferences.rb +12 -0
- data/app/queries/decidim/conferences/visible_conferences.rb +12 -0
- data/app/serializers/decidim/conferences/conference_registration_serializer.rb +18 -0
- data/app/serializers/decidim/conferences/data_portability_conference_invite_serializer.rb +31 -0
- data/app/serializers/decidim/conferences/data_portability_conference_registration_serializer.rb +28 -0
- data/app/uploaders/decidim/conferences/partner_logo_uploader.rb +15 -0
- data/app/views/decidim/conference_speakers/_conference_speaker.html.erb +1 -0
- data/app/views/decidim/conferences/_conference.html.erb +1 -0
- data/app/views/decidim/conferences/_order_by_conferences.html.erb +3 -0
- data/app/views/decidim/conferences/admin/conference_copies/_form.html.erb +37 -0
- data/app/views/decidim/conferences/admin/conference_copies/new.html.erb +7 -0
- data/app/views/decidim/conferences/admin/conference_invites/_form.html.erb +30 -0
- data/app/views/decidim/conferences/admin/conference_invites/index.html.erb +83 -0
- data/app/views/decidim/conferences/admin/conference_invites/new.html.erb +21 -0
- data/app/views/decidim/conferences/admin/conference_registrations/index.html.erb +43 -0
- data/app/views/decidim/conferences/admin/conference_speakers/_form.html.erb +61 -0
- data/app/views/decidim/conferences/admin/conference_speakers/edit.html.erb +7 -0
- data/app/views/decidim/conferences/admin/conference_speakers/index.html.erb +68 -0
- data/app/views/decidim/conferences/admin/conference_speakers/new.html.erb +7 -0
- data/app/views/decidim/conferences/admin/conference_user_roles/_form.html.erb +22 -0
- data/app/views/decidim/conferences/admin/conference_user_roles/edit.html.erb +7 -0
- data/app/views/decidim/conferences/admin/conference_user_roles/index.html.erb +65 -0
- data/app/views/decidim/conferences/admin/conference_user_roles/new.html.erb +7 -0
- data/app/views/decidim/conferences/admin/conferences/_form.html.erb +122 -0
- data/app/views/decidim/conferences/admin/conferences/edit.html.erb +18 -0
- data/app/views/decidim/conferences/admin/conferences/index.html.erb +65 -0
- data/app/views/decidim/conferences/admin/conferences/new.html.erb +11 -0
- data/app/views/decidim/conferences/admin/invite_join_conference_mailer/invite.html.erb +12 -0
- data/app/views/decidim/conferences/admin/media_links/_form.html.erb +25 -0
- data/app/views/decidim/conferences/admin/media_links/edit.html.erb +7 -0
- data/app/views/decidim/conferences/admin/media_links/index.html.erb +51 -0
- data/app/views/decidim/conferences/admin/media_links/new.html.erb +7 -0
- data/app/views/decidim/conferences/admin/partners/_form.html.erb +30 -0
- data/app/views/decidim/conferences/admin/partners/edit.html.erb +7 -0
- data/app/views/decidim/conferences/admin/partners/index.html.erb +56 -0
- data/app/views/decidim/conferences/admin/partners/new.html.erb +7 -0
- data/app/views/decidim/conferences/conference_program/_program_item.html.erb +31 -0
- data/app/views/decidim/conferences/conference_program/_program_meeting.html.erb +68 -0
- data/app/views/decidim/conferences/conference_program/show.html.erb +54 -0
- data/app/views/decidim/conferences/conference_registration_mailer/confirmation.html.erb +3 -0
- data/app/views/decidim/conferences/conference_speakers/index.html.erb +19 -0
- data/app/views/decidim/conferences/conference_widgets/show.html.erb +11 -0
- data/app/views/decidim/conferences/conferences/_conferences_sidebar.html.erb +11 -0
- data/app/views/decidim/conferences/conferences/_partners.html.erb +15 -0
- data/app/views/decidim/conferences/conferences/_promoted_conference.html.erb +27 -0
- data/app/views/decidim/conferences/conferences/_statistics.html.erb +10 -0
- data/app/views/decidim/conferences/conferences/index.html.erb +25 -0
- data/app/views/decidim/conferences/conferences/show.html.erb +105 -0
- data/app/views/decidim/conferences/media/_attachments.html.erb +6 -0
- data/app/views/decidim/conferences/media/index.html.erb +31 -0
- data/app/views/devise/mailer/join_conference.html.erb +13 -0
- data/app/views/devise/mailer/join_conference.text.erb +11 -0
- data/app/views/layouts/decidim/_conference_hero.html.erb +44 -0
- data/app/views/layouts/decidim/_conferences_nav.html.erb +90 -0
- data/app/views/layouts/decidim/admin/conference.html.erb +100 -0
- data/app/views/layouts/decidim/admin/conferences.html.erb +11 -0
- data/app/views/layouts/decidim/conference.html.erb +28 -0
- data/config/locales/ca.yml +464 -0
- data/config/locales/de.yml +464 -0
- data/config/locales/en.yml +467 -0
- data/config/locales/es-PY.yml +464 -0
- data/config/locales/es.yml +464 -0
- data/config/locales/eu.yml +464 -0
- data/config/locales/fi.yml +464 -0
- data/config/locales/fr.yml +464 -0
- data/config/locales/gl.yml +464 -0
- data/config/locales/hu.yml +464 -0
- data/config/locales/it.yml +464 -0
- data/config/locales/nl.yml +464 -0
- data/config/locales/pl.yml +476 -0
- data/config/locales/pt-BR.yml +464 -0
- data/config/locales/pt.yml +464 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/sv.yml +464 -0
- data/config/locales/uk.yml +1 -0
- data/db/migrate/20180626151505_add_conferences.rb +40 -0
- data/db/migrate/20180626152015_add_conference_user_roles.rb +17 -0
- data/db/migrate/20180702084256_add_conference_speakers.rb +19 -0
- data/db/migrate/20180706104306_add_conference_invites.rb +16 -0
- data/db/migrate/20180706104825_add_conference_registrations.rb +17 -0
- data/db/migrate/20181004144411_add_conferences_partner.rb +18 -0
- data/db/migrate/20181010133930_add_relation_between_speaker_and_meeting.rb +10 -0
- data/db/migrate/20181015100301_add_conference_media_link.rb +15 -0
- data/db/seeds/Exampledocument.pdf +0 -0
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/db/seeds/homepage_image.jpg +0 -0
- data/db/seeds/logo.png +0 -0
- data/lib/decidim/conferences.rb +12 -0
- data/lib/decidim/conferences/admin.rb +10 -0
- data/lib/decidim/conferences/admin_engine.rb +86 -0
- data/lib/decidim/conferences/engine.rb +80 -0
- data/lib/decidim/conferences/participatory_space.rb +177 -0
- data/lib/decidim/conferences/test/factories.rb +153 -0
- data/lib/decidim/conferences/version.rb +10 -0
- metadata +330 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Log
|
5
|
+
module ValueTypes
|
6
|
+
# This class presents the given value as a Decidim::Conference. Check
|
7
|
+
# the `DefaultPresenter` for more info on how value
|
8
|
+
# presenters work.
|
9
|
+
class ConferencePresenter < DefaultPresenter
|
10
|
+
# Public: Presents the value as a Decidim::Conference. If the conference
|
11
|
+
# can be found, it shows its title. Otherwise it shows its ID.
|
12
|
+
#
|
13
|
+
# Returns an HTML-safe String.
|
14
|
+
def present
|
15
|
+
return unless value
|
16
|
+
return h.translated_attribute(conference.title) if conference
|
17
|
+
I18n.t("not_found", id: value, scope: "decidim.log.value_types.conference_presenter")
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def conference
|
23
|
+
@conference ||= Decidim::Conference.find_by(id: value)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A class used to find the admins for an conference.
|
7
|
+
class AdminUsers < Rectify::Query
|
8
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
9
|
+
#
|
10
|
+
# conference - an conference that needs to find its conference admins
|
11
|
+
def self.for(conference)
|
12
|
+
new(conference).query
|
13
|
+
end
|
14
|
+
|
15
|
+
# Initializes the class.
|
16
|
+
#
|
17
|
+
# conference - an conference that needs to find its conference admins
|
18
|
+
def initialize(conference)
|
19
|
+
@conference = conference
|
20
|
+
end
|
21
|
+
|
22
|
+
# Finds organization admins and the users with role admin for the given conference.
|
23
|
+
#
|
24
|
+
# Returns an ActiveRecord::Relation.
|
25
|
+
def query
|
26
|
+
Decidim::User.where(id: organization_admins)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :conference
|
32
|
+
|
33
|
+
def organization_admins
|
34
|
+
conference.organization.admins
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A class used to find the ConferenceInvites by their status status.
|
7
|
+
class ConferenceInvites < Rectify::Query
|
8
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
9
|
+
#
|
10
|
+
# conference_invites - the initial Invites relation that needs to be filtered.
|
11
|
+
# query - query to filter conference_invites
|
12
|
+
# status - invite status to be used as a filter
|
13
|
+
def self.for(conference_invites, query = nil, status = nil)
|
14
|
+
new(conference_invites, query, status).query
|
15
|
+
end
|
16
|
+
|
17
|
+
# Initializes the class.
|
18
|
+
#
|
19
|
+
# conference_invites - the initial Invites relation that need to be filtered
|
20
|
+
# query - query to filter conference_invites
|
21
|
+
# status - invite status to be used as a filter
|
22
|
+
def initialize(conference_invites, query = nil, status = nil)
|
23
|
+
@conference_invites = conference_invites
|
24
|
+
@query = query
|
25
|
+
@status = status
|
26
|
+
end
|
27
|
+
|
28
|
+
# List the conference_invites by the different filters.
|
29
|
+
def query
|
30
|
+
@conference_invites = filter_by_search(@conference_invites)
|
31
|
+
@conference_invites = filter_by_status(@conference_invites)
|
32
|
+
@conference_invites
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def filter_by_search(conference_invites)
|
38
|
+
return conference_invites if @query.blank?
|
39
|
+
conference_invites.joins(:user).where(
|
40
|
+
User.arel_table[:name].lower.matches("%#{@query}%").or(User.arel_table[:email].lower.matches("%#{@query}%"))
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def filter_by_status(conference_invites)
|
45
|
+
case @status
|
46
|
+
when "accepted"
|
47
|
+
conference_invites.where.not(accepted_at: nil)
|
48
|
+
when "rejected"
|
49
|
+
conference_invites.where.not(rejected_at: nil)
|
50
|
+
when "sent"
|
51
|
+
conference_invites.where.not(sent_at: nil).where(accepted_at: nil, rejected_at: nil)
|
52
|
+
else
|
53
|
+
conference_invites
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
module Admin
|
6
|
+
# A class used to find the ConferenceSpeakers's by the search.
|
7
|
+
class ConferenceSpeakers < Rectify::Query
|
8
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
9
|
+
#
|
10
|
+
# conference_speakers - the initial ConferenceSpeaker relation that needs to be filtered.
|
11
|
+
# query - query to filter user group names
|
12
|
+
def self.for(conference_speakers, query = nil)
|
13
|
+
new(conference_speakers, query).query
|
14
|
+
end
|
15
|
+
|
16
|
+
# Initializes the class.
|
17
|
+
#
|
18
|
+
# conference_speakers - the ConferenceSpeaker relation that need to be filtered
|
19
|
+
# query - query to filter user group names
|
20
|
+
def initialize(conference_speakers, query = nil)
|
21
|
+
@conference_speakers = conference_speakers
|
22
|
+
@query = query
|
23
|
+
end
|
24
|
+
|
25
|
+
# List the conference speakers by the different filters.
|
26
|
+
def query
|
27
|
+
@conference_speakers = filter_by_search(@conference_speakers)
|
28
|
+
@conference_speakers
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def filter_by_search(conference_speakers)
|
34
|
+
return conference_speakers if @query.blank?
|
35
|
+
conference_speakers.where("LOWER(full_name) LIKE LOWER(?)", "%#{@query}%")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# This query class filters meetings for component and day
|
6
|
+
class ConferenceProgramMeetings < Rectify::Query
|
7
|
+
def initialize(component, user = nil)
|
8
|
+
@component = component
|
9
|
+
@user = user
|
10
|
+
end
|
11
|
+
|
12
|
+
def query
|
13
|
+
Decidim::Meetings::Meeting.where(component: @component).visible_meeting_for(@user)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# This query class filters meetings for component and day
|
6
|
+
class ConferenceProgramMeetingsByDay < Rectify::Query
|
7
|
+
def initialize(component, day, user = nil)
|
8
|
+
@component = component
|
9
|
+
@day = day
|
10
|
+
@user = user
|
11
|
+
end
|
12
|
+
|
13
|
+
def query
|
14
|
+
Rectify::Query.merge(
|
15
|
+
ConferenceProgramMeetings.new(@component, @user)
|
16
|
+
).query.where(start_time: @day.beginning_of_day..@day.end_of_day).order(start_time: :asc)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# A class used to find the Conferences that the given user has
|
6
|
+
# the specific role privilege.
|
7
|
+
class ConferencesWithUserRole < Rectify::Query
|
8
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
9
|
+
#
|
10
|
+
# user - a User that needs to find which conferences can manage
|
11
|
+
# role - (optional) a Symbol to specify the role privilege
|
12
|
+
def self.for(user, role = :any)
|
13
|
+
new(user, role).query
|
14
|
+
end
|
15
|
+
|
16
|
+
# Initializes the class.
|
17
|
+
#
|
18
|
+
# user - a User that needs to find which conferences can manage
|
19
|
+
# role - (optional) a Symbol to specify the role privilege
|
20
|
+
def initialize(user, role = :any)
|
21
|
+
@user = user
|
22
|
+
@role = role
|
23
|
+
end
|
24
|
+
|
25
|
+
# Finds the Conferences that the given user has role privileges.
|
26
|
+
# If the special role ':any' is provided it returns all conferences where
|
27
|
+
# the user has some kind of role privilege.
|
28
|
+
#
|
29
|
+
# Returns an ActiveRecord::Relation.
|
30
|
+
def query
|
31
|
+
# Admin users have all role privileges for all organization conferences
|
32
|
+
return Conferences::OrganizationConferences.new(user.organization).query if user.admin?
|
33
|
+
|
34
|
+
Conference.where(id: conference_ids)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
attr_reader :user, :role
|
40
|
+
|
41
|
+
def conference_ids
|
42
|
+
user_roles = ConferenceUserRole.where(user: user) if role == :any
|
43
|
+
user_roles = ConferenceUserRole.where(user: user, role: role) if role != :any
|
44
|
+
user_roles.pluck(:decidim_conference_id)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# This query class filters all conferences given an organization.
|
6
|
+
class OrganizationConferences < Rectify::Query
|
7
|
+
def initialize(organization)
|
8
|
+
@organization = organization
|
9
|
+
end
|
10
|
+
|
11
|
+
def query
|
12
|
+
Decidim::Conference.where(organization: @organization)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# This query class filters public conferences given an organization in a
|
6
|
+
# meaningful prioritized order.
|
7
|
+
class OrganizationPrioritizedConferences < Rectify::Query
|
8
|
+
def initialize(organization, user = nil)
|
9
|
+
@organization = organization
|
10
|
+
@user = user
|
11
|
+
end
|
12
|
+
|
13
|
+
def query
|
14
|
+
Rectify::Query.merge(
|
15
|
+
OrganizationPublishedConferences.new(@organization, @user),
|
16
|
+
PrioritizedConferences.new
|
17
|
+
).query
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# This query class filters published conferences given an organization.
|
6
|
+
class OrganizationPublishedConferences < Rectify::Query
|
7
|
+
def initialize(organization, user = nil)
|
8
|
+
@organization = organization
|
9
|
+
@user = user
|
10
|
+
end
|
11
|
+
|
12
|
+
def query
|
13
|
+
Rectify::Query.merge(
|
14
|
+
OrganizationConferences.new(@organization),
|
15
|
+
VisibleConferences.new(@user),
|
16
|
+
PublishedConferences.new
|
17
|
+
).query
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
# This query orders conferences by importance, prioritizing promoted
|
6
|
+
# conferences.
|
7
|
+
class PrioritizedConferences < Rectify::Query
|
8
|
+
def query
|
9
|
+
Decidim::Conference.order(promoted: :desc)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
class ConferenceRegistrationSerializer < Decidim::Exporters::Serializer
|
6
|
+
# Serializes a conference registration
|
7
|
+
def serialize
|
8
|
+
{
|
9
|
+
id: resource.id,
|
10
|
+
user: {
|
11
|
+
name: resource.user.name,
|
12
|
+
email: resource.user.email
|
13
|
+
}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
class DataPortabilityConferenceInviteSerializer < Decidim::Exporters::Serializer
|
6
|
+
# Serializes a conference invite for data portability
|
7
|
+
def serialize
|
8
|
+
{
|
9
|
+
id: resource.id,
|
10
|
+
sent_at: resource.sent_at,
|
11
|
+
accepted_at: resource.accepted_at,
|
12
|
+
rejected_at: resource.rejected_at,
|
13
|
+
user: {
|
14
|
+
name: resource.user.name,
|
15
|
+
email: resource.user.email
|
16
|
+
},
|
17
|
+
conference: {
|
18
|
+
title: resource.conference.title,
|
19
|
+
reference: resource.conference.reference,
|
20
|
+
slogan: resource.conference.slogan,
|
21
|
+
description: resource.conference.description,
|
22
|
+
start_date: resource.conference.start_date,
|
23
|
+
end_date: resource.conference.end_date,
|
24
|
+
location: resource.conference.location,
|
25
|
+
objectives: resource.conference.objectives
|
26
|
+
}
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/app/serializers/decidim/conferences/data_portability_conference_registration_serializer.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Conferences
|
5
|
+
class DataPortabilityConferenceRegistrationSerializer < Decidim::Exporters::Serializer
|
6
|
+
# Serializes a registration for data portability
|
7
|
+
def serialize
|
8
|
+
{
|
9
|
+
id: resource.id,
|
10
|
+
user: {
|
11
|
+
name: resource.user.name,
|
12
|
+
email: resource.user.email
|
13
|
+
},
|
14
|
+
conference: {
|
15
|
+
title: resource.conference.title,
|
16
|
+
reference: resource.conference.reference,
|
17
|
+
slogan: resource.conference.slogan,
|
18
|
+
description: resource.conference.description,
|
19
|
+
start_date: resource.conference.start_date,
|
20
|
+
end_date: resource.conference.end_date,
|
21
|
+
location: resource.conference.location,
|
22
|
+
objectives: resource.conference.objectives
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|