UI module for Icon

This commit is contained in:
Andrew Croce 2018-07-17 14:42:05 -04:00
parent e2799f8458
commit 0de6322801
2 changed files with 9 additions and 2 deletions

View File

@ -15,7 +15,7 @@ from atst.handlers.dev import Dev
from atst.home import home
from atst.api_client import ApiClient
from atst.sessions import RedisSessions
from atst.ui import UI
from atst import ui_modules
ENV = os.getenv("TORNADO_ENV", "dev")
@ -100,11 +100,11 @@ def make_app(config, deps, **kwargs):
static_path=home.child("static"),
cookie_secret=config["default"]["COOKIE_SECRET"],
debug=config["default"].getboolean("DEBUG"),
ui_modules=ui_modules,
**kwargs,
)
app.config = config
app.sessions = deps["sessions"]
app.ui = UI
return app

7
atst/ui_modules.py Normal file
View File

@ -0,0 +1,7 @@
from tornado.web import UIModule
class Icon(UIModule):
def render(self, name, classes=''):
with open('static/icons/%s.svg' % name) as svg:
return self.render_string(
"components/icon.html.to", svg=svg.read(), name=name, classes=classes)