diff --git a/lib/missions.js b/lib/missions.js index 025e176..035de2e 100644 --- a/lib/missions.js +++ b/lib/missions.js @@ -1,3 +1,5 @@ +var async = require('async'); +var filesize = require('filesize'); var fs = require('fs'); var path = require('path'); @@ -14,16 +16,30 @@ Missions.prototype.missionPath = function (name) { } Missions.prototype.list = function (cb){ + var self = this; fs.readdir(this.missionsPath(), function (err, files) { if (err) { cb(err); } else { - var missions = files.map(function (filename) { - return { - name: filename, - }; + async.map(files, function (filename, cb) { + fs.stat(self.missionPath(filename), function (err, stat) { + if (err) { + cb(err); + } + + cb(null, { + dateCreated: new Date(stat.ctime), + dateModified: new Date(stat.mtime), + name: filename, + size: stat.size, + sizeFormatted: filesize(stat.size), + }); + }); + }, function (err, missions) { + if (cb) { + cb(err, missions); + } }); - cb(null, missions); } }); }; diff --git a/public/css/styles.css b/public/css/styles.css index 280c70c..bb27e72 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -20,3 +20,7 @@ body { #footer .container .text-muted { margin: 20px 0; } + +.text-nowrap { + white-space: nowrap; +} diff --git a/public/js/tpl/missions/list.html b/public/js/tpl/missions/list.html index ebc1521..5370c02 100644 --- a/public/js/tpl/missions/list.html +++ b/public/js/tpl/missions/list.html @@ -2,6 +2,8 @@ Mission + Size + Updated diff --git a/public/js/tpl/missions/list_item.html b/public/js/tpl/missions/list_item.html index 49ecff6..176a451 100644 --- a/public/js/tpl/missions/list_item.html +++ b/public/js/tpl/missions/list_item.html @@ -1,6 +1,8 @@ <%-name%> +<%-sizeFormatted%> +<%-dateModified.substring(0, 10)%>