UI module for Icon
This commit is contained in:
parent
e2799f8458
commit
0de6322801
@ -15,7 +15,7 @@ from atst.handlers.dev import Dev
|
|||||||
from atst.home import home
|
from atst.home import home
|
||||||
from atst.api_client import ApiClient
|
from atst.api_client import ApiClient
|
||||||
from atst.sessions import RedisSessions
|
from atst.sessions import RedisSessions
|
||||||
from atst.ui import UI
|
from atst import ui_modules
|
||||||
|
|
||||||
ENV = os.getenv("TORNADO_ENV", "dev")
|
ENV = os.getenv("TORNADO_ENV", "dev")
|
||||||
|
|
||||||
@ -100,11 +100,11 @@ def make_app(config, deps, **kwargs):
|
|||||||
static_path=home.child("static"),
|
static_path=home.child("static"),
|
||||||
cookie_secret=config["default"]["COOKIE_SECRET"],
|
cookie_secret=config["default"]["COOKIE_SECRET"],
|
||||||
debug=config["default"].getboolean("DEBUG"),
|
debug=config["default"].getboolean("DEBUG"),
|
||||||
|
ui_modules=ui_modules,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
app.config = config
|
app.config = config
|
||||||
app.sessions = deps["sessions"]
|
app.sessions = deps["sessions"]
|
||||||
app.ui = UI
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
7
atst/ui_modules.py
Normal file
7
atst/ui_modules.py
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user