


%table.table_content
  -table_rows = table_content.table_rows
  %tr
    -i = 0
    -table_content.nbr_cols.times do 
      -i += 1
      %td.add_col
        %span.innerWrapper
          .col_menu
            =link_to "Ajouter une colonne avant", portlet_table_cols_path(:position => i, :table_content_id =>table_content.id ), :method => :post, :remote => true
          
            =link_to "Ajouter une colonne après", portlet_table_cols_path(:position => i+1, :table_content_id =>table_content.id ), :method => :post, :remote => true
            
            -if table_content.nbr_cols > 1
              =link_to "Supprimer cette colonne", portlet_table_col_path(:id => i, :table_content_id =>table_content.id ), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer cette colonne ?"
          = i(:cog_alt, :gray_light, 12)
        
    %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.table_content_cel{:id => cel_table.id}

          =render :partial => "admin/blocks/block", :locals => {:block => cel_table.block}
      
      %td.add_cel 
        
        .innerWrapper
          .row_menu
            =link_to "Ajouter un rang avant", portlet_table_rows_path(:table_row => {:table_content_id => table_content.id, :position => (table_row.position)}), :method => :post, :remote => true
          
            =link_to "Ajouter un rang après", portlet_table_rows_path(:table_row => {:table_content_id => table_content.id, :position => (table_row.position+1)}), :method => :post, :remote => true
            -if table_content.nbr_rows > 1
              =link_to "Supprimer ce rang", portlet_table_row_path(table_row), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer ce rang ?"
          = i(:cog_alt, :gray_light, 12)
        
          
        
    