spina-admin-conferences 1.3.10 → 2.0.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/spina/admin/conferences/application.sass +0 -15
  3. data/app/controllers/spina/admin/conferences/application_controller.rb +6 -3
  4. data/app/controllers/spina/admin/conferences/conferences_controller.rb +18 -27
  5. data/app/controllers/spina/admin/conferences/delegates_controller.rb +2 -4
  6. data/app/controllers/spina/admin/conferences/dietary_requirements_controller.rb +1 -1
  7. data/app/controllers/spina/admin/conferences/institutions_controller.rb +1 -1
  8. data/app/controllers/spina/admin/conferences/presentation_attachment_types_controller.rb +1 -1
  9. data/app/controllers/spina/admin/conferences/presentation_types_controller.rb +1 -1
  10. data/app/controllers/spina/admin/conferences/presentations_controller.rb +4 -5
  11. data/app/controllers/spina/admin/conferences/rooms_controller.rb +1 -1
  12. data/app/controllers/spina/admin/conferences/sessions_controller.rb +1 -1
  13. data/app/jobs/spina/admin/conferences/presentation_import_job.rb +2 -3
  14. data/app/models/spina/admin/conferences/conference.rb +4 -7
  15. data/app/models/spina/admin/conferences/event.rb +21 -58
  16. data/app/models/spina/admin/conferences/presentation.rb +15 -33
  17. data/app/models/spina/parts/admin/conferences/date.rb +14 -0
  18. data/app/models/spina/parts/admin/conferences/email_address.rb +20 -0
  19. data/app/models/spina/parts/admin/conferences/time.rb +14 -0
  20. data/app/models/spina/parts/admin/conferences/url.rb +20 -0
  21. data/app/views/spina/admin/conferences/{delegates/_form_conferences.html.haml → application/_conferences.html.haml} +2 -4
  22. data/app/views/spina/admin/conferences/{conferences/_form_delegates.html.haml → application/_delegates.html.haml} +2 -3
  23. data/app/views/spina/admin/conferences/application/_dietary_requirements.html.haml +9 -0
  24. data/app/views/spina/admin/conferences/application/_institutions.html.haml +10 -0
  25. data/app/views/spina/admin/conferences/application/_presentation_attachment_types.html.haml +10 -0
  26. data/app/views/spina/admin/conferences/{conferences/_form_presentation_types.html.haml → application/_presentation_types.html.haml} +2 -3
  27. data/app/views/spina/admin/conferences/{rooms/_form_presentations.html.haml → application/_presentations.html.haml} +2 -3
  28. data/app/views/spina/admin/conferences/{conferences/_form_rooms.html.haml → application/_rooms.html.haml} +2 -3
  29. data/app/views/spina/admin/conferences/{presentation_types/_form_sessions.html.haml → application/_sessions.html.haml} +2 -3
  30. data/app/views/spina/admin/conferences/conferences/_event_fields.html.haml +15 -21
  31. data/app/views/spina/admin/conferences/conferences/_form.html.haml +7 -3
  32. data/app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml +22 -24
  33. data/app/views/spina/admin/conferences/conferences/_form_parts.html.haml +7 -14
  34. data/app/views/spina/admin/conferences/conferences/index.html.haml +1 -13
  35. data/app/views/spina/admin/conferences/delegates/_form.html.haml +4 -3
  36. data/app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml +47 -32
  37. data/app/views/spina/admin/conferences/delegates/index.html.haml +1 -12
  38. data/app/views/spina/admin/conferences/dietary_requirements/_form.html.haml +3 -3
  39. data/app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml +7 -8
  40. data/app/views/spina/admin/conferences/dietary_requirements/index.html.haml +1 -10
  41. data/app/views/spina/admin/conferences/institutions/_form.html.haml +4 -3
  42. data/app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml +29 -35
  43. data/app/views/spina/admin/conferences/institutions/index.html.haml +1 -11
  44. data/app/views/spina/admin/conferences/presentation_attachment_types/_form.html.haml +2 -2
  45. data/app/views/spina/admin/conferences/presentation_attachment_types/index.html.haml +1 -10
  46. data/app/views/spina/admin/conferences/presentation_types/_form.html.haml +4 -3
  47. data/app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml +13 -17
  48. data/app/views/spina/admin/conferences/presentation_types/index.html.haml +1 -12
  49. data/app/views/spina/admin/conferences/presentations/_attachment_fields.html.haml +6 -15
  50. data/app/views/spina/admin/conferences/presentations/_form.html.haml +3 -3
  51. data/app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml +56 -55
  52. data/app/views/spina/admin/conferences/presentations/index.html.haml +1 -12
  53. data/app/views/spina/admin/conferences/rooms/_form.html.haml +3 -3
  54. data/app/views/spina/admin/conferences/rooms/_form_room_details.html.haml +13 -15
  55. data/app/views/spina/admin/conferences/rooms/index.html.haml +1 -12
  56. data/app/views/spina/admin/conferences/sessions/_form.html.haml +3 -3
  57. data/app/views/spina/admin/conferences/sessions/_form_session_details.html.haml +18 -20
  58. data/app/views/spina/admin/conferences/sessions/_session.html.haml +1 -1
  59. data/app/views/spina/admin/conferences/sessions/index.html.haml +1 -12
  60. data/app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml +4 -4
  61. data/app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml +2 -2
  62. data/app/views/spina/admin/parts/admin/conferences/dates/_form.html.haml +2 -0
  63. data/app/views/spina/admin/parts/admin/conferences/email_addresses/_form.html.haml +2 -0
  64. data/app/views/spina/admin/parts/admin/conferences/times/_form.html.haml +2 -0
  65. data/app/views/spina/admin/parts/admin/conferences/urls/_form.html.haml +2 -0
  66. data/config/locales/en.yml +26 -29
  67. data/db/migrate/20210315164409_add_json_attributes_to_spina_conferences_presentations.rb +7 -0
  68. data/db/migrate/20210315164410_add_json_attributes_to_spina_conferences_conferences.rb +7 -0
  69. data/db/migrate/20210315164411_convert_partables_to_json.rb +407 -0
  70. data/lib/spina/admin/conferences/engine.rb +7 -0
  71. data/lib/spina/admin/conferences/version.rb +1 -1
  72. data/lib/tasks/spina/admin/conferences_tasks.rake +11 -1
  73. metadata +27 -31
  74. data/app/helpers/spina/admin/conferences/conferences_helper.rb +0 -44
  75. data/app/models/spina/admin/conferences/date_part.rb +0 -15
  76. data/app/models/spina/admin/conferences/email_address_part.rb +0 -21
  77. data/app/models/spina/admin/conferences/part.rb +0 -20
  78. data/app/models/spina/admin/conferences/time_part.rb +0 -53
  79. data/app/models/spina/admin/conferences/url_part.rb +0 -21
  80. data/app/views/spina/admin/conferences/conferences/_form_presentations.html.haml +0 -12
  81. data/app/views/spina/admin/conferences/delegates/_form_presentations.html.haml +0 -12
  82. data/app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml +0 -12
  83. data/app/views/spina/admin/conferences/institutions/_form_delegates.html.haml +0 -12
  84. data/app/views/spina/admin/conferences/institutions/_form_rooms.html.haml +0 -12
  85. data/app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml +0 -12
  86. data/app/views/spina/admin/conferences/presentations/_form_presenters.html.haml +0 -12
  87. data/app/views/spina/admin/conferences/sessions/_form_presentations.html.haml +0 -12
  88. data/app/views/spina/admin/partables/admin/conferences/date_parts/_form.html.haml +0 -5
  89. data/app/views/spina/admin/partables/admin/conferences/email_address_parts/_form.html.haml +0 -5
  90. data/app/views/spina/admin/partables/admin/conferences/time_parts/_form.html.haml +0 -7
  91. data/app/views/spina/admin/partables/admin/conferences/url_parts/_form.html.haml +0 -5
