spina-admin-conferences 1.3.6 → 2.0.0.alpha

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.
Files changed (119) 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/20200911161739_move_conference_parts.rb +10 -8
  89. data/db/migrate/20201007125625_add_timestamps_to_spina_conferences_parts.rb +4 -3
  90. data/db/migrate/20210315164409_add_json_attributes_to_spina_conferences_presentations.rb +7 -0
  91. data/db/migrate/20210315164410_add_json_attributes_to_spina_conferences_conferences.rb +7 -0
  92. data/db/migrate/20210315164411_convert_partables_to_json.rb +407 -0
  93. data/lib/spina/admin/conferences.rb +2 -0
  94. data/lib/spina/admin/conferences/engine.rb +7 -0
  95. data/lib/spina/admin/conferences/version.rb +1 -1
  96. data/lib/tasks/spina/admin/conferences_tasks.rake +11 -1
  97. metadata +87 -63
  98. data/app/assets/javascripts/spina/admin/conferences/application.es6 +0 -20
  99. data/app/helpers/spina/admin/conferences/conferences_helper.rb +0 -44
  100. data/app/models/spina/admin/conferences/date_part.rb +0 -15
  101. data/app/models/spina/admin/conferences/email_address_part.rb +0 -21
  102. data/app/models/spina/admin/conferences/part.rb +0 -20
  103. data/app/models/spina/admin/conferences/time_part.rb +0 -53
  104. data/app/models/spina/admin/conferences/url_part.rb +0 -21
  105. data/app/views/spina/admin/conferences/application/_errors.js.erb +0 -2
  106. data/app/views/spina/admin/conferences/conferences/_form_presentations.html.haml +0 -12
  107. data/app/views/spina/admin/conferences/delegates/_form_presentations.html.haml +0 -12
  108. data/app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml +0 -12
  109. data/app/views/spina/admin/conferences/institutions/_form_delegates.html.haml +0 -12
  110. data/app/views/spina/admin/conferences/institutions/_form_rooms.html.haml +0 -12
  111. data/app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml +0 -12
  112. data/app/views/spina/admin/conferences/presentations/_form_presenters.html.haml +0 -12
  113. data/app/views/spina/admin/conferences/sessions/_form_presentations.html.haml +0 -12
  114. data/app/views/spina/admin/partables/admin/conferences/date_parts/_form.html.haml +0 -5
  115. data/app/views/spina/admin/partables/admin/conferences/email_address_parts/_form.html.haml +0 -5
  116. data/app/views/spina/admin/partables/admin/conferences/time_parts/_form.html.haml +0 -7
  117. data/app/views/spina/admin/partables/admin/conferences/url_parts/_form.html.haml +0 -5
  118. data/config/initializers/types.rb +0 -13
  119. data/lib/spina/admin/conferences/types/interval_type.rb +0 -29
@@ -45,7 +45,7 @@ module Spina
45
45
  add_breadcrumb t('.new')
46
46
  render :new
47
47
  end
48
- format.js { render partial: 'errors', locals: { errors: @presentation.errors } }
48
+ format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
49
49
  end
50
50
  end
51
51
  end
@@ -61,7 +61,7 @@ module Spina
61
61
  add_breadcrumb @presentation.title
62
62
  render :edit
63
63
  end
64
- format.js { render partial: 'errors', locals: { errors: @presentation.errors } }
64
+ format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
65
65
  end
66
66
  end
67
67
  end
@@ -77,7 +77,7 @@ module Spina
77
77
  add_breadcrumb @presentation.title
78
78
  render :edit
79
79
  end
80
- format.js { render partial: 'errors', locals: { errors: @presentation.errors } }
80
+ format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
81
81
  end
82
82
  end
83
83
  end
@@ -98,7 +98,7 @@ module Spina
98
98
  end
99
99
 
100
100
  def set_conferences
101
- @conferences = Conference.all.to_json methods: %i[name localized_dates],
101
+ @conferences = Conference.all.to_json methods: %i[name],
102
102
  include:
