Browse Source

Check node sections have content before outputting

pm2
Luke Childs 9 years ago
parent
commit
82ece06fbc
  1. 216
      views/node.html

216
views/node.html

@ -15,110 +15,138 @@
</section> </section>
</div> </div>
<section class="overview"> {% if
<h3>Overview</h3> node.nickname or
<i class="icon-tor"></i> node.fingerprint or
<dl> node.hashed_fingerprint or
{% if node.nickname %} node.advertised_bandwidth or
<dt>Nickname</dt> node.flags.length
<dd>{{ node.nickname }}</dd> %}
{% endif %} <section class="overview">
{% if node.fingerprint %} <h3>Overview</h3>
<dt>Fingerprint</dt> <i class="icon-tor"></i>
<dd>{{ node.fingerprint }}</dd>
{% endif %}
{% if node.hashed_fingerprint %}
<dt>Hashed Fingerprint</dt>
<dd>{{ node.hashed_fingerprint }}</dd>
{% endif %}
{% if node.advertised_bandwidth %}
<dt>Advertised Bandwidth</dt>
<dd>{{ node | bandwidth }}</dd>
{% endif %}
{% if node.flags.length %}
<dt>Flags</dt>
{% for flag in node.flags %}
<dd class="flag"><i class="icon-{{ flag | lower }}"></i> {{ flag }}</dd>
{% endfor %}
{% endif %}
</dl>
</section>
<div class="columns">
<section class="config">
<h3>Config</h3>
<dl> <dl>
{% if node.type %} {% if node.nickname %}
<dt>Type</dt> <dt>Nickname</dt>
<dd>{{ node.type | title }}</dd> <dd>{{ node.nickname }}</dd>
{% endif %} {% endif %}
{% if node.platform %} {% if node.fingerprint %}
<dt>Platform</dt> <dt>Fingerprint</dt>
<dd>{{ node.platform }}</dd> <dd>{{ node.fingerprint }}</dd>
{% endif %}
{% if node.or_addresses.length %}
<dt>Or Addresses</dt>
{% for address in node.or_addresses %}
<dd>{{ address }}</dd>
{% endfor %}
{% endif %} {% endif %}
{% if node.dir_address %} {% if node.hashed_fingerprint %}
<dt>Dir Address</dt> <dt>Hashed Fingerprint</dt>
<dd>{{ node.dir_address }}</dd> <dd>{{ node.hashed_fingerprint }}</dd>
{% endif %} {% endif %}
{% if node.transports.length %} {% if node.advertised_bandwidth %}
<dt>Transport Protocols</dt> <dt>Advertised Bandwidth</dt>
{% for transportProtocol in node.transports %} <dd>{{ node | bandwidth }}</dd>
<dd>{{ transportProtocol }}</dd>
{% endfor %}
{% endif %} {% endif %}
{% if node.exit_policy.length %} {% if node.flags.length %}
<dt>Exit Policy</dt> <dt>Flags</dt>
{% for rule in node.exit_policy %} {% for flag in node.flags %}
<dd>{{ rule }}</dd> <dd class="flag"><i class="icon-{{ flag | lower }}"></i> {{ flag }}</dd>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</dl> </dl>
</section> </section>
{% endif %}
<section class="meta"> <div class="columns">
<h3>Meta</h3>
<dl> {% if
{% if node.host_name %} node.type or
<dt>Hostname</dt> node.platform or
<dd>{{ node.host_name }}</dd> node.or_addresses.length or
{% endif %} node.dir_address or
{% if node.contact %} node.transports.length or
<dt>Contact</dt> node.exit_policy.length
<dd>{{ node.contact }}</dd> %}
{% endif %} <section class="config">
{% if node.country_name %} <h3>Config</h3>
<dt>Country</dt> <dl>
<dd>{{ node.country_name }}</dd> {% if node.type %}
{% endif %} <dt>Type</dt>
{% if node.region_name %} <dd>{{ node.type | title }}</dd>
<dt>Region</dt> {% endif %}
<dd>{{ node.region_name }}</dd> {% if node.platform %}
{% endif %} <dt>Platform</dt>
{% if node.city_name %} <dd>{{ node.platform }}</dd>
<dt>City</dt> {% endif %}
<dd>{{ node.city_name }}</dd> {% if node.or_addresses.length %}
{% endif %} <dt>Or Addresses</dt>
{% if node.as_number %} {% for address in node.or_addresses %}
<dt>AS Number</dt> <dd>{{ address }}</dd>
<dd>{{ node.as_number }}</dd> {% endfor %}
{% endif %} {% endif %}
{% if node.as_name %} {% if node.dir_address %}
<dt>AS Name</dt> <dt>Dir Address</dt>
<dd>{{ node.as_name }}</dd> <dd>{{ node.dir_address }}</dd>
{% endif %} {% endif %}
{% if node.consensus_weight %} {% if node.transports.length %}
<dt>Consensus Weight</dt> <dt>Transport Protocols</dt>
<dd>{{ node.consensus_weight }}</dd> {% for transportProtocol in node.transports %}
{% endif %} <dd>{{ transportProtocol }}</dd>
</dl> {% endfor %}
</section> {% endif %}
{% if node.exit_policy.length %}
<dt>Exit Policy</dt>
{% for rule in node.exit_policy %}
<dd>{{ rule }}</dd>
{% endfor %}
{% endif %}
</dl>
</section>
{% endif %}
{% if
node.host_name or
node.contact or
node.country_name or
node.region_name or
node.city_name or
node.as_number or
node.as_name or
node.consensus_weight
%}
<section class="meta">
<h3>Meta</h3>
<dl>
{% if node.host_name %}
<dt>Hostname</dt>
<dd>{{ node.host_name }}</dd>
{% endif %}
{% if node.contact %}
<dt>Contact</dt>
<dd>{{ node.contact }}</dd>
{% endif %}
{% if node.country_name %}
<dt>Country</dt>
<dd>{{ node.country_name }}</dd>
{% endif %}
{% if node.region_name %}
<dt>Region</dt>
<dd>{{ node.region_name }}</dd>
{% endif %}
{% if node.city_name %}
<dt>City</dt>
<dd>{{ node.city_name }}</dd>
{% endif %}
{% if node.as_number %}
<dt>AS Number</dt>
<dd>{{ node.as_number }}</dd>
{% endif %}
{% if node.as_name %}
<dt>AS Name</dt>
<dd>{{ node.as_name }}</dd>
{% endif %}
{% if node.consensus_weight %}
<dt>Consensus Weight</dt>
<dd>{{ node.consensus_weight }}</dd>
{% endif %}
</dl>
</section>
{% endif %}
</div> </div>

Loading…
Cancel
Save