Remove ui_methods and ui_modules

This commit is contained in:
richard-dds 2018-08-06 15:41:05 -04:00
parent b9f4a4be71
commit d5ced09646
2 changed files with 0 additions and 94 deletions

View File

@ -1,27 +0,0 @@
import os
import re
def navigationContext(self):
return (
"workspace"
if re.match("\/workspaces\/[A-Za-z0-9]*", self.request.uri)
else "global"
)
def dev(self):
return os.getenv("FLASK_ENV", "dev") == "dev"
def matchesPath(self, href):
return re.match("^" + href, self.request.uri)
def modal(self, body):
return self.render_string("components/modal.html.to", body=body)
def modalOpen(self):
# For now, just check a dummy URL param
return self.get_argument("modal", False)

View File

@ -1,67 +0,0 @@
import re
class Alert(UIModule):
def render(self, title, message=None, actions=None, level="info"):
return self.render_string(
"components/alert.html.to",
title=title,
message=message,
actions=actions,
level=level,
)
class TextInput(UIModule):
def render(self, field, placeholder=""):
return self.render_string(
"components/text_input.html.to",
field=field,
label=re.sub("<[^<]+?>", "", str(field.label)),
errors=field.errors,
placeholder=placeholder,
description=field.description,
)
class OptionsInput(UIModule):
def render(self, field, inline=False):
return self.render_string(
"components/options_input.html.to",
field=field,
label=re.sub("<[^<]+?>", "", str(field.label)),
errors=field.errors,
description=field.description,
inline=inline,
)
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
)
class SidenavItem(UIModule):
def render(self, label, href, active=False, icon=None, subnav=None):
return self.render_string(
"navigation/_sidenav_item.html.to",
label=label,
href=href,
active=active,
icon=icon,
subnav=subnav,
)
class EmptyState(UIModule):
def render(self, message, actionLabel, actionHref, icon=None):
return self.render_string(
"components/empty_state.html.to",
message=message,
actionLabel=actionLabel,
actionHref=actionHref,
icon=icon,
)