mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 13:19:16 -05:00
templatetags/theming_tags
This commit is contained in:
0
cookbook/templatetags/__init__.py
Normal file
0
cookbook/templatetags/__init__.py
Normal file
@@ -1,7 +1,6 @@
|
|||||||
|
from cookbook.models import UserPreference
|
||||||
from django import template
|
from django import template
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
|
|
||||||
from cookbook.models import UserPreference
|
|
||||||
from recipes.settings import STICKY_NAV_PREF_DEFAULT
|
from recipes.settings import STICKY_NAV_PREF_DEFAULT
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
@@ -33,7 +32,7 @@ def nav_color(request):
|
|||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def sticky_nav(request):
|
def sticky_nav(request):
|
||||||
if (not request.user.is_authenticated and STICKY_NAV_PREF_DEFAULT) or \
|
if (not request.user.is_authenticated and STICKY_NAV_PREF_DEFAULT) or \
|
||||||
(request.user.is_authenticated and request.user.userpreference.sticky_navbar):
|
(request.user.is_authenticated and request.user.userpreference.sticky_navbar): # noqa: E501
|
||||||
return 'position: sticky; top: 0; left: 0; z-index: 1000;'
|
return 'position: sticky; top: 0; left: 0; z-index: 1000;'
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
Reference in New Issue
Block a user