Browse Source

Add title to listing table

pm2
Luke Childs 9 years ago
parent
commit
14771aaa13
  1. 3
      viewModels/listing.js
  2. 1
      views/listing.html

3
viewModels/listing.js

@ -2,10 +2,12 @@ const tor = require('../lib/tor');
module.exports = (req, res) => { module.exports = (req, res) => {
let title = 'Top 10 nodes by consensus weight';
const query = { const query = {
limit: 10 limit: 10
}; };
if(req.query.s) { if(req.query.s) {
title = `Search results for "${req.query.s}"`;
query.search = req.query.s; query.search = req.query.s;
} else { } else {
query.order = '-consensus_weight'; query.order = '-consensus_weight';
@ -13,6 +15,7 @@ module.exports = (req, res) => {
} }
tor.listNodes(query).then(nodes => res.render('listing.html', { tor.listNodes(query).then(nodes => res.render('listing.html', {
title: title,
nodes: nodes nodes: nodes
})); }));
} }

1
views/listing.html

@ -1,6 +1,7 @@
{% extends 'index.html' %} {% extends 'index.html' %}
{% block main %} {% block main %}
<h2>{{ title }}</h2>
<table> <table>
<thead> <thead>
<tr> <tr>

Loading…
Cancel
Save