Rails.application.routes.draw do
  root 'site#index'
  concern :paginatable do
    get '(page/:page)', action: :index, on: :collection, as: ''
  end
  namespace :ps_admin do
    namespace :articles do
      get 'all_page/publish'
      get 'all_page/unpublish'
      resources :all_page
    end
    root 'home#index'
    post 'home/change_pass'
    resources :home
    get 'all_page/publish'
    get 'all_page/unpublish'
    get 'all_page/pp_priority_up'
    get 'all_page/pp_priority_down'
    resources :all_page
    resources :article
    get 'category/set_active'
    get 'category/import_categories'
    get 'category/deactivate_activate'
    resources :category
    post 'product/xedit'
    get 'product/import_products'
    get 'product/set_active'
    get 'product/set_chk_quantity'
    resources :product
    get 'image/pos_up'
    get 'image/pos_down'
    get 'image/set_active'
    get 'image/set_cover'
    resources :image
    post 'settings/xedit'
    post 'settings/home_page_update'
    resources :settings
    resources :admins
    get 'order/anonimize'
    get 'order/status_histories'
    get 'order/change_status'
    resources :order
  end
  devise_for :admins
  get 'cart/cart'
  post 'cart/add_to_cart'
  get 'cart/remove_from_cart'
  get 'cart/clear'
  post 'cart/change_qty'
  post 'checkout/change_shipping'
  get 'checkout/order'
  post 'checkout/end_order'
  post 'site/send_email'
  get 'site/kontakt'
  get 'site/preview/:id' => 'site#preview'
  resources :site
  resources :product, concerns: :paginatable
  resources :category
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
