config/routes.rb in e9_crm-0.1.7 vs config/routes.rb in e9_crm-0.1.8

- old
+ new

@@ -1,8 +1,14 @@ Rails.application.routes.draw do crm_path = 'admin/crm' + scope :module => :e9_crm do + resources :offers, :as => :public_offer, :only => :show do + resources :leads, :as => :deals, :only => [:new, :create], :path => '' + end + end + scope :path => crm_path, :module => :e9_crm do resources :companies, :except => :show resources :contacts do # page_views currently not routed, but near working #resources :page_views, :path => 'activity', :only => :index @@ -11,12 +17,12 @@ member do post :upload_avatar delete :reset_avatar end end + resources :deals, :except => :show - resources :offers, :except => :show # contact_emails are generated by email templates, and end up in the sent emails list resources :contact_emails, :except => [:index, :show] resources :email_templates, :except => :show @@ -36,24 +42,41 @@ end scope :path => :campaigns do #get '/activity', :to => redirect("/#{crm_path}/campaigns/all/activity") resources :campaign_groups, :path => 'groups', :except => [:show] - resources :sales_campaigns, :path => 'sales', :except => [:show, :index] - resources :affiliate_campaigns, :path => 'affiliate', :except => [:show, :index] - resources :email_campaigns, :path => 'email', :except => [:show, :index] + resources :sales_campaigns, :path => 'sales', :except => [:show, :index] + resources :affiliate_campaigns, :path => 'affiliate', :except => [:show, :index] + resources :email_campaigns, :path => 'email', :except => [:show, :index] resources :advertising_campaigns, :path => 'advertising', :except => [:show, :index] do - resources :dated_costs, :path => 'costs' + resources :dated_costs, :path => 'costs' end %w( advertising affiliate email sales ).each do |path| get "/#{path}", :to => redirect("/#{crm_path}/campaigns?type=#{path}") end end - # leads are simply a scoped view of offers (only index) - get :leads, :as => :leads, :to => 'deals#leads' - get :marketing_report, :to => 'deals#reports', :only => :index + resources :offers, :only => [:index, :destroy] + scope :path => :offers do + resources :contact_offers, :path => 'contact', :except => [:show, :index] + resources :file_download_offers, :path => 'file_download', :except => [:show, :index] + resources :new_content_subscription_offers, :path => 'new_content_subscription', :except => [:show, :index] + resources :newsletter_subscription_offers, :path => 'newsletter_subscription', :except => [:show, :index] + resources :video_offers, :path => 'video', :except => [:show, :index] + + %w( contact file_download new_content_subscription newsletter_subscription video ).each do |path| + get "/#{path}", :as => "#{path}_offers_redirect", :to => redirect("/#{crm_path}/offers?type=#{path}") + get "/#{path}/:id", :as => "#{path}_offers_edit_redirect", :to => redirect("/#{crm_path}/#{path}/%{id}/edit"), :constraints => { :id => /\d+/ } + end + + %w( contact file_download new_content_subscription newsletter_subscription video ).each do |path| + end + end + + # leads are simply a scoped view of deals (only index) + get :leads, :as => :leads, :to => 'deals#leads' + get :marketing_report, :to => 'deals#reports' get '/merge_contacts/:contact_a_id/and/:contact_b_id', :as => :new_contact_merge, :to => 'contact_merges#new' post '/merge_contacts', :as => :contact_merges, :to => 'contact_merges#create' # redirect shows to edits