mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
all themes in one function
This commit is contained in:
@@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
<link rel="manifest" crossorigin="use-credentials" href="{% url 'web_manifest' %}">
|
<link rel="manifest" crossorigin="use-credentials" href="{% url 'web_manifest' %}">
|
||||||
|
|
||||||
<meta name="msapplication-TileColor" content="{% nav_bg_color request %}">
|
<meta name="msapplication-TileColor" content="{{ theme_values.nav_bg_color }}">
|
||||||
<meta name="msapplication-TileImage" content="{{ theme_values.logo_color_144 }}">
|
<meta name="msapplication-TileImage" content="{{ theme_values.logo_color_144 }}">
|
||||||
|
|
||||||
<meta name="theme-color" content="{% nav_bg_color request %}">
|
<meta name="theme-color" content="{{ theme_values.nav_bg_color }}">
|
||||||
|
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||||
|
|
||||||
@@ -76,9 +76,9 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg {% nav_text_color request %}"
|
<nav class="navbar navbar-expand-lg {{ theme_values.nav_text_class }}"
|
||||||
id="id_main_nav"
|
id="id_main_nav"
|
||||||
style="{% sticky_nav request %}; background-color: {% nav_bg_color request %}">
|
style="{% sticky_nav request %}; background-color: {{ theme_values.nav_bg_color }}">
|
||||||
|
|
||||||
{% if not request.user.userpreference.left_handed %}
|
{% if not request.user.userpreference.left_handed %}
|
||||||
{% if not request.user.is_authenticated or request.user.userpreference.nav_show_logo %}
|
{% if not request.user.is_authenticated or request.user.userpreference.nav_show_logo %}
|
||||||
|
|||||||
@@ -67,40 +67,6 @@ def theme_values(request):
|
|||||||
return tv
|
return tv
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag
|
|
||||||
def nav_bg_color(request):
|
|
||||||
if not request.user.is_authenticated:
|
|
||||||
if UNAUTHENTICATED_THEME_FROM_SPACE > 0:
|
|
||||||
with scopes_disabled():
|
|
||||||
space = Space.objects.filter(id=UNAUTHENTICATED_THEME_FROM_SPACE).first()
|
|
||||||
if space.nav_bg_color:
|
|
||||||
return space.nav_bg_color
|
|
||||||
return '#ddbf86'
|
|
||||||
else:
|
|
||||||
if request.space.nav_bg_color:
|
|
||||||
return request.space.nav_bg_color
|
|
||||||
else:
|
|
||||||
return request.user.userpreference.nav_bg_color
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag
|
|
||||||
def nav_text_color(request):
|
|
||||||
type_mapping = {Space.DARK: 'navbar-light',
|
|
||||||
Space.LIGHT: 'navbar-dark'} # inverted since navbar-dark means the background
|
|
||||||
if not request.user.is_authenticated:
|
|
||||||
if UNAUTHENTICATED_THEME_FROM_SPACE > 0:
|
|
||||||
with scopes_disabled():
|
|
||||||
space = Space.objects.filter(id=UNAUTHENTICATED_THEME_FROM_SPACE).first()
|
|
||||||
if space.nav_text_color and space.nav_text_color in type_mapping:
|
|
||||||
return type_mapping[space.nav_text_color]
|
|
||||||
return 'navbar-light'
|
|
||||||
else:
|
|
||||||
if request.space.nav_text_color != Space.BLANK:
|
|
||||||
return type_mapping[request.space.nav_text_color]
|
|
||||||
else:
|
|
||||||
return type_mapping[request.user.userpreference.nav_text_color]
|
|
||||||
|
|
||||||
|
|
||||||
@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 (
|
||||||
|
|||||||
Reference in New Issue
Block a user