spina-admin-conferences 1.3.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -10
  3. data/app/assets/config/spina_admin_conferences_manifest.js +2 -2
  4. data/app/assets/javascripts/{spina/admin/conferences/controllers/conference_events_form_controller.es6 → controllers/spina/admin/conferences/conference_events_form_controller.js} +3 -4
  5. data/app/assets/javascripts/{spina/admin/conferences/controllers/presentation_attachments_form_controller.es6 → controllers/spina/admin/conferences/presentation_attachments_form_controller.js} +3 -4
  6. data/app/assets/javascripts/{spina/admin/conferences/controllers/select_options_controller.es6 → controllers/spina/admin/conferences/select_options_controller.js} +8 -9
  7. data/app/assets/javascripts/importmap.json.erb +6 -0
  8. data/app/assets/javascripts/spina/admin/conferences/application.js +4 -0
  9. data/app/assets/stylesheets/spina/admin/conferences/application.sass +3 -14
  10. data/app/controllers/spina/admin/conferences/application_controller.rb +6 -3
  11. data/app/controllers/spina/admin/conferences/conferences_controller.rb +21 -30
  12. data/app/controllers/spina/admin/conferences/delegates_controller.rb +5 -7
  13. data/app/controllers/spina/admin/conferences/dietary_requirements_controller.rb +4 -4
  14. data/app/controllers/spina/admin/conferences/institutions_controller.rb +4 -4
  15. data/app/controllers/spina/admin/conferences/presentation_attachment_types_controller.rb +4 -4
  16. data/app/controllers/spina/admin/conferences/presentation_types_controller.rb +4 -4
  17. data/app/controllers/spina/admin/conferences/presentations_controller.rb +7 -8
  18. data/app/controllers/spina/admin/conferences/rooms_controller.rb +4 -4
  19. data/app/controllers/spina/admin/conferences/sessions_controller.rb +4 -4
  20. data/app/jobs/spina/admin/conferences/presentation_import_job.rb +2 -3
  21. data/app/models/spina/admin/conferences/conference.rb +4 -7
  22. data/app/models/spina/admin/conferences/event.rb +21 -58
  23. data/app/models/spina/admin/conferences/presentation.rb +15 -33
  24. data/app/models/spina/parts/admin/conferences/date.rb +14 -0
  25. data/app/models/spina/parts/admin/conferences/email_address.rb +20 -0
  26. data/app/models/spina/parts/admin/conferences/time.rb +14 -0
  27. data/app/models/spina/parts/admin/conferences/url.rb +20 -0
  28. data/app/views/layouts/spina/admin/conferences/application.html.haml +6 -0
  29. data/app/views/layouts/spina/admin/conferences/conferences.html.haml +2 -4
  30. data/app/views/layouts/spina/admin/conferences/delegates.html.haml +2 -4
  31. data/app/views/layouts/spina/admin/conferences/dietary_requirements.html.haml +2 -4
  32. data/app/views/layouts/spina/admin/conferences/institutions.html.haml +2 -4
  33. data/app/views/layouts/spina/admin/conferences/presentation_attachment_types.html.haml +2 -4
  34. data/app/views/layouts/spina/admin/conferences/presentations.html.haml +2 -4
  35. data/app/views/spina/admin/conferences/{delegates/_form_conferences.html.haml → application/_conferences.html.haml} +2 -4
  36. data/app/views/spina/admin/conferences/{conferences/_form_delegates.html.haml → application/_delegates.html.haml} +2 -3
  37. data/app/views/spina/admin/conferences/application/_dietary_requirements.html.haml +9 -0
  38. data/app/views/spina/admin/conferences/application/_errors.turbo_stream.haml +1 -0
  39. data/app/views/spina/admin/conferences/application/_institutions.html.haml +10 -0
  40. data/app/views/spina/admin/conferences/application/_presentation_attachment_types.html.haml +10 -0
  41. data/app/views/spina/admin/conferences/{conferences/_form_presentation_types.html.haml → application/_presentation_types.html.haml} +2 -3
  42. data/app/views/spina/admin/conferences/{rooms/_form_presentations.html.haml → application/_presentations.html.haml} +2 -3
  43. data/app/views/spina/admin/conferences/{conferences/_form_rooms.html.haml → application/_rooms.html.haml} +2 -3
  44. data/app/views/spina/admin/conferences/{presentation_types/_form_sessions.html.haml → application/_sessions.html.haml} +2 -3
  45. data/app/views/spina/admin/conferences/conferences/_event_fields.html.haml +18 -25
  46. data/app/views/spina/admin/conferences/conferences/_event_row.html.haml +2 -2
  47. data/app/views/spina/admin/conferences/conferences/_form.html.haml +7 -3
  48. data/app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml +22 -24
  49. data/app/views/spina/admin/conferences/conferences/_form_parts.html.haml +7 -14
  50. data/app/views/spina/admin/conferences/conferences/index.html.haml +1 -13
  51. data/app/views/spina/admin/conferences/delegates/_form.html.haml +4 -3
  52. data/app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml +47 -32
  53. data/app/views/spina/admin/conferences/delegates/index.html.haml +1 -12
  54. data/app/views/spina/admin/conferences/dietary_requirements/_form.html.haml +3 -3
  55. data/app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml +7 -8
  56. data/app/views/spina/admin/conferences/dietary_requirements/index.html.haml +1 -10
  57. data/app/views/spina/admin/conferences/events/new.js.erb +3 -9
  58. data/app/views/spina/admin/conferences/institutions/_form.html.haml +4 -3
  59. data/app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml +29 -35
  60. data/app/views/spina/admin/conferences/institutions/index.html.haml +1 -11
  61. data/app/views/spina/admin/conferences/presentation_attachment_types/_form.html.haml +3 -3
  62. data/app/views/spina/admin/conferences/presentation_attachment_types/index.html.haml +1 -10
  63. data/app/views/spina/admin/conferences/presentation_attachments/new.js.erb +3 -3
  64. data/app/views/spina/admin/conferences/presentation_types/_form.html.haml +4 -3
  65. data/app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml +13 -17
  66. data/app/views/spina/admin/conferences/presentation_types/index.html.haml +1 -12
  67. data/app/views/spina/admin/conferences/presentations/_attachment_fields.html.haml +10 -19
  68. data/app/views/spina/admin/conferences/presentations/_attachment_row.html.haml +2 -2
  69. data/app/views/spina/admin/conferences/presentations/_form.html.haml +3 -3
  70. data/app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml +56 -55
  71. data/app/views/spina/admin/conferences/presentations/index.html.haml +1 -12
  72. data/app/views/spina/admin/conferences/rooms/_form.html.haml +3 -3
  73. data/app/views/spina/admin/conferences/rooms/_form_room_details.html.haml +13 -15
  74. data/app/views/spina/admin/conferences/rooms/index.html.haml +1 -12
  75. data/app/views/spina/admin/conferences/sessions/_form.html.haml +3 -3
  76. data/app/views/spina/admin/conferences/sessions/_form_session_details.html.haml +18 -20
  77. data/app/views/spina/admin/conferences/sessions/_session.html.haml +1 -1
  78. data/app/views/spina/admin/conferences/sessions/index.html.haml +1 -12
  79. data/app/views/spina/admin/hooks/conferences/_head.html.haml +5 -0
  80. data/app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml +15 -14
  81. data/app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml +4 -2
  82. data/app/views/spina/admin/parts/admin/conferences/dates/_form.html.haml +2 -0
  83. data/app/views/spina/admin/parts/admin/conferences/email_addresses/_form.html.haml +2 -0
  84. data/app/views/spina/admin/parts/admin/conferences/times/_form.html.haml +2 -0
  85. data/app/views/spina/admin/parts/admin/conferences/urls/_form.html.haml +2 -0
  86. data/config/initializers/assets.rb +1 -1
  87. data/config/locales/en.yml +26 -29
  88. data/db/migrate/20210315164409_add_json_attributes_to_spina_conferences_presentations.rb +7 -0
  89. data/db/migrate/20210315164410_add_json_attributes_to_spina_conferences_conferences.rb +7 -0
  90. data/db/migrate/20210315164411_convert_partables_to_json.rb +407 -0
  91. data/lib/spina/admin/conferences.rb +2 -0
  92. data/lib/spina/admin/conferences/engine.rb +7 -0
  93. data/lib/spina/admin/conferences/version.rb +1 -1
  94. data/lib/tasks/spina/admin/conferences_tasks.rake +11 -1
  95. metadata +85 -61
  96. data/app/assets/javascripts/spina/admin/conferences/application.es6 +0 -20
  97. data/app/helpers/spina/admin/conferences/conferences_helper.rb +0 -44
  98. data/app/models/spina/admin/conferences/date_part.rb +0 -15
  99. data/app/models/spina/admin/conferences/email_address_part.rb +0 -21
  100. data/app/models/spina/admin/conferences/part.rb +0 -20
  101. data/app/models/spina/admin/conferences/time_part.rb +0 -53
  102. data/app/models/spina/admin/conferences/url_part.rb +0 -21
  103. data/app/views/spina/admin/conferences/application/_errors.js.erb +0 -2
  104. data/app/views/spina/admin/conferences/conferences/_form_presentations.html.haml +0 -12
  105. data/app/views/spina/admin/conferences/delegates/_form_presentations.html.haml +0 -12
  106. data/app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml +0 -12
  107. data/app/views/spina/admin/conferences/institutions/_form_delegates.html.haml +0 -12
  108. data/app/views/spina/admin/conferences/institutions/_form_rooms.html.haml +0 -12
  109. data/app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml +0 -12
  110. data/app/views/spina/admin/conferences/presentations/_form_presenters.html.haml +0 -12
  111. data/app/views/spina/admin/conferences/sessions/_form_presentations.html.haml +0 -12
  112. data/app/views/spina/admin/partables/admin/conferences/date_parts/_form.html.haml +0 -5
  113. data/app/views/spina/admin/partables/admin/conferences/email_address_parts/_form.html.haml +0 -5
  114. data/app/views/spina/admin/partables/admin/conferences/time_parts/_form.html.haml +0 -7
  115. data/app/views/spina/admin/partables/admin/conferences/url_parts/_form.html.haml +0 -5
  116. data/config/initializers/types.rb +0 -13
  117. data/lib/spina/admin/conferences/types/interval_type.rb +0 -29
