From 0de63228019fe140228a69a524cb65ec7ca13f21 Mon Sep 17 00:00:00 2001 From: Andrew Croce Date: Tue, 17 Jul 2018 14:42:05 -0400 Subject: [PATCH] UI module for Icon --- atst/app.py | 4 ++-- atst/ui_modules.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 atst/ui_modules.py diff --git a/atst/app.py b/atst/app.py index 7dcc1b9a..d804bdfa 100644 --- a/atst/app.py +++ b/atst/app.py @@ -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 diff --git a/atst/ui_modules.py b/atst/ui_modules.py new file mode 100644 index 00000000..ec197bcd --- /dev/null +++ b/atst/ui_modules.py @@ -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)