.qi_header
  %h1 To do


.qi_row

  -if params[:i_previ_id] 
    -@i_tasks = ITask.where(:i_previ_id => params[:i_previ_id], :done => false).all
  
  -elsif params[:archive]
    -@i_tasks = ITask.where(:done => true).all
  
  -elsif params[:urgent]
    -@i_tasks = ITask.where(:urgent => true, :done => false).all
  -elsif params[:no]
    -@i_tasks = ITask.where(:done => false, :i_previ_id => nil).all
    
  -else
    -params[:all] = true
    -@i_tasks = ITask.where(:done => false).all
    
  -if params[:i_task_project_id] and params[:i_task_project_id].to_s != ""
    -@i_task_project = IWebsite.where(:id => params[:i_task_project_id]).first
    -@i_tasks = @i_tasks.where(:i_website_id => params[:i_task_project_id]).all
    
  

  :scss
    .i_task_project{
      background:white;
      font-weight:bold;
      padding:10px 20px;
      margin-top:10px;
    }
  .tasks_menu
    =link_to admin_i_tasks_path(:no => 1, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:no]) do
      Non planifiées
      
    =link_to admin_i_tasks_path(:all => 1, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:all]) do
      Toutes les tâches
  
  
    =link_to admin_i_tasks_path(:urgent => 1, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:urgent]) do
      =ic :"free-code-camp"
      Urgent
      
    =link_to admin_i_tasks_path(:i_previ_id => 1, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:i_previ_id].to_s == "1") do
      =ic :star
      Aujourd'hui
      
    =link_to admin_i_tasks_path(:i_previ_id => 2, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:i_previ_id].to_s == "2") do
      =ic :"arrow-right"
      Rapidement
      
    =link_to admin_i_tasks_path(:i_previ_id => 3, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:i_previ_id].to_s == "3") do
      =ic :history
      Un jour
      
    =link_to admin_i_tasks_path(:archive => 1, :i_task_project_id => params[:i_task_project_id]), :class => ("active" if params[:archive]) do
      Journal
  
  -if @i_task_project
    .i_task_project
      .right
        =@i_task_project.admin.name if @i_task_project.admin
        
        =link_to ic(:globe), "/p/#{@i_task_project.token}", :target => "_blank"
        
        
      =@i_task_project.name
      &nbsp;&nbsp;
      =link_to ic(:times), params.merge(:i_task_project_id => "")
      
      
  :scss
    .tasks_menu{
      a{
        display:inline-block;
        padding:4px 8px;
        
        &:hover,&.active{
          font-weight:bold;
        }
      }
      
    }
     
  #i_task_form
    
      
    #new_i_task_form=render :partial => "admin/i_tasks/form", :locals => {:new_var => true}

  .row
    #i_tasks_results= render :partial => "admin/i_tasks/results"
    
  .projects
    %strong Projets avec des tâches en cours : 
    %br
    -ITask.where(:done => false).where("i_website_id is not NULL").group(:i_website_id).map {|i| [i.i_website_id, i.i_website.name]}.sort.each do |iw|
      =link_to iw[1],admin_i_tasks_path(:i_task_project_id => iw[0]), :class => "project"
  
  :scss
    .projects{
      margin-bottom:100px;
      .project{
        display:inline-block;
        padding:5px 8px;
        margin:5px;
        background:white;
      }
      
    }
    