spina-admin-conferences-fork 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +100 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/config/spina_admin_conferences_manifest.js +3 -0
  6. data/app/assets/javascripts/controllers/spina/admin/conferences/conference_events_form_controller.js +174 -0
  7. data/app/assets/javascripts/controllers/spina/admin/conferences/presentation_attachments_form_controller.js +174 -0
  8. data/app/assets/javascripts/controllers/spina/admin/conferences/select_options_controller.js +215 -0
  9. data/app/assets/javascripts/importmap.json.erb +6 -0
  10. data/app/assets/javascripts/spina/admin/conferences/application.js +4 -0
  11. data/app/assets/stylesheets/spina/admin/conferences/application.sass +3 -0
  12. data/app/controllers/spina/admin/conferences/application_controller.rb +23 -0
  13. data/app/controllers/spina/admin/conferences/conferences_controller.rb +139 -0
  14. data/app/controllers/spina/admin/conferences/delegates_controller.rb +114 -0
  15. data/app/controllers/spina/admin/conferences/dietary_requirements_controller.rb +106 -0
  16. data/app/controllers/spina/admin/conferences/events_controller.rb +24 -0
  17. data/app/controllers/spina/admin/conferences/institutions_controller.rb +106 -0
  18. data/app/controllers/spina/admin/conferences/presentation_attachment_types_controller.rb +104 -0
  19. data/app/controllers/spina/admin/conferences/presentation_attachments_controller.rb +24 -0
  20. data/app/controllers/spina/admin/conferences/presentation_types_controller.rb +109 -0
  21. data/app/controllers/spina/admin/conferences/presentations_controller.rb +123 -0
  22. data/app/controllers/spina/admin/conferences/rooms_controller.rb +109 -0
  23. data/app/controllers/spina/admin/conferences/sessions_controller.rb +118 -0
  24. data/app/jobs/spina/admin/conferences/application_job.rb +11 -0
  25. data/app/jobs/spina/admin/conferences/delegate_import_job.rb +37 -0
  26. data/app/jobs/spina/admin/conferences/import_job.rb +26 -0
  27. data/app/jobs/spina/admin/conferences/presentation_import_job.rb +37 -0
  28. data/app/mailers/spina/admin/conferences/application_mailer.rb +13 -0
  29. data/app/models/spina/admin/conferences/application_record.rb +14 -0
  30. data/app/models/spina/admin/conferences/conference.rb +269 -0
  31. data/app/models/spina/admin/conferences/delegate.rb +89 -0
  32. data/app/models/spina/admin/conferences/dietary_requirement.rb +33 -0
  33. data/app/models/spina/admin/conferences/event.rb +85 -0
  34. data/app/models/spina/admin/conferences/institution.rb +46 -0
  35. data/app/models/spina/admin/conferences/presentation.rb +134 -0
  36. data/app/models/spina/admin/conferences/presentation_attachment.rb +27 -0
  37. data/app/models/spina/admin/conferences/presentation_attachment_type.rb +35 -0
  38. data/app/models/spina/admin/conferences/presentation_type.rb +60 -0
  39. data/app/models/spina/admin/conferences/room.rb +52 -0
  40. data/app/models/spina/admin/conferences/session.rb +56 -0
  41. data/app/models/spina/admin/conferences.rb +11 -0
  42. data/app/models/spina/parts/admin/conferences/date.rb +14 -0
  43. data/app/models/spina/parts/admin/conferences/email_address.rb +20 -0
  44. data/app/models/spina/parts/admin/conferences/time.rb +14 -0
  45. data/app/models/spina/parts/admin/conferences/url.rb +20 -0
  46. data/app/validators/spina/admin/conferences/conference_date_validator.rb +20 -0
  47. data/app/validators/spina/admin/conferences/email_address_validator.rb +28 -0
  48. data/app/validators/spina/admin/conferences/finish_date_validator.rb +20 -0
  49. data/app/validators/spina/admin/conferences/finish_time_validator.rb +20 -0
  50. data/app/validators/spina/admin/conferences/http_url_validator.rb +28 -0
  51. data/app/views/layouts/spina/admin/conferences/application.html.haml +6 -0
  52. data/app/views/layouts/spina/admin/conferences/conferences.html.haml +17 -0
  53. data/app/views/layouts/spina/admin/conferences/delegates.html.haml +8 -0
  54. data/app/views/layouts/spina/admin/conferences/dietary_requirements.html.haml +8 -0
  55. data/app/views/layouts/spina/admin/conferences/institutions.html.haml +15 -0
  56. data/app/views/layouts/spina/admin/conferences/presentation_attachment_types.html.haml +8 -0
  57. data/app/views/layouts/spina/admin/conferences/presentations.html.haml +8 -0
  58. data/app/views/spina/admin/conferences/application/_conferences.html.haml +12 -0
  59. data/app/views/spina/admin/conferences/application/_delegates.html.haml +11 -0
  60. data/app/views/spina/admin/conferences/application/_dietary_requirements.html.haml +9 -0
  61. data/app/views/spina/admin/conferences/application/_empty_list.html.haml +3 -0
  62. data/app/views/spina/admin/conferences/application/_errors.html.haml +11 -0
  63. data/app/views/spina/admin/conferences/application/_errors.turbo_stream.haml +1 -0
  64. data/app/views/spina/admin/conferences/application/_institutions.html.haml +10 -0
  65. data/app/views/spina/admin/conferences/application/_presentation_attachment_types.html.haml +10 -0
  66. data/app/views/spina/admin/conferences/application/_presentation_types.html.haml +11 -0
  67. data/app/views/spina/admin/conferences/application/_presentations.html.haml +11 -0
  68. data/app/views/spina/admin/conferences/application/_rooms.html.haml +11 -0
  69. data/app/views/spina/admin/conferences/application/_sessions.html.haml +11 -0
  70. data/app/views/spina/admin/conferences/conferences/_conference.html.haml +9 -0
  71. data/app/views/spina/admin/conferences/conferences/_event_fields.html.haml +31 -0
  72. data/app/views/spina/admin/conferences/conferences/_event_row.html.haml +5 -0
  73. data/app/views/spina/admin/conferences/conferences/_form.html.haml +27 -0
  74. data/app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml +27 -0
  75. data/app/views/spina/admin/conferences/conferences/_form_parts.html.haml +8 -0
  76. data/app/views/spina/admin/conferences/conferences/_form_structure.html.haml +19 -0
  77. data/app/views/spina/admin/conferences/conferences/_form_structure_item.html.haml +13 -0
  78. data/app/views/spina/admin/conferences/conferences/edit.html.haml +1 -0
  79. data/app/views/spina/admin/conferences/conferences/index.html.haml +7 -0
  80. data/app/views/spina/admin/conferences/conferences/new.html.haml +1 -0
  81. data/app/views/spina/admin/conferences/delegates/_delegate.html.haml +13 -0
  82. data/app/views/spina/admin/conferences/delegates/_form.html.haml +24 -0
  83. data/app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml +53 -0
  84. data/app/views/spina/admin/conferences/delegates/edit.html.haml +1 -0
  85. data/app/views/spina/admin/conferences/delegates/index.html.haml +13 -0
  86. data/app/views/spina/admin/conferences/delegates/new.html.haml +1 -0
  87. data/app/views/spina/admin/conferences/dietary_requirements/_dietary_requirement.html.haml +6 -0
  88. data/app/views/spina/admin/conferences/dietary_requirements/_form.html.haml +23 -0
  89. data/app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml +8 -0
  90. data/app/views/spina/admin/conferences/dietary_requirements/edit.html.haml +1 -0
  91. data/app/views/spina/admin/conferences/dietary_requirements/index.html.haml +7 -0
  92. data/app/views/spina/admin/conferences/dietary_requirements/new.html.haml +1 -0
  93. data/app/views/spina/admin/conferences/events/new.js.erb +21 -0
  94. data/app/views/spina/admin/conferences/institutions/_form.html.haml +24 -0
  95. data/app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml +29 -0
  96. data/app/views/spina/admin/conferences/institutions/_institution.html.haml +7 -0
  97. data/app/views/spina/admin/conferences/institutions/edit.html.haml +1 -0
  98. data/app/views/spina/admin/conferences/institutions/index.html.haml +7 -0
  99. data/app/views/spina/admin/conferences/institutions/new.html.haml +1 -0
  100. data/app/views/spina/admin/conferences/presentation_attachment_types/_form.html.haml +23 -0
  101. data/app/views/spina/admin/conferences/presentation_attachment_types/_presentation_attachment_type.html.haml +6 -0
  102. data/app/views/spina/admin/conferences/presentation_attachment_types/edit.html.haml +1 -0
  103. data/app/views/spina/admin/conferences/presentation_attachment_types/index.html.haml +7 -0
  104. data/app/views/spina/admin/conferences/presentation_attachment_types/new.html.haml +1 -0
  105. data/app/views/spina/admin/conferences/presentation_attachments/new.js.erb +21 -0
  106. data/app/views/spina/admin/conferences/presentation_types/_form.html.haml +24 -0
  107. data/app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml +16 -0
  108. data/app/views/spina/admin/conferences/presentation_types/_presentation_type.html.haml +8 -0
  109. data/app/views/spina/admin/conferences/presentation_types/edit.html.haml +1 -0
  110. data/app/views/spina/admin/conferences/presentation_types/index.html.haml +7 -0
  111. data/app/views/spina/admin/conferences/presentation_types/new.html.haml +1 -0
  112. data/app/views/spina/admin/conferences/presentations/_attachment_fields.html.haml +18 -0
  113. data/app/views/spina/admin/conferences/presentations/_attachment_row.html.haml +2 -0
  114. data/app/views/spina/admin/conferences/presentations/_form.html.haml +23 -0
  115. data/app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml +55 -0
  116. data/app/views/spina/admin/conferences/presentations/_presentation.html.haml +11 -0
  117. data/app/views/spina/admin/conferences/presentations/edit.html.haml +1 -0
  118. data/app/views/spina/admin/conferences/presentations/index.html.haml +13 -0
  119. data/app/views/spina/admin/conferences/presentations/new.html.haml +1 -0
  120. data/app/views/spina/admin/conferences/rooms/_form.html.haml +23 -0
  121. data/app/views/spina/admin/conferences/rooms/_form_room_details.html.haml +16 -0
  122. data/app/views/spina/admin/conferences/rooms/_room.html.haml +8 -0
  123. data/app/views/spina/admin/conferences/rooms/edit.html.haml +1 -0
  124. data/app/views/spina/admin/conferences/rooms/index.html.haml +7 -0
  125. data/app/views/spina/admin/conferences/rooms/new.html.haml +1 -0
  126. data/app/views/spina/admin/conferences/sessions/_form.html.haml +23 -0
  127. data/app/views/spina/admin/conferences/sessions/_form_session_details.html.haml +21 -0
  128. data/app/views/spina/admin/conferences/sessions/_session.html.haml +8 -0
  129. data/app/views/spina/admin/conferences/sessions/edit.html.haml +1 -0
  130. data/app/views/spina/admin/conferences/sessions/index.html.haml +7 -0
  131. data/app/views/spina/admin/conferences/sessions/new.html.haml +1 -0
  132. data/app/views/spina/admin/hooks/conferences/_head.html.haml +7 -0
  133. data/app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml +21 -0
  134. data/app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml +6 -0
  135. data/app/views/spina/admin/parts/admin/conferences/dates/_form.html.haml +2 -0
  136. data/app/views/spina/admin/parts/admin/conferences/email_addresses/_form.html.haml +2 -0
  137. data/app/views/spina/admin/parts/admin/conferences/times/_form.html.haml +2 -0
  138. data/app/views/spina/admin/parts/admin/conferences/urls/_form.html.haml +2 -0
  139. data/config/initializers/assets.rb +13 -0
  140. data/config/locales/en.yml +351 -0
  141. data/config/routes.rb +27 -0
  142. data/db/migrate/20180907141228_create_spina_dates.rb +11 -0
  143. data/db/migrate/20180907141229_create_spina_email_addresses.rb +11 -0
  144. data/db/migrate/20180907141230_create_spina_urls.rb +11 -0
  145. data/db/migrate/20180907141231_create_spina_conferences_institutions.rb +12 -0
  146. data/db/migrate/20180907141232_create_spina_conferences_delegates.rb +15 -0
  147. data/db/migrate/20180907141234_create_spina_conferences_dietary_requirements.rb +11 -0
  148. data/db/migrate/20180907141235_create_spina_conferences_conferences.rb +12 -0
  149. data/db/migrate/20180907141236_create_spina_conferences_presentation_types.rb +13 -0
  150. data/db/migrate/20180907141238_create_join_table_spina_conferences_conference_delegate.rb +7 -0
  151. data/db/migrate/20180907141239_create_join_table_spina_conferences_delegate_presentation.rb +7 -0
  152. data/db/migrate/20180907141240_create_join_table_spina_conferences_delegate_dietary_requirement.rb +7 -0
  153. data/db/migrate/20180907141242_add_type_to_spina_pages.rb +7 -0
  154. data/db/migrate/20180907141243_create_spina_conferences_conference_page_parts.rb +14 -0
  155. data/db/migrate/20180914121905_add_logo_ref_to_spina_conferences_institutions.rb +7 -0
  156. data/db/migrate/20180916135431_create_spina_conferences_rooms.rb +13 -0
  157. data/db/migrate/20180916135432_create_spina_conferences_room_possessions.rb +10 -0
  158. data/db/migrate/20180916135433_create_spina_conferences_room_uses.rb +10 -0
  159. data/db/migrate/20180916135434_create_spina_conferences_presentations.rb +15 -0
  160. data/db/migrate/20181009122503_create_spina_times.rb +11 -0
  161. data/db/migrate/20181009130631_rename_spina_page_parts.rb +10 -0
  162. data/db/migrate/20181012190811_rename_spina_conferences_page_parts.rb +10 -0
  163. data/db/migrate/20181012213049_change_start_time_in_spina_conferences_conferences.rb +15 -0
  164. data/db/migrate/20181012214813_rename_start_time_in_spina_conferences_conferences.rb +7 -0
  165. data/db/migrate/20181017155705_add_dependent_option_to_foreign_keys.rb +36 -0
  166. data/db/migrate/20190408131354_change_spina_resources.rb +56 -0
  167. data/db/migrate/20190622131423_create_spina_conferences_parts.rb +12 -0
  168. data/db/migrate/20190701174807_remove_spina_conference_pages.rb +199 -0
  169. data/db/migrate/20190704135524_add_constraints_to_columns.rb +24 -0
  170. data/db/migrate/20200126034441_create_spina_conferences_presentation_attachment_types.rb +11 -0
  171. data/db/migrate/20200126213718_create_spina_conferences_presentation_attachments.rb +19 -0
  172. data/db/migrate/20200420104603_create_spina_conferences_dietary_requirement_name_translations.rb +19 -0
  173. data/db/migrate/20200420104740_create_spina_conferences_institution_name_and_city_translations.rb +20 -0
  174. data/db/migrate/20200420105057_create_spina_conferences_presentation_title_and_abstract_translations.rb +20 -0
  175. data/db/migrate/20200420105144_create_spina_conferences_presentation_attachment_type_name_translations.rb +20 -0
  176. data/db/migrate/20200420105201_create_spina_conferences_presentation_type_name_translations.rb +19 -0
  177. data/db/migrate/20200420105458_create_spina_conferences_room_building_and_number_translations.rb +20 -0
  178. data/db/migrate/20200420110407_move_attributes_to_translation_tables.rb +161 -0
  179. data/db/migrate/20200420120706_remove_name_from_spina_conferences_dietary_requirements.rb +7 -0
  180. data/db/migrate/20200420120759_remove_name_and_city_from_spina_conferences_institutions.rb +8 -0
  181. data/db/migrate/20200420120946_remove_title_and_abstract_from_spina_conferences_presentations.rb +8 -0
  182. data/db/migrate/20200420121310_remove_name_from_spina_conferences_presentation_attachment_types.rb +7 -0
  183. data/db/migrate/20200420121321_remove_name_from_spina_conferences_presentation_types.rb +7 -0
  184. data/db/migrate/20200420121443_remove_building_and_number_from_spina_conferences_rooms.rb +8 -0
  185. data/db/migrate/20200502133408_create_spina_conferences_conference_name_translations.rb +19 -0
  186. data/db/migrate/20200502183409_set_name_for_spina_conferences_conferences.rb +47 -0
  187. data/db/migrate/20200502183410_remove_institution_from_spina_conferences_conferences.rb +8 -0
  188. data/db/migrate/20200502183719_remove_spina_conferences_room_possessions.rb +60 -0
  189. data/db/migrate/20200503230732_rename_spina_conferences_room_uses.rb +8 -0
  190. data/db/migrate/20200510125131_create_spina_conferences_session_name_translations.rb +19 -0
  191. data/db/migrate/20200802165242_create_spina_conferences_events.rb +13 -0
  192. data/db/migrate/20200802184921_create_spina_conferences_event_name_description_and_location_translations.rb +21 -0
  193. data/db/migrate/20200911161632_update_spina_conferences_parts.rb +23 -0
  194. data/db/migrate/20200911161651_update_spina_parts.rb +37 -0
  195. data/db/migrate/20200911161726_move_presentation_parts.rb +101 -0
  196. data/db/migrate/20200911161739_move_conference_parts.rb +221 -0
  197. data/db/migrate/20201002122517_remove_spina_conferences_conference_page_parts.rb +14 -0
  198. data/db/migrate/20201007125625_add_timestamps_to_spina_conferences_parts.rb +10 -0
  199. data/db/migrate/20210315164409_add_json_attributes_to_spina_conferences_presentations.rb +7 -0
  200. data/db/migrate/20210315164410_add_json_attributes_to_spina_conferences_conferences.rb +7 -0
  201. data/db/migrate/20210315164411_convert_partables_to_json.rb +407 -0
  202. data/db/migrate/20210417102513_add_locale_to_action_text_rich_texts.rb +11 -0
  203. data/db/migrate/20210417102514_move_texts_to_action_text_rich_texts.rb +82 -0
  204. data/lib/spina/admin/conferences/engine.rb +31 -0
  205. data/lib/spina/admin/conferences/migration/renaming.rb +79 -0
  206. data/lib/spina/admin/conferences/railtie.rb +34 -0
  207. data/lib/spina/admin/conferences/version.rb +10 -0
  208. data/lib/spina/admin/conferences.rb +23 -0
  209. data/lib/tasks/spina/admin/conferences_tasks.rake +14 -0
  210. metadata +603 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c49d67e54dfe8e122eb4fc4ca6e7d333408739c25ce9bc8f4bb1e425af16240