@@ -1,44 +0,0 @@
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
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Admin
5
- module Conferences
6
- # Date parts, without associated times.
7
- class DatePart < ApplicationRecord
8
- has_many :page_parts, as: :page_partable
9
- has_many :parts, as: :partable
10
- has_many :layout_parts, as: :layout_partable
11
- has_many :structure_parts, as: :structure_partable
12
- end
13
- end
14
- end
15
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Admin
5
- module Conferences
6
- # Email address parts. The format is validated.
7
- #
8
- # = Validators
9
- # Email address (using {EmailAddressValidator}):: {#content}.
10
- # @see EmailAddressValidator
11
- class EmailAddressPart < ApplicationRecord
12
- has_many :page_parts, as: :page_partable
13
- has_many :parts, as: :partable
14
- has_many :layout_parts, as: :layout_partable
15
- has_many :structure_parts, as: :structure_partable
16
-
17
- validates :content, 'spina/admin/conferences/email_address': true, allow_blank: true
18
- end
19
- end
20
- end
21
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Admin
5
- module Conferences
6
- # Join records between partables and pageables.
7
- class Part < ApplicationRecord
8
- include Spina::Part
9
- include Spina::Optionable
10
-
11
- belongs_to :pageable, inverse_of: :parts, polymorphic: true, touch: true
12
- belongs_to :partable, polymorphic: true, optional: true
13
-
14
- accepts_nested_attributes_for :partable
15
-
16
- validates :name, uniqueness: { scope: :pageable_id }
17
- end
18
- end
19
- end
20
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Admin
5
- module Conferences
6
- # Time parts.
7
- class TimePart < ApplicationRecord
8
- has_many :page_parts, as: :page_partable
9
- has_many :parts, as: :partable
10
- has_many :layout_parts, as: :layout_partable
11
- has_many :structure_parts, as: :structure_partable
12
-
13
- # @return [Date, nil] the date of the time part. Nil if the time part has no date and time
14
- def date
15
- return if content.blank?
16
-
17
- content.to_date
18
- end
19
-
20
- # Sets the date of the time part.
21
- # @param date [Date] the new date
22
- # @return [void]
23
- def date=(date)
24
- if date.blank? || date.to_date.blank?
25
- self.content = nil
26
- return
27
- end
28
-
29
- self.content = date.to_date + (content.try(:seconds_since_midnight) || 0).seconds
30
- end
31
-
32
- # @return [ActiveSupport::TimeWithZone, nil] the time of the time part. Nil if the time part has no date and time
33
- def time
34
- return if content.blank?
35
-
36
- content
37
- end
38
-
39
- # Sets the start time of the time part.
40
- # @param time [ActiveSupport::TimeWithZone] the new time
41
- # @return [void]
42
- def time=(time)
43
- if time.blank?
44
- self.content = nil
45
- return
46
- end
47
-
48
- self.content = Time.parse(time, date).to_datetime.in_time_zone
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Admin
5
- module Conferences
6
- # URL parts. The format is validated.
7
- #
8
- # = Validators
9
- # HTTP(S) URL (using {HttpUrlValidator}):: {#content}.
10
- # @see HttpUrlValidator
11
- class UrlPart < ApplicationRecord
12
- has_many :page_parts, as: :page_partable
13
- has_many :parts, as: :partable
14
- has_many :layout_parts, as: :layout_partable
15
- has_many :structure_parts, as: :structure_partable
16
-
17
- validates :content, 'spina/admin/conferences/http_url': true, allow_blank: true
18
- end
19
- end
20
- end
21
- end
@@ -1,2 +0,0 @@
1
- document.querySelector('aside#notifications')
2
- .insertAdjacentHTML('beforeend', '<%= j(render partial: 'errors', formats: :html, locals: { errors: errors }) %>');
@@ -1,12 +0,0 @@
1
- #presentations.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :conference
7
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :title
8
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :presenters
9
- %th
10
-
11
- %tbody
12
- = render @conference.presentations.any? ? @conference.presentations : 'empty_list', message: t('spina.admin.conferences.presentations.index.no_presentations')
@@ -1,12 +0,0 @@
1
- #presentations.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :conference
7
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :title
8
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :presenters
9
- %th
10
-
11
- %tbody
12
- = render @delegate.presentations.any? ? @delegate.presentations : 'empty_list', message: t('spina.admin.conferences.presentations.index.no_presentations')
@@ -1,12 +0,0 @@
1
- #delegates.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :name
7
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :email_address
8
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :institution
9
- %th
10
-
11
- %tbody
12
- = render @dietary_requirement.delegates.any? ? @dietary_requirement.delegates : 'empty_list', message: t('spina.admin.conferences.delegates.index.no_delegates')
@@ -1,12 +0,0 @@
1
- #delegates.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :name
7
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :email_address
8
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :institution
9
- %th
10
-
11
- %tbody
12
- = render @institution.delegates.any? ? @institution.delegates : 'empty_list', message: t('spina.admin.conferences.delegates.index.no_delegates')
@@ -1,12 +0,0 @@
1
- #rooms.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Room.human_attribute_name :institution
7
- %th= Spina::Admin::Conferences::Room.human_attribute_name :building
8
- %th= Spina::Admin::Conferences::Room.human_attribute_name :number
9
- %th
10
-
11
- %tbody
12
- = render @institution.rooms.any? ? @institution.rooms : 'empty_list', message: t('spina.admin.conferences.rooms.index.no_rooms')
@@ -1,12 +0,0 @@
1
- #presentations.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :conference
7
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :title
8
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :presenters
9
- %th
10
-
11
- %tbody
12
- = render @presentation_type.presentations.any? ? @presentation_type.presentations : 'empty_list', message: t('spina.admin.conferences.presentations.index.no_presentations')
@@ -1,12 +0,0 @@
1
- #presenters.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :name
7
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :email_address
8
- %th= Spina::Admin::Conferences::Delegate.human_attribute_name :institution
9
- %th
10
-
11
- %tbody
12
- = render @presentation.presenters.any? ? @presentation.presenters : 'empty_list', message: t('spina.admin.conferences.presenters.no_presenters')
@@ -1,12 +0,0 @@
1
- #presentations.tab-content.well
2
- .table-container
3
- %table.table
4
- %thead
5
- %tr
6
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :conference
7
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :title
8
- %th= Spina::Admin::Conferences::Presentation.human_attribute_name :presenters
9
- %th
10
-
11
- %tbody
12
- = render @session.presentations.any? ? @session.presentations : 'empty_list', message: t('spina.admin.conferences.presentations.index.no_presentations')
@@ -1,5 +0,0 @@
1
- .horizontal-form-label
2
- = f.object.title
3
- .horizontal-form-content
4
- = f.fields_for :partable, f.object.partable do |ff|
5
- = ff.date_field :content, class: 'conference-datepicker'
@@ -1,5 +0,0 @@
1
- .horizontal-form-label
2
- = f.object.title
3
- .horizontal-form-content
4
- = f.fields_for :partable, f.object.partable do |ff|
5
- = ff.email_field :content
@@ -1,7 +0,0 @@
1
- .horizontal-form-label
2
- = f.object.title
3
- = f.fields_for :partable, f.object.partable do |ff|
4
- .horizontal-form-content
5
- .input-group
6
- = ff.date_field :date, class: 'conference-datepicker'
7
- = ff.time_field :time
@@ -1,5 +0,0 @@
1
- .horizontal-form-label
2
- = f.object.title
3
- .horizontal-form-content
4
- = f.fields_for :partable, f.object.partable do |ff|
5
- = ff.url_field :content
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spina/admin/conferences/types/interval_type'
4
-
5
- ActiveRecord::Type.register :interval, Spina::Admin::Conferences::IntervalType, adapter: :postgresql
6
-
7
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
8
- alias_method :configure_connection_without_interval, :configure_connection
9
- define_method :configure_connection do
10
- configure_connection_without_interval
11
- execute 'SET IntervalStyle = iso_8601', 'SCHEMA'
12
- end
13
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Admin
5
- module Conferences
6
- # This type maps between ActiveSupport::Duration and interval in PostgreSQL
7
- class IntervalType < ActiveRecord::Type::Value
8
- def cast(value)
9
- case value
10
- when ::ActiveSupport::Duration
11
- value
12
- when ::String
13
- ::ActiveSupport::Duration.parse(value)
14
- when ::Integer
15
- ::ActiveSupport::Duration.build(value)
16
- end
17
- rescue ActiveSupport::Duration::ISO8601Parser::ParsingError
18
- nil
19
- end
20
-
21
- def serialize(value)
22
- return unless value.class == ::ActiveSupport::Duration
23
-
24
- value.iso8601
25
- end
26
- end
27
- end
28
- end
29
- end