# -*- encoding : utf-8 -*-
Survey::Application.routes.draw do
  
  devise_for :admins, :controllers => {:sessions => "admins/sessions", :passwords => "admins/passwords"} 
  
  match 'plaquettes/:slug.:f' => 'plaquettes#show', :as => :plaquette, :f => "html"
  
  get "forum_user/index"


  #admin
  namespace :admin do
    root :to => "dashboard#index"
    
    resources :admins
    resources :survey_types
    resources :petitions do
      member do 
        get :reconfirm
      end
    end
    resources :tiny_urls
    
    #note files
    resources :note_files
    resources :notes
    resources :topics
    
    #sheets
    resources :sheets do
      collection do 
        get 'stats'
        get 'recus'
        put 'index'
      end
    end
    resources :newsgroups
    resources :donates
    resources :sheet_years
    resources :people do
      member do 
        get 'principal'
      end
    end
    
    resources :newsletters do
      member do
        get "select_recipients"
        put "select_recipients"
        post "send_test"
        post "send_newsletter"
      end
    end
    
  
  end
  
  
  #forum
  namespace :forum do
    root :to => "forums#show", :id => 1
    resources :forum_topics
    resources :forum_messages
    resources :forums
    resources :forum_categories
    resources :forum_users
    resources :forum_user_images do
      member do
        get :rotate
      end
    end
    resources :auths do
      collection do 
        get :logout
      end
    end
    
  end
  
  
  
  

  
  	

  match 'u/:id' => 'tiny_urls#show', :as => :tiny_url
  
  
  match 'sondages/:slug/merci-de-votre-participation.:f' => 'survey_sets#thank', :as => :thank_survey_set, :f => "html"
  match 'sondages/:slug.:f' => 'survey_sets#new', :as => :new_survey_set, :f => "html"
  match 'sondages/:slug/resultats.:f' => 'survey_sets#show', :as => :survey_set, :f => "html"
  
  match 'petitions/:id.:f' => 'petitions#show', :as => :petition, :f => "html"
  
  
  resources :petitions do
    member do 
      get :confirm
    end
  end
  
  resources :survey_sets do
    collection do 
      get 'thanks'
      
    end
      
  end
  

  root :to => 'admin/dashboard#index'

 
end
