.qi_header
  .right
    =link_to "Ajouter un slide", new_admin_home_slider_slide_path(:home_slider_id => @home_slider.id), :remote => true, :class => "btn btn-primary"
  %h1
    Sliders
    %span
      =@home_slider.name


.qi_row
  .qi_pannel.qi_plain.padding



    .home_slider_slides
      =render @home_slider.home_slider_slides.order(:position)
  
    :coffeescript
      adjustment = ""
      $('.home_slider_slides').sortable({
        stop: (event, ui) ->
      
          result = []
          $(this).find(".home_slider_slide").each ->
            result.push $(this).data("id")
        
      
          $.ajax({
            url:"/admin/home_slider_slides/reorder.js", 
            type: "GET",
            data: { 
              order : result
              }
    
          })
       
      });
      
      
    .sub_header
      %h2 Simulation
    #home_slider_simulation

      -@date = Time.now
  
      -@home_slides_simu = @home_slider.home_slider_slides.where(:enabled => true)
      -@home_slides_simu = @home_slides_simu.where("start_at IS NULL or start_at <= ?",@date)
      -@home_slides_simu = @home_slides_simu.where("end_at IS NULL or end_at >= ?",@date)
      -@home_slides_simu = @home_slides_simu.order(:position)
      -@home_slides_simu.each do |home_slider_slide|
        -if home_slider_slide.image_file
          =image_tag home_slider_slide.image_file.file.url, :style => "height:200px;"