103
103
  { presentation_types:
104
104
  { methods: [:name], include: { sessions: { methods: [:name] } } } }
@@ -113,10 +113,9 @@ module Spina
113
113
  end
114
114
 
115
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])
116
+ params.require(:presentation).permit(:title, :abstract, :session_id, :start_datetime,
117
+ presenter_ids: [],
118
+ attachments_attributes: %i[id attachment_id attachment_type_id _destroy])
120
119
  end
121
120
  end
122
121
  end
@@ -46,7 +46,7 @@ module Spina
46
46
  add_breadcrumb t('.new')
47
47
  render :new
48
48
  end
49
- format.js { render partial: 'errors', locals: { errors: @room.errors } }
49
+ format.turbo_stream { render partial: 'errors', locals: { errors: @room.errors } }
50
50
  end
51
51
  end
52
52
  end
@@ -62,7 +62,7 @@ module Spina
62
62
  add_breadcrumb @room.name
63
63
  render :edit
64
64
  end
65
- format.js { render partial: 'errors', locals: { errors: @room.errors } }
65
+ format.turbo_stream { render partial: 'errors', locals: { errors: @room.errors } }
66
66
  end
67
67
  end
68
68
  end
@@ -78,7 +78,7 @@ module Spina
78
78
  add_breadcrumb @room.name
79
79
  render :edit
80
80
  end
81
- format.js { render partial: 'errors', locals: { errors: @room.errors } }
81
+ format.turbo_stream { render partial: 'errors', locals: { errors: @room.errors } }
82
82
  end
83
83
  end
84
84
  end
@@ -101,7 +101,7 @@ module Spina
101
101
  end
102
102
 
103
103
  def room_params
104
- params.require(:admin_conferences_room).permit(:building, :number, :institution_id)
104
+ params.require(:room).permit(:building, :number, :institution_id)
105
105
  end
106
106
  end
107
107
  end
@@ -47,7 +47,7 @@ module Spina
47
47
  add_breadcrumb t('.new')
48
48
  render :new
49
49
  end
50
- format.js { render partial: 'errors', locals: { errors: @session.errors } }
50
+ format.turbo_stream { render partial: 'errors', locals: { errors: @session.errors } }
51
51
  end
52
52
  end
53
53
  end
@@ -63,7 +63,7 @@ module Spina
63
63
  add_breadcrumb @session.name
64
64
  render :edit
65
65
  end
66
- format.js { render partial: 'errors', locals: { errors: @session.errors } }
66
+ format.turbo_stream { render partial: 'errors', locals: { errors: @session.errors } }
67
67
  end
68
68
  end
69
69
  end
@@ -79,7 +79,7 @@ module Spina
79
79
  add_breadcrumb @session.name
80
80
  render :edit
81
81
  end
82
- format.js { render partial: 'errors', locals: { errors: @session.errors } }
82
+ format.turbo_stream { render partial: 'errors', locals: { errors: @session.errors } }
83
83
  end
84
84
  end
85
85
  end
@@ -110,7 +110,7 @@ module Spina
110
110
  end
111
111
 
112
112
  def session_params
113
- params.require(:admin_conferences_session).permit(:name, :presentation_type_id, :room_id)
113
+ params.require(:session).permit(:name, :presentation_type_id, :room_id)
114
114
  end
115
115
  end
116
116
  end
@@ -13,8 +13,7 @@ module Spina
13
13
  # == Columns
14
14
  # The CSV should has the following columns. Make sure to include the column names in the header row.
15
15
  # +session_id+:: The id of the associated session.
16
- # +date+:: The date of the presentation, in ISO 8601 format.
17
- # +start_time+:: The start time of the presentation, in HH:MM format.
16
+ # +start_datetime+:: The start time of the presentation, in ISO 8601 format.
18
17
  # +title+:: The title of the presentation for the default locale.
19
18
  # +abstract+:: The presentation's abstract.
20
19
  # +presenter_ids+:: The ids of the presenters.
@@ -30,7 +29,7 @@ module Spina
30
29
 
