diff --git a/atst/app.py b/atst/app.py
index f4cfe183..23ad724b 100644
--- a/atst/app.py
+++ b/atst/app.py
@@ -42,6 +42,12 @@ def make_flask_callbacks(app):
g.dev = os.getenv("TORNADO_ENV", "dev") == "dev"
g.matchesPath = lambda href: re.match('^'+href, request.url)
g.modalOpen = request.args.get("modal", False)
+ g.current_user = {
+ "id": "cce17030-4109-4719-b958-ed109dbb87c8",
+ "first_name": "Amanda",
+ "last_name": "Adamson",
+ "atat_role": "default"
+ }
# TODO: Make me a macro
def modal(self, body):
diff --git a/templates/components.html b/templates/components.html
new file mode 100644
index 00000000..06d487ea
--- /dev/null
+++ b/templates/components.html
@@ -0,0 +1,32 @@
+{% macro Icon(name, classes="") -%}
+ {% autoescape false %}
+ {{ svg }}
+ {% endautoescape %}
+{%- endmacro %}
+
+{% macro SidenavItem(label, href, active=False, icon=None, subnav=None) -%}
+
+
+ {% if icon %}
+ {{ Icon(icon, classes="sidenav__link-icon") }}
+ {% endif %}
+
+ {{label}}
+
+
+ {% if subnav and active %}
+
+ {% endif %}
+
+{%- endmacro %}
diff --git a/templates/navigation/global_navigation.html.to b/templates/navigation/global_navigation.html.to
index 60991d47..594bf574 100644
--- a/templates/navigation/global_navigation.html.to
+++ b/templates/navigation/global_navigation.html.to
@@ -1,24 +1,25 @@
+{% from "components.html" import SidenavItem %}
- {% if dev() %}
- {% module SidenavItem("Styleguide",
+ {% if g.dev %}
+ {{ SidenavItem("Styleguide",
href="/styleguide",
icon="visible",
- active=matchesPath('/styleguide'),
+ active=g.matchesPath('/styleguide'),
subnav=[
- {"label":"Subnav 1", "href":"/styleguide?subnav1", "icon": "plus", "active": matchesPath('/styleguide?subnav1')},
- {"label":"Subnav 2", "href":"/styleguide?subnav2", "active": matchesPath('/styleguide?subnav2')},
- ]) %}
- {% end %}
+ {"label":"Subnav 1", "href":"/styleguide?subnav1", "icon": "plus", "active": g.matchesPath('/styleguide?subnav1')},
+ {"label":"Subnav 2", "href":"/styleguide?subnav2", "active": g.matchesPath('/styleguide?subnav2')},
+ ]) }}
+ {% endif %}
- {% module SidenavItem("Requests",
+ {{ SidenavItem("Requests",
href="/requests",
icon="document",
- active=matchesPath('/requests'),
+ active=g.matchesPath('/requests'),
subnav=[
- {"label":"New Request", "href":"/requests/new", "icon": "plus", "active": matchesPath('/requests/new')},
+ {"label":"New Request", "href":"/requests/new", "icon": "plus", "active": g.matchesPath('/requests/new')},
]
- ) %}
- {% module SidenavItem("Workspaces", href="/workspaces", icon="cloud", active=matchesPath('/workspaces')) %}
+ ) }}
+ {{ SidenavItem("Workspaces", href="/workspaces", icon="cloud", active=g.matchesPath('/workspaces')) }}
diff --git a/templates/navigation/topbar.html.to b/templates/navigation/topbar.html.to
index 9af26690..10fc0c6d 100644
--- a/templates/navigation/topbar.html.to
+++ b/templates/navigation/topbar.html.to
@@ -1,18 +1,19 @@
+{% from "components.html" import Icon %}