Commits

Peter Ward committed 96ade92

time selector

  • Participants
  • Parent commits 9158633

Comments (0)

Files changed (3)

File static/css/style.css

     padding: 1% 2%;
 }
 
+.time-selector {
+    float: right;
+}
+
 .chart {
     width: 100%;
     height: 20em;

File templates/base.html

                             url_for('show_view',
                                 hostname=hostname,
                                 view=view,
-                                start=start,
+                                start=start if start else -60*10,
                             )
                         }}">{{view}}</a></li>
                     {%- endfor %}

File templates/view.html

 {% block content %}
 <h1>{{ current_hostname }}: {{ current_view }}</h1>
 
+<div class="time-selector">
+{% for label, start in [
+    ('1y', -31536000),
+    ('6m', -15552000),
+    ('1m', -2678400),
+    ('1w', -604800),
+    ('1d', -86400),
+    ('6h', -21600),
+    ('1h', -3600),
+    ('30m', -1800),
+    ('5m', -300)
+] %}
+<a href="{{
+    url_for('show_view',
+        hostname=current_hostname,
+        view=current_view,
+        start=start,
+    )
+}}">{{ label }}</a>
+{% endfor %}
+</div>
+
 {% for chart in charts %}
 <div id="chart-{{ loop.index0 }}" class="chart"></div>
 {% endfor %}