/
application.html
84 lines (72 loc) · 2.02 KB
/
application.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{% extends "_base.html" %}
{% block content %}
<h2>Application "{{ app.name }}"</h2>
<p><b>Details</b> (<a href="{{ base_url }}edit/application/{{ app.id }}">edit</a>)</p>
<ul>
<li><b>Version:</b> {{ app.version }}</li>
<li><b>Email:</b> {% if app.email %}<a href="mailto:{{ app.email }}">{{ app.email }}</a>{% else %}none{% endif %}</li>
<li><b>Website:</b> {% if app.website %}<a href="{{ app.website }}">{{ app.website }}</a>{% else %}none{% endif %}</li>
</ul>
<p><b>Searches during the last 30 days</b></p>
<div id="lookups-graph-fp"></div>
<p><b>Searches per month</b></p>
<table class="listing">
{% for m in monthly_stats %}
<tr>
<td>{{ m.month.strftime('%B %Y') }}</td>
<td class="r">{{ m.lookups }}</td>
</tr>
{% endfor %}
</table>
{% macro lookup_data_series(name, data, field, visible=True) %}
{
name: '{{ name }}',
data: [
{% for i in data -%}
[Date.UTC({{ i.date.year }}, {{ i.date.month - 1 }}, {{ i.date.day }}), {{ i[field] }}]{% if not loop.last %},{% endif %}
{%- endfor %}
],
visible: {{ 'true' if visible else 'false' }}
}
{% endmacro %}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/static/highcharts.js" type="text/javascript"></script>
<script type="text/javascript">
var chart1; // globally available
var chart2; // globally available
$(document).ready(function() {
chart2 = new Highcharts.Chart({
chart: {
renderTo: 'lookups-graph-fp',
height: 250,
zoomType: 'x',
defaultSeriesType: 'line'
},
title: { text: '' },
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%e. %b',
year: '%b'
}
},
yAxis: {
title: { text: '' }
},
legend: {
shadow: false
},
plotOptions: {
line: {
lineWidth: 1
}
},
series: [
{{ lookup_data_series('All', lookups, 'count') }},
{{ lookup_data_series('Hits', lookups, 'count_hits') }},
{{ lookup_data_series('Misses', lookups, 'count_nohits') }}
]
});
});
</script>
{% endblock %}