31
30
  def presentation_params(params)
32
31
  params = ActionController::Parameters.new(params)
33
- params.permit :title, :date, :start_time, :abstract, :session_id, presenter_ids: []
32
+ params.permit :title, :start_datetime, :abstract, :session_id, presenter_ids: []
34
33
  end
35
34
  end
36
35
  end
@@ -13,7 +13,10 @@ module Spina
13
13
  # = Translations
14
14
  # - {#name}
15
15
  class Conference < ApplicationRecord
16
- include Partable
16
+ include AttrJson::Record
17
+ include AttrJson::NestedAttributes
18
+ include Spina::Partable
19
+ include Spina::TranslatedContent
17
20
 
18
21
  default_scope { includes(:translations) }
19
22
 
@@ -37,11 +40,6 @@ module Spina
37
40
  # @note Destroying a conference destroys dependent events.
38
41
  # @see Event
39
42
  has_many :events, -> { includes(:translations) }, inverse_of: :conference, dependent: :destroy
40
- # @!attribute [rw] events
41
- # @return [ActiveRecord::Relation] directly associated events
42
- # @note Destroying a conference destroys dependent events.
43
- # @see Event
44
- has_many :parts, as: :pageable, dependent: :destroy
45
43
  # @!attribute [rw] sessions
46
44
  # @return [ActiveRecord::Relation] Sessions associated with {#presentation_types}
47
45
  # @see Session
@@ -68,7 +66,6 @@ module Spina
68
66
  has_and_belongs_to_many :delegates, foreign_key: :spina_conferences_conference_id, # rubocop:disable Rails/HasAndBelongsToMany
69
67
  association_foreign_key: :spina_conferences_delegate_id
70
68
  accepts_nested_attributes_for :events, allow_destroy: true
71
- accepts_nested_attributes_for :parts, allow_destroy: true
72
69
 
73
70
  validates :name, :start_date, :finish_date, :year, presence: true
74
71
  validates :finish_date, 'spina/admin/conferences/finish_date': true, unless: proc { |conference| conference.start_date.blank? }
@@ -6,8 +6,8 @@ module Spina
6
6
  # Events during conferences.
7
7
  #
8
8
  # = Validators
9
- # Presence:: {#name}, {#start_time}, {#finish_time}.
10
- # Conference date (using {ConferenceDateValidator}):: {#start_time}, {#finish_time}.
9
+ # Presence:: {#name}, {#:start_datetime}, {#:finish_datetime}, {#:location}.
10
+ # Conference date (using {ConferenceDateValidator}):: {#start_datetime}, {#finish_datetime}.
11
11
  # @see ConferenceDateValidator
12
12
  #
13
13
  # = Translations
@@ -18,23 +18,36 @@ module Spina
18
18
  default_scope { includes(:translations) }
19
19
 
20
20
  # @!attribute [rw] name
21
- # @return [String, nil] the translated name of the conference
21
+ # @return [String, nil] the translated name of the event
22
22
  # @!attribute [rw] description
23
- # @return [String, nil] the translated description of the conference
23
+ # @return [String, nil] the translated description of the event
24
+ # @!attribute [rw] start_datetime
25
+ # @return [ActiveSupport::TimeWithZone, nil] the start time of the event
26
+ # @!attribute [rw] finish_datetime
27
+ # @return [ActiveSupport::TimeWithZone, nil] the finish time of the event
24
28
  # @!attribute [rw] location
25
- # @return [String, nil] the translated location of the conference
29
+ # @return [String, nil] the translated location of the event
26
30
  translates :name, :description, :location, fallbacks: true
27
31
 
28
32
  # @return [ActiveRecord::Relation] all events, ordered by name
29
33
  scope :sorted, -> { i18n.order :name }
30
34
 