@@ -6,6 +6,8 @@ module Spina
6
6
  # Engine class for the plugin. This is where the plugin is registered as a {Spina::Plugin} with {Spina}.
7
7
  # @note The +name+ and +namespace+ of the {Spina::Plugin} object is +'conferences'+ (for compatibility reasons).
8
8
  class Engine < ::Rails::Engine
9
+ isolate_namespace Spina::Admin::Conferences
10
+
9
11
  config.before_initialize do
10
12
  ::Spina::Plugin.register do |plugin|
11
13
  plugin.name = 'conferences'
@@ -14,6 +16,11 @@ module Spina
14
16
  end
15
17
 
16
18
  config.after_initialize do
19
+ Spina::Part.register(Spina::Parts::Admin::Conferences::Date)
20
+ Spina::Part.register(Spina::Parts::Admin::Conferences::EmailAddress)
21
+ Spina::Part.register(Spina::Parts::Admin::Conferences::Time)
22
+ Spina::Part.register(Spina::Parts::Admin::Conferences::Url)
23
+
17
24
  ActiveSupport::Deprecation
18
25
  .new('2.0', 'Spina::Admin::Conferences')
19
26
  .tap { |deprecator| deprecator.deprecate_methods(Conference, to_ics: :to_event) }
@@ -4,7 +4,7 @@ module Spina
4
4
  module Admin
