Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/activeadmin_calendar.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# frozen_string_literal: true

# Load ActiveAdmin first so `ActiveAdmin::Views` exists by the time we
# register the view component. AA doesn't publish a load hook for itself
# (only `:active_admin_controller`), and `config.to_prepare` would fire
# too late for engines that require AA resources from an initializer.
# Sibling plugins (active_admin_sidebar, etc.) use the same pattern.
require "activeadmin"
require "activeadmin_calendar/version"

module ActiveadminCalendar
end

require "activeadmin_calendar/engine" if defined?(Rails)
require "activeadmin_calendar/index_as_calendar"
7 changes: 4 additions & 3 deletions lib/activeadmin_calendar/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
require "rails/engine"

module ActiveadminCalendar
# Empty engine — kept so Propshaft / Tailwind can discover this gem's
# `app/assets/stylesheets` directory on AA 4. The view component
# itself is required eagerly from `lib/activeadmin_calendar.rb` so it
# is available before AA resources are loaded.
class Engine < ::Rails::Engine
config.to_prepare do
require "activeadmin_calendar/index_as_calendar"
end
end
end
Loading