Module: Quickadmin

Defined in:
lib/quickadmin.rb

Defined Under Namespace

Modules: Mixins Classes: Admin, Application, Validates

Class Method Summary collapse

Class Method Details

.activateObject

Activation hook - runs after AfterAppLoads BootLoader



45
46
47
48
# File 'lib/quickadmin.rb', line 45

def self.activate
  result = ::Application.class_eval { include Quickadmin::Mixins::EnsureQuickadmin }
  Merb.logger.info("Including EnsureQuickadmin mixin into #{result}")
end

.deactivateObject

Deactivation hook - triggered by Merb::Slices.deactivate(Quickadmin)



51
52
# File 'lib/quickadmin.rb', line 51

def self.deactivate
end

.initObject

Initialization hook - runs before AfterAppLoads BootLoader



37
38
39
40
41
42
# File 'lib/quickadmin.rb', line 37

def self.init
  unless File.exist?(Merb.root / 'config' /  'quickadmins.yaml')
    Merb.logger.info("Creating initial quickadmins.yaml file")
    File.new(Merb.root / 'config' /  'quickadmins.yaml', 'w').puts(sample_yaml)
  end
end

.loadedObject

Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.



33
34
# File 'lib/quickadmin.rb', line 33

def self.loaded
end

.setup_router(scope) ⇒ Object

Note:

prefix your named routes with :quickadmin_ to avoid potential conflicts with global named routes.

Setup routes inside the host application



63
64
65
66
# File 'lib/quickadmin.rb', line 63

def self.setup_router(scope)
  scope.match('/openid').to(:controller => 'validates', :action => 'openid').name(:openid)
  scope.match('/logout').to(:controller => 'validates', :action => 'logout').name(:logout)
end