spina-admin-conferences-fork 2.1.2 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/spina_admin_conferences_manifest.js +3 -3
  3. data/app/assets/javascripts/spina/admin/conferences/application.js +0 -4
  4. data/app/assets/javascripts/{controllers/spina/admin/conferences → spina/admin/conferences/controllers}/select_options_controller.js +1 -1
  5. data/app/assets/stylesheets/spina/admin/conferences/application.tailwind.css +0 -0
  6. data/app/controllers/spina/admin/conferences/application_controller.rb +8 -1
  7. data/app/controllers/spina/admin/conferences/conferences_controller.rb +13 -25
  8. data/app/controllers/spina/admin/conferences/delegates_controller.rb +12 -24
  9. data/app/controllers/spina/admin/conferences/dietary_requirements_controller.rb +12 -24
  10. data/app/controllers/spina/admin/conferences/institutions_controller.rb +12 -24
  11. data/app/controllers/spina/admin/conferences/presentation_attachment_types_controller.rb +12 -24
  12. data/app/controllers/spina/admin/conferences/presentation_types_controller.rb +12 -26
  13. data/app/controllers/spina/admin/conferences/presentations_controller.rb +12 -24
  14. data/app/controllers/spina/admin/conferences/rooms_controller.rb +12 -26
  15. data/app/controllers/spina/admin/conferences/sessions_controller.rb +12 -26
  16. data/app/jobs/spina/admin/conferences/import_job.rb +2 -2
  17. data/app/models/spina/admin/conferences/conference.rb +1 -1
  18. data/app/models/spina/admin/conferences/delegate.rb +3 -3
  19. data/app/models/spina/admin/conferences/presentation.rb +1 -1
  20. data/app/views/spina/admin/conferences/application/_conferences.html.haml +10 -11
  21. data/app/views/spina/admin/conferences/application/_delegates.html.haml +9 -10
  22. data/app/views/spina/admin/conferences/application/_dietary_requirements.html.haml +7 -8
  23. data/app/views/spina/admin/conferences/application/_institutions.html.haml +8 -9
  24. data/app/views/spina/admin/conferences/application/_presentation_attachment_types.html.haml +8 -9
  25. data/app/views/spina/admin/conferences/application/_presentation_types.html.haml +9 -10
  26. data/app/views/spina/admin/conferences/application/_presentations.html.haml +9 -10
  27. data/app/views/spina/admin/conferences/application/_rooms.html.haml +9 -10
  28. data/app/views/spina/admin/conferences/application/_sessions.html.haml +9 -10
  29. data/app/views/spina/admin/conferences/conferences/_conference.html.haml +13 -9
  30. data/app/views/spina/admin/conferences/conferences/_event_fields.html.haml +18 -25
  31. data/app/views/spina/admin/conferences/conferences/_form.html.haml +24 -22
  32. data/app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml +28 -22
  33. data/app/views/spina/admin/conferences/conferences/_form_delegates.html.haml +1 -0
  34. data/app/views/spina/admin/conferences/conferences/_form_parts.html.haml +5 -7
  35. data/app/views/spina/admin/conferences/conferences/_form_presentation_types.html.haml +1 -0
  36. data/app/views/spina/admin/conferences/conferences/_form_presentations.html.haml +1 -0
  37. data/app/views/spina/admin/conferences/conferences/_form_rooms.html.haml +1 -0
  38. data/app/views/spina/admin/conferences/conferences/index.html.haml +22 -4
  39. data/app/views/spina/admin/conferences/delegates/_delegate.html.haml +10 -12
  40. data/app/views/spina/admin/conferences/delegates/_form.html.haml +23 -19
  41. data/app/views/spina/admin/conferences/delegates/_form_conferences.html.haml +1 -0
  42. data/app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml +29 -53
  43. data/app/views/spina/admin/conferences/delegates/_form_presentations.html.haml +1 -0
  44. data/app/views/spina/admin/conferences/delegates/index.html.haml +14 -10
  45. data/app/views/spina/admin/conferences/dietary_requirements/_dietary_requirement.html.haml +7 -6
  46. data/app/views/spina/admin/conferences/dietary_requirements/_form.html.haml +23 -18
  47. data/app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml +1 -0
  48. data/app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml +3 -8
  49. data/app/views/spina/admin/conferences/dietary_requirements/index.html.haml +6 -4
  50. data/app/views/spina/admin/conferences/institutions/_form.html.haml +23 -19
  51. data/app/views/spina/admin/conferences/institutions/_form_delegates.html.haml +1 -0
  52. data/app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml +24 -25
  53. data/app/views/spina/admin/conferences/institutions/_form_rooms.html.haml +1 -0
  54. data/app/views/spina/admin/conferences/institutions/_institution.html.haml +9 -7
  55. data/app/views/spina/admin/conferences/institutions/index.html.haml +19 -4
  56. data/app/views/spina/admin/conferences/presentation_attachment_types/_form.html.haml +15 -20
  57. data/app/views/spina/admin/conferences/presentation_attachment_types/_presentation_attachment_type.html.haml +7 -6
  58. data/app/views/spina/admin/conferences/presentation_attachment_types/index.html.haml +6 -4
  59. data/app/views/spina/admin/conferences/presentation_types/_form.html.haml +23 -19
  60. data/app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml +7 -16
  61. data/app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml +1 -0
  62. data/app/views/spina/admin/conferences/presentation_types/_form_sessions.html.haml +1 -0
  63. data/app/views/spina/admin/conferences/presentation_types/_presentation_type.html.haml +11 -8
  64. data/app/views/spina/admin/conferences/presentation_types/index.html.haml +22 -4
  65. data/app/views/spina/admin/conferences/presentations/_attachment_fields.html.haml +10 -16
  66. data/app/views/spina/admin/conferences/presentations/_form.html.haml +23 -18
  67. data/app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml +59 -55
  68. data/app/views/spina/admin/conferences/presentations/_form_presenters.html.haml +1 -0
  69. data/app/views/spina/admin/conferences/presentations/_presentation.html.haml +10 -8
  70. data/app/views/spina/admin/conferences/presentations/index.html.haml +15 -10
  71. data/app/views/spina/admin/conferences/rooms/_form.html.haml +23 -18
  72. data/app/views/spina/admin/conferences/rooms/_form_presentations.html.haml +1 -0
  73. data/app/views/spina/admin/conferences/rooms/_form_room_details.html.haml +7 -16
  74. data/app/views/spina/admin/conferences/rooms/_room.html.haml +11 -8
  75. data/app/views/spina/admin/conferences/rooms/index.html.haml +19 -4
  76. data/app/views/spina/admin/conferences/sessions/_form.html.haml +23 -18
  77. data/app/views/spina/admin/conferences/sessions/_form_presentations.html.haml +1 -0
  78. data/app/views/spina/admin/conferences/sessions/_form_session_details.html.haml +13 -19
  79. data/app/views/spina/admin/conferences/sessions/_session.html.haml +11 -8
  80. data/app/views/spina/admin/conferences/sessions/index.html.haml +22 -4
  81. data/app/views/spina/admin/hooks/conferences/_head.html.haml +0 -6
  82. data/app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml +25 -19
  83. data/app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml +0 -6
  84. data/app/views/spina/admin/parts/admin/conferences/dates/_form.html.haml +2 -2
  85. data/app/views/spina/admin/parts/admin/conferences/email_addresses/_form.html.haml +4 -2
  86. data/app/views/spina/admin/parts/admin/conferences/times/_form.html.haml +2 -2
  87. data/app/views/spina/admin/parts/admin/conferences/urls/_form.html.haml +4 -2
  88. data/config/locales/en.yml +31 -9
  89. data/config/routes.rb +1 -4
  90. data/db/migrate/20180907141242_add_type_to_spina_pages.rb +1 -1
  91. data/db/migrate/20180907141243_create_spina_conferences_conference_page_parts.rb +1 -1
  92. data/db/migrate/20181017155705_add_dependent_option_to_foreign_keys.rb +1 -1
  93. data/db/migrate/20190408131354_change_spina_resources.rb +10 -10
  94. data/db/migrate/20190701174807_remove_spina_conference_pages.rb +15 -15
  95. data/db/migrate/20190704135524_add_constraints_to_columns.rb +1 -1
  96. data/db/migrate/20200126213718_create_spina_conferences_presentation_attachments.rb +1 -1
  97. data/db/migrate/20200802184921_create_spina_conferences_event_name_description_and_location_translations.rb +1 -1
  98. data/db/migrate/20200911161739_move_conference_parts.rb +3 -3
  99. data/db/migrate/20201002122517_remove_spina_conferences_conference_page_parts.rb +1 -1
  100. data/db/migrate/20201007125625_add_timestamps_to_spina_conferences_parts.rb +2 -2
  101. data/db/migrate/20210315164411_convert_partables_to_json.rb +10 -18
  102. data/db/migrate/20210417102513_add_locale_to_action_text_rich_texts.rb +1 -1
  103. data/lib/spina/admin/conferences/engine.rb +13 -0
  104. data/lib/spina/admin/conferences/migration/renaming.rb +4 -4
  105. data/lib/spina/admin/conferences/railtie.rb +1 -0
  106. data/lib/spina/admin/conferences/version.rb +1 -1
  107. data/lib/spina/admin/conferences.rb +1 -2
  108. metadata +60 -82
  109. data/app/assets/javascripts/controllers/spina/admin/conferences/conference_events_form_controller.js +0 -174
  110. data/app/assets/javascripts/controllers/spina/admin/conferences/presentation_attachments_form_controller.js +0 -174
  111. data/app/assets/javascripts/importmap.json.erb +0 -6
  112. data/app/assets/stylesheets/spina/admin/conferences/application.sass +0 -3
  113. data/app/controllers/spina/admin/conferences/events_controller.rb +0 -24
  114. data/app/controllers/spina/admin/conferences/presentation_attachments_controller.rb +0 -24
  115. data/app/views/layouts/spina/admin/conferences/application.html.haml +0 -6
  116. data/app/views/layouts/spina/admin/conferences/conferences.html.haml +0 -17
  117. data/app/views/layouts/spina/admin/conferences/delegates.html.haml +0 -8
  118. data/app/views/layouts/spina/admin/conferences/dietary_requirements.html.haml +0 -8
  119. data/app/views/layouts/spina/admin/conferences/institutions.html.haml +0 -15
  120. data/app/views/layouts/spina/admin/conferences/presentation_attachment_types.html.haml +0 -8
  121. data/app/views/layouts/spina/admin/conferences/presentations.html.haml +0 -8
  122. data/app/views/spina/admin/conferences/conferences/_event_row.html.haml +0 -5
  123. data/app/views/spina/admin/conferences/conferences/_form_structure.html.haml +0 -19
  124. data/app/views/spina/admin/conferences/conferences/_form_structure_item.html.haml +0 -13
  125. data/app/views/spina/admin/conferences/events/new.js.erb +0 -21
  126. data/app/views/spina/admin/conferences/presentation_attachments/new.js.erb +0 -21
  127. data/app/views/spina/admin/conferences/presentations/_attachment_row.html.haml +0 -2
  128. data/config/initializers/assets.rb +0 -13
  129. data/vendor/assets/javascripts/spina/trix.js +0 -21
  130. data/vendor/assets/stylesheets/spina/trix.css +0 -375
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d2b15301bf52a685a4ac923f560eae781ab82d14efb9dacafdd7381709a59fc
4
- data.tar.gz: bb37d19f4aeb71f2a38678e2f88e38e28c1d6110bf40b8fcc58e3e6173d362ad
3
+ metadata.gz: 7d4f99ddd9bb98f040badcd6932efa9488a3942f493695351af340161d8d41f8
4
+ data.tar.gz: 962d1f8d378591cacb509cde4b95de75b0070031d35cdcf9fa8eac33f6568c8d
5
5
  SHA512:
