extends layout

block content
  h1 Saved Files
  table#files(cellpadding="0",cellspacing="0",border="0",class="display",style="table { clear: both }")
    thead
      tr
        th File Number
        th Node
        th Name
        th Locked
        th First Date
        th File Size
    tbody
  br
  #files

  script(type='text/javascript').
    var filesTable;

    $(document).ready(function() {
      filesTable = $('#files').dataTable( {
        "oLanguage": {
          "sProcessing": "<img src=\"watching.gif\"><div class='blink'>I'm Hootin' :D</div>",
          "sLengthMenu": "_MENU_"
        },
        "sDom": '<"H"lipr>t<"F"ip>',
        "iDisplayLength": 500,
        "aLengthMenu": [100, 500, 1000, 5000],
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "#{basePath}files.json",
        "bRetrieve": true,
        "bFilter": false,
        "bScrollCollapse": true,
        "bAutoWidth": false,
        "aoColumns": [
          { "mDataProp" : "num"
          },
          { "mDataProp" : "node"
          },
          { "mDataProp" : "name"
          },
          { "mDataProp" : "locked",
            "fnRender" : function(oObj) {
              return oObj.aData.locked === 1?true:"false";
            }
          },
          { "mDataProp" : "first",
            "fnRender" : function(oObj) {
              return dateString(oObj.aData.first, " ");
            }
          },
          { "mDataProp" : "filesize"
          }
        ],
        "aaSorting": [[3, "desc"]]
      } );
    } );
