Reorganize macros into separate component files

Replace a few old UI Module instances with  macros
This commit is contained in:
Andrew Croce
2018-08-03 10:35:04 -04:00
parent a7eb915771
commit 5e8183aaf1
29 changed files with 198 additions and 298 deletions

View File

@@ -1,24 +0,0 @@
<li>
<a class="sidenav__link {% if active %}sidenav__link--active{% end %}" href="{{href}}" title="{{label}}">
{% if icon %}
{% module Icon(icon, classes="sidenav__link-icon") %}
{% end %}
<span class="sidenav__link-label">{{label}}</span>
</a>
{% if subnav and active %}
<ul>
{% for item in subnav %}
<li>
<a class="sidenav__link {% if item["active"] %}sidenav__link--active{% end %}" href="{{item["href"]}}" title="{{item["label"]}}">
{% if "icon" in item %}
{% module Icon(item["icon"], classes="sidenav__link-icon") %}
{% end %}
<span class="sidenav__link-label">{{item["label"]}}</span>
</a>
</li>
{% end %}
</ul>
{% end %}
</li>

View File

@@ -1,4 +1,5 @@
{% from "components.html" import SidenavItem %}
{% from "components/sidenav_item.html" import SidenavItem %}
<div class="global-navigation sidenav global-navigation__context--{{context}}">
<ul>
{% if g.dev %}

View File

@@ -1,4 +1,5 @@
{% from "components.html" import Icon %}
{% from "components/icon.html" import Icon %}
<header class="topbar">
<nav class="topbar__navigation">
<a href="/home" class="topbar__link topbar__link--shield" title="JEDI Home">

View File

@@ -1,42 +1,44 @@
{% from "components/sidenav_item.html" import SidenavItem %}
<nav class='sidenav workspace-navigation'>
<ul>
{% module SidenavItem(
{{ SidenavItem(
"Projects",
href=reverse_url('workspace_projects', '123456'),
active=matchesPath('\/workspaces\/[A-Za-z0-9]*\/projects'),
href='/workspace_projects/123456',
active=g.matchesPath('\/workspaces\/[A-Za-z0-9]*\/projects'),
subnav=[
{
"label": "Add New Project",
"href":"/",
"active": matchesPath('workspaces/projects/new'),
"active": g.matchesPath('workspaces/projects/new'),
"icon": "plus"
}
]
)%}
) }}
{% module SidenavItem(
{{ SidenavItem(
"Members",
href=reverse_url('workspace_members', '123456'),
active=matchesPath('\/workspaces\/[A-Za-z0-9]*\/members'),
href='/workspace_members/123456',
active=g.matchesPath('\/workspaces\/[A-Za-z0-9]*\/members'),
subnav=[
{
"label": "Add New Member",
"href": "",
"active": matchesPath('/workspaces/members/new'),
"active": g.matchesPath('/workspaces/members/new'),
"icon": "plus"
},
{
"label": "Editing Member",
"href": "",
"active": matchesPath('/workspaces/123456/members/789/edit')
"active": g.matchesPath('/workspaces/123456/members/789/edit')
}
]
)%}
) }}
{% module SidenavItem(
{{ SidenavItem(
"Funding & Reports",
href=reverse_url('workspace_projects', '123456'),
active=matchesPath('\/workspaces\/[A-Za-z0-9]*\/reports')
)%}
href='/workspace_reports/123456',
active=g.matchesPath('\/workspaces\/[A-Za-z0-9]*\/reports')
) }}
</ul>
</nav>