35
+ # @!attribute [rw] start_time
36
+ # @return [ActiveSupport::TimeWithZone, nil] the start time (alias)
37
+ # @see #start_datetime
38
+ alias_attribute :start_time, :start_datetime
39
+ # @!attribute [rw] :finish_time
40
+ # @return [ActiveSupport::TimeWithZone, nil] the finish time (alias)
41
+ # @see #finish_datetime
42
+ alias_attribute :finish_time, :finish_datetime
43
+
31
44
  # @!attribute [rw] conference
32
45
  # @return [Conference, nil] directly associated conferences
33
46
  belongs_to :conference, -> { includes(:translations) }, inverse_of: :events, touch: true
34
47
 
35
- validates :name, :date, :start_time, :start_datetime, :finish_time, :finish_datetime, :location, presence: true
36
- validates :date, 'spina/admin/conferences/conference_date': true
37
- validates :finish_time, 'spina/admin/conferences/finish_time': true
48
+ validates :name, :start_datetime, :finish_datetime, :location, presence: true
49
+ validates :start_datetime, :finish_datetime, 'spina/admin/conferences/conference_date': true
50
+ validates :finish_datetime, 'spina/admin/conferences/finish_time': true
38
51
 
39
52
  # @return [Date, nil] the start date of the event. Nil if the event has no start date and time
40
53
  def date
@@ -43,56 +56,6 @@ module Spina
43
56
  start_datetime.to_date
44
57
  end
45
58
 
46
- # Sets the date of the presentation.
47
- # @param date [Date] the new date
48
- # @return [void]
49
- def date=(date)
50
- if date.blank? || date.to_date.blank?
51
- self.start_datetime = nil
52
- return
53
- end
54
-
55
- self.start_datetime = date.to_date + (start_datetime.try(:seconds_since_midnight) || 0).seconds
56
- end
57
-
58
- # @return [ActiveSupport::TimeWithZone, nil] the start time of the event. Nil if the event has no start date and time
59
- def start_time
60
- return if start_datetime.blank?
61
-
62
- start_datetime
63
- end
64
-
65
- # Sets the start time of the event.
66
- # @param start_time [ActiveSupport::TimeWithZone] the new start time
67
- # @return [void]
68
- def start_time=(start_time)
69
- if start_time.blank?
70
- self.start_datetime = nil
71
- return
72
- end
73
-
74
- self.start_datetime = Time.parse(start_time, date).to_datetime.in_time_zone
75
- end
76
-
77
- # @return [ActiveSupport::TimeWithZone, nil] the finish time of the event. Nil if the event has no finish date and time
78
- def finish_time
79
- return if finish_datetime.blank?
80
-
81
- finish_datetime
82
- end
83
-
84
- # Sets the finish time of the event.
85
- # @param finish_time [ActiveSupport::TimeWithZone] the new finish time
86
- # @return [void]
87
- def finish_time=(finish_time)
88
- if finish_time.blank?
89
- self.finish_datetime = nil
90
- return
91
- end
92
-
93
- self.finish_datetime = Time.parse(finish_time, date).to_datetime.in_time_zone
94
- end
95
-
96
59
  # @return [Icalendar::Event] the event as an iCal event
97
60
  def to_event # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
98
61
  event = Icalendar::Event.new
@@ -15,6 +15,14 @@ module Spina
15
15
  # - {#title}
16
16
  # - {#abstract}
17
17
  class Presentation < ApplicationRecord
18
+ include AttrJson::Record
19
+ include AttrJson::NestedAttributes
20
+ include Spina::Partable
21
+ include Spina::TranslatedContent
22
+
23
+ # @!attribute [rw] start_datetime
24
+ # @return [ActiveSupport::TimeWithZone, nil] the presentation start time
25
+
18
26
  default_scope { includes(:translations) }
19
27
 
20
28
  # @!attribute [rw] title
@@ -65,11 +73,16 @@ module Spina
65
73
  association_foreign_key: :spina_conferences_delegate_id
66
74
  accepts_nested_attributes_for :attachments, allow_destroy: true
67
75
 
