c3navclient? hide the headers!

This commit is contained in:
Laura Klünder 2018-11-26 00:51:17 +01:00
parent 92ce3144bf
commit 5055b6a367
6 changed files with 36 additions and 18 deletions

View file

@ -30,6 +30,14 @@ $color-test: $color-primary;
/* bootstrap overrides so it looks like the rest of the site */
body {
font-size:16px;
display: flex;
flex-direction: column;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.navbar {
font-family: 'Roboto', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
@ -111,13 +119,10 @@ nav.navbar .container {
}
#main {
overflow:hidden;
position:absolute;
top:60px;
left:0;
width:100vw;
bottom:0;
position:relative;
padding:0;
margin:0;
flex-grow: 1;
}
#sidebar {
position: absolute;
@ -310,11 +315,6 @@ h4 {
/* responsiveness */
#responsive_switch {
display:none;
width:100vw;
position:absolute;
top:54px;
left:0;
right:0;
padding:4px;
background-color:#f8f8f8;
border-width:0 0 3px;
@ -364,9 +364,6 @@ h4 {
body.map-enabled #responsive_switch {
display:block;
}
body.map-enabled #main {
top:88px;
}
}

View file

@ -17,8 +17,9 @@
<link href="{% static 'editor/css/editor.scss' %}" rel="stylesheet" type="text/x-scss">
{% endcompress %}
</head>
<body>
<body{% if mobileclient %} data-user-data="{{ user_data_json }}" data-count-display="{{ request.changeset.count_display }}"{% if request.changeset.direct_editing%} data-direct-editing{% endif %}{% endif %}>
{% if not mobileclient %}
<nav class="navbar navbar-static-top navbar-default">
<div class="container-fluid">
<div class="navbar-header">
@ -30,7 +31,8 @@
</button>
<a class="navbar-brand" href="{% url 'editor.index' %}">
{% if header_logo %}<img src="{% static header_logo %}">{% else %}c3nav{% endif %}
{% trans 'map editor' %}</a>
{% trans 'map editor' %}
</a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse">
{% block addnav %}
@ -38,11 +40,12 @@
</div>
</div>
</nav>
{% endif %}
{% block subheader %}
{% endblock %}
<div class="container" id="main">
<div id="main">
{% block content %}
{% endblock %}
</div>

View file

@ -297,6 +297,8 @@ TEMPLATES = [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'c3nav.site.context_processors.logos',
'c3nav.site.context_processors.mobileclient',
'c3nav.site.context_processors.user_data_json',
],
'loaders': template_loaders
},

View file

@ -1,5 +1,8 @@
import json
import os
from django.core.serializers.json import DjangoJSONEncoder
from c3nav.site.finders import logo_paths
logos_result = {
@ -10,3 +13,15 @@ logos_result = {
def logos(request):
return logos_result
def mobileclient(request):
return {
'mobileclient': 'c3navclient' in request.META['HTTP_USER_AGENT'],
}
def user_data_json(request):
return {
'user_data_json': lambda: json.dumps(dict(request.user_data), cls=DjangoJSONEncoder),
}

View file

@ -32,6 +32,7 @@ body {
display: flex;
flex-direction: column;
position: absolute;
align-items: stretch;
top: 0;
left: 0;
bottom: 0;

View file

@ -18,8 +18,8 @@
<link href="{% static 'site/css/c3nav.scss' %}" rel="stylesheet" type="text/x-scss">
{% endcompress %}
</head>
<body>
{% if not embed %}
<body{% if mobileclient %} data-user-data="{{ user_data_json }}"{% endif %}>
{% if not embed and not mobileclient %}
<header>
<h1><a href="{% block header_title_url %}/{% endblock %}">
{% if header_logo %}<img src="{% static header_logo %}">{% else %}c3nav {% endif %}{% spaceless %}