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 */ /* bootstrap overrides so it looks like the rest of the site */
body { body {
font-size:16px; font-size:16px;
display: flex;
flex-direction: column;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
bottom: 0;
right: 0;
} }
.navbar { .navbar {
font-family: 'Roboto', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; font-family: 'Roboto', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
@ -111,13 +119,10 @@ nav.navbar .container {
} }
#main { #main {
overflow:hidden; overflow:hidden;
position:absolute; position:relative;
top:60px;
left:0;
width:100vw;
bottom:0;
padding:0; padding:0;
margin:0; margin:0;
flex-grow: 1;
} }
#sidebar { #sidebar {
position: absolute; position: absolute;
@ -310,11 +315,6 @@ h4 {
/* responsiveness */ /* responsiveness */
#responsive_switch { #responsive_switch {
display:none; display:none;
width:100vw;
position:absolute;
top:54px;
left:0;
right:0;
padding:4px; padding:4px;
background-color:#f8f8f8; background-color:#f8f8f8;
border-width:0 0 3px; border-width:0 0 3px;
@ -364,9 +364,6 @@ h4 {
body.map-enabled #responsive_switch { body.map-enabled #responsive_switch {
display:block; 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"> <link href="{% static 'editor/css/editor.scss' %}" rel="stylesheet" type="text/x-scss">
{% endcompress %} {% endcompress %}
</head> </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"> <nav class="navbar navbar-static-top navbar-default">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
@ -30,7 +31,8 @@
</button> </button>
<a class="navbar-brand" href="{% url 'editor.index' %}"> <a class="navbar-brand" href="{% url 'editor.index' %}">
{% if header_logo %}<img src="{% static header_logo %}">{% else %}c3nav{% endif %} {% if header_logo %}<img src="{% static header_logo %}">{% else %}c3nav{% endif %}
{% trans 'map editor' %}</a> {% trans 'map editor' %}
</a>
</div> </div>
<div class="collapse navbar-collapse" id="navbar-collapse"> <div class="collapse navbar-collapse" id="navbar-collapse">
{% block addnav %} {% block addnav %}
@ -38,11 +40,12 @@
</div> </div>
</div> </div>
</nav> </nav>
{% endif %}
{% block subheader %} {% block subheader %}
{% endblock %} {% endblock %}
<div class="container" id="main"> <div id="main">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>

View file

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

View file

@ -1,5 +1,8 @@
import json
import os import os
from django.core.serializers.json import DjangoJSONEncoder
from c3nav.site.finders import logo_paths from c3nav.site.finders import logo_paths
logos_result = { logos_result = {
@ -10,3 +13,15 @@ logos_result = {
def logos(request): def logos(request):
return logos_result 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; display: flex;
flex-direction: column; flex-direction: column;
position: absolute; position: absolute;
align-items: stretch;
top: 0; top: 0;
left: 0; left: 0;
bottom: 0; bottom: 0;

View file

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