5
5
  module Conferences
6
6
  # Version number.
7
- VERSION = '1.3.10'
7
+ VERSION = '2.0.0.alpha'
8
8
  end
9
9
  end
10
10
  end
@@ -1,4 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- namespace :spina_admin_conferences do
3
+ namespace :spina do
4
+ Rake::Task[:convert_layout_parts_to_json].clear if Rake::Task.task_defined?('spina:convert_layout_parts_to_json')
5
+ Rake::Task[:convert_page_parts_to_json].clear if Rake::Task.task_defined?('spina:convert_page_parts_to_json')
6
+
7
+ desc 'Convert table-based partables to JSON-based parts'
8
+ task convert_parts_to_json: %i[environment spina_admin_conferences:install:migrations] do
9
+ puts "If the upgrade migrations were missing, they should now have been copied to your migrations path.\n" \
10
+ 'If you have custom partables, you must modify the upgrade migration before running it: ' \
11
+ "for more information, see the documentation in the migration.\n" \
12
+ 'Once the migration is ready, run `rails db:migrate`.'
13
+ end
4
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina-admin-conferences
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 2.0.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Malčić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-03 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: icalendar
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '2.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: stimulus-rails
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -375,7 +375,6 @@ files:
375
375
  - app/controllers/spina/admin/conferences/presentations_controller.rb
376
376
  - app/controllers/spina/admin/conferences/rooms_controller.rb
377
377
  - app/controllers/spina/admin/conferences/sessions_controller.rb
378
- - app/helpers/spina/admin/conferences/conferences_helper.rb
379
378
  - app/jobs/spina/admin/conferences/application_job.rb
380
379
  - app/jobs/spina/admin/conferences/delegate_import_job.rb
381
380
  - app/jobs/spina/admin/conferences/import_job.rb
@@ -384,21 +383,20 @@ files:
384
383
  - app/models/spina/admin/conferences.rb
385
384
  - app/models/spina/admin/conferences/application_record.rb
386
385
  - app/models/spina/admin/conferences/conference.rb
387
- - app/models/spina/admin/conferences/date_part.rb
388
386
  - app/models/spina/admin/conferences/delegate.rb
389
387
  - app/models/spina/admin/conferences/dietary_requirement.rb
390
- - app/models/spina/admin/conferences/email_address_part.rb
391
388
  - app/models/spina/admin/conferences/event.rb
392
389
  - app/models/spina/admin/conferences/institution.rb
393
- - app/models/spina/admin/conferences/part.rb
394
390
  - app/models/spina/admin/conferences/presentation.rb
395
391
  - app/models/spina/admin/conferences/presentation_attachment.rb
396
392
  - app/models/spina/admin/conferences/presentation_attachment_type.rb
397
393
  - app/models/spina/admin/conferences/presentation_type.rb
398
394
  - app/models/spina/admin/conferences/room.rb
399
395
  - app/models/spina/admin/conferences/session.rb
400
- - app/models/spina/admin/conferences/time_part.rb
401
- - app/models/spina/admin/conferences/url_part.rb
396
+ - app/models/spina/parts/admin/conferences/date.rb
397
+ - app/models/spina/parts/admin/conferences/email_address.rb
398
+ - app/models/spina/parts/admin/conferences/time.rb
399
+ - app/models/spina/parts/admin/conferences/url.rb
402
400
  - app/validators/spina/admin/conferences/conference_date_validator.rb
403
401
  - app/validators/spina/admin/conferences/email_address_validator.rb
404
402
  - app/validators/spina/admin/conferences/finish_date_validator.rb
@@ -411,19 +409,24 @@ files:
411
409
  - app/views/layouts/spina/admin/conferences/institutions.html.haml