68
- validates :title, :date, :start_time, :start_datetime, :abstract, :presenters, presence: true
69
- validates :date, 'spina/admin/conferences/conference_date': true
76
+ validates :title, :start_datetime, :abstract, :presenters, presence: true
77
+ validates :start_datetime, 'spina/admin/conferences/conference_date': true
70
78
  validates_associated :presenters
71
79
  validates_associated :attachments
72
80
 
81
+ # @!attribute [rw] start_time
82
+ # @return [ActiveSupport::TimeWithZone, nil] the start time (alias)
83
+ # @see #start_datetime
84
+ alias_attribute :start_time, :start_datetime
85
+
73
86
  # Imports a presentation from CSV.
74
87
  # @param file [String] the CSV file to be read
75
88
  # @return [void]
@@ -85,37 +98,6 @@ module Spina
85
98
  start_datetime.to_date
86
99
  end
87
100
 
88
- # Sets the date of the presentation.
89
- # @param date [Date] the new date
90
- # @return [void]
91
- def date=(date)
92
- if date.blank? || date.to_date.blank?
93
- self.start_datetime = nil
94
- return
95
- end
96
-
97
- self.start_datetime = date.to_date + (start_datetime.try(:seconds_since_midnight) || 0).seconds
98
- end
99
-
100
- # @return [ActiveSupport::TimeWithZone, nil] the start time of the presentation. Nil if the presentation has no start date and time
101
- def start_time
102
- return if start_datetime.blank?
103
-
104
- start_datetime
105
- end
106
-
107
- # Sets the start time of the presentation.
108
- # @param start_time [ActiveSupport::TimeWithZone] the new start time
109
- # @return [void]
110
- def start_time=(start_time)
111
- if start_time.blank?
112
- self.start_datetime = nil
113
- return
114
- end
115
-
116
- self.start_datetime = Time.parse(start_time, date).to_datetime.in_time_zone
117
- end
118
-
119
101
  # @return [Icalendar::Event] the presentation as an iCal event
120
102
  def to_event # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
121
103
  event = Icalendar::Event.new
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Parts
5
+ module Admin
6
+ module Conferences
7
+ # Date parts, without associated times.
8
+ class Date < Spina::Parts::Base
9
+ attr_json :content, :date
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Parts
5
+ module Admin
6
+ module Conferences
7
+ # Email address parts. The format is validated.
8
+ #
9
+ # = Validators
10
+ # Email address (using {EmailAddressValidator}):: {#content}.
11
+ # @see EmailAddressValidator
12
+ class EmailAddress < Spina::Parts::Base
13
+ attr_json :content, :string
14
+
15
+ validates :content, 'spina/admin/conferences/email_address': true, allow_blank: true
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Parts
5
+ module Admin
6
+ module Conferences
7
+ # Time parts.
8
+ class Time < Spina::Parts::Base
9
+ attr_json :content, :time
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Parts
5
+ module Admin
6
+ module Conferences
7
+ # URL parts. The format is validated.
8
+ #
9
+ # = Validators
10
+ # HTTP(S) URL (using {HttpUrlValidator}):: {#content}.
11
+ # @see HttpUrlValidator
12
+ class Url < Spina::Parts::Base
13
+ attr_json :content, :string
14
+
15
+ validates :content, 'spina/admin/conferences/http_url': true, allow_blank: true
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ - content_for :application do
2
+ %div{ data: { turbolinks: 'false' } }
3
+ = yield(:admin_header)
4
+ = yield
5
+
6
+ = render template: 'layouts/spina/admin/admin'
@@ -1,4 +1,4 @@
1
- - content_for :application do
1
+ - content_for :admin_header do
2
2
  %header#header
3
3
  #header_actions
4
4
  = yield(:header_actions)
@@ -14,6 +14,4 @@
14
14
  %li{class: ('active' if controller_name == 'sessions')}
15
15
  = link_to Spina::Admin::Conferences::Session.model_name.human(count: 0), admin_conferences_sessions_path
16
16
 
17
- = yield
18
-
19
- = render template: 'layouts/spina/admin/admin'
17
+ = render template: 'layouts/spina/admin/conferences/application'