Changeset - 5da13e8942c1
[Not reviewed]
default
0 1 0
Dennis Fink - 11 years ago 2013-11-18 22:01:33
dennis.fink@c3l.lu
updated ennstatus
1 file changed with 11 insertions and 2 deletions:
0 comments (0 inline, 0 general)
ennstatus/templates/status/macros.html
Show inline comments
 
{% macro colorize_status(status) %}
 
  {% if status == "Online" %}
 
    {% set color = "text-success" %}
 
  {% elif status == "Unknown" %}
 
    {% set color = "text-warning" %}
 
  {% else %}
 
    {% set color = "text-danger" %}
 
  {% endif %}
 
  <p class={{ color }}>{{ status}}</p>
 
  <p class={{ color }}>{{ status }}</p>
 
{% endmacro %}
 

	
 
{% macro colorize_obfs(obfs) %}
 
  {% if obfs %}
 
    {% set color = "text-success" %}
 
  {% else %}
 
    {% set color = "text-danger" %}
 
  {% endif %}
 
  <p class={{ color }}>{{ obfs }}</p>
 
{% endmacro %}
 

	
 
{% macro create_country(country) %}
 
  {% set country_class = "flag-" + country|lower|replace(' ', '-') %}
 
  <i class={{ country_class }}></i> {{ country|title }}
 
{% endmacro %}
 

	
 
{% macro create_fingerprint(fingerprint) %}
 
  <a href="http://torstatus.enn.lu/#details/{{ fingerprint }}">{{ fingerprint|upper}}</a>
 
{% endmacro %}
 

	
 
{% macro create_server_table(server_type, servers) %}
 
@@ -39,20 +48,20 @@
 
          <td>{{ loop.index }}</td>
 
          <td>{{ server['server_name'] }}</td>
 
          {% if server_type in ('Exit', 'Relay') %}
 
            <td>{{ server['ip'] }}</td>
 
          {% endif %}
 
          {% for status in [server['server_status'], server['tor_status']] %}
 
            <td>{{ colorize_status(status) }}</td>
 
          {% endfor %}
 
          <td>{{ create_country(server['country']) }}</td>
 
          {% if server_type in ('Exit', 'Relay') %}
 
            <td>{{ create_fingerprint(server['fingerprint']) }}</td>
 
          {% else %}
 
            <td>{{ server['obfs'] }}</td>
 
            <td>{{ colorize_obfs(server['obfs']) }}</td>
 
          {% endif %}
 
          <td>{{ server['last_updated'] }}</td>
 
        </tr>
 
      {% endfor %}
 
    </tbody>
 
  </table>
 
{% endmacro %}
0 comments (0 inline, 0 general)