4
+ data.tar.gz: c33f5d5d1ec3807dd692dea90a507017af41f50ec7381ced7bc1d9ebe8ecca5c
5
+ SHA512:
6
+ metadata.gz: 3d60e46c9dd93b243fd48c2ffd6bed97eef83d95742d3b011423e273db1c27071c6f5c0e5ddb7c0b5f5baa748bec43c86b1fd2cdde1fd973f7a8e897cb0cf6fc
7
+ data.tar.gz: 2785f5d514a75333ba1190724fd1bb3444b949478bf7aa9859d09327e90885f7a46bacf76b893454e7a51ff16ef6e3bdb7a108802272fd533460dde43d44d1e5
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2019 Justin Malčić
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Conferences
2
+
3
+ ![Rails tests](https://github.com/jmalcic/spina-admin-conferences/workflows/Rails%20tests/badge.svg?branch=master&event=push)
4
+ [![Coverage Status](https://coveralls.io/repos/github/jmalcic/spina-admin-conferences/badge.svg?branch=master)](https://coveralls.io/github/jmalcic/spina-admin-conferences?branch=master)
5
+ [![Total alerts](https://img.shields.io/lgtm/alerts/g/jmalcic/spina-admin-conferences.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jmalcic/spina-admin-conferences/alerts/)
6
+ [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/jmalcic/spina-admin-conferences.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jmalcic/spina-admin-conferences/context:javascript)
7
+ [![Code quality](https://www.codefactor.io/repository/github/jmalcic/spina-admin-conferences/badge)](https://www.codefactor.io/repository/github/jmalcic/spina-admin-conferences)
8
+ [![Inline docs](http://inch-ci.org/github/jmalcic/spina-admin-conferences.svg?branch=master)](http://inch-ci.org/github/jmalcic/spina-admin-conferences)
9
+ [![Visual testing](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Ulab/spina-admin-conferences)
10
+
11
+ *Conferences* is a plugin for [Spina](https://www.spinacms.com 'Spina website') (a [Rails](http://rubyonrails.org 'Ruby on Rails website') content management system) to add conference management functionality.
12
+ With the plugin, you'll be able to manage details of conferences, delegates, and presentations.
13
+ See the wiki for details of the types of data supported.
14
+
15
+ ## Usage
16
+
17
+ The plugin will add a **Conferences** item to Spina's primary navigation menu.
18
+ The menu structure will then be as follows:
19
+
20
+ * *Other menu items*
21
+
22
+ * Conferences
23
+
24
+ * Institutions
25
+
26
+ * Conferences
27
+
28
+ * Delegates
29
+
30
+ * Presentations
31
+
32
+ After installing the plugin, you just need to start your server in the usual way:
33
+ ```bash
34
+ $ rails s
35
+ ```
36
+
37
+ ## Installation
38
+
39
+ ### From scratch
40
+
41
+ You'll need [Rails](http://rubyonrails.org 'Ruby on Rails website') installed if it isn't already.
42
+ Read how to do this in the [Rails getting started guide](https://guides.rubyonrails.org/getting_started.html 'Getting Started with Rails').
43
+
44
+ Then run:
45
+ ```bash
46
+ $ rails new your_app --database postgresql
47
+ $ rails db:create
48
+ $ rails active_storage:install
49
+ ```
50
+
51
+ Add this line to your application's Gemfile:
52
+
53
+ ```ruby
54
+ gem 'spina'
55
+ ```
56
+
57
+ And then execute:
58
+ ```bash
59
+ $ bundle:install
60
+ ```
61
+
62
+ Run the Spina install generator:
63
+ ```bash
64
+ $ rails g spina:install
65
+ ```
66
+
67
+ And follow the prompts.
68
+ Then follow the instructions below.
69
+
70
+ ### For existing Spina installations
71
+
72
+ Add this line to your application's Gemfile:
73
+
74
+ ```ruby
75
+ gem 'spina-admin-conferences'
76
+ ```
77
+
78
+ You'll then need to install and run the migrations from Conferences (the Spina install generator does this for Spina).
79
+
80
+ First install the migrations and then migrate the database:
81
+ ```bash
82
+ $ rake spina_admin_conferences:install:migrations
83
+ $ rake db:migrate
84
+ ```
85
+
86
+ ### Configuring the main Rails app
87
+
88
+ Conferences requires a job queueing backend for import functionality, and you'll also want to cache pages listing
89
+ presentations, conferences, and so on. Read about this in the Rails guides covering
90
+ [Active Job](https://guides.rubyonrails.org/active_job_basics.html) and
91
+ [caching](https://guides.rubyonrails.org/caching_with_rails.html).
92
+
93
+ ## Contributing
94
+
95
+ You're very welcome to contribute, particularly to translations.
96
+ If there's a bug, or you have a feature request, make an issue on GitHub first.
97
+
98
+ ## License
99
+
100
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rdoc/task'
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = 'Spina::Admin::Conferences'
14
+ rdoc.options << '--line-numbers'
15
+ rdoc.rdoc_files.include('README.md')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
20
+ load 'rails/tasks/engine.rake'
21
+
22
+ load 'rails/tasks/statistics.rake'
23
+
24
+ require 'bundler/gem_tasks'
25
+
26
+ require 'rake/testtask'
27
+
28
+ Rake::TestTask.new(:test) do |t|
29
+ t.libs << 'test'
30
+ t.pattern = 'test/**/*_test.rb'
31
+ t.verbose = false
32
+ t.warning = false
33
+ t.ruby_opts = %w[-W:no-deprecated]
34
+ end
35
+
36
+ task default: :test
37
+
38
+ require 'rubocop/rake_task'
39
+
40
+ RuboCop::RakeTask.new
@@ -0,0 +1,3 @@
1
+ //= link spina_manifest.js
2
+ //= link spina/admin/conferences/application.css
3
+ //= link_tree ../javascripts
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @external Controller
3
+ * @see {@link https://stimulusjs.org}
4
+ */
5
+ import { Controller } from 'stimulus'
6
+
7
+ /**
8
+ * @classdesc Controller that manages conference event inputs.
9
+ */
10
+ export default class extends Controller {
11
+ // noinspection JSUnusedGlobalSymbols
12
+ static get targets() {
13
+ return [
14
+ /**
15
+ * @private
16
+ * @property {HTMLElement[]} formLinkTargets - The form link elements.
17
+ */
18
+ 'formLink',
19
+ /**
20
+ * @private
21
+ * @property {HTMLElement} addFormLinkTarget - The button element for adding forms.
22
+ */
23
+ 'addFormLink',
24
+ /**
25
+ * @private
26
+ * @property {HTMLElement[]} formPaneTargets - The form pane elements.
27
+ */
28
+ 'formPane',
29
+ /**
30
+ * @private
31
+ * @property {HTMLElement[]} destroyFieldTargets - The destroy field hidden inputs.
32
+ */
33
+ 'destroyField',
34
+ /**
35
+ * @private
36
+ * @property {HTMLElement[]} formLinkLabelTargets - The form link label elements.
37
+ */
38
+ 'formLinkLabel'
39
+ ]
40
+ }
41
+ // noinspection JSUnusedGlobalSymbols
42
+ /**
43
+ * @private
44
+ * @property {string} activeClass - The class used to mark elements as active.
45
+ */
46
+ static get classes() {
47
+ return ['active']
48
+ }
49
+
50
+ /**
51
+ * Returns visible form pane targets.
52
+ * @private
53
+ * @return {HTMLElement[]} Form pane targets currently shown.
54
+ */
55
+ get visibleFormPaneTargets() {
56
+ return this.getVisibleTargets(this.formPaneTargets)
57
+ }
58
+
59
+ /**
60
+ * Returns visible form link targets.
61
+ * @private
62
+ * @return {HTMLElement[]} Form link targets currently shown.
63
+ */
64
+ get visibleFormLinkTargets() {
65
+ return this.getVisibleTargets(this.formLinkTargets)
66
+ }
67
+
68
+ // noinspection JSUnusedGlobalSymbols
69
+ /**
70
+ * Removes the form for the button firing the event.
71
+ * @param {Event} event - The event fired by the button.
72
+ */
73
+ removeForm(event) {
74
+ if (!(event.currentTarget instanceof HTMLElement)) return
75
+ const index = this.getIndexOfChild(this.formPaneTargets, event.currentTarget)
76
+ const visibleIndex = this.getIndexOfChild(this.visibleFormPaneTargets, event.currentTarget)
77
+ this.destroyFieldTargets[index].value = true.toString()
78
+ this.hideTargetPair(index)
79
+ if (this.visibleFormPaneTargets.length > 0) {
80
+ let newIndex = visibleIndex <= this.visibleFormPaneTargets.length - 1 ? visibleIndex : visibleIndex - 1
81
+ this.makeTargetPairActive(newIndex)
82
+ }
83
+ this.updateURL()
84
+ }
85
+
86
+ // noinspection JSUnusedGlobalSymbols
87
+ /**
88
+ * Updates the form link labels with new type.
89
+ * @param {Event} event - The event fired by the select element.
90
+ */
91
+ updateType(event) {
92
+ if (!(event.currentTarget instanceof HTMLSelectElement)) return
93
+ const index = this.getIndexOfChild(this.formPaneTargets, event.currentTarget)
94
+ this.formLinkLabelTargets[index].textContent = event.currentTarget.selectedOptions[0].label
95
+ }
96
+
97
+ /**
98
+ * Updates the URL used to get new forms.
99
+ */
100
+ updateURL() {
101
+ const params = new URLSearchParams(this.addFormLinkTarget.search)
102
+ params.set('index', String(this.formPaneTargets.length))
103
+ params.set('active', String(this.visibleFormPaneTargets.length === 0))
104
+ this.addFormLinkTarget.search = params.toString()
105
+ }
106
+
107
+ /**
108
+ * Hides a form pane and form link target sharing an index.
109
+ * @private
110
+ * @private
111
+ * @param {Number} index - The index of the targets to hide.
112
+ */
113
+ hideTargetPair(index) {
114
+ this.hide(this.formPaneTargets[index])
115
+ this.hide(this.formLinkTargets[index])
116
+ }
117
+
118
+ /**
119
+ * Marks a form pane and form link target sharing an index as active.
120
+ * @private
121
+ * @param {Number} index - The index of the targets to show.
122
+ */
123
+ makeTargetPairActive(index) {
124
+ this.makeActive(this.visibleFormPaneTargets[index])
125
+ this.makeActive(this.visibleFormLinkTargets[index])
126
+ }
127
+
128
+ /**
129
+ * Makes an element inactive and hides it.
130
+ * @private
131
+ * @param {HTMLElement} element - The element.
132
+ */
133
+ hide(element) {
134
+ this.makeInactive(element)
135
+ element.hidden = true
136
+ }
137
+
138
+ /**
139
+ * Makes an element inactive.
140
+ * @private
141
+ * @param {HTMLElement} element - The element.
142
+ */
143
+ makeInactive(element) {
144
+ element.classList.remove(this.activeClass)
145
+ }
146
+
147
+ /**
148
+ * Makes an element active.
149
+ * @private
150
+ * @param {HTMLElement} element - The element.
151
+ */
152
+ makeActive(element) {
153
+ element.classList.add(this.activeClass)
154
+ }
155
+
156
+ /**
157
+ * Gets the index of an element within a collection.
158
+ * @private
159
+ * @param {HTMLElement[]} collection
160
+ * @param {HTMLElement} child
161
+ */
162
+ getIndexOfChild(collection, child) {
163
+ return collection.indexOf(collection.find(element => element.contains(child)))
164
+ }
165
+
166
+ /**
167
+ * Gets visible targets within a collection.
168
+ * @private
169
+ * @param {HTMLElement[]} targets
170
+ */
171
+ getVisibleTargets(targets) {
172
+ return targets.filter(target => target.hidden === false)
173
+ }
174
+ }
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @external Controller
3
+ * @see {@link https://stimulusjs.org}
4
+ */
5
+ import { Controller } from 'stimulus'
6
+
7
+ /**
8
+ * @classdesc Controller that manages presentation attachment inputs.
9
+ */
10
+ export default class extends Controller {
11
+ // noinspection JSUnusedGlobalSymbols
12
+ static get targets() {
13
+ return [
14
+ /**
15
+ * @private
16
+ * @property {HTMLElement[]} formLinkTargets - The form link elements.
17
+ */
18
+ 'formLink',
19
+ /**
20
+ * @private
21
+ * @property {HTMLElement} addFormLinkTarget - The button element for adding forms.
22
+ */
23
+ 'addFormLink',
24
+ /**
25
+ * @private
26
+ * @property {HTMLElement[]} formPaneTargets - The form pane elements.
27
+ */
28
+ 'formPane',
29
+ /**
30
+ * @private
31
+ * @property {HTMLElement[]} destroyFieldTargets - The destroy field hidden inputs.
32
+ */
33
+ 'destroyField',
34
+ /**
35
+ * @private
36
+ * @property {HTMLElement[]} formLinkLabelTargets - The form link label elements.
37
+ */
38
+ 'formLinkLabel'
39
+ ]
40
+ }
41
+ // noinspection JSUnusedGlobalSymbols
42
+ /**
43
+ * @private
44
+ * @property {string} activeClass - The class used to mark elements as active.
45
+ */
46
+ static get classes() {
47
+ return ['active']
48
+ }
49
+
50
+ /**
51
+ * Returns visible form pane targets.
52
+ * @private
53
+ * @return {HTMLElement[]} Form pane targets currently shown.
54
+ */
55
+ get visibleFormPaneTargets() {
56
+ return this.getVisibleTargets(this.formPaneTargets)
57
+ }
58
+
59
+ /**
60
+ * Returns visible form link targets.
61
+ * @private
62
+ * @return {HTMLElement[]} Form link targets currently shown.
63
+ */
64
+ get visibleFormLinkTargets() {
65
+ return this.getVisibleTargets(this.formLinkTargets)
66
+ }
67
+
68
+ // noinspection JSUnusedGlobalSymbols
69
+ /**
70
+ * Removes the form for the button firing the event.
71
+ * @param {Event} event - The event fired by the button.
72
+ */
73
+ removeForm(event) {
74
+ if (!(event.currentTarget instanceof HTMLElement)) return
75
+ const index = this.getIndexOfChild(this.formPaneTargets, event.currentTarget)
76
+ const visibleIndex = this.getIndexOfChild(this.visibleFormPaneTargets, event.currentTarget)
77
+ this.destroyFieldTargets[index].value = true.toString()
78
+ this.hideTargetPair(index)
79
+ if (this.visibleFormPaneTargets.length > 0) {
80
+ let newIndex = visibleIndex <= this.visibleFormPaneTargets.length - 1 ? visibleIndex : visibleIndex - 1
81
+ this.makeTargetPairActive(newIndex)
82
+ }
83
+ this.updateURL()
84
+ }
85
+
86
+ // noinspection JSUnusedGlobalSymbols
87
+ /**
88
+ * Updates the form link labels with new type.
89
+ * @param {Event} event - The event fired by the select element.
90
+ */
91
+ updateType(event) {
92
+ if (!(event.currentTarget instanceof HTMLSelectElement)) return
93
+ const index = this.getIndexOfChild(this.formPaneTargets, event.currentTarget)
94
+ this.formLinkLabelTargets[index].textContent = event.currentTarget.selectedOptions[0].label
95
+ }
96
+
97
+ /**
98
+ * Updates the URL used to get new forms.
99
+ */
100
+ updateURL() {
101
+ const params = new URLSearchParams(this.addFormLinkTarget.search)
102
+ params.set('index', String(this.formPaneTargets.length))
103
+ params.set('active', String(this.visibleFormPaneTargets.length === 0))
104
+ this.addFormLinkTarget.search = params.toString()
105
+ }
106
+
107
+ /**
108
+ * Hides a form pane and form link target sharing an index.
109
+ * @private
110
+ * @private
111
+ * @param {Number} index - The index of the targets to hide.
112
+ */
113
+ hideTargetPair(index) {
114
+ this.hide(this.formPaneTargets[index])
115
+ this.hide(this.formLinkTargets[index])
116
+ }
117
+
118
+ /**
119
+ * Marks a form pane and form link target sharing an index as active.
120
+ * @private
121
+ * @param {Number} index - The index of the targets to show.
122
+ */
123
+ makeTargetPairActive(index) {
124
+ this.makeActive(this.visibleFormPaneTargets[index])
125
+ this.makeActive(this.visibleFormLinkTargets[index])
126
+ }
127
+
128
+ /**
129
+ * Makes an element inactive and hides it.
130
+ * @private
131
+ * @param {HTMLElement} element - The element.
132
+ */
133
+ hide(element) {
134
+ this.makeInactive(element)
135
+ element.hidden = true
136
+ }
137
+
138
+ /**
139
+ * Makes an element inactive.
140
+ * @private
141
+ * @param {HTMLElement} element - The element.
142
+ */
143
+ makeInactive(element) {
144
+ element.classList.remove(this.activeClass)
145
+ }
146
+
147
+ /**
148
+ * Makes an element active.
149
+ * @private
150
+ * @param {HTMLElement} element - The element.
151
+ */
152
+ makeActive(element) {
153
+ element.classList.add(this.activeClass)
154
+ }
155
+
156
+ /**
157
+ * Gets the index of an element within a collection.
158
+ * @private
159
+ * @param {HTMLElement[]} collection
160
+ * @param {HTMLElement} child
161
+ */
162
+ getIndexOfChild(collection, child) {
163
+ return collection.indexOf(collection.find(element => element.contains(child)))
164
+ }
165
+
166
+ /**
167
+ * Gets visible targets within a collection.
168
+ * @private
169
+ * @param {HTMLElement[]} targets
170
+ */
171
+ getVisibleTargets(targets) {
172
+ return targets.filter(target => target.hidden === false)
173
+ }
174
+ }