6
- metadata.gz: b1734c3ab9456ff22fe027302fa74c558b875c3231395665f4a05db33820650b68c65fa8eec8301d43e4536c10b4c03e722a2322009efc5a56aefbf897ae66c2
7
- data.tar.gz: 7773bdf6a9504dd960718454521ff3c5656c23e3cbcb42326ffc9e493a904b3437d2d8300caa2ae9714d19a54d52d79a2f74b059d7a0e23a6c7807c92e196184
6
+ metadata.gz: b170baf53afa700552aa77180d312b53fd607d39f523a7d3b00db1d22817209f6b57102787c13eebef7557961a0a678571bffecc0a018653eb9058c568b46a89
7
+ data.tar.gz: 8629259d8564b8ff94f8e9c9e48213cb27c85c9413682a7571624565aae405d5a79dc9884f8cd8dddf5787163d26a98a0e5156a3bd03bbdaf398d04fb98d8929
@@ -1,3 +1,3 @@
1
- //= link spina_manifest.js
2
- //= link spina/admin/conferences/application.css
3
- //= link_tree ../javascripts
1
+ //= link_directory ../javascripts/spina/admin/conferences/controllers
2
+
3
+ //= link spina/admin/conferences/application.js
@@ -1,4 +0,0 @@
1
- document.addEventListener('turbo:load', (event) => {
2
- const customEvent = new CustomEvent('turbolinks:load', { cancelable: event.cancelable, bubbles: true, detail: event.detail })
3
- document.documentElement.dispatchEvent(customEvent)
4
- })
@@ -2,7 +2,7 @@
2
2
  * @external Controller
