Class: Elrte::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/elrte/router.rb

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ Router

Returns a new instance of Router.



4
5
6
# File 'lib/elrte/router.rb', line 4

def initialize(application)
  @application = application
end

Instance Method Details

#apply(router) ⇒ Object

Creates all the necessary routes for the Elrte configurations

Use this within the routes.rb file:

Application.routes.draw do |map|
  Elrte.routes(self)
end


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/elrte/router.rb', line 16

def apply(router)
  router.send('match', {'elfinder' => 'elfinder#connector', :as => 'elfinder_connector'})
  #p @application.namespaces.values
  #router.instance_exec(@application.namespaces.values) do |namespaces|
  #  namespaces.each do |namespace|
  #    match '/elfinder' => 'Elfinder#connector', :as => 'elfinder_connector'
  #    #if namespace.root?
  #    #  match '/' => 'dashboard#index', :as => 'dashboard'
  #    #else
  #    #  name = namespace.name
  #    #  match name.to_s => "#{name}/dashboard#index", :as => "#{name.to_s}_dashboard"
  #    #end
  #  end
  #end

end