active_admin.rb 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. require 'meta_search'
  2. require 'bourbon'
  3. require 'devise'
  4. require 'kaminari'
  5. require 'formtastic'
  6. require 'sass'
  7. require 'inherited_resources'
  8. require 'jquery-rails'
  9. require 'active_admin/arbre'
  10. require 'active_admin/engine'
  11. module ActiveAdmin
  12. autoload :VERSION, 'active_admin/version'
  13. autoload :Application, 'active_admin/application'
  14. autoload :AssetRegistration, 'active_admin/asset_registration'
  15. autoload :Breadcrumbs, 'active_admin/breadcrumbs'
  16. autoload :Callbacks, 'active_admin/callbacks'
  17. autoload :Component, 'active_admin/component'
  18. autoload :BaseController, 'active_admin/base_controller'
  19. autoload :ControllerAction, 'active_admin/controller_action'
  20. autoload :CSVBuilder, 'active_admin/csv_builder'
  21. autoload :Dashboards, 'active_admin/dashboards'
  22. autoload :DependencyChecker, 'active_admin/dependency_checker'
  23. autoload :Deprecation, 'active_admin/deprecation'
  24. autoload :Devise, 'active_admin/devise'
  25. autoload :DSL, 'active_admin/dsl'
  26. autoload :Event, 'active_admin/event'
  27. autoload :FormBuilder, 'active_admin/form_builder'
  28. autoload :FilterFormBuilder, 'active_admin/filter_form_builder'
  29. autoload :Inputs, 'active_admin/inputs'
  30. autoload :Iconic, 'active_admin/iconic'
  31. autoload :Menu, 'active_admin/menu'
  32. autoload :MenuItem, 'active_admin/menu_item'
  33. autoload :Namespace, 'active_admin/namespace'
  34. autoload :Page, 'active_admin/page'
  35. autoload :PagePresenter, 'active_admin/page_presenter'
  36. autoload :PageController, 'active_admin/page_controller'
  37. autoload :PageDSL, 'active_admin/page_dsl'
  38. autoload :Reloader, 'active_admin/reloader'
  39. autoload :Resource, 'active_admin/resource'
  40. autoload :ResourceController, 'active_admin/resource_controller'
  41. autoload :ResourceDSL, 'active_admin/resource_dsl'
  42. autoload :Renderer, 'active_admin/renderer'
  43. autoload :Scope, 'active_admin/scope'
  44. autoload :ScopeChain, 'active_admin/helpers/scope_chain'
  45. autoload :SidebarSection, 'active_admin/sidebar_section'
  46. autoload :TableBuilder, 'active_admin/table_builder'
  47. autoload :ViewFactory, 'active_admin/view_factory'
  48. autoload :ViewHelpers, 'active_admin/view_helpers'
  49. autoload :Views, 'active_admin/views'
  50. class Railtie < ::Rails::Railtie
  51. # Add load paths straight to I18n, so engines and application can overwrite it.
  52. require 'active_support/i18n'
  53. I18n.load_path += Dir[File.expand_path('../active_admin/locales/*.yml', __FILE__)]
  54. end
  55. class << self
  56. attr_accessor :application
  57. def application
  58. @application ||= ::ActiveAdmin::Application.new
  59. end
  60. # Gets called within the initializer
  61. def setup
  62. application.setup!
  63. yield(application)
  64. application.prepare!
  65. end
  66. delegate :register, :to => :application
  67. delegate :register_page, :to => :application
  68. delegate :unload!, :to => :application
  69. delegate :load!, :to => :application
  70. delegate :routes, :to => :application
  71. # Returns true if this rails application has the asset
  72. # pipeline enabled.
  73. def use_asset_pipeline?
  74. DependencyChecker.rails_3_1? && Rails.application.config.try(:assets).try(:enabled)
  75. end
  76. # Migration MoveAdminNotesToComments generated with version 0.2.2 might reference
  77. # to ActiveAdmin.default_namespace.
  78. delegate :default_namespace, :to => :application
  79. ActiveAdmin::Deprecation.deprecate self, :default_namespace,
  80. "ActiveAdmin.default_namespace is deprecated. Please use ActiveAdmin.application.default_namespace"
  81. end
  82. end
  83. ActiveAdmin::DependencyChecker.check!
  84. require 'active_admin/comments'