Browse Source

Add filter for node name and show title on node page

pm2
Luke Childs 8 years ago
parent
commit
089f70b911
  1. 5
      lib/nunjuck-filters.js
  2. 1
      views/node.html

5
lib/nunjuck-filters.js

@ -49,7 +49,10 @@ const filters = {
// Encode query string
return `/?${querystring.encode(query)}`;
}
},
nodeName: node => node.nickname
|| node.fingerprint && node.fingerprint.slice(0, 8)
|| node.hashed_fingerprint && node.hashed_fingerprint.slice(0, 8)
};
module.exports = app => Object.keys(filters).forEach(filter => {

1
views/node.html

@ -5,6 +5,7 @@
{% if error %}
<h2>{{ 'Invalid node' if error.statusCode == 400 else error.statusMessage }}</h2>
{% else %}
<h2>{{ node.type | title }}: {{ node | nodeName }}</h2>
<pre>{{ node | dump }}</pre>
{% endif %}

Loading…
Cancel
Save