Split mission and world name in missions list

This commit is contained in:
Björn Dahlgren 2019-06-23 20:04:28 +02:00
parent a9f49bbbcf
commit cd9f9f82f5
5 changed files with 16 additions and 3 deletions

View File

@ -43,12 +43,19 @@ Missions.prototype.updateMissions = function (cb) {
return cb(err)
}
var filenameWithoutPbo = path.basename(filename, '.pbo')
var worldName = path.extname(filenameWithoutPbo)
var missionName = path.basename(filenameWithoutPbo, worldName)
worldName = worldName.replace('.', '')
cb(null, {
dateCreated: new Date(stat.ctime),
dateModified: new Date(stat.mtime),
missionName: missionName,
name: filename,
size: stat.size,
sizeFormatted: filesize(stat.size)
sizeFormatted: filesize(stat.size),
worldName: worldName
})
})
}, function (err, missions) {

View File

@ -2,6 +2,7 @@
<thead>
<tr>
<th>Mission</th>
<th>World</th>
<th>Size</th>
<th>Updated</th>
<th></th>

View File

@ -1,6 +1,7 @@
<td style="width: 100%;">
<a href='/api/missions/<%-encodeURI(name)%>'><%-name%></a>
<a href='/api/missions/<%-encodeURI(name)%>'><%-missionName%></a>
</td>
<td><%-worldName%></td>
<td class="text-nowrap"><%-sizeFormatted%></td>
<td class="text-nowrap"><%-dateModified.substring(0, 10)%></td>
<td>

View File

@ -3,6 +3,7 @@
<thead>
<tr>
<th>Mission</th>
<th>World</th>
<th>&nbsp;</th>
</tr>
</thead>

View File

@ -1,5 +1,8 @@
<td>
<%-name%>
<%-missionName%>
</td>
<td>
<%-worldName%>
</td>
<td>
<a class="btn btn-primary btn-xs add pull-right">