Reorganize routes.rb

No changes intended here, just grouping and commenting!
This commit is contained in:
Emi Matchu 2023-11-11 15:18:01 -08:00
parent 4926996e8e
commit c960e831bc

View file

@ -1,36 +1,39 @@
OpenneoImpressItems::Application.routes.draw do OpenneoImpressItems::Application.routes.draw do
root :to => 'outfits#new' root :to => 'outfits#new'
# Login and account management!
devise_for :auth_users
# The outfit editor!
# TODO: It's a bit silly that outfits/new points to outfits#edit. # TODO: It's a bit silly that outfits/new points to outfits#edit.
# Should we refactor the controller/view structure here? # Should we refactor the controller/view structure here?
get '/outfits/new', to: 'outfits#edit', as: :wardrobe get '/outfits/new', to: 'outfits#edit', as: :wardrobe
get '/wardrobe' => redirect('/outfits/new') get '/wardrobe' => redirect('/outfits/new')
get '/start/:color_name/:species_name' => 'outfits#start' get '/start/:color_name/:species_name' => 'outfits#start'
resources :contributions, :only => [:index] # The outfits users have created!
resources :outfits, :only => [:show, :create, :update, :destroy]
get '/your-outfits', to: 'outfits#index', as: :current_user_outfits
get '/users/current-user/outfits', to: redirect('/your-outfits')
# The item database!
resources :items, :only => [:index, :show] do resources :items, :only => [:index, :show] do
resources :appearances, controller: 'item_appearances', only: [:index] resources :appearances, controller: 'item_appearances', only: [:index]
collection do collection do
get :needed get :needed
end end
end end
resources :outfits, :only => [:show, :create, :update, :destroy]
scope 'import' do
resources :neopets_page_import_tasks, only: [:new, :create],
path: ':page_type/pages/:expected_index'
end
get '/your-outfits', to: 'outfits#index', as: :current_user_outfits
get '/users/current-user/outfits', to: redirect('/your-outfits')
# Loading and modeling pets!
post '/pets/load' => 'pets#load', :as => :load_pet post '/pets/load' => 'pets#load', :as => :load_pet
get '/modeling' => 'pets#bulk', :as => :bulk_pets get '/modeling' => 'pets#bulk', :as => :bulk_pets
devise_for :auth_users # Contributions to our modeling database!
resources :contributions, :only => [:index]
post '/locales/choose' => 'locales#choose', :as => :choose_locale get 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors
get 'users/top_contributors' => redirect('/users/top-contributors')
# User resources, like their item lists!
resources :users, :path => 'user', :only => [:index, :update] do resources :users, :path => 'user', :only => [:index, :update] do
resources :contributions, :only => [:index] resources :contributions, :only => [:index]
resources :closet_hangers, :only => [:index, :update, :destroy], :path => 'closet' do resources :closet_hangers, :only => [:index, :update, :destroy], :path => 'closet' do
@ -53,25 +56,30 @@ OpenneoImpressItems::Application.routes.draw do
resources :neopets_connections, path: 'neopets-connections', resources :neopets_connections, path: 'neopets-connections',
only: [:create, :destroy] only: [:create, :destroy]
end end
get 'users/current-user/closet' => 'closet_hangers#index', :as => :your_items
# Importing users' owned items from Neopets.com!
scope 'import' do
resources :neopets_page_import_tasks, only: [:new, :create],
path: ':page_type/pages/:expected_index'
end
# Donation campaign stuff!
resources :donations, only: [:create, :show, :update] do resources :donations, only: [:create, :show, :update] do
collection do collection do
resources :donation_features, path: 'features', only: [:index] resources :donation_features, path: 'features', only: [:index]
end end
end end
resources :campaigns, only: [:show], path: '/donate/campaigns' resources :campaigns, only: [:show], path: '/donate/campaigns'
get '/donate' => 'campaigns#current', as: :donate get '/donate' => 'campaigns#current', as: :donate
get 'users/current-user/closet' => 'closet_hangers#index', :as => :your_items # Static pages!
get 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors
get 'users/top_contributors' => redirect('/users/top-contributors')
get 'image-mode' => 'static#image_mode', :as => :image_mode get 'image-mode' => 'static#image_mode', :as => :image_mode
get '/pardon-our-dust' => 'static#pardon_our_dust', :as => :pardon_our_dust get '/pardon-our-dust' => 'static#pardon_our_dust', :as => :pardon_our_dust
get '/terms' => redirect("https://impress-2020.openneo.net/terms"), :as => :terms get '/terms' => redirect("https://impress-2020.openneo.net/terms"), :as => :terms
# Other useful lil things!
get '/sitemap.xml' => 'sitemap#index', :as => :sitemap, :format => :xml get '/sitemap.xml' => 'sitemap#index', :as => :sitemap, :format => :xml
get '/robots.txt' => 'sitemap#robots', :as => :robots, :format => :text get '/robots.txt' => 'sitemap#robots', :as => :robots, :format => :text
post '/locales/choose' => 'locales#choose', :as => :choose_locale
end end