3
3
  * @see {@link https://stimulusjs.org}
4
4
  */
5
- import { Controller } from 'stimulus'
5
+ import { Controller } from '@hotwired/stimulus'
6
6
 
7
7
  /**
8
8
  * @classdesc Controller that links related select elements.
@@ -9,11 +9,18 @@ module Spina
9
9
 
10
10
  add_flash_types :success
11
11
 
12
- layout 'spina/admin/conferences/application', only: %i[new edit]
12
+ layout :admin_layout
13
+
13
14
  before_action :set_locale
14
15
 
16
+ admin_section :conferences
17
+
15
18
  private
16
19
 
20
+ def admin_layout
21
+ 'spina/admin/admin'
22
+ end
23
+
17
24
  def set_locale
18
25
  @locale = params[:locale] || I18n.default_locale
19
26
  end
@@ -19,7 +19,7 @@ module Spina
19
19
  ].freeze
20
20
  CONTENT_PARAMS = Spina.config.locales.inject({}) { |params, locale| params.merge("#{locale}_content_attributes": [*PARTS_PARAMS]) }
21
21
  PARAMS = [:start_date, :finish_date, :name, **CONTENT_PARAMS,
22
- events_attributes: %i[id name start_datetime finish_datetime description location] ].freeze
22
+ events_attributes: %i[id name start_datetime finish_datetime description location]].freeze
23
23
  PARTS = %w[text submission_url submission_email_address submission_date submission_text gallery sponsors].freeze
24
24
 
25
25
  before_action :set_conference, only: %i[edit update destroy]
@@ -52,51 +52,39 @@ module Spina
52
52
 
53
53
  # Creates a conference.
54
54
  # @return [void]
55
- def create # rubocop:disable Metrics/MethodLength
55
+ def create
56
56
  @conference = Conference.new(conference_params)
57
57
 
58
58
  if @conference.save
59
59
  redirect_to admin_conferences_conferences_path, success: t('.saved')
60
60
  else
61
- respond_to do |format|
62
- format.html do
63
- add_breadcrumb t('.new')
64
- render :new
65
- end
66
- format.turbo_stream { render partial: 'errors', locals: { errors: @conference.errors } }
67
- end
61
+ add_breadcrumb t('.new')
62
+ flash.now[:alert] = t('.failed')
63
+ render :new, status: :unprocessable_entity
68
64
  end
69
65
  end
70
66
 
71
67
  # Updates a conference.
72
68
  # @return [void]
73
- def update # rubocop:disable Metrics/MethodLength
69
+ def update
74
70
  if @conference.update(conference_params)
75
71
  redirect_to admin_conferences_conferences_path, success: t('.saved')
76
72
  else
77
- respond_to do |format|
78
- format.html do
79
- add_breadcrumb @conference.name
80
- render :edit
81
- end
82
- format.turbo_stream { render partial: 'errors', locals: { errors: @conference.errors } }
83
- end
73
+ add_breadcrumb @conference.name
74
+ flash.now[:alert] = t('.failed')
75
+ render :edit, status: :unprocessable_entity
84
76
  end
85
77
  end
86
78
 
87
79
  # Destroys a conference.
88
80
  # @return [void]
89
- def destroy # rubocop:disable Metrics/MethodLength
81
+ def destroy
90
82
  if @conference.destroy
91
83
  redirect_to admin_conferences_conferences_path, success: t('.destroyed')
92
84
  else
93
- respond_to do |format|
94
- format.html do
95
- add_breadcrumb @conference.name
96
- render :edit
97
- end
98
- format.turbo_stream { render partial: 'errors', locals: { errors: @conference.errors } }
99
- end
85
+ add_breadcrumb @conference.name
86
+ flash.now[:alert] = t('.failed')
87
+ render :edit, status: :unprocessable_entity
100
88
  end
101
89
  end
102
90
 
@@ -33,51 +33,39 @@ module Spina
33
33
 
34
34
  # Creates a delegate.
35
35
  # @return [void]
36
- def create # rubocop:disable Metrics/MethodLength
36
+ def create
37
37
  @delegate = Delegate.new(delegate_params)
38
38
 
39
39
  if @delegate.save
40
40
  redirect_to admin_conferences_delegates_path, success: t('.saved')
41
41
  else
42
- respond_to do |format|
43
- format.html do
44
- add_breadcrumb t('.new')
45
- render :new
46
- end
47
- format.turbo_stream { render partial: 'errors', locals: { errors: @delegate.errors } }
48
- end
42
+ add_breadcrumb t('.new')
43
+ flash.now[:alert] = t('.failed')
44
+ render :new, status: :unprocessable_entity
49
45
  end
50
46
  end
51
47
 
52
48
  # Updates a delegate.
53
49
  # @return [void]
54
- def update # rubocop:disable Metrics/MethodLength
50
+ def update
55
51
  if @delegate.update(delegate_params)
56
52
  redirect_to admin_conferences_delegates_path, success: t('.saved')
57
53
  else
58
- respond_to do |format|
59
- format.html do
60
- add_breadcrumb @delegate.full_name
61
- render :edit
62
- end
63
- format.turbo_stream { render partial: 'errors', locals: { errors: @delegate.errors } }
64
- end
54
+ add_breadcrumb @delegate.full_name
55
+ flash.now[:alert] = t('.failed')
56
+ render :edit, status: :unprocessable_entity
65
57
  end
66
58
  end
67
59
 
68
60
  # Destroys a delegate.
69
61
  # @return [void]
70
- def destroy # rubocop:disable Metrics/MethodLength
62
+ def destroy
71
63
  if @delegate.destroy
72
64
  redirect_to admin_conferences_delegates_path, success: t('.destroyed')
73
65
  else
74
- respond_to do |format|
75
- format.html do
76
- add_breadcrumb @delegate.full_name
77
- render :edit
78
- end
79
- format.turbo_stream { render partial: 'errors', locals: { errors: @delegate.errors } }
80
- end
66
+ add_breadcrumb @delegate.full_name
67
+ flash.now[:alert] = t('.failed')
68
+ render :edit, status: :unprocessable_entity
81
69
  end
82
70
  end
83
71
 
@@ -33,51 +33,39 @@ module Spina
33
33
 
34
34
  # Creates a dietary requirement.
35
35
  # @return [void]
36
- def create # rubocop:disable Metrics/MethodLength
36
+ def create
37
37
  @dietary_requirement = DietaryRequirement.new dietary_requirement_params
38
38
 
39
39
  if @dietary_requirement.save
40
40
  redirect_to admin_conferences_dietary_requirements_path, success: t('.saved')
41
41
  else
42
- respond_to do |format|
43
- format.html do
44
- add_breadcrumb t('.new')
45
- render :new
46
- end
47
- format.turbo_stream { render partial: 'errors', locals: { errors: @dietary_requirement.errors } }
48
- end
42
+ add_breadcrumb t('.new')
43
+ flash.now[:alert] = t('.failed')
44
+ render :new, status: :unprocessable_entity
49
45
  end
50
46
  end
51
47
 
52
48
  # Updates a dietary requirement.
53
49
  # @return [void]
54
- def update # rubocop:disable Metrics/MethodLength
50
+ def update
55
51
  if @dietary_requirement.update(dietary_requirement_params)
56
52
  redirect_to admin_conferences_dietary_requirements_path, success: t('.saved')
57
53
  else
58
- respond_to do |format|
59
- format.html do
60
- add_breadcrumb @dietary_requirement.name
61
- render :edit
62
- end
63
- format.turbo_stream { render partial: 'errors', locals: { errors: @dietary_requirement.errors } }
64
- end
54
+ add_breadcrumb @dietary_requirement.name
55
+ flash.now[:alert] = t('.failed')
56
+ render :edit, status: :unprocessable_entity
65
57
  end
66
58
  end
67
59
 
68
60
  # Destroys a dietary requirement.
69
61
  # @return [void]
70
- def destroy # rubocop:disable Metrics/MethodLength
62
+ def destroy
71
63
  if @dietary_requirement.destroy
72
64
  redirect_to admin_conferences_dietary_requirements_path, success: t('.destroyed')
73
65
  else
74
- respond_to do |format|
75
- format.html do
76
- add_breadcrumb @dietary_requirement.name
77
- render :edit
78
- end
79
- format.turbo_stream { render partial: 'errors', locals: { errors: @dietary_requirement.errors } }
80
- end
66
+ add_breadcrumb @dietary_requirement.name
67
+ flash.now[:alert] = t('.failed')
68
+ render :edit, status: :unprocessable_entity
81
69
  end
82
70
  end
83
71
 
@@ -33,51 +33,39 @@ module Spina
33
33
 
34
34
  # Creates an institution.
35
35
  # @return [void]
36
- def create # rubocop:disable Metrics/MethodLength
36
+ def create
37
37
  @institution = Institution.new(conference_params)
38
38
 
39
39
  if @institution.save
40
40
  redirect_to admin_conferences_institutions_path, success: t('.saved')
41
41
  else
42
- respond_to do |format|
43
- format.html do
44
- add_breadcrumb t('.new')
45
- render :new
46
- end
47
- format.turbo_stream { render partial: 'errors', locals: { errors: @institution.errors } }
48
- end
42
+ add_breadcrumb t('.new')
43
+ flash.now[:alert] = t('.failed')
44
+ render :new, status: :unprocessable_entity
49
45
  end
50
46
  end
51
47
 
52
48
  # Updates an institution.
53
49
  # @return [void]
54
- def update # rubocop:disable Metrics/MethodLength
50
+ def update
55
51
  if @institution.update(conference_params)
56
52
  redirect_to admin_conferences_institutions_path, success: t('.saved')
57
53
  else
58
- respond_to do |format|
59
- format.html do
60
- add_breadcrumb @institution.name
61
- render :edit
62
- end
63
- format.turbo_stream { render partial: 'errors', locals: { errors: @institution.errors } }
64
- end
54
+ add_breadcrumb @institution.name
55
+ flash.now[:alert] = t('.failed')
56
+ render :edit, status: :unprocessable_entity
65
57
  end
66
58
  end
67
59
 
68
60
  # Destroys an institution.
69
61
  # @return [void]
70
- def destroy # rubocop:disable Metrics/MethodLength
62
+ def destroy
71
63
  if @institution.destroy
72
64
  redirect_to admin_conferences_institutions_path, success: t('.destroyed')
73
65
  else
74
- respond_to do |format|
75
- format.html do
76
- add_breadcrumb @institution.name
77
- render :edit
78
- end
79
- format.turbo_stream { render partial: 'errors', locals: { errors: @institution.errors } }
80
- end
66
+ add_breadcrumb @institution.name
67
+ flash.now[:alert] = t('.failed')
68
+ render :edit, status: :unprocessable_entity
81
69
  end
82
70
  end
83
71
 
@@ -32,51 +32,39 @@ module Spina
32
32
 
33
33
  # Creates a presentation attachment type.
34
34
  # @return [void]
35
- def create # rubocop:disable Metrics/MethodLength
35
+ def create
36
36
  @presentation_attachment_type = PresentationAttachmentType.new presentation_attachment_type_params
37
37
 
38
38
  if @presentation_attachment_type.save
39
39
  redirect_to admin_conferences_presentation_attachment_types_path, success: t('.saved')
40
40
  else
41
- respond_to do |format|
42
- format.html do
43
- add_breadcrumb t('.new')
44
- render :new
45
- end
46
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_attachment_type.errors } }
47
- end
41
+ add_breadcrumb t('.new')
42
+ flash.now[:alert] = t('.failed')
43
+ render :new, status: :unprocessable_entity
48
44
  end
49
45
  end
50
46
 
51
47
  # Updates a presentation attachment type.
52
48
  # @return [void]
53
- def update # rubocop:disable Metrics/MethodLength
49
+ def update
54
50
  if @presentation_attachment_type.update(presentation_attachment_type_params)
55
51
  redirect_to admin_conferences_presentation_attachment_types_path, success: t('.saved')
56
52
  else
57
- respond_to do |format|
58
- format.html do
59
- add_breadcrumb @presentation_attachment_type.name
60
- render :edit
61
- end
62
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_attachment_type.errors } }
63
- end
53
+ add_breadcrumb @presentation_attachment_type.name
54
+ flash.now[:alert] = t('.failed')
55
+ render :edit, status: :unprocessable_entity
64
56
  end
65
57
  end
66
58
 
67
59
  # Destroys a presentation attachment type.
68
60
  # @return [void]
69
- def destroy # rubocop:disable Metrics/MethodLength
61
+ def destroy
70
62
  if @presentation_attachment_type.destroy
71
63
  redirect_to admin_conferences_presentation_attachment_types_path, success: t('.destroyed')
72
64
  else
73
- respond_to do |format|
74
- format.html do
75
- add_breadcrumb @presentation_attachment_type.name
76
- render :edit
77
- end
78
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_attachment_type.errors } }
79
- end
65
+ add_breadcrumb @presentation_attachment_type.name
66
+ flash.now[:alert] = t('.failed')
67
+ render :edit, status: :unprocessable_entity
80
68
  end
81
69
  end
82
70
 
@@ -10,8 +10,6 @@ module Spina
10
10
  before_action :set_breadcrumbs
11
11
  before_action :set_tabs
12
12
 
13
- layout 'spina/admin/conferences/conferences'
14
-
15
13
  # @!group Actions
16
14
 
17
15
  # Renders a list of presentation types.
@@ -35,51 +33,39 @@ module Spina
35
33
 
36
34
  # Creates a presentation type.
37
35
  # @return [void]
38
- def create # rubocop:disable Metrics/MethodLength
36
+ def create
39
37
  @presentation_type = PresentationType.new presentation_type_params
40
38
 
41
39
  if @presentation_type.save
42
40
  redirect_to admin_conferences_presentation_types_path, success: t('.saved')
43
41
  else
44
- respond_to do |format|
45
- format.html do
46
- add_breadcrumb t('.new')
47
- render :new
48
- end
49
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_type.errors } }
50
- end
42
+ add_breadcrumb t('.new')
43
+ flash.now[:alert] = t('.failed')
44
+ render :new, status: :unprocessable_entity
51
45
  end
52
46
  end
53
47
 
54
48
  # Updates a presentation type.
55
49
  # @return [void]
56
- def update # rubocop:disable Metrics/MethodLength
50
+ def update
57
51
  if @presentation_type.update(presentation_type_params)
58
52
  redirect_to admin_conferences_presentation_types_path, success: t('.saved')
59
53
  else
60
- respond_to do |format|
61
- format.html do
62
- add_breadcrumb @presentation_type.name
63
- render :edit
64
- end
65
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_type.errors } }
66
- end
54
+ add_breadcrumb @presentation_type.name
55
+ flash.now[:alert] = t('.failed')
56
+ render :edit, status: :unprocessable_entity
67
57
  end
68
58
  end
69
59
 
70
60
  # Destroys a presentation type.
71
61
  # @return [void]
72
- def destroy # rubocop:disable Metrics/MethodLength
62
+ def destroy
73
63
  if @presentation_type.destroy
74
64
  redirect_to admin_conferences_presentation_types_path, success: t('.destroyed')
75
65
  else
76
- respond_to do |format|
77
- format.html do
78
- add_breadcrumb @presentation_type.name
79
- render :edit
80
- end
81
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_type.errors } }
82
- end
66
+ add_breadcrumb @presentation_type.name
67
+ flash.now[:alert] = t('.failed')
68
+ render :edit, status: :unprocessable_entity
83
69
  end
84
70
  end
85
71
 
@@ -34,51 +34,39 @@ module Spina
34
34
 
35
35
  # Creates a presentation.
36
36
  # @return [void]
37
- def create # rubocop:disable Metrics/MethodLength
37
+ def create
38
38
  @presentation = Presentation.new presentation_params
39
39
 
40
40
  if @presentation.save
41
41
  redirect_to admin_conferences_presentations_path, success: t('.saved')
42
42
  else
43
- respond_to do |format|
44
- format.html do
45
- add_breadcrumb t('.new')
46
- render :new
47
- end
48
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
49
- end
43
+ add_breadcrumb t('.new')
44
+ flash.now[:alert] = t('.failed')
45
+ render :new, status: :unprocessable_entity
50
46
  end
51
47
  end
52
48
 
53
49
  # Updates a presentation.
54
50
  # @return [void]
55
- def update # rubocop:disable Metrics/MethodLength
51
+ def update
56
52
  if @presentation.update(presentation_params)
57
53
  redirect_to admin_conferences_presentations_path, success: t('.saved')
58
54
  else
59
- respond_to do |format|
60
- format.html do
61
- add_breadcrumb @presentation.title
62
- render :edit
63
- end
64
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
65
- end
55
+ add_breadcrumb @presentation.name
56
+ flash.now[:alert] = t('.failed')
57
+ render :edit, status: :unprocessable_entity
66
58
  end
67
59
  end
68
60
 
69
61
  # Destroys a presentation.
70
62
  # @return [void]
71
- def destroy # rubocop:disable Metrics/MethodLength
63
+ def destroy
72
64
  if @presentation.destroy
73
65
  redirect_to admin_conferences_presentations_path, success: t('.destroyed')
74
66
  else
75
- respond_to do |format|
76
- format.html do
77
- add_breadcrumb @presentation.title
78
- render :edit
79
- end
80
- format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
81
- end
67
+ add_breadcrumb @presentation.name
68
+ flash.now[:alert] = t('.failed')
69
+ render :edit, status: :unprocessable_entity
82
70
  end
83
71
  end
84
72
 
@@ -10,8 +10,6 @@ module Spina
10
10
  before_action :set_breadcrumbs
11
11
  before_action :set_tabs
12
12
 
13
- layout 'spina/admin/conferences/institutions'
14
-
15
13
  # @!group Actions
16
14
 
17
15
  # Renders a list of rooms.
@@ -35,51 +33,39 @@ module Spina
35
33
 
36
34
  # Creates a room.
37
35
  # @return [void]
38
- def create # rubocop:disable Metrics/MethodLength
36
+ def create
39
37
  @room = Room.new(room_params)
40
38
 
41
39
  if @room.save
42
40
  redirect_to admin_conferences_rooms_path, success: t('.saved')
43
41
  else
44
- respond_to do |format|
45
- format.html do
46
- add_breadcrumb t('.new')
47
- render :new
48
- end
49
- format.turbo_stream { render partial: 'errors', locals: { errors: @room.errors } }
50
- end
42
+ add_breadcrumb t('.new')
43
+ flash.now[:alert] = t('.failed')
44
+ render :new, status: :unprocessable_entity
51
45
  end
52
46
  end
53
47
 
54
48
  # Updates a room.
55
49
  # @return [void]
56
- def update # rubocop:disable Metrics/MethodLength
50
+ def update
57
51
  if @room.update(room_params)
58
52
  redirect_to admin_conferences_rooms_path, success: t('.saved')
59
53
  else
60
- respond_to do |format|
61
- format.html do
62
- add_breadcrumb @room.name
63
- render :edit
64
- end
65
- format.turbo_stream { render partial: 'errors', locals: { errors: @room.errors } }
66
- end
54
+ add_breadcrumb @room.name
55
+ flash.now[:alert] = t('.failed')
56
+ render :edit, status: :unprocessable_entity
67
57
  end
68
58
  end
69
59
 
70
60
  # Destroys a room.
71
61
  # @return [void]
72
- def destroy # rubocop:disable Metrics/MethodLength
62
+ def destroy
73
63
  if @room.destroy
74
64
  redirect_to admin_conferences_rooms_path, success: t('.destroyed')
75
65
  else
76
- respond_to do |format|
77
- format.html do
78
- add_breadcrumb @room.name
79
- render :edit
80
- end
81
- format.turbo_stream { render partial: 'errors', locals: { errors: @room.errors } }
82
- end
66
+ add_breadcrumb @room.name
67
+ flash.now[:alert] = t('.failed')
68
+ render :edit, status: :unprocessable_entity
83
69
  end
84
70
  end
85
71