-if admin 





  %table
    -table_rows = input.table_rows
    %tr
      -i = 0
      -input.nbr_cols.times do 
        -i += 1
        %td.add_col{:style => "text-align:center;"}
          
          .btn-group
            %a.btn.dropdown-toggle{:href => "#", :data => {:toggle => "dropdown"}}
              = i(:cog)
              
            %ul.dropdown-menu
              %li=link_to "Ajouter une colonne avant", portlet_table_cols_path(:position => i, :table_content_id =>input.id ), :method => :post, :remote => true
          
              %li=link_to "Ajouter une colonne après", portlet_table_cols_path(:position => i+1, :table_content_id =>input.id ), :method => :post, :remote => true
            
              -if input.nbr_cols > 1
                %li=link_to "Supprimer cette colonne", portlet_table_col_path(:id => i, :table_content_id =>input.id ), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer cette colonne ?"
              
    
      %td
  
    -table_rows.each do |table_row|
      %tr{:id => table_row.id}
    
      
        -CelTable.where(:table_row_id => table_row.id).order("position ASC").each do |cel_table|
        
          %td.input_cel{:id => cel_table.id, :style => "border:1px solid black;"}

            =render :partial => "admin/blocks/block", :locals => {:block => cel_table.block, :sortable => false}
      
        %td.add_cel 
        
          .btn-group{:style => "position:relative;"}
            %a.btn.dropdown-toggle{:href => "#", :data => {:toggle => "dropdown"}}
              = i(:cog)
              
            %ul.dropdown-menu{:style => "position:absolute;right:40px !important;left:auto !important;top:-2px !important;"}
              %li=link_to "Ajouter un rang avant", portlet_table_rows_path(:table_row => {:table_content_id => input.id, :position => (table_row.position)}), :method => :post, :remote => true
          
              %li=link_to "Ajouter un rang après", portlet_table_rows_path(:table_row => {:table_content_id => input.id, :position => (table_row.position+1)}), :method => :post, :remote => true
              -if input.nbr_rows > 1
                %li=link_to "Supprimer ce rang", portlet_table_row_path(table_row), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer ce rang ?"
        
    
        
    

-else

  %table
    -table_rows = input.table_rows

    -if table_rows
      -table_rows.each do |table_row|
        %tr
    
          -table_row.cel_tables.each do |cel_table|
      
            %td
              =render :partial => "public/blocks/block", :locals => {:admin => false, :block => cel_table.block, :sortable => false}
              
        

