Skip to content

Instantly share code, notes, and snippets.

@robcole
Created September 12, 2011 22:44
Show Gist options
  • Save robcole/1212692 to your computer and use it in GitHub Desktop.
Save robcole/1212692 to your computer and use it in GitHub Desktop.
class ValidSubdomain
def self.matches?(request)
request.subdomain != "affiliate"
end
end
DeucesCracked::Application.routes.draw do
namespace "admin" do
resources :users, :dcrb_aliases, :podcasts, :podshows
match "/podshows/:id", :to => "podshows#show", :via => :post
end
match "/admin", :to => "admin#index"
match "/alerts/create", :to => "alerts#create"
match "/test_exception_notifier", :to => "application#test_exception_notifier"
match "/hand_converter/convert_hand", :to => "hand_converter#convert_hand"
match "/design", :to => "design#index"
controller :promotions do
match "/openhouse", :to => :openhouse
match "/open-house", :to => :openhouse
match "/fff", :to => :fff
match "/promotions/dcrb", :to => :dcrb
match "/promotions/dcrb_create", :to => :dcrb_create
match "/promotions/welcome_dcrb", :to => :welcome_dcrb
match "/promotions/:action", :to => :action
end
controller :reader do
match "/reader/edit", :to => :edit
match "/reader/unfollow", :to => :unfollow
match "/reader/unfollow_all", :to => :unfollow_all
match "/reader/mark_read/:id", :to => :mark_read
match "/reader/mark_unread/:id", :to => :mark_unread
match "/reader/load_more_items/:type", :to => :load_more_items
match "/reader/load_more_items", :to => :load_more_items
match "/reader", :to => :index
match "/reader/create", :to => :create
match "/reader/track_videos", :to => :track_videos
match "/reader/destroy", :to => :destroy
match "/reader/:obj/:id", :to => :show
end
resources :reader_admin
resources :blog_entry_images
resources :wysihat_test_images
resources :wysihat_tests
resources :playlists do
collection do
get :public
get :series
get :add_to_list
post :add_videos_to_playlist
post :sorting
get :update_title
get :update_description
end
member do
get :public_private
post :public_private
get :flip_follow
post :flip_follow
get :unfollow
post :unfollow
get :public_add
post :public_add
get :public_delete
post :public_delete
get :make_public
get :make_private
end
end
match "/playlist_items/:id/flip_viewed", :to => "playlist_items#flip_viewed"
match "/playlist_items/:id/destroy", :to => "playlist_items#destroy"
resources :playlist_users
match "/videos/experimental", :to => "videos#experimental"
match "/promotions/welcome_back", :to => "promotions/welcome_back#welcome_back"
match "/connect4charity", :to => "promotions#connect4charity"
match "/quiz/random.:format", :to => "quiz#random"
resources :blog_templates
match "/video_notes/note_partial/:id", :to => "video_notes#note_partial"
resources :video_notes
match '/gift_cards/:action', :to => "gift_cards"
match '/giftcards/:action', :to => "gift_cards"
match '/giftcard/:action', :to => "gift_cards"
match '/giftcard', :to => "gift_cards#index"
resources :gift_cards
resources :gift_cards, :as => "giftcard"
match "/flashpass", :to => "gift_cards#indexoz"
match "/aussie", :to => "promotions#aussie"
match "/wsop", :to => "promotions#wsop"
match "/wcoop", :to => "promotions#wcoop"
match "/robusto/:action", :to => "robustos"
match "/forums/set_forum_color", :to => "forums#set_forum_color"
match "/member_videos/feed", :to => "member_videos#feed"
match "/member_videos/success/:id", :to => "member_videos#success"
match "/member_videos/remove_video_file", :to => "member_videos#remove_video_file"
resources :member_videos
match "/chunky_bacon/:id", :to => "chunky_bacon#index"
# match "/admin/*anything", :to => "index#redirect_to_admin"
# blogs ON
# match "blogs", :to => "blogs"
# match "blogs/:id/comments_feed", :to => "blogs#comments_feed"
# match "blog_entries", :to => "blog_entries"
# match "blog_comments", :to => "blog_comments"
resources :articles do
collection do
get 'search'
get 'feed'
end
end
match "/articles/feed.rss", :to => "articles#feed"
match "/blogs/vip", :to => "blogs#vip"
match "/blogs/community", :to => "blogs#community"
match "/blogs/search_by_login", :to => "blogs#search_by_login"
match "/blog_entries/popout", :to => "blog_entries#popout"
resources :blogs do
collection do
get :feed
get :comments_feed
get :dashboard
end
member do
get :search
get :feed
end
resources :blog_entries do
resources :blog_comments
end
end
resources :blog_entries do
collection do
get :feed
post :create_comment
end
end
resources :blog_comments do
collection do
get :feed
end
member do
post :update_comment
end
end
# for some reason this works but putting this in resources member section for blog_comments doesn't
match "/blog_comments/:id/destroy", :to => "blog_comments#destroy"
match "/blogs/create", :to => "blogs#create"
match "/blogs/:sub_domain", :to => "blogs#show"
match "/blogs/:sub_domain/comments_feed", :to => "blogs#comments_feed"
match "/blogs/:sub_domain/:id", :to => "blog_entries#show"
match "/messages/inbox", :to => "messages#index"
match "/messages/show/:id", :to => "messages#show"
match "/messages/delete/:id", :to => "messages#delete"
match "/messages/reply/:id", :to => "messages#reply"
match "/messages/destroy", :to => "messages#destroy"
resources :messages do
collection do
get :sent
get :inbox
get :trash
put :mark_read
put :delete_messages
end
end
match "/messages/new/:id", :to => "messages#new", :constraints => {:id => /[^\s\t"\<\>][^\<\>]*[^\s\t\<\>]/}
resources :forums do
collection do
get :set_forum_color
end
end
resources :topics do
collection do
get :feed
end
end
#match "/posts/quote/:id", :to => "posts#quote"
resources :posts do
get 'quote', :on => :member
end
# note - (ben) name_prefix is deprecated for :as - but that doesn't seem to work ??
resources :posts, :as => 'all' do
collection do
get :search
end
member do
get :edit_cancel
end
end
match "/posts/edit_cancel/:id", :to => "posts#edit_cancel"
# note - (ben) name_prefix is deprecated for :as - but that doesn't seem to work ??
%w(forum user).each do |attr|
resources :posts, :as => "#{attr}", :path_prefix => "/#{attr.pluralize}/:#{attr}_id"
end
resources :forums do
resources :posts
resources :topics do
resources :posts
resource :monitorship
end
end
#match "/forums/:forum_id/:topic_id/:post_id", :to => "topics#show"
#match "search", :to => "search#index"
match "/search", :to => "search#index"
match "/search.:format", :to => "search#index"
match "/search/new", :to => "search#new"
match "/search/forum", :to => "search#forum"
match "/search/:search_type", :to => "search#index"
match "/search.xml/:search_type.:forumat", :to => "search#index"
# for forum stylesheet persistance --abr
resources :stylesheet
# by tracker request. --jls
match "/forums/:forum_id/:id", :to => "topics#show"
match "/users/:id", :to => "users#show", :constraints => {:id => /[^\s\t"\<\>][^\<\>]*[^\s\t\<\>]/}
resources :users do
collection do
post :validate_email
post :validate_login
get :manage
end
end
match "/user/:login/rss/:type/:key", :to => "users#rss", :as => :user_rss, :constraints => {:login => /.+/}
match "/forum", :to => "forums#index"
match "/topics/rss", :to => "topics#rss"
resources :avatars
resources :products
resources :feeds
match '/coaches/:id', :controller => 'coaches', :action => 'show', :id => /[^\s\t'\<\>][^\<\>]*[^\s\t\<\>]/
controller :coaches do
match "/coaches/bio/:login", :to => :bio
end
resources :coaches do
collection do
get :moveup
get :movedown
get :manage
get :learnmore
get :feed
get :show
end
end
controller :coaching do
match '/coaching', :to => :index
match '/coaching/signup', :to => :signup
match '/coaching/index', :to => :index
end
resources :series do
collection do
get :manage
end
end
controller :payments do
match "/payment", :to => :index, :as => :index
match "/payments/update_card", :to => :update_card, :as => :update_card
match "/payments/silentpost", :to => :silentpost, :as => :silentpost
match "/payments/sitetransferinstructions", :to => :sitetransferinstructions
match "/payments/receipt", :to => :receipt
end
controller :account do
match "/mydc/my_subscription", :to => :my_subscription
match "/account/my_subscription_create", :to => :my_subscription_create
match "/mydc/subscribe", :to => :subscribe
match "/mydc/mgroffer", :to => :mgroffer
match "/account/upgrade", :to => :upgrade
match "/account/login", :to => :login
match "/account/logout", :to => :logout
match "/account/forgotpassword", :to => :forgotpassword
match "/account/resetpassword", :to => :resetpassword
match "/account/plans", :to => :plans
match "/account/signup", :to => :signup
match "/account/signup_basic", :to => :signup_basic
match "/account/signup_create", :to => :signup_create
match "/account/signup_create_simple", :to => :signup_create_simple
match "/account/signup_flash_only" => redirect("/account/signup")
match "/account/signup_create_flash_only" => redirect("/account/signup")
match "/account/termsofuse", :to => :termsofuse
match "/account/privacy", :to => :privacy
match "/account/welcome", :to => :welcome
match "/account/getc", :to => :getc
match "/account/simple_login", :to => :simple_login
end
resources :account
resources :site_transfers
resources :video_views
resources :ratings
resources :video_files
controller :videos do
match "/videos/rate/:id", :to => :rate
match "/videos/download_file/:id", :to => :download_file
match "/videos/save_stats/:id", :to => :save_stats
match "/videos/xspf/:id", :to => :xspf
match "/videos/comments/:id", :to => :comments
match "/videos", :to => :index
match "/videos/latest", :to => :latest
end
resources :videos do
collection do
get :manage
get :xspf
get :index
end
end
# for videos with a series. This route fucks with the default :controller/:action/:id scheme, so explicity add new
# video routes above this one.
match "videos/:series_name/:video_name", :to=>"videos#show"
resources :video_thumbs
controller :advantage do
match "/advantage/api", :to => :api
match "/advantage/manual", :to => :manual
end
controller :api do
match "/api/subscription_activate_manual", :to => "api#subscription_activate_manual"
match "/api/subscription_activate", :to => "api#subscription_activate"
end
resources :api
resources :advantage
resources :subscriptions do
collection do
get :cimprofiles
get :manage
get :cancel
get :farewell
get :upgrade
get :upgrade_confirm
get :cancel_free_trial
get :buy_confirm
end
end
controller :subscriptions do
match "/subscriptions/destroy", :to => :destroy
end
match "/paypal_payments/:action", :to => "paypal_payments"
match "/moneybookers_payments/:action", :to => "moneybookers_payments"
controller :dashboard do
match "/dashboard/remove_site_notification/:id", :to => :remove_site_notification
match "/dashboard/mydc", :to => :index
match "/dashboard", :to => :index
end
controller :messages do
match "/messages/private_messages", :to => :index
match "/mydc/private_messages", :to => :index
match "/mydc/private_messages/:message_type", :to => :index
end
match "/mydc", :to => "dashboard#index" # redirect("/dashboard")
controller :mydc do
match "/mydc/flip_setting", :to => :flip_setting
match "/mydc/change_background", :to => :change_background
match "/mydc/settings", :to => :settings
match "/mydc/update_settings", :to => :update_settings
match "/mydc/change_password", :to => :change_password
match "/mydc/update_password", :to => :update_password
match "/mydc/refer_a_friend", :to => :refer_a_friend
match "/mydc/offers", :to => :offers
match "/mydc/mgr_promo", :to => :mgr_promo
match "/mydc/notifications", :to => :notifications
match "/mydc/my_subscription", :to => :my_subscription
match "/mydc/update_account_notifications", :to => :update_account_notifications
match "/mydc/account_profile", :to => :account_profile
match "/mydc/update_account_profile", :to => :update_account_profile
end
match "/hem_promo", :to => "hem_promo#order"
match "/hem_promo/confirm", :to => "hem_promo#confirm"
%w(articles videos blog_entries).each do |f|
match "/tags/#{f}", :to => "tags##{f}"
match "/tags/#{f}/:tag", :to => "tags##{f}" #, :constraints => { :tag => /.+/ } #, :as => :things
end
match '/tags', :to => "tags#index"
match '/tags/:tag', :to => "tags#show", :constraints => { :tag => /.+/ } #, :as => :things
match "/tools", :to => "tools#index", :constraints => ValidSubdomain
match "/podcasts", :to => "podcasts#index"
match "/podcasts/podcast.xml", :to => "podcasts#podcast"
match "/podcasts/:url", :to => "podcasts#show"
match "/podcasts/:url/podcast.:format", :to => "podcasts#podcast"
match "/podcasts/podcast_float/:id", :to => "podcasts#podcast_float"
controller :index do
match "/index/back_to_admin", :back_to_admin
end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => "index#index", :constraints => ValidSubdomain
# Remaining affiliate routes need to stay below others, otherwise they interfere with matching affiliate params
# Remove after August 2012
constraints(:subdomain => "affiliate") do
match "/account/simple_login", :to => redirect("http://#{DeucesCracked::Application.config.domain}/account/simple_login")
match "/:action", :to => redirect("http://#{DeucesCracked::Application.config.domain}/affiliates/%{action}")
match "/", :to => redirect("http://#{DeucesCracked::Application.config.domain}/affiliates")
end
match "/affiliate/:action", :to => redirect("/affiliates/%{action}")
match "/affiliate", :to => redirect("/affiliates")
controller :affiliates do
match "/affiliates", :to => :index
match "/affiliates/:action", :to => :action
end
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment