Module: Weeler::ActionDispatch::Routing::Mapper

Defined in:
lib/weeler/action_dispatch/routing/mapper.rb

Instance Method Summary collapse

Instance Method Details

#mount_weeler_at(mount_location, options = {}, &block) ⇒ Object

Mounts weeler at mount_location location. E.g.

mount_weeler_at "root" do
  weeler_resources :posts, include_in_weeler_menu: true
end


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/weeler/action_dispatch/routing/mapper.rb', line 25

def mount_weeler_at mount_location, options={}, &block
  Weeler.mount_location_namespace = mount_location.gsub("/", "").to_sym
  scope mount_location do
    namespace :weeler, :path => nil do
      mount_configuration_controllers

      weeler_resources :static_sections

      resources :seos, :only => [:update]


      root :to => "home#index"
      get "/home/about"
      get "/content", to: "content#index"
      get "/administration", to: "administration#index"
      get "/configuration", to: "configuration#index"

      add_concerns

      yield if block_given?
    end
  end
end

#weeler_resources(*args, &block) ⇒ Object

Pass given resource to “resources” mount method and add extra routes for members and collections needed by weeler

Options:

  • include_in_weeler_menu: true to include this resource in content section.



12
13
14
15
16
17
# File 'lib/weeler/action_dispatch/routing/mapper.rb', line 12

def weeler_resources(*args, &block)
  add_menu_item args[0] if args[0].present? && args[1].present? && args[1][:include_in_weeler_menu] == true
  resources *args do
    yield if block_given?
  end
end