Rails.application.routes.draw do
  
  get ":lang/blog/tags/:tag_id.html"=> "public/articles#tags", :as => :tag_public_articles, :lang => "fr"
  
  
  get "robots.:f" => "public/seo#robots"
  get "sitemap.:f" => "public/seo#sitemap"
  


  


  

  get '/fr', :to => redirect("/fr/index.html")
  get '/en', :to => redirect("/en/index.html")

  scope "(:lang)", locale: /#{I18n.available_locales.join("|")}/ do
    get "contact.html" =>"public/contacts#new", :defaults => {:raison_id => 1}, :as => :general_contact
  end
  
  
  get 'u/:id' => 'tiny_urls#show', :as => :tiny_url
    
 


  
  
  
  
  namespace :public do
    
    resources :p_friends do
      member do
        get :confirm
      end
    end
    resources :kaps
    resources :kapsmes do
      member do
        get :validate_by_token
      end
    end
    
    resources :kaps_days do
      collection do
        get :today
      end
      resources :kapsmes
    end
    
    
    get "my_account" => "my_account#index", :as => :my_account
    resources :contacts
    
    resources :p_customer_sheets
    
    resources :particulars
    
    resources :p_products
    
    resources :p_orders do
      collection do
        post :add_product
        get :cart
        post :update_cart
        get :particulars
        post :particulars_save
        get :recap
        post :recap_save
        
      end
      
      member do
        get :thank
      end
    end
    
    resources :p_sheet_lines
    resources :specific_maps 
    resources :specific_map_items
    
   
    resources :comments
    
    
    
    resources :password_resets
    
    resources :p_customers
    
    resources :p_customer_auths do

      collection do
        get :logout

      end
    end
    
    
    
  end
  
  namespace :portlet do
    resources :share_contents
    resources :slide_contents
    resources :agir_contents
    resources :time_contents
    resources :video_contents
    resources :petition_contents
    resources :timeline_history_contents
    resources :menu_item_link_contents
    resources :quote_contents
    resources :event_contents
    resources :break_contents
    resources :download_contents
    resources :dynamic_contents
    resources :gallery_contents
    resources :gallery_images do
      collection do
        get :reorder
      end
    end
    resources :html_contents
    resources :image_contents
    resources :keynumber_contents
    resources :articleindexs_contents
    resources :link_contents
    resources :img_link_contents
    resources :text_contents
    resources :map_contents
    resources :title_contents
    resources :table_contents
    resources :block_contents
    resources :table_rows
    resources :table_cols
    resources :portlets do
      collection do
        post :reorder
      end
    end
  end
  
  namespace :admin do
    resources :p_product_stocks do
      collection do
        get :import
        get :import_prix
      end
    end
    
    resources :p_price_cats
    resources :p_ship_bills
    resources :p_stats
    resources :p_payment_types
    resources :p_payments
    resources :p_drivers
    resources :p_document_type
    resources :p_documents
    resources :p_trucks
    resources :p_product_cats
    resources :p_fournisseur_orders
    resources :p_brut_products
    resources :p_tanks
    
    
    resources :p_products do
      collection do
        get :autocomplete
        post :reorder
      end
  
      
      member do
        get :autocomplete_apercu
        get :stock
        
        get :degressif
      end
      
    end
    resources :p_fournisseurs do
      collection do
        get :import
      end
      
    end
    
    resources :p_customers do
      collection do
        get :autocomplete
        get :import
      end
      
      member do
        get :autocomplete_apercu
      end
    end
    
    resources :p_customer_cats
    
    resources :p_ship_tours do
      member do
        get :to_ship
        get :ship_return
        post :ship_return_save
      end
    end
    resources :p_ship_tour_trucks do
      member do 
        post :update_ship_tour_truck_sheet_lines
      end
    end
    resources :p_trucks
    resources :p_truck_spaces
    
    resources :p_customer_sheets do
      member do
        get :generate_d
        get :generate_fp
        get :generate_fa
        get :generate_bc
        get :generate_bl
        get :generate_f
        get :reject
        get :unreject
        get :cancel
        get :uncancel
        
        
        get :set_sheet_line_ship
        post :set_sheet_line_ship_save
        
      end
      collection do
        get :affects
        get :update_stocks
      end
    end
    
    resources :mail_contents
    resources :mail_templates

    resources :contacts

    resources :translations do
      collection do
        post :import
      end
    end

    

    resources :specific_maps do
      resources :specific_map_items do
        member do
          get :geoloc
        end
      end
      
    end
    
    
    resources :edit_watchers
    resources :specific_preferences
    resources :popups
    resources :tiny_urls
    
    resources :article_authors
    resources :home_sliders
    resources :home_slider_slides do
      
      collection do
        get :reorder
      end
      
    end
    
  
    resources :timeline_histories
    resources :timeline_years
    resources :timeline_contents
    
    
    
    
		resources :categories do
			collection do
				post :reorder
			end
		end
    resources :comments
    resources :articles do
      member do
        get :edit_menu_items
      end
    end
   
    resources :tags
    resources :password_resets
    
    resources :admin_auths do
        collection do 
          get :logout
        end
    end
    
    resources :admins
    resources :admin_roles
  
    
    resources :external_links do
      collection do
        get :cible
      end
    end
    
  
    resources :menus
    resources :menu_items do
      collection do
        get :cible
        post :reorder
        get :import
        get :anglais
        get :lien_anglais
        get :update_permalinks
      end
      member do
        get :clone
        get :clone_as_article
        get :edit_articles
      end
    end
    resources :image_files do
      member do
        get :rotate
      end
    end
    resources :file_folders
    resources :data_files
		resources :video_folders do
      member do
        get :change_video_folder
      end
    end
		resources :video_files
    resources :pages do
      member do
        get :copy_lang
      end
    end
    resources :menu_urls
    resources :menu_aliases
    resources :blocks
    resources :albums do
      member do
        get :change_album
      end
        
    end
    resources :cibles
  

  end
  
  resources :audio_files
  resources :video_files
  resources :download_data_files

  get 'fr/read/:token' => "public/data_files#read", :as => :read_data_file

  get 'admin' => "admin/admin_auths#index"
  get 'admin/new_site' => "admin/admin_auths#new_site"
  
  
  
  
  get ':lang/*url.html' => 'public/menu_items#show', :as => :menu_item, :f => "html"
  get ':lang/*url.:f' => 'public/menu_items#redirect',  :f => "html"
  
  
  get "home2" => redirect('/')
  
  get "plan" => "public/home#plan"
  
  
  root "public/kaps_days#today"
  
 
  
 
  
  if !Rails.env.development?
    get '*path', to: 'public/menu_items#show'
  end
end
