spina-admin-conferences 1.3.3
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +101 -0
- data/Rakefile +40 -0
- data/app/assets/config/spina_admin_conferences_manifest.js +4 -0
- data/app/assets/javascripts/spina/admin/conferences/application.es6 +20 -0
- data/app/assets/javascripts/spina/admin/conferences/controllers/conference_events_form_controller.es6 +175 -0
- data/app/assets/javascripts/spina/admin/conferences/controllers/presentation_attachments_form_controller.es6 +175 -0
- data/app/assets/javascripts/spina/admin/conferences/controllers/select_options_controller.es6 +216 -0
- data/app/assets/stylesheets/spina/admin/conferences/application.sass +14 -0
- data/app/controllers/spina/admin/conferences/application_controller.rb +20 -0
- data/app/controllers/spina/admin/conferences/conferences_controller.rb +148 -0
- data/app/controllers/spina/admin/conferences/delegates_controller.rb +116 -0
- data/app/controllers/spina/admin/conferences/dietary_requirements_controller.rb +106 -0
- data/app/controllers/spina/admin/conferences/events_controller.rb +24 -0
- data/app/controllers/spina/admin/conferences/institutions_controller.rb +106 -0
- data/app/controllers/spina/admin/conferences/presentation_attachment_types_controller.rb +104 -0
- data/app/controllers/spina/admin/conferences/presentation_attachments_controller.rb +24 -0
- data/app/controllers/spina/admin/conferences/presentation_types_controller.rb +109 -0
- data/app/controllers/spina/admin/conferences/presentations_controller.rb +124 -0
- data/app/controllers/spina/admin/conferences/rooms_controller.rb +109 -0
- data/app/controllers/spina/admin/conferences/sessions_controller.rb +118 -0
- data/app/helpers/spina/admin/conferences/conferences_helper.rb +44 -0
- data/app/jobs/spina/admin/conferences/application_job.rb +11 -0
- data/app/jobs/spina/admin/conferences/delegate_import_job.rb +37 -0
- data/app/jobs/spina/admin/conferences/import_job.rb +26 -0
- data/app/jobs/spina/admin/conferences/presentation_import_job.rb +38 -0
- data/app/mailers/spina/admin/conferences/application_mailer.rb +13 -0
- data/app/models/spina/admin/conferences.rb +11 -0
- data/app/models/spina/admin/conferences/application_record.rb +14 -0
- data/app/models/spina/admin/conferences/conference.rb +152 -0
- data/app/models/spina/admin/conferences/date_part.rb +15 -0
- data/app/models/spina/admin/conferences/delegate.rb +89 -0
- data/app/models/spina/admin/conferences/dietary_requirement.rb +33 -0
- data/app/models/spina/admin/conferences/email_address_part.rb +21 -0
- data/app/models/spina/admin/conferences/event.rb +120 -0
- data/app/models/spina/admin/conferences/institution.rb +46 -0
- data/app/models/spina/admin/conferences/part.rb +20 -0
- data/app/models/spina/admin/conferences/presentation.rb +143 -0
- data/app/models/spina/admin/conferences/presentation_attachment.rb +27 -0
- data/app/models/spina/admin/conferences/presentation_attachment_type.rb +35 -0
- data/app/models/spina/admin/conferences/presentation_type.rb +60 -0
- data/app/models/spina/admin/conferences/room.rb +52 -0
- data/app/models/spina/admin/conferences/session.rb +56 -0
- data/app/models/spina/admin/conferences/time_part.rb +53 -0
- data/app/models/spina/admin/conferences/url_part.rb +21 -0
- data/app/validators/spina/admin/conferences/conference_date_validator.rb +20 -0
- data/app/validators/spina/admin/conferences/email_address_validator.rb +28 -0
- data/app/validators/spina/admin/conferences/finish_date_validator.rb +20 -0
- data/app/validators/spina/admin/conferences/finish_time_validator.rb +20 -0
- data/app/validators/spina/admin/conferences/http_url_validator.rb +28 -0
- data/app/views/layouts/spina/admin/conferences/conferences.html.haml +19 -0
- data/app/views/layouts/spina/admin/conferences/delegates.html.haml +10 -0
- data/app/views/layouts/spina/admin/conferences/dietary_requirements.html.haml +10 -0
- data/app/views/layouts/spina/admin/conferences/institutions.html.haml +17 -0
- data/app/views/layouts/spina/admin/conferences/presentation_attachment_types.html.haml +10 -0
- data/app/views/layouts/spina/admin/conferences/presentations.html.haml +10 -0
- data/app/views/spina/admin/conferences/application/_empty_list.html.haml +3 -0
- data/app/views/spina/admin/conferences/application/_errors.html.haml +11 -0
- data/app/views/spina/admin/conferences/application/_errors.js.erb +2 -0
- data/app/views/spina/admin/conferences/conferences/_conference.html.haml +9 -0
- data/app/views/spina/admin/conferences/conferences/_event_fields.html.haml +39 -0
- data/app/views/spina/admin/conferences/conferences/_event_row.html.haml +5 -0
- data/app/views/spina/admin/conferences/conferences/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml +29 -0
- data/app/views/spina/admin/conferences/conferences/_form_delegates.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_parts.html.haml +15 -0
- data/app/views/spina/admin/conferences/conferences/_form_presentation_types.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_rooms.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_structure.html.haml +19 -0
- data/app/views/spina/admin/conferences/conferences/_form_structure_item.html.haml +13 -0
- data/app/views/spina/admin/conferences/conferences/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/conferences/index.html.haml +18 -0
- data/app/views/spina/admin/conferences/conferences/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/delegates/_delegate.html.haml +13 -0
- data/app/views/spina/admin/conferences/delegates/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/delegates/_form_conferences.html.haml +14 -0
- data/app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml +38 -0
- data/app/views/spina/admin/conferences/delegates/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/delegates/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/delegates/index.html.haml +23 -0
- data/app/views/spina/admin/conferences/delegates/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_dietary_requirement.html.haml +6 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml +12 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml +9 -0
- data/app/views/spina/admin/conferences/dietary_requirements/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/dietary_requirements/index.html.haml +15 -0
- data/app/views/spina/admin/conferences/dietary_requirements/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/events/new.js.erb +27 -0
- data/app/views/spina/admin/conferences/institutions/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/institutions/_form_delegates.html.haml +12 -0
- data/app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml +35 -0
- data/app/views/spina/admin/conferences/institutions/_form_rooms.html.haml +12 -0
- data/app/views/spina/admin/conferences/institutions/_institution.html.haml +7 -0
- data/app/views/spina/admin/conferences/institutions/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/institutions/index.html.haml +16 -0
- data/app/views/spina/admin/conferences/institutions/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/_presentation_attachment_type.html.haml +6 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/index.html.haml +15 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_attachments/new.js.erb +21 -0
- data/app/views/spina/admin/conferences/presentation_types/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml +20 -0
- data/app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/presentation_types/_form_sessions.html.haml +12 -0
- data/app/views/spina/admin/conferences/presentation_types/_presentation_type.html.haml +8 -0
- data/app/views/spina/admin/conferences/presentation_types/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_types/index.html.haml +17 -0
- data/app/views/spina/admin/conferences/presentation_types/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentations/_attachment_fields.html.haml +27 -0
- data/app/views/spina/admin/conferences/presentations/_attachment_row.html.haml +2 -0
- data/app/views/spina/admin/conferences/presentations/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml +55 -0
- data/app/views/spina/admin/conferences/presentations/_form_presenters.html.haml +12 -0
- data/app/views/spina/admin/conferences/presentations/_presentation.html.haml +11 -0
- data/app/views/spina/admin/conferences/presentations/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentations/index.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentations/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/rooms/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/rooms/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/rooms/_form_room_details.html.haml +18 -0
- data/app/views/spina/admin/conferences/rooms/_room.html.haml +8 -0
- data/app/views/spina/admin/conferences/rooms/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/rooms/index.html.haml +17 -0
- data/app/views/spina/admin/conferences/rooms/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/sessions/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/sessions/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/sessions/_form_session_details.html.haml +23 -0
- data/app/views/spina/admin/conferences/sessions/_session.html.haml +8 -0
- data/app/views/spina/admin/conferences/sessions/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/sessions/index.html.haml +17 -0
- data/app/views/spina/admin/conferences/sessions/new.html.haml +1 -0
- data/app/views/spina/admin/hooks/conferences/_head.html.haml +2 -0
- data/app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml +20 -0
- data/app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml +4 -0
- data/app/views/spina/admin/partables/admin/conferences/date_parts/_form.html.haml +5 -0
- data/app/views/spina/admin/partables/admin/conferences/email_address_parts/_form.html.haml +5 -0
- data/app/views/spina/admin/partables/admin/conferences/time_parts/_form.html.haml +7 -0
- data/app/views/spina/admin/partables/admin/conferences/url_parts/_form.html.haml +5 -0
- data/config/initializers/assets.rb +13 -0
- data/config/initializers/types.rb +13 -0
- data/config/locales/en.yml +354 -0
- data/config/routes.rb +27 -0
- data/db/migrate/20180907141228_create_spina_dates.rb +11 -0
- data/db/migrate/20180907141229_create_spina_email_addresses.rb +11 -0
- data/db/migrate/20180907141230_create_spina_urls.rb +11 -0
- data/db/migrate/20180907141231_create_spina_conferences_institutions.rb +12 -0
- data/db/migrate/20180907141232_create_spina_conferences_delegates.rb +15 -0
- data/db/migrate/20180907141234_create_spina_conferences_dietary_requirements.rb +11 -0
- data/db/migrate/20180907141235_create_spina_conferences_conferences.rb +12 -0
- data/db/migrate/20180907141236_create_spina_conferences_presentation_types.rb +13 -0
- data/db/migrate/20180907141238_create_join_table_spina_conferences_conference_delegate.rb +7 -0
- data/db/migrate/20180907141239_create_join_table_spina_conferences_delegate_presentation.rb +7 -0
- data/db/migrate/20180907141240_create_join_table_spina_conferences_delegate_dietary_requirement.rb +7 -0
- data/db/migrate/20180907141242_add_type_to_spina_pages.rb +7 -0
- data/db/migrate/20180907141243_create_spina_conferences_conference_page_parts.rb +14 -0
- data/db/migrate/20180914121905_add_logo_ref_to_spina_conferences_institutions.rb +7 -0
- data/db/migrate/20180916135431_create_spina_conferences_rooms.rb +13 -0
- data/db/migrate/20180916135432_create_spina_conferences_room_possessions.rb +10 -0
- data/db/migrate/20180916135433_create_spina_conferences_room_uses.rb +10 -0
- data/db/migrate/20180916135434_create_spina_conferences_presentations.rb +15 -0
- data/db/migrate/20181009122503_create_spina_times.rb +11 -0
- data/db/migrate/20181009130631_rename_spina_page_parts.rb +10 -0
- data/db/migrate/20181012190811_rename_spina_conferences_page_parts.rb +10 -0
- data/db/migrate/20181012213049_change_start_time_in_spina_conferences_conferences.rb +15 -0
- data/db/migrate/20181012214813_rename_start_time_in_spina_conferences_conferences.rb +7 -0
- data/db/migrate/20181017155705_add_dependent_option_to_foreign_keys.rb +36 -0
- data/db/migrate/20190408131354_change_spina_resources.rb +56 -0
- data/db/migrate/20190622131423_create_spina_conferences_parts.rb +12 -0
- data/db/migrate/20190701174807_remove_spina_conference_pages.rb +199 -0
- data/db/migrate/20190704135524_add_constraints_to_columns.rb +24 -0
- data/db/migrate/20200126034441_create_spina_conferences_presentation_attachment_types.rb +11 -0
- data/db/migrate/20200126213718_create_spina_conferences_presentation_attachments.rb +19 -0
- data/db/migrate/20200420104603_create_spina_conferences_dietary_requirement_name_translations.rb +19 -0
- data/db/migrate/20200420104740_create_spina_conferences_institution_name_and_city_translations.rb +20 -0
- data/db/migrate/20200420105057_create_spina_conferences_presentation_title_and_abstract_translations.rb +20 -0
- data/db/migrate/20200420105144_create_spina_conferences_presentation_attachment_type_name_translations.rb +20 -0
- data/db/migrate/20200420105201_create_spina_conferences_presentation_type_name_translations.rb +19 -0
- data/db/migrate/20200420105458_create_spina_conferences_room_building_and_number_translations.rb +20 -0
- data/db/migrate/20200420110407_move_attributes_to_translation_tables.rb +161 -0
- data/db/migrate/20200420120706_remove_name_from_spina_conferences_dietary_requirements.rb +7 -0
- data/db/migrate/20200420120759_remove_name_and_city_from_spina_conferences_institutions.rb +8 -0
- data/db/migrate/20200420120946_remove_title_and_abstract_from_spina_conferences_presentations.rb +8 -0
- data/db/migrate/20200420121310_remove_name_from_spina_conferences_presentation_attachment_types.rb +7 -0
- data/db/migrate/20200420121321_remove_name_from_spina_conferences_presentation_types.rb +7 -0
- data/db/migrate/20200420121443_remove_building_and_number_from_spina_conferences_rooms.rb +8 -0
- data/db/migrate/20200502133408_create_spina_conferences_conference_name_translations.rb +19 -0
- data/db/migrate/20200502183409_set_name_for_spina_conferences_conferences.rb +47 -0
- data/db/migrate/20200502183410_remove_institution_from_spina_conferences_conferences.rb +8 -0
- data/db/migrate/20200502183719_remove_spina_conferences_room_possessions.rb +60 -0
- data/db/migrate/20200503230732_rename_spina_conferences_room_uses.rb +8 -0
- data/db/migrate/20200510125131_create_spina_conferences_session_name_translations.rb +19 -0
- data/db/migrate/20200802165242_create_spina_conferences_events.rb +13 -0
- data/db/migrate/20200802184921_create_spina_conferences_event_name_description_and_location_translations.rb +21 -0
- data/db/migrate/20200911161632_update_spina_conferences_parts.rb +23 -0
- data/db/migrate/20200911161651_update_spina_parts.rb +37 -0
- data/db/migrate/20200911161726_move_presentation_parts.rb +101 -0
- data/db/migrate/20200911161739_move_conference_parts.rb +219 -0
- data/db/migrate/20201002122517_remove_spina_conferences_conference_page_parts.rb +14 -0
- data/db/migrate/20201007125625_add_timestamps_to_spina_conferences_parts.rb +9 -0
- data/lib/spina/admin/conferences.rb +20 -0
- data/lib/spina/admin/conferences/engine.rb +26 -0
- data/lib/spina/admin/conferences/migration/renaming.rb +81 -0
- data/lib/spina/admin/conferences/railtie.rb +34 -0
- data/lib/spina/admin/conferences/types/interval_type.rb +29 -0
- data/lib/spina/admin/conferences/version.rb +10 -0
- data/lib/tasks/spina/admin/conferences_tasks.rake +4 -0
- metadata +561 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spina
|
|
4
|
+
module Admin
|
|
5
|
+
module Conferences
|
|
6
|
+
# Controller for {Presentation} objects.
|
|
7
|
+
# @see Presentation
|
|
8
|
+
class PresentationsController < ApplicationController
|
|
9
|
+
before_action :set_presentation, only: %i[edit update destroy]
|
|
10
|
+
before_action :set_breadcrumb
|
|
11
|
+
before_action :set_tabs
|
|
12
|
+
before_action :set_conferences, only: %i[new edit]
|
|
13
|
+
|
|
14
|
+
# @!group Actions
|
|
15
|
+
|
|
16
|
+
# Renders a list of presentations.
|
|
17
|
+
# @return [void]
|
|
18
|
+
def index
|
|
19
|
+
@presentations = Presentation.sorted
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Renders a form for a new presentation.
|
|
23
|
+
# @return [void]
|
|
24
|
+
def new
|
|
25
|
+
@presentation = Presentation.new
|
|
26
|
+
add_breadcrumb t('.new')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Renders a form for an existing presentation.
|
|
30
|
+
# @return [void]
|
|
31
|
+
def edit
|
|
32
|
+
add_breadcrumb @presentation.title
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Creates a presentation.
|
|
36
|
+
# @return [void]
|
|
37
|
+
def create # rubocop:disable Metrics/MethodLength
|
|
38
|
+
@presentation = Presentation.new presentation_params
|
|
39
|
+
|
|
40
|
+
if @presentation.save
|
|
41
|
+
redirect_to admin_conferences_presentations_path, success: t('.saved')
|
|
42
|
+
else
|
|
43
|
+
respond_to do |format|
|
|
44
|
+
format.html do
|
|
45
|
+
add_breadcrumb t('.new')
|
|
46
|
+
render :new
|
|
47
|
+
end
|
|
48
|
+
format.js { render partial: 'errors', locals: { errors: @presentation.errors } }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Updates a presentation.
|
|
54
|
+
# @return [void]
|
|
55
|
+
def update # rubocop:disable Metrics/MethodLength
|
|
56
|
+
if @presentation.update(presentation_params)
|
|
57
|
+
redirect_to admin_conferences_presentations_path, success: t('.saved')
|
|
58
|
+
else
|
|
59
|
+
respond_to do |format|
|
|
60
|
+
format.html do
|
|
61
|
+
add_breadcrumb @presentation.title
|
|
62
|
+
render :edit
|
|
63
|
+
end
|
|
64
|
+
format.js { render partial: 'errors', locals: { errors: @presentation.errors } }
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Destroys a presentation.
|
|
70
|
+
# @return [void]
|
|
71
|
+
def destroy # rubocop:disable Metrics/MethodLength
|
|
72
|
+
if @presentation.destroy
|
|
73
|
+
redirect_to admin_conferences_presentations_path, success: t('.destroyed')
|
|
74
|
+
else
|
|
75
|
+
respond_to do |format|
|
|
76
|
+
format.html do
|
|
77
|
+
add_breadcrumb @presentation.title
|
|
78
|
+
render :edit
|
|
79
|
+
end
|
|
80
|
+
format.js { render partial: 'errors', locals: { errors: @presentation.errors } }
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Imports a presentation.
|
|
86
|
+
# @return [void]
|
|
87
|
+
# @see Presentation#import
|
|
88
|
+
def import
|
|
89
|
+
Presentation.import params[:file]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @!endgroup
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
def set_presentation
|
|
97
|
+
@presentation = Presentation.find params[:id]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def set_conferences
|
|
101
|
+
@conferences = Conference.all.to_json methods: %i[name localized_dates],
|
|
102
|
+
include:
|
|
103
|
+
{ presentation_types:
|
|
104
|
+
{ methods: [:name], include: { sessions: { methods: [:name] } } } }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def set_breadcrumb
|
|
108
|
+
add_breadcrumb Presentation.model_name.human(count: 0), admin_conferences_presentations_path
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def set_tabs
|
|
112
|
+
@tabs = %w[presentation_details presenters]
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def presentation_params
|
|
116
|
+
params.require(:admin_conferences_presentation).permit(:title, :abstract, :session_id, :date, :start_time,
|
|
117
|
+
presenter_ids: [],
|
|
118
|
+
attachments_attributes:
|
|
119
|
+
%i[id attachment_id attachment_type_id _destroy])
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spina
|
|
4
|
+
module Admin
|
|
5
|
+
module Conferences
|
|
6
|
+
# Controller for {Room} objects.
|
|
7
|
+
# @see Room
|
|
8
|
+
class RoomsController < ApplicationController
|
|
9
|
+
before_action :set_room, only: %i[edit update destroy]
|
|
10
|
+
before_action :set_breadcrumbs
|
|
11
|
+
before_action :set_tabs
|
|
12
|
+
|
|
13
|
+
layout 'spina/admin/conferences/institutions'
|
|
14
|
+
|
|
15
|
+
# @!group Actions
|
|
16
|
+
|
|
17
|
+
# Renders a list of rooms.
|
|
18
|
+
# @return [void]
|
|
19
|
+
def index
|
|
20
|
+
@rooms = Room.sorted
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Renders a form for a new room.
|
|
24
|
+
# @return [void]
|
|
25
|
+
def new
|
|
26
|
+
@room = Room.new
|
|
27
|
+
add_breadcrumb t('.new')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Renders a form for an existing room.
|
|
31
|
+
# @return [void]
|
|
32
|
+
def edit
|
|
33
|
+
add_breadcrumb @room.name
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Creates a room.
|
|
37
|
+
# @return [void]
|
|
38
|
+
def create # rubocop:disable Metrics/MethodLength
|
|
39
|
+
@room = Room.new(room_params)
|
|
40
|
+
|
|
41
|
+
if @room.save
|
|
42
|
+
redirect_to admin_conferences_rooms_path, success: t('.saved')
|
|
43
|
+
else
|
|
44
|
+
respond_to do |format|
|
|
45
|
+
format.html do
|
|
46
|
+
add_breadcrumb t('.new')
|
|
47
|
+
render :new
|
|
48
|
+
end
|
|
49
|
+
format.js { render partial: 'errors', locals: { errors: @room.errors } }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Updates a room.
|
|
55
|
+
# @return [void]
|
|
56
|
+
def update # rubocop:disable Metrics/MethodLength
|
|
57
|
+
if @room.update(room_params)
|
|
58
|
+
redirect_to admin_conferences_rooms_path, success: t('.saved')
|
|
59
|
+
else
|
|
60
|
+
respond_to do |format|
|
|
61
|
+
format.html do
|
|
62
|
+
add_breadcrumb @room.name
|
|
63
|
+
render :edit
|
|
64
|
+
end
|
|
65
|
+
format.js { render partial: 'errors', locals: { errors: @room.errors } }
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Destroys a room.
|
|
71
|
+
# @return [void]
|
|
72
|
+
def destroy # rubocop:disable Metrics/MethodLength
|
|
73
|
+
if @room.destroy
|
|
74
|
+
redirect_to admin_conferences_rooms_path, success: t('.destroyed')
|
|
75
|
+
else
|
|
76
|
+
respond_to do |format|
|
|
77
|
+
format.html do
|
|
78
|
+
add_breadcrumb @room.name
|
|
79
|
+
render :edit
|
|
80
|
+
end
|
|
81
|
+
format.js { render partial: 'errors', locals: { errors: @room.errors } }
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @!endgroup
|
|
87
|
+
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def set_room
|
|
91
|
+
@room = Room.find params[:id]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def set_breadcrumbs
|
|
95
|
+
add_breadcrumb Institution.model_name.human(count: 0), admin_conferences_institutions_path
|
|
96
|
+
add_breadcrumb Room.model_name.human(count: 0), admin_conferences_rooms_path
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def set_tabs
|
|
100
|
+
@tabs = %w[room_details presentations]
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def room_params
|
|
104
|
+
params.require(:admin_conferences_room).permit(:building, :number, :institution_id)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spina
|
|
4
|
+
module Admin
|
|
5
|
+
module Conferences
|
|
6
|
+
# Controller for {Session} objects.
|
|
7
|
+
# @see Session
|
|
8
|
+
class SessionsController < ApplicationController
|
|
9
|
+
before_action :set_session, only: %i[edit update destroy]
|
|
10
|
+
before_action :set_breadcrumbs
|
|
11
|
+
before_action :set_tabs
|
|
12
|
+
before_action :set_conferences, :set_institutions, only: %i[new edit]
|
|
13
|
+
|
|
14
|
+
layout 'spina/admin/conferences/conferences'
|
|
15
|
+
|
|
16
|
+
# @!group Actions
|
|
17
|
+
|
|
18
|
+
# Renders a list of sessions.
|
|
19
|
+
# @return [void]
|
|
20
|
+
def index
|
|
21
|
+
@sessions = Session.all
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Renders a form for a new session.
|
|
25
|
+
# @return [void]
|
|
26
|
+
def new
|
|
27
|
+
@session = Session.new
|
|
28
|
+
add_breadcrumb t('.new')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Renders a form for an existing session.
|
|
32
|
+
# @return [void]
|
|
33
|
+
def edit
|
|
34
|
+
add_breadcrumb @session.name
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Creates a session.
|
|
38
|
+
# @return [void]
|
|
39
|
+
def create # rubocop:disable Metrics/MethodLength
|
|
40
|
+
@session = Session.new(session_params)
|
|
41
|
+
|
|
42
|
+
if @session.save
|
|
43
|
+
redirect_to admin_conferences_sessions_path, success: t('.saved')
|
|
44
|
+
else
|
|
45
|
+
respond_to do |format|
|
|
46
|
+
format.html do
|
|
47
|
+
add_breadcrumb t('.new')
|
|
48
|
+
render :new
|
|
49
|
+
end
|
|
50
|
+
format.js { render partial: 'errors', locals: { errors: @session.errors } }
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Updates a session.
|
|
56
|
+
# @return [void]
|
|
57
|
+
def update # rubocop:disable Metrics/MethodLength
|
|
58
|
+
if @session.update(session_params)
|
|
59
|
+
redirect_to admin_conferences_sessions_path, success: t('.saved')
|
|
60
|
+
else
|
|
61
|
+
respond_to do |format|
|
|
62
|
+
format.html do
|
|
63
|
+
add_breadcrumb @session.name
|
|
64
|
+
render :edit
|
|
65
|
+
end
|
|
66
|
+
format.js { render partial: 'errors', locals: { errors: @session.errors } }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Destroys a session.
|
|
72
|
+
# @return [void]
|
|
73
|
+
def destroy # rubocop:disable Metrics/MethodLength
|
|
74
|
+
if @session.destroy
|
|
75
|
+
redirect_to admin_conferences_sessions_path, success: t('.destroyed')
|
|
76
|
+
else
|
|
77
|
+
respond_to do |format|
|
|
78
|
+
format.html do
|
|
79
|
+
add_breadcrumb @session.name
|
|
80
|
+
render :edit
|
|
81
|
+
end
|
|
82
|
+
format.js { render partial: 'errors', locals: { errors: @session.errors } }
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# @!endgroup
|
|
88
|
+
|
|
89
|
+
private
|
|
90
|
+
|
|
91
|
+
def set_session
|
|
92
|
+
@session = Session.find params[:id]
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def set_conferences
|
|
96
|
+
@conferences = Conference.all.to_json methods: [:name], include: { presentation_types: { methods: [:name] } }
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def set_institutions
|
|
100
|
+
@institutions = Institution.all.to_json methods: [:name], include: { rooms: { methods: [:name] } }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def set_breadcrumbs
|
|
104
|
+
add_breadcrumb Conference.model_name.human(count: 0), admin_conferences_conferences_path
|
|
105
|
+
add_breadcrumb Session.model_name.human(count: 0), admin_conferences_sessions_path
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def set_tabs
|
|
109
|
+
@tabs = %w[session_details presentations]
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def session_params
|
|
113
|
+
params.require(:admin_conferences_session).permit(:name, :presentation_type_id, :room_id)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spina
|
|
4
|
+
module Admin
|
|
5
|
+
module Conferences
|
|
6
|
+
# Helper for conferences
|
|
7
|
+
module ConferencesHelper
|
|
8
|
+
STRUCTURES = [
|
|
9
|
+
{ name: 'sponsors', structure_parts: [
|
|
10
|
+
{ name: 'name', title: 'Name', partable_type: 'Spina::Line' },
|
|
11
|
+
{ name: 'logo', title: 'Logo', partable_type: 'Spina::Image' },
|
|
12
|
+
{ name: 'website', title: 'Website', partable_type: 'Spina::Admin::Conferences::UrlPart' }
|
|
13
|
+
] }
|
|
14
|
+
].freeze
|
|
15
|
+
|
|
16
|
+
def new_custom_structure_item(form, part)
|
|
17
|
+
item = StructureItem.new
|
|
18
|
+
build_custom_structure_parts(part.name, item)
|
|
19
|
+
fields = form.fields_for(:structure_items, item, child_index: item.object_id) do |builder|
|
|
20
|
+
render('spina/admin/conferences/conferences/form_structure_item', f: builder, structure: part)
|
|
21
|
+
end
|
|
22
|
+
link_to icon('plus'), '#', class: %w[add_structure_item_fields button button-link],
|
|
23
|
+
data: { id: item.object_id, fields: fields.squish }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def build_custom_structure_parts(name, item)
|
|
27
|
+
structure = STRUCTURES.find { |structure_attributes| structure_attributes[:name] == name }
|
|
28
|
+
return item.parts if structure.blank?
|
|
29
|
+
|
|
30
|
+
structure[:structure_parts].map { |part_attributes| build_custom_structure_part(item.parts, part_attributes) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def build_custom_structure_part(parts, part_attributes)
|
|
36
|
+
parts.where(name: part_attributes[:name]).first_or_initialize(**part_attributes).then do |part|
|
|
37
|
+
part.partable ||= part.partable_type.constantize.new
|
|
38
|
+
part
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spina
|
|
4
|
+
module Admin
|
|
5
|
+
module Conferences
|
|
6
|
+
# Job for importing {Delegate} objects.
|
|
7
|
+
# @see Delegate
|
|
8
|
+
class DelegateImportJob < ImportJob
|
|
9
|
+
queue_as :default
|
|
10
|
+
|
|
11
|
+
# Performs the job.
|
|
12
|
+
# @param csv [String] the UTF-8-encoded string to parse as a CSV
|
|
13
|
+
# == Columns
|
|
14
|
+
# The CSV should has the following columns. Make sure to include the column names in the header row.
|
|
15
|
+
# +first_name+:: The first name of the delegate.
|
|
16
|
+
# +last_name+:: The last name of the delegate.
|
|
17
|
+
# +email_address+:: The email address of the delegate.
|
|
18
|
+
# +institution_id+:: The id of the current institution of the delegate.
|
|
19
|
+
# +dietary_requirement_ids+:: The ids of the dietary requirements of the delegate.
|
|
20
|
+
#
|
|
21
|
+
# @return [void]
|
|
22
|
+
def perform(csv)
|
|
23
|
+
Delegate.transaction do
|
|
24
|
+
import(csv) { |row| Delegate.create! delegate_params(row.to_h) }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def delegate_params(params)
|
|
31
|
+
params = ActionController::Parameters.new(params)
|
|
32
|
+
params.permit :first_name, :last_name, :email_address, :institution_id, conference_ids: [], dietary_requirement_ids: []
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|