Add limited sort support
parent
1c08e51b0d
commit
6fab2976cf
|
@ -4,7 +4,7 @@ const path = require('path')
|
|||
|
||||
module.exports = (plugin, app) => {
|
||||
router.get(['/db/:collection', '/db/:collection/:type', '/db/:collection/:type/:name'], async function(req, res) {
|
||||
let collection = app.live.db.getCollection(req.params.collection)
|
||||
let collection = app.live.db.getCollection(req.params.collection).chain()
|
||||
let results = []
|
||||
let error = ''
|
||||
let errorCode = 0
|
||||
|
@ -31,7 +31,10 @@ module.exports = (plugin, app) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
//console.log(results, error, errorCode)
|
||||
if (req.query['sort-by']) {
|
||||
results.simplesort(req.query['sort-by'])
|
||||
}
|
||||
results = results.data()
|
||||
|
||||
let content
|
||||
if (errorCode > 0) {
|
||||
|
|
|
@ -22,17 +22,17 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><a href="?sort-by=name">Name</a></th>
|
||||
<th>Description</th>
|
||||
<th>Attack</th>
|
||||
<th>Damage</th>
|
||||
<th>Type</th>
|
||||
<th>Range</th>
|
||||
<th><a href="?sort-by=attack">Attack</a></th>
|
||||
<th><a href="?sort-by=damage">Damage</a></th>
|
||||
<th><a href="?sort-by=weapontype">Type</a></th>
|
||||
<th><a href="?sort-by=range">Range</a></th>
|
||||
<th>Radius</th>
|
||||
<th>Capacity</th>
|
||||
<th>Duration</th>
|
||||
<th>Properties</th>
|
||||
<th>Worth</th>
|
||||
<th><a href="?sort-by=worth">Worth</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -62,11 +62,11 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><a href="?sort-by=name">Name</a></th>
|
||||
<th>Description</th>
|
||||
<th>Defense</th>
|
||||
<th>Properties</th>
|
||||
<th>Worth</th>
|
||||
<th><a href="?sort-by=worth">Worth</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -89,10 +89,10 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><a href="?sort-by=name">Name</a></th>
|
||||
<th>Description</th>
|
||||
<th>Properties</th>
|
||||
<th>Worth</th>
|
||||
<th><a href="?sort-by=worth">Worth</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -136,6 +136,7 @@
|
|||
#}}
|
||||
|
||||
{{##def.consumables_table:it:
|
||||
Sort: <a href="?sort-by=name">Name</a> <a href="?sort-by=worth">Worth</a>
|
||||
{{~it :item:index}}
|
||||
{{#def.consumables_table_entry:item || ''}}
|
||||
{{~}}
|
||||
|
|
Loading…
Reference in New Issue