ActionController::Routing::Routes.draw do |map| map.resources :suppliers, :path_prefix => "/admin", :collection => {:destroy_collection => :post, :tagged_collection => :post} map.resources :sale_event_items, :path_prefix => "/admin", :collection => {:destroy_collection => :post, :set_attribute_collection => :post} map.resources :sale_events, :path_prefix => "/admin", :collection => {:destroy_collection => :post, :tagged_collection => :post, :auto_complete => :get} map.resources :entities, :path_prefix => "/admin", :collection => {:destroy_collection => :post, :tagged_collection => :post} map.resources :products, :path_prefix => "/admin", :member => {:display_info => :get, :discounts => :get, :sale_events => :get}, :collection => {:destroy_collection => :post, :tagged_collection => :post} map.resources :reports, :path_prefix => "/admin", :collection => {:field_auto_complete => :get} map.opt_out_unsubscribed "/admin/opt-out/unsubscribed", :controller => "opt_outs", :action => "unsubscribed" map.opt_out_unsubscribe "/admin/opt-out/unsubscribe", :controller => "opt_outs", :action => "unsubscribe", :method => :post map.opt_out "/admin/opt-out", :controller => "opt_outs", :action => "show" # TODO : change this later map.blank_landing "/admin", :controller => "admin/dashboard", :action => "blank_landing" map.resources :profiles, :path_prefix => "/admin", :member => {:confirm => :get, :authorize => :put, :show_feed => :get}, :collection => {:signup => :post, :validate_feed => :get, :validate_forum_alias => :get, :login => :post} map.resources :email_labels, :path_prefix => "/admin", :collection => {:destroy_collection => :post } map.resources :filters, :path_prefix => "/admin", :collection => {:test_data => :get, :empty_grid => :get} map.resources :quick_entries, :collection => { :auto_complete => :get, :auto_complete_save_to_field => :post, :auto_complete_for_field => :post, :new => :post} map.resources :referrals map.resources :folders, :path_prefix => "/admin", :collection => {:destroy_collection => :post, :auto_complete_tag => :get}, :member => {:display_new_folder_window => :get} map.ui "admin/ui/*path", :controller => "ui", :action => "connect" map.resources :configurations, :path_prefix => "/admin" map.resources :templates, :path_prefix => "/admin", :collection => {:destroy_all => :post} map.resources :imports, :path_prefix => "/admin", :collection => {:destroy_all => :post, :summaries => :post}, :member => {:go => :post, :save => :post, :summary => :get} map.resources :mappers, :path_prefix => "/admin" map.resources :layouts, :path_prefix => "/admin" map.resources :pages, :path_prefix => "/admin", :member => {:behavior => :get}, :new => {:behavior => :get}, :collection => {:sandbox => :get} map.resources :snippets, :path_prefix => "/admin", :member => {:behavior => :get}, :new => {:behavior => :get} map.resources :forum_categories, :path_prefix => "/admin" do |forum_category| forum_category.resources :forums do |forum| forum.resources :topics do |topic| topic.resources :posts end end end map.resources :feeds, :path_prefix => "/admin", :member => {:refresh => :get}, :collection => {:auto_complete_tag => :get, :refresh_all => :get, :show_feeds => :get, :refresh_my_feeds => :get} map.resources :assets, :path_prefix => "/admin", :member => {:download => :get, :display_edit => :get, :display_new_file_window => :get, :update_permissions => :get}, :collection => {:auto_complete_tag => :get, :show_all_records_files => :get} map.connect "/assets/download/:filename", :controller => "assets", :action => "download", :filename => /[-.\w]+/ map.resources :posts, :name_prefix => "topic_", :path_prefix => "/admin/forum_categories/:forum_category_id/forums/:forum_id/topics/:topic_id" map.resources :posts, :name_prefix => "forum_", :path_prefix => "/admin/forum_categories/:forum_category_id/forums/:forum_id" map.resources :posts, :name_prefix => "forum_category_", :path_prefix => "/admin/forum_categories/:forum_category_id" map.resources :posts, :name_prefix => 'all_', :path_prefix => "/admin", :collection => { :search => :get } map.resources :parties, :path_prefix => "/admin", :collection => {:auto_complete => :get, :forgot_password => :get, :reset_password => :post, :import_load => :post, :import => :get, :plaxo => :get, :address_book => :get, :register => :get, :signup => :post, :destroy_collection => :post, :reset_collection_password => :post, :tagged_collection => :post, :add_collection_to_group => :post, :async_tag_parties => :post, :async_get_tag_name_id_hashes => :get }, :member => {:general => :get, :profile => :get, :tags => :get, :notes => :get, :network => :get, :security => :get, :staff => :get, :testimonials => :get, :archive => :put, :confirm => :get, :authorize => :put, :refresh_inbox => :get, :send_new_password => :get, :update_feeds => :put} do |parties| parties.resources :addresses, :controller => "address_contact_routes", :name_prefix => :party_ parties.resources :phones, :controller => "phone_contact_routes", :name_prefix => :party_ parties.resources :links, :controller => "link_contact_routes", :name_prefix => :party_ parties.resources :emails, :controller => "email_contact_routes", :name_prefix => :party_ parties.resources :email_accounts, :controller => "email_accounts", :name_prefix => :party_, :member => {:retrieve => :get}, :collection => { :retrieve_all => :get} map.with_options(:controller => "email_contact_routes", :action => "validate", :party_id => /\d+/) do |m| m.validate_emails "/admin/parties/:party_id/emails;validate" m.validate_email "/admin/parties/:party_id/emails/:id;validate", :id => /\d+/ end parties.resources :attachments, :name_prefix => :party parties.resources :testimonials, :name_prefix => :party_, :member => {:approve => :put, :reject => :put} end map.resources :futures, :path_prefix => "/admin", :collection => {:show_collection => :get}, :member => { :async_get_future_as_json => :get } map.thumb_picture 'pictures/:id/thumbnail.jpg', :controller => 'pictures', :action => 'thumbnail', :format => 'JPEG', :mime_type => 'image/jpeg' map.picture 'pictures/:id/image.jpg', :controller => 'pictures', :action => 'retrieve', :format => 'JPEG', :mime_type => 'image/jpeg' map.with_options(:action => "update") do |m| m.denied_permissions "/admin/denied_permissions", :controller => "denied_permissions" m.roles "/admin/roles", :controller => "roles" m.memberships "/admin/memberships", :controller => "memberships" end map.resources :groups, :path_prefix => "/admin" map.resources :permission_sets, :path_prefix => "/admin" map.resources :addresses, :controller => "address_contact_routes", :path_prefix => "/admin" map.resources :phones, :controller => "phone_contact_routes", :path_prefix => "/admin" map.resources :links, :controller => "link_contact_routes", :path_prefix => "/admin" map.resources :mass_emails, :path_prefix => "/admin", :collection => {:save => :post}, :member => {:preview => :get, :release => :put, :unrelease => :get, :show_recipient => :get} map.resources :emails, :path_prefix => "/admin", :collection => { :show_unread_emails => :get, :show_sent_and_read_emails => :get, :show_all_emails => :get, :async_destroy_collection => :post, :sandbox_new => :get, :async_get_account_addresses => :get, :async_get_mailbox_emails => :get, :async_get_email => :get, :sandbox => :get, :async_send => :post, :async_get_template_label_id_hashes => :get, :async_get_tags => :get, :async_get_searches => :get }, :member => { :reply => :get, :reply_all => :get, :forward => :get, :release => :put } do |email| email.resources :attachments end map.connect "/admin/a/:attachment_uuid/:recipient_uuid", :controller => "attachments", :action => "show", :attachment_uuid => /[-A-Fa-f0-9]{36}/, :recipient_uuid => /[-A-Fa-f0-9]{36}/ map.with_options(:controller => "email_contact_routes", :action => "validate") do |m| m.validate_emails "/admin/emails;validate" m.validate_email "/admin/emails/:id;validate", :id => /\d+/ end map.resources :testimonials, :path_prefix => "/admin", :member => {:approve => :put, :reject => :put} map.resources :contact_requests, :path_prefix => "/admin", :member => {:complete => :put}, :collection => {:bugs => :post, :bug_buster => :get} # Authentication map.logout "sessions/destroy", :controller => "sessions", :action => "destroy" map.resources :sessions, :new => {:google => :get} map.register "/register", :controller => "parties", :action => "register" map.connect "/create-link", :controller => "welcome", :action => "create_link" map.public_contents 'contents/:year/:month/:day', :controller => 'articles', :year => nil, :month => nil, :day => nil, :requirements => {:year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/} map.public_read_content 'archives/:title', :controller => 'articles', :action => 'permalink', :title => /.+/ map.with_options(:controller => 'admin/estimates') do |m| m.customer_estimate_edit 'estimates/:id/edit', :action => 'customer_edit' m.customer_estimate_destroy 'estimates/:id/destroy', :action => 'customer_destroy' m.estimate_edit 'admin/estimates/:id/edit', :action => 'edit' m.estimate_show 'admin/estimates/:id/show', :action => 'show' m.estimates 'admin/estimates', :action => 'index' m.quick_product_list 'admin/estimates/products-list', :action => 'products_list' m.estimate_section_appender 'admin/estimates/editor/:section/new', :action => 'new_section' m.estimate_section_deletor 'admin/estimates/editor/:id/:section_id/delete', :action => 'delete_section', :id => /\d+/, :section_id => /\d+/ m.connect "/admin/estimates/:action/:id" end map.with_options(:controller => "admin/estimate_lines") do |m| m.connect "admin/estimate-lines/:action/:id" end map.customer_quote 'estimates/:id', :controller => 'admin/quotes', :action => 'view', :id => /\d+/ map.with_options(:controller => 'admin/invoices') do |m| m.invoice 'invoices/:id', :action => 'view', :id => /E?\d{8}/ m.invoice_edit 'invoices/:id', :action => 'edit', :id => /\d+/ m.invoice_void 'invoices/:id/void', :action => 'void', :id => /\d+/ m.connect 'invoices/:id', :action => 'view2', :id => /\d+/ m.invoices 'admin/invoices', :action => 'index' m.connect "admin/invoices/:action/:id" end map.with_options(:controller => "admin/customer_notification") do |m| m.send_estimate 'admin/estimates/:id/send', :action => 'send_estimate' m.send_invoice 'invoices/:id/send', :action => 'send_invoice' m.connect "admin/customer-notifications/get-template", :action => "get_template" end map.picture_zoom 'pictures/zoom/:id/image.jpg', :controller => 'pictures', :action => 'view' map.thumb_picture 'pictures/:id/thumbnail.jpg', :controller => 'pictures', :action => 'thumbnail', :format => 'JPEG', :mime_type => 'image/jpeg' map.picture 'pictures/:id/image.jpg', :controller => 'pictures', :action => 'retrieve', :format => 'JPEG', :mime_type => 'image/jpeg' map.connect 'pictures/:id/image.gif', :controller => 'pictures', :action => 'retrieve', :format => 'GIF', :mime_type => 'image/gif' map.connect 'pictures/:id/image.png', :controller => 'pictures', :action => 'retrieve', :format => 'PNG', :mime_type => 'image/png' map.picture_view 'admin/pictures/:id', :controller => 'pictures', :action => 'view' map.connect 'images.xml', :controller => 'welcome', :action => 'images' map.with_options(:controller => "admin/dashboard") do |m| m.read_mail 'admin/dashboard/email/:id/read', :action => 'read_mail' m.pay_balance 'admin/dashboard/pay-balance/:id', :action => 'pay_balance' m.link_edit "admin/dashboard/links/:id/edit", :action => 'edit_link' m.link_approve "admin/dashboard/links/:id/approve", :action => 'approve_link' m.link_reject "admin/dashboard/links/:id/reject", :action => 'reject_link' m.dashboard 'admin/dashboard', :action => 'index' end map.with_options(:controller => "admin/policies") do |m| m.policy "/policies/:action/:id" end map.with_options(:controller => "cart") do |m| m.cart_update_shipping '/cart/update-shipping', :action => 'update_shipping' m.cart_buy "/cart/buy", :action => "buy" m.cart_add '/cart/update/:product_no', :action => 'update', :product_no => /[-\w."'%]+/ m.cart_remove '/cart/remove/:product_no', :action => 'remove', :product_no => /[-\w."'%]+/ m.cart_view '/cart', :action => 'view' m.connect '/cart/:action/:id' end map.product_details 'products/details/:product_no', :controller => 'admin/product_catalog/products', :action => 'public_view', :product_no => /[-\w."'%]+/ map.product_list 'products/*category_path', :controller => 'admin/product_catalog/products', :action => 'public_index' map.navlinks 'links.xml', :controller => 'welcome', :action => 'navlinks' map.images 'images.xml', :controller => 'welcome', :action => 'images' map.reload_estimate 'estimator/reload/:id', :controller => 'estimator', :action => 'reload' map.auto_reload_estimate 'estimator/:uuid', :controller => 'estimator', :action => 'reload_uuid', :uuid => /[-a-f\d]{36}/i map.connect 'estimator/:action/:id', :controller => 'estimator', :action => 'index' map.public_forgot 'forgot', :controller => 'admin/account', :action => 'forgot', :public => '1' map.forgot 'admin/forgot', :controller => 'admin/account', :action => 'forgot' map.public_dashboard 'dashboard', :controller => 'admin/dashboard', :action => 'index', :public => '1' map.ipn_notify 'ipn/:id', :controller => 'payment', :action => 'ipn' map.thanks 'payment/thanks/:id', :controller => 'payment', :action => 'thanks' map.completed_payments_for_invoice '/admin/payments/completed/invoice/:custom', :controller => 'admin/payments', :action => 'filter', :status => 'completed', :field => 'invoice', :custom => /\d+/ map.payments_for_invoice '/admin/payments/invoice/:custom', :controller => 'admin/payments', :action => 'filter', :field => 'invoice', :custom => /\d+/ map.with_options(:controller => 'admin/payments') do |m| m.payment_new 'admin/payments/new/:type/:id', :requirements => {:type => /estimate|invoice/, :id => /\d+/}, :action => 'new' m.new_payment 'admin/payments/new', :action => 'new' m.payment_view 'admin/payments/:id/view', :action => 'view' m.payment_edit 'admin/payments/:id/edit', :action => 'edit' m.payment_status 'admin/payments/:id/status', :action => 'change_status' m.payments 'admin/payments', :action => 'index' m.filter_payments 'admin/payments', :action => 'filter' m.show_all_records_payments 'admin/payments/show_all_records_payments', :action => 'show_all_records_payments' end map.connect 'policies', :controller => 'policies', :action => 'privacy' map.weekly_calendar 'admin/calendar/:year/:month/:week', :controller => 'admin/calendar', :action => 'weekly', :year => /\d{4}/, :month => /\d{1,2}/, :week => /w\d/ map.daily_calendar 'admin/calendar/:year/:month/:day', :controller => 'admin/calendar', :action => 'daily', :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/ map.monthly_calendar 'admin/calendar/:year/:month', :controller => 'admin/calendar', :action => 'monthly', :year => /\d{4}/, :month => /\d{1,2}/ map.product_sales "/admin/catalog/reports/:action", :controller => "/admin/product_catalog/reports" map.with_options(:controller => "admin/teams") do |m| m.teams "/admin/teams/:action/:id", :action => "index" end map.todos 'admin/todos', :controller => 'admin/todos', :action => 'index' map.todo_show 'admin/todos/:id', :controller => 'admin/todos', :action => 'show', :requirements => {:id => /\d+/} map.todo_edit 'admin/todos/:id/edit', :controller => 'admin/todos', :action => 'edit', :requirements => {:id => /\d+/} map.todo_complete 'admin/todos/:id/complete', :controller => 'admin/todos', :action => 'complete', :requirements => {:id => /\d+/} map.delete_assignee 'admin/todos/:todo_id/assignees/:id/delete', :controller => 'admin/todos', :action => 'delete_assignee', :todo_id => /\d+/, :id => /\d+/ map.todo_new 'admin/todos/new', :controller => 'admin/todos', :action => 'new' map.unsecured_download 'admin/attachments/:id/download', :controller => 'admin/attachments', :action => 'download' map.with_options(:controller => 'admin/payments') do |m| m.auto_complete_for_invoice_no "admin/payments/auto-complete/invoice_no", :action => "auto_complete_for_invoice_no" m.new_payment "admin/payments/new", :action => "new" end map.with_options(:controller => 'admin/mailings') do |m| m.mailing_edit 'admin/mailings/:id/edit', :action => 'edit' m.mailing_new 'admin/mailings/new/:party', :action => 'new', :party => /\d+/ m.read_email 'admin/mailings/:email/read/:id', :action => 'read' m.mailings 'admin/mailings', :action => 'index' m.mailing_new_without_party 'admin/mailings/new', :action => 'new' m.mailing_create 'admin/mailings/create', :action => 'create' m.mailing_filter 'admin/mailings/filter', :action => 'filter' m.mailing_clear 'admin/mailings/clear', :action => 'clear' m.filter_mailings 'admin/mailings/filter_mailings', :action =>'filter_mailings' end map.content_edit 'admin/contents/:id/edit', :controller => 'admin/contents', :action => 'edit' map.content_new 'admin/contents/new', :controller => 'admin/contents', :action => 'new' map.contents 'admin/contents', :controller => 'admin/contents' map.attachment_download 'document/:attachment/:url_hash', :controller => 'attachments', :action => 'download', :requirements => {:url_hash => /[a-z0-9]{40}/, :attachment => /\d+/} map.new_attachment_authorization 'admin/parties/:id/attachment/:attachment/authorization/new', :controller => 'admin/parties', :action => 'new_authorization', :requirements => {:attachment => /\d+/} map.save_attachment_authorization 'admin/parties/:id/attachment/:attachment/authorization/save', :controller => 'admin/parties', :action => 'save_authorization', :requirements => {:attachment => /\d+/} map.destroy_attachment_authorization 'admin/parties/:id/attachment/:attachment/:authorization/destroy', :controller => 'admin/parties', :action => 'destroy_authorization', :requirements => {:attachment => /\d+/, :authorization => /\d+/} map.issue_details 'admin/smrty/issues/:id/details', :controller => 'admin/smrty', :action => 'details' map.smrty 'admin/smrty', :controller => 'admin/smrty' map.with_options(:controller => 'admin/links') do |m| m.link_edit 'admin/links/:id/edit', :action => 'edit' m.link_new 'admin/links/new', :action => 'new' m.links 'admin/links/index/categories/:link_category_id', :action => 'index', :requirements => {:link_category_id => /\d+/}, :defaults => {:link_category_id => nil} end map.public_links 'links', :controller => 'welcome', :action => 'links' map.with_options(:controller => "admin/link_categories") do |m| m.connect "/admin/link-categories/:action/:id" end map.properties_feed 'feeds/properties/:area/atom.rss', :controller => 'feeds', :action => 'properties', :area => /[-\s\w+]+/i map.interest_feed 'feeds/interest/:id/atom.rss', :controller => 'feeds', :action => 'interests' map.news_feed 'feeds/news/atom.rss', :controller => 'feeds', :action => 'news' map.picks_feed 'feeds/picks/:tag/atom.rss', :controller => 'feeds', :action => 'properties_by_tag', :tag => /[-\w]+/i map.visit_event_edit 'admin/visit/edit/:id', :controller => 'admin/visits', :action => 'edit' map.with_options(:controller => 'admin/lookup') do |m| m.mail_tags_lookup 'admin/lookup/mail-tags.js', :action => 'mail_tags_for_lookup' m.party_tags_lookup 'admin/lookup/party-tags.js', :action => 'party_tags_for_lookup' m.product_lookup 'admin/lookup/products', :action => 'lookup_product' m.product_category_auto_complete 'admin/lookup/product-categories', :action => 'lookup_product_category' m.supplier_auto_complete 'admin/lookup/suppliers', :action => 'lookup_supplier' m.customer_auto_complete 'admin/lookup/customers', :action => 'lookup_customer' m.staff_auto_complete 'admin/lookup/staff', :action => 'lookup_staff' end map.with_options(:controller => 'admin/product_catalog/import') do |m| m.import_products 'admin/catalog/import/products', :action => 'import' m.prepare_import_products 'admin/catalog/import/products/prepare', :action => 'index' end map.with_options(:controller => "tour") do |m| m.tour_details "/tour/:id/details", :action => "details" m.tour "/tour/:action", :action => "vancouver" end map.page_under_construction 'admin/page-under-construction', :controller => 'system' #map.contact 'contact', :controller => 'welcome', :action => 'contact' map.with_options(:controller => "search") do |m| m.remove_saved_search 'admin/search/:action/:id' m.perform_advanced_search "/admin/search/perform_advanced_search", :action => "perform_advanced_search" m.connect 'admin/search/:action' m.async_get_name_id_hashes '/admin/search/async_get_name_id_hashes', :action => 'async_get_name_id_hashes' end # "Alias" routes map.redirect "/login", :new_session map.redirect "/forums", :forum_categories map.with_options(:controller => "pages") do |m| m.home "/", :action => "show" m.connect '*path', :action => 'show' end # These routes will be hidden, since the *path route above is a catch-all # This is temporary, until all code has been move where it really belongs map.connect "/home", :controller => "welcome", :action => "index" map.connect "/:controller/:action/:id" end