-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidgets.py
37 lines (28 loc) · 956 Bytes
/
widgets.py
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
# generate the landing page
from flask import Flask, jsonify, abort, render_template
d = None
def links(app):
return app.jinja_env.get_template('widgets/links.html').render()
def stats(app):
data = d.stats()
return app.jinja_env.get_template('widgets/stats.html').render(data=data)
def showcase(app):
sc = []
l = d.treeiter("export/showcase")
for i in l:
if i.is_leaf == True:
sc.append(i.info())
return app.jinja_env.get_template('widgets/showcase.html').render(list=sc)
class front_widgets:
def __init__(self,app):
self.widget_order = ['stats','links','showcase']
self.widgets = {
'showcase' : showcase(app),
'stats' : stats(app),
'links' : links(app),
}
def front(app):
data = []
w = front_widgets(app)
tmpl = app.jinja_env
return tmpl.get_template('front.html').render(widgets=w,data=data)