
-if admin
  
  .description
    =raw input.description
 
  .gallery_images  
    =render :collection => input.gallery_images, :partial => "portlet/gallery_images/gallery_image"
    %p{:style => "clear:both;"}
  
  %p
    Légende :
    =input.name
  
  :coffeescript
  
    adjustment = ""
    
    $('.gallery_images').sortable({
      itemSelector:".gallery_image",
      containerSelector :".gallery_images",
      stop: (event, ui) ->
      
        result = []
        $(this).find(".gallery_image").each ->
          result.push $(this).data("id")
        
      
        $.ajax({
          url:"/portlet/gallery_images/reorder.js", 
          type: "GET",
          data: { 
            order : result
            } 
    
        })
    });
  

  

-else
  
    
  
  -if input.style == 3
    .portlet.input
    
      
    
      .rea-gal  
        -input.gallery_images.each do |gallery_images|
          =link_to image_tag(gallery_images.image_file.file.square.url, :alt => "#{gallery_images.title}"), gallery_images.image_file.file.large.url, :title => gallery_images.title
        .clear
          

  -elsif input.style==2

    .diaporama-wrapper
      #diaporama.diaporama{:id => input.id}

        -input.gallery_images.each do |gallery_images|
          -css = "background:url('#{gallery_images.image_file.file.large.medium.url}') center center no-repeat;background-size:100%;background-size:contain;"
          %div.with_ratio{:style => css, :data => {:ratio => "0.66"}}
            =#image_tag gallery_images.image_file.file.large.medium.url
          
          
            -if false
              .desc
                -if gallery_images.title?
                  %h3
                    =gallery_images.title
                    ="/" if gallery_images.description?
                -if gallery_images.description?
                  =gallery_images.description
      
      
      -if input.with_legend
        .legend
          =input.name          
                
    :javascript
      $(document).ready(function(){
      $('.diaporama').bxSlider();
      });

  



  -elsif input.style==1
    .portlet.input
      %table.gallery_images  
        =raw "<tr>"
      
        - i = 0
        -input.gallery_images.each do |gallery_images|
          -if gallery_images.image_file
            - i = i+1
        
            %td=link_to image_tag(gallery_images.image_file.file.large.medium.small.thumb.url, :alt => "#{gallery_images.title}"), gallery_images.image_file.file.large.url, :rel => "prettyPhoto"
        
            -if i % 4 == 0
              =raw "</tr><tr>"
        
        
        =raw "</tr>"

  