Sha256: e01623a95a15755717d64437097680806fe69dd0a6596b2c88c2083471379b12

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

# Routes for admin interface
Cardboard::Engine.routes.draw do

  get "my_account", to: "my_account#edit"
  patch "my_account", to: "my_account#update"

  post "pages/sort", to: "pages#sort"
  resources :pages

  get "/yoda", to: "super_user#index"

  get "/settings", to: "settings#index"
  patch "/settings/update", to: "settings#update", as: "setting"

  get "/", to: "dashboard#index", as: "dashboard" #Don't put a root path here

  scope as: 'cardboard' do
    #generate routes for custom cardboard resources controllers
    Cardboard.resource_controllers.each do |controller|
      if controller.singular?
        # Singular controller names are non-standard in rails.  We must specify the
        # controller explicitly here to keep the name from 
        # being pluralized in the route.
        resource controller.controller_name, controller: controller.controller_name
      else
        resources controller.controller_name
      end
    end
  end

end

# Routes for public pages
Cardboard::DynamicRouter.load

#legacy support
Rails.application.routes.named_routes.module.module_eval do
  def page_path(identifier, options = {})
    url = Cardboard::Page.where(identifier: identifier.to_s).first.try(:url)
    options.present? && url ? "#{url}?#{options.to_query}" : url
  end

  def page_url(identifier, options = {})
    return nil unless url = page_path(identifier, options)
    root_url + url[1..-1]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cardboard_cms-0.3.1 config/routes.rb