From 29b82614a0df5723b6b7f607633392b602e27955 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 29 Jul 2015 17:39:02 +0200 Subject: [PATCH] Build page for each files --- build.py | 5 +++++ templates/index.html | 9 +++++++++ templates/layout/default.html | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/build.py b/build.py index 9ea681b..e19ef93 100644 --- a/build.py +++ b/build.py @@ -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) diff --git a/templates/index.html b/templates/index.html index 2ea801d..3be6be6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,7 +1,16 @@ {% extends "layout/default.html" %} +{% block script %} + +function importDevice() { + md5 = gns3.importDevice(); + window.location = "/images/" + md5 + ".html" +} + +{% endblock %} {% block body %}

Hello Networker!

Show devices

+

Import device

{% endblock %} diff --git a/templates/layout/default.html b/templates/layout/default.html index 1fe02a0..198f2a5 100644 --- a/templates/layout/default.html +++ b/templates/layout/default.html @@ -12,6 +12,10 @@ + +