summaryrefslogtreecommitdiffstats
path: root/ipsilon
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-10-19 16:02:22 -0400
committerPatrick Uiterwijk <puiterwijk@redhat.com>2014-10-27 16:31:43 +0100
commit7a88f6bc436a95536b5af896f2f4997c859571f9 (patch)
treec25f50f87d0e909367bbbe39e9606fafe4a6cfc9 /ipsilon
parentf3575089742ba85ed420f6f9becd2cde4135097f (diff)
downloadipsilon-7a88f6bc436a95536b5af896f2f4997c859571f9.tar.gz
ipsilon-7a88f6bc436a95536b5af896f2f4997c859571f9.tar.xz
ipsilon-7a88f6bc436a95536b5af896f2f4997c859571f9.zip
Add SVG Image to the Home administration page
This SVG image contain HREF links that are template in jinja to link images/text i the SVG to the menu pages. Clicking on elements of the SVG thus redirects to the relevant menu item. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon')
-rwxr-xr-xipsilon/admin/common.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py
index 4d69bcd..b68e53e 100755
--- a/ipsilon/admin/common.py
+++ b/ipsilon/admin/common.py
@@ -276,12 +276,15 @@ class Admin(AdminPage):
def __init__(self, site, mount):
super(Admin, self).__init__(site)
+ self.title = 'Home'
+ self.mount = mount
self.url = '%s/%s' % (self.basepath, mount)
- self.menu = []
+ self.menu = [self]
def root(self, *args, **kwargs):
return self._template('admin/index.html',
title='Configuration',
+ baseurl=self.url,
menu=self.menu)
def add_subtree(self, name, page):
@@ -291,3 +294,20 @@ class Admin(AdminPage):
def del_subtree(self, name):
self.menu.remove(self.__dict__[name])
del self.__dict__[name]
+
+ def get_menu_urls(self):
+ urls = dict()
+ for item in self.menu:
+ name = getattr(item, 'name', None)
+ if name:
+ urls['%s_url' % name] = cherrypy.url('/%s/%s' % (self.mount,
+ name))
+ return urls
+
+ @admin_protect
+ def scheme(self):
+ cherrypy.response.headers.update({'Content-Type': 'image/svg+xml'})
+ urls = self.get_menu_urls()
+ # pylint: disable=star-args
+ return self._template('admin/ipsilon-scheme.svg', **urls)
+ scheme.public_function = True