412
410
  - app/views/layouts/spina/admin/conferences/presentation_attachment_types.html.haml
413
411
  - app/views/layouts/spina/admin/conferences/presentations.html.haml
412
+ - app/views/spina/admin/conferences/application/_conferences.html.haml
413
+ - app/views/spina/admin/conferences/application/_delegates.html.haml
414
+ - app/views/spina/admin/conferences/application/_dietary_requirements.html.haml
414
415
  - app/views/spina/admin/conferences/application/_empty_list.html.haml
415
416
  - app/views/spina/admin/conferences/application/_errors.html.haml
416
417
  - app/views/spina/admin/conferences/application/_errors.turbo_stream.haml
418
+ - app/views/spina/admin/conferences/application/_institutions.html.haml
419
+ - app/views/spina/admin/conferences/application/_presentation_attachment_types.html.haml
420
+ - app/views/spina/admin/conferences/application/_presentation_types.html.haml
421
+ - app/views/spina/admin/conferences/application/_presentations.html.haml
422
+ - app/views/spina/admin/conferences/application/_rooms.html.haml
423
+ - app/views/spina/admin/conferences/application/_sessions.html.haml
417
424
  - app/views/spina/admin/conferences/conferences/_conference.html.haml
418
425
  - app/views/spina/admin/conferences/conferences/_event_fields.html.haml
419
426
  - app/views/spina/admin/conferences/conferences/_event_row.html.haml
420
427
  - app/views/spina/admin/conferences/conferences/_form.html.haml
421
428
  - app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml
422
- - app/views/spina/admin/conferences/conferences/_form_delegates.html.haml
423
429
  - app/views/spina/admin/conferences/conferences/_form_parts.html.haml
424
- - app/views/spina/admin/conferences/conferences/_form_presentation_types.html.haml
425
- - app/views/spina/admin/conferences/conferences/_form_presentations.html.haml
426
- - app/views/spina/admin/conferences/conferences/_form_rooms.html.haml
427
430
  - app/views/spina/admin/conferences/conferences/_form_structure.html.haml
428
431
  - app/views/spina/admin/conferences/conferences/_form_structure_item.html.haml
429
432
  - app/views/spina/admin/conferences/conferences/edit.html.haml
@@ -431,24 +434,19 @@ files:
431
434
  - app/views/spina/admin/conferences/conferences/new.html.haml
432
435
  - app/views/spina/admin/conferences/delegates/_delegate.html.haml
433
436
  - app/views/spina/admin/conferences/delegates/_form.html.haml
434
- - app/views/spina/admin/conferences/delegates/_form_conferences.html.haml
435
437
  - app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml
436
- - app/views/spina/admin/conferences/delegates/_form_presentations.html.haml
437
438
  - app/views/spina/admin/conferences/delegates/edit.html.haml
438
439
  - app/views/spina/admin/conferences/delegates/index.html.haml
439
440
  - app/views/spina/admin/conferences/delegates/new.html.haml
440
441
  - app/views/spina/admin/conferences/dietary_requirements/_dietary_requirement.html.haml
441
442
  - app/views/spina/admin/conferences/dietary_requirements/_form.html.haml
442
- - app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml
443
443
  - app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml
444
444
  - app/views/spina/admin/conferences/dietary_requirements/edit.html.haml
445
445
  - app/views/spina/admin/conferences/dietary_requirements/index.html.haml
446
446
  - app/views/spina/admin/conferences/dietary_requirements/new.html.haml
447
447
  - app/views/spina/admin/conferences/events/new.js.erb
448
448
  - app/views/spina/admin/conferences/institutions/_form.html.haml
449
- - app/views/spina/admin/conferences/institutions/_form_delegates.html.haml
450
449
  - app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml
451
- - app/views/spina/admin/conferences/institutions/_form_rooms.html.haml
452
450
  - app/views/spina/admin/conferences/institutions/_institution.html.haml
453
451
  - app/views/spina/admin/conferences/institutions/edit.html.haml
454
452
  - app/views/spina/admin/conferences/institutions/index.html.haml
@@ -461,8 +459,6 @@ files:
461
459
  - app/views/spina/admin/conferences/presentation_attachments/new.js.erb
462
460
  - app/views/spina/admin/conferences/presentation_types/_form.html.haml
463
461
  - app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml
464
- - app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml
465
- - app/views/spina/admin/conferences/presentation_types/_form_sessions.html.haml
466
462
  - app/views/spina/admin/conferences/presentation_types/_presentation_type.html.haml
467
463
  - app/views/spina/admin/conferences/presentation_types/edit.html.haml
468
464
  - app/views/spina/admin/conferences/presentation_types/index.html.haml
@@ -471,20 +467,17 @@ files:
471
467
  - app/views/spina/admin/conferences/presentations/_attachment_row.html.haml
472
468
  - app/views/spina/admin/conferences/presentations/_form.html.haml
473
469
  - app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml
474
- - app/views/spina/admin/conferences/presentations/_form_presenters.html.haml
475
470
  - app/views/spina/admin/conferences/presentations/_presentation.html.haml
476
471
  - app/views/spina/admin/conferences/presentations/edit.html.haml
477
472
  - app/views/spina/admin/conferences/presentations/index.html.haml
478
473
  - app/views/spina/admin/conferences/presentations/new.html.haml
479
474
  - app/views/spina/admin/conferences/rooms/_form.html.haml
480
- - app/views/spina/admin/conferences/rooms/_form_presentations.html.haml
481
475
  - app/views/spina/admin/conferences/rooms/_form_room_details.html.haml
482
476
  - app/views/spina/admin/conferences/rooms/_room.html.haml
483
477
  - app/views/spina/admin/conferences/rooms/edit.html.haml
484
478
  - app/views/spina/admin/conferences/rooms/index.html.haml
485
479
  - app/views/spina/admin/conferences/rooms/new.html.haml
486
480
  - app/views/spina/admin/conferences/sessions/_form.html.haml
487
- - app/views/spina/admin/conferences/sessions/_form_presentations.html.haml
488
481
  - app/views/spina/admin/conferences/sessions/_form_session_details.html.haml
489
482
  - app/views/spina/admin/conferences/sessions/_session.html.haml
490
483
  - app/views/spina/admin/conferences/sessions/edit.html.haml
@@ -493,10 +486,10 @@ files:
493
486
  - app/views/spina/admin/hooks/conferences/_head.html.haml
494
487
  - app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml
495
488
  - app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml
496
- - app/views/spina/admin/partables/admin/conferences/date_parts/_form.html.haml
497
- - app/views/spina/admin/partables/admin/conferences/email_address_parts/_form.html.haml
498
- - app/views/spina/admin/partables/admin/conferences/time_parts/_form.html.haml
499
- - app/views/spina/admin/partables/admin/conferences/url_parts/_form.html.haml
489
+ - app/views/spina/admin/parts/admin/conferences/dates/_form.html.haml
490
+ - app/views/spina/admin/parts/admin/conferences/email_addresses/_form.html.haml
491
+ - app/views/spina/admin/parts/admin/conferences/times/_form.html.haml
492
+ - app/views/spina/admin/parts/admin/conferences/urls/_form.html.haml
500
493
  - config/initializers/assets.rb
501
494
  - config/locales/en.yml
502
495
  - config/routes.rb
@@ -557,6 +550,9 @@ files:
557
550
  - db/migrate/20200911161739_move_conference_parts.rb
558
551
  - db/migrate/20201002122517_remove_spina_conferences_conference_page_parts.rb
559
552
  - db/migrate/20201007125625_add_timestamps_to_spina_conferences_parts.rb
553
+ - db/migrate/20210315164409_add_json_attributes_to_spina_conferences_presentations.rb
554
+ - db/migrate/20210315164410_add_json_attributes_to_spina_conferences_conferences.rb
555
+ - db/migrate/20210315164411_convert_partables_to_json.rb
560
556
  - lib/spina/admin/conferences.rb
561
557
  - lib/spina/admin/conferences/engine.rb
562
558
  - lib/spina/admin/conferences/migration/renaming.rb
@@ -578,11 +574,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
578
574
  version: '2.7'
579
575
  required_rubygems_version: !ruby/object:Gem::Requirement
580
576
  requirements:
581
- - - ">="
577
+ - - ">"
582
578
  - !ruby/object:Gem::Version
583
- version: '0'
579
+ version: 1.3.1
584
580
  requirements: []
585
- rubygems_version: 3.1.2
581
+ rubygems_version: 3.1.4
586
582
  signing_key:
587
583
  specification_version: 4
588
584
  summary: Conference management plugin for Spina.
@@ -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,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')