Skip to content

Commit

Permalink
Make accounts use more resourceful(ish) routes.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmallett committed Mar 2, 2015
1 parent a778db7 commit eb23320
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@
get '/humans', to: 'text#humans', format: 'txt'
get '/robots', to: 'text#robots', format: 'txt'

# TODO: Check which of these routes are not needed.
resources :accounts, only: [:index], format: false do
collection do
get 'confirm'
get 'login'
post 'login'
get 'signup'
post 'signup'
get 'recover_password'
post 'recover_password'
get 'logout'
post 'logout'
end
end

namespace :admin do
get '/', to: 'dashboard#index', as: 'dashboard'

Expand Down Expand Up @@ -117,13 +132,6 @@
resources :users, only: [:index, :new, :edit, :create, :update, :destroy], format: false
end

# Work around the Bad URI bug
%w{ accounts }.each do |i|
get "#{i}", to: "#{i}#index", format: false
match "#{i}(/:action)", controller: i, format: false, via: [:get, :post, :put, :delete] # TODO: convert this magic catchers to resources item to close un-needed HTTP method
match "#{i}(/:action(/:id))", :controller => i, :id => nil, format: false, via: [:get, :post, :put, :delete] # TODO: convert this magic catchers to resources item to close un-needed HTTP method
end

# Admin/XController
%w{feedback resources sidebar textfilters themes settings seo}.each do |i|
match "/admin/#{i}", controller: "admin/#{i}", action: :index, format: false, via: [:get, :post, :put, :delete] # TODO: convert this magic catchers to resources item to close un-needed HTTP method
Expand Down

0 comments on commit eb23320

Please sign in to comment.