Build page for each files

This commit is contained in:
Julien Duponchelle 2015-07-29 17:39:02 +02:00
parent 21d28e2944
commit 29b82614a0
3 changed files with 18 additions and 0 deletions

View File

@ -40,6 +40,7 @@ if os.path.exists('build'):
else:
os.mkdir('build')
os.mkdir(os.path.join('build', 'devices'))
os.mkdir(os.path.join('build', 'images'))
def render(template_file, out, **kwargs):
@ -64,4 +65,8 @@ for file in os.listdir('devices'):
devices.append(device)
for image_type in device['images']:
for image in device['images'][image_type]:
render('device.html', os.path.join('images', image['md5sum'] + '.html'), device=device)
render('devices.html', os.path.join('devices', 'index.html'), devices=devices)

View File

@ -1,7 +1,16 @@
{% extends "layout/default.html" %}
{% block script %}
function importDevice() {
md5 = gns3.importDevice();
window.location = "/images/" + md5 + ".html"
}
{% endblock %}
{% block body %}
<div class="jumbotron">
<h1>Hello Networker!</h1>
<p><a class="btn btn-primary btn-lg" href="/devices" role="button">Show devices</a></p>
<p><a class="btn btn-primary btn-lg" href="#" role="button" onclick="importDevice()">Import device</a></p>
</div>
{% endblock %}

View File

@ -12,6 +12,10 @@
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
{% block script %}{% endblock %}
</script>
</head>
<body>
<nav class="navbar navbar-default">