aboutsummaryrefslogtreecommitdiffstats
path: root/torouterui/templates/lib.html
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-09-15 22:50:14 +0200
committerficus <ficus@robocracy.org>2012-09-15 22:50:14 +0200
commitced83335a5a338cb9c24956b96da526465d94df8 (patch)
treeb345cd21dfcbb9e660aceb2433c92bd50848938f /torouterui/templates/lib.html
parent57a1e70dee45f5cd9493d6d23f8fc7b6435d5388 (diff)
downloadtui-ced83335a5a338cb9c24956b96da526465d94df8.tar.gz
tui-ced83335a5a338cb9c24956b96da526465d94df8.zip
refactor to distributable format
Diffstat (limited to 'torouterui/templates/lib.html')
-rw-r--r--torouterui/templates/lib.html84
1 files changed, 84 insertions, 0 deletions
diff --git a/torouterui/templates/lib.html b/torouterui/templates/lib.html
new file mode 100644
index 0000000..6ac5e12
--- /dev/null
+++ b/torouterui/templates/lib.html
@@ -0,0 +1,84 @@
+
+
+{% macro ifstatus(ifstatus) -%}
+{% if not ifstatus %}
+<span class="text-error">
+Network hardware not detected at all!
+</span>
+{% else %}
+<table class="table table-condensed {% if ifstatus.state in ["DOWN", "DISCONNECTED"] %}muted{% endif %}">
+ <tr>
+ <th>Interface Name
+ <td><span style="font-family:monospace;">{{ ifstatus.ifname }}</span>
+ <tr>
+ <th>Status
+ <td><span style="font-weight: bold;" class="label
+ {% if ifstatus.state == 'RUNNING' %}label-success{% elif ifstatus.state == 'up' %}label-info{% else %}label-important{% endif %}">
+ {{ ifstatus.state }}
+ </span>
+ <tr>
+ <th>MAC Address
+ <td><span style="font-family:monospace;">{{ ifstatus.mac }}</span>
+ <tr>
+ <th>IPv4 Addresses
+ <td><span style="font-family:monospace;">
+ {% for addr in ifstatus.ipv4addrs %}
+ {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})<br>
+ {% endfor %}</span>
+ <tr>
+ <th>IPv6 Addresses
+ <td><span style="font-family:monospace;">
+ {% for addr in ifstatus.ipv6addrs %}
+ {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})<br>
+ {% endfor %}</span>
+ {% if ifstatus.radio_state %}
+ <tr>
+ <th>Radio State
+ <td><span style="font-family:monospace;">{{ ifstatus.radio_state }}</span>
+ <tr>
+ <th>SSID
+ <td><span style="font-family:monospace;">{{ ifstatus.ssid }}</span>
+ <tr>
+ <th>Frequency
+ <td><span style="font-family:monospace;">{{ ifstatus.freq }}</span>
+ <tr>
+ <th>Signal Strength
+ <td><span style="font-family:monospace;">{{ ifstatus.signal_dbm }}</span>
+ {% endif %}
+</table>
+{% endif %}
+{%- endmacro %}
+
+
+{% macro logbox(name, contents) -%}
+<h3>{{name}}</h3>
+{% if contents == None %}
+<span class="text-error">Access to {{name}} was denied, or file did not exist.</span>
+{% else %}
+<div style="height: 18em; width: 60em;">
+<pre style="height: 18em; width 60em; overflow: auto;">
+{{ contents }}
+</pre>
+</div>
+{% endif%}
+{%- endmacro %}
+
+
+{% macro forminput(form, formerr, name, title, placeholder) -%}
+<div class="control-group {% if formerr[name] %}error{% endif %}">
+ <label class="control-label" for="{{name}}">{{ title }}</label>
+ <div class="controls">
+ <input type="text" name="{{name}}" placeholder="{{placeholder}}" {% if form[name] %}value="{{ form[name] }}"{% endif %}>
+ {% if formerr[name] %}
+ <span class="help-inline">{{ formerr[name] }}</span>
+ {% endif %}
+ </div>
+</div>
+{%- endmacro %}
+
+{% macro formcheckbox(form, formerr, name, title, value) -%}
+ <label class="checkbox">
+ <input type="checkbox" name="{{name}}" id="{{name}}" value="{{value}}" {% if form[name] == value %}checked{% endif %}>
+ <h4>{{title}}</h4>
+ </label>
+{% endmacro %}