-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a93f65
commit 363db73
Showing
13 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Template tags relating to layout.""" | ||
|
||
from django import template | ||
from django.template.loader import render_to_string | ||
from django.urls import reverse | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.simple_tag(takes_context=True) | ||
def primary_navigation_item(context, *params, **kwargs): | ||
"""Render navigation items.""" | ||
context["text"] = kwargs.pop("text") | ||
context["link_name"] = kwargs.pop("link") | ||
context["icon"] = kwargs.pop("icon") | ||
context["link"] = reverse(context["link_name"], kwargs=kwargs) | ||
return render_to_string("_primary_navigation_item.html", context) | ||
|
||
|
||
@register.simple_tag(takes_context=True) | ||
def secondary_navigation_item(context, *params, **kwargs): | ||
"""Render navigation items.""" | ||
context["text"] = kwargs.pop("text") | ||
context["link_name"] = kwargs.pop("link") | ||
context["link"] = reverse(context["link_name"], kwargs=kwargs) | ||
return render_to_string("_secondary_navigation_item.html", context) | ||
|
||
|
||
@register.simple_tag(takes_context=True) | ||
def tertiary_navigation_item(context, *params, **kwargs): | ||
"""Render navigation items.""" | ||
context["text"] = kwargs.pop("text") | ||
context["link_name"] = kwargs.pop("link") | ||
context["link"] = reverse(context["link_name"], kwargs=kwargs) | ||
return render_to_string("_tertiary_navigation_item.html", context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<li class="menu__item menu__item--with-icon main-header__padded {% if primary_nav == link %}menu__item--active{% endif %}"> | ||
<a href="{% url link %}" class="menu__item__icon plain-link"><i class="fa fa-{{icon}}"></i></a> | ||
<a href="{% url link %}" class="menu__item__text plain-link">{{text}}</a> | ||
<li class="menu__item menu__item--with-icon main-header__padded {% if primary_nav == link_name %}menu__item--active{% endif %}"> | ||
<a href="{{link}}" class="menu__item__icon plain-link"><i class="fa fa-{{icon}}"></i></a> | ||
<a href="{{link}}" class="menu__item__text plain-link">{{text}}</a> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<li><a class="secondary-navigation__link {% if secondary_nav == link %}secondary-navigation__link--active{% endif %}" href="{% url link %}">{{text}}</a></li> | ||
<li><a class="secondary-navigation__link {% if secondary_nav == link_name %}secondary-navigation__link--active{% endif %}" href="{{link}}">{{text}}</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<li><a class="navigation-block__link {% if tertiary_nav == link %}navigation-block__link--active{% endif %}" href="{% url link %}">{{text}}</a></li> | ||
<li><a class="navigation-block__link {% if tertiary_nav == link_name %}navigation-block__link--active{% endif %}" href="{{link}}">{{text}}</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{% load layout %} | ||
{% if request.user.is_superuser %} | ||
{% include "_primary_navigation_item.html" with link="admin" text="Admin" icon="cogs" %} | ||
{% primary_navigation_item link="admin" text="Admin" icon="cogs" %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{% load plugins %} | ||
{% load layout %} | ||
|
||
{% with v="pages.configuration.NameOfEvents"|get_configuration %} | ||
{% with vv=v|title|add:"s" %} | ||
{% include "_primary_navigation_item.html" with link="events" text=vv icon="calendar" %} | ||
{% primary_navigation_item link="events" text=vv icon="calendar" %} | ||
{% endwith %} | ||
{% endwith %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{% load xextends %} | ||
{% load layout %} | ||
|
||
{% xextends "base.html" with primary_nav="notifications_list" %} | ||
|
||
{% block secondary_navigation %} | ||
<ul class="inline-list inline-list--space"> | ||
{% include "_secondary_navigation_item.html" with link="notifications_list" text="Notifications" %} | ||
{% include "_secondary_navigation_item.html" with link="notifications_settings" text="Settings" %} | ||
{% secondary_navigation_item link="notifications_list" text="Notifications" %} | ||
{% secondary_navigation_item link="notifications_settings" text="Settings" %} | ||
</ul> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{% load layout %} | ||
|
||
{% if request.user.is_authenticated %} | ||
<li class="menu__item menu__item--with-icon main-header__padded"> | ||
<a href="{% url "account_logout" %}" class="menu__item__icon plain-link"><i class="fa fa-sign-out"></i></a> | ||
<a href="{% url "account_logout" %}" class="menu__item__text plain-link">Log Out</a> | ||
</li> | ||
{% else %} | ||
{% include "_primary_navigation_item.html" with link="account_login" text="Log In" icon="sign-in" %} | ||
{% primary_navigation_item link="account_login" text="Log In" icon="sign-in" %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{% load layout %} | ||
|
||
{% if request.user.is_staff %} | ||
{% include "_primary_navigation_item.html" with link="staff" text="Staff" icon="cogs" %} | ||
{% primary_navigation_item link="staff" text="Staff" icon="cogs" %} | ||